static const char* TIMEZONE_LIST_FILE_PATH = "/opt/data/setting/tzlist.ini";
static const char* CLOCALE_LIST_FILE_PATH = "/opt/usr/etc/clocale.list";
+#define _FALLBACK_ // It should be removed after checking SLP changes.
Locale
_LocaleManagerImpl::GetSystemLocale(void)
SysTryReturn(NID_LCL, pDummyValue, null, E_OUT_OF_MEMORY,
"[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pClocaleMap->Add(*(pClocaleId.get()), *(pDummyValue.get()));
+ r = pClocaleMap->Add(pClocaleId.get(), pDummyValue.get());
SysTryReturn(NID_LCL, r == E_SUCCESS, null, r,
"[%s] It is failed to add the clocale id into the clocale map.", GetErrorMessage(r));
pClocaleId.release();
if (!pAvailableLocaleList->Contains(*(pLocale.get())) && pClocaleMap->ContainsKey(localeId))
{
- r = pAvailableLocaleList->Add(*(pLocale.get()));
+ r = pAvailableLocaleList->Add(pLocale.get());
SysTryReturn(NID_LCL, !IsFailed(r), null, E_SYSTEM, "It is failed to make the locale list");
pLocale.release();
}
return language;
}
+// FALLBACk should be removed after checking the SLP change.
+#ifdef _FALLBACK_
+IList*
+_LocaleManagerImpl::GetAvailableLanguagesN(void)
+{
+ std::unique_ptr<IList> pLocaleList (GetAvailableLocalesN());
+ std::unique_ptr<HashMap> pLanguageMap(new (std::nothrow) HashMap(SingleObjectDeleter));
+ SysTryReturn(NID_LCL, pLanguageMap, null, E_OUT_OF_MEMORY,"[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pLanguageMap->Construct();
+
+ std::unique_ptr<ArrayList> pAvailableLanguageList(new (std::nothrow) ArrayList(SingleObjectDeleter));
+ SysTryReturn(NID_LCL, pAvailableLanguageList, null, E_OUT_OF_MEMORY,"[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+ pAvailableLanguageList->Construct();
+
+ for (int i = 0; i < pLocaleList->GetCount() ; i++)
+ {
+ Locale* pLocale = (Locale*)pLocaleList->GetAt(i);
+ std::unique_ptr<String> pLanguageCode(new (std::nothrow) String(pLocale->GetLanguageCodeString()));
+ SysTryReturn(NID_LCL, pLanguageCode, null, E_OUT_OF_MEMORY,"[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ if (!pLanguageMap->ContainsKey(*pLanguageCode))
+ {
+ std::unique_ptr<String> pDummyValue(new (std::nothrow) String());
+ SysTryReturn(NID_LCL, pDummyValue, null, E_OUT_OF_MEMORY,"[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pLanguageMap->Add(pLanguageCode.get(), pDummyValue.get());
+ SysTryReturn(NID_LCL, !IsFailed(r), null, E_SYSTEM, "It is failed to make a language map.");
+
+ std::unique_ptr<String> pLangCode(new (std::nothrow) String(*(pLanguageCode.get())));
+ r = pAvailableLanguageList->Add(pLangCode.get());
+ SysTryReturn(NID_LCL, !IsFailed(r), null, E_SYSTEM, "It is failed to make a language list.");
+
+ pLanguageCode.release();
+ pDummyValue.release();
+ pLangCode.release();
+ }
+ }
+
+ SetLastResult(E_SUCCESS);
+ return pAvailableLanguageList.release();
+}
+#else
IList*
_LocaleManagerImpl::GetAvailableLanguagesN(void)
{
SetLastResult(E_SUCCESS);
return pAvailableLanguageList.release();
}
-
+#endif
IList*
_LocaleManagerImpl::GetAvailableLanguageLocalesN(void)
if (!pAvailableLanguageList->Contains(*(pLocale.get())))
{
- result r = pAvailableLanguageList->Add(*(pLocale.get()));
+ result r = pAvailableLanguageList->Add(pLocale.get());
SysTryReturn(NID_LCL, r == E_SUCCESS, null, E_SYSTEM,
"[%s] It is failed to add a locale string [%s].", GetErrorMessage(E_SYSTEM), pLocId.get());
pLocale.release();
{
std::unique_ptr< String > pDummyValue(new (std::nothrow) String());
SysTryReturn(NID_LCL, pDummyValue, null, E_OUT_OF_MEMORY,"[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pTimeZoneMap->Add(*(pTimeZone.get()), *(pDummyValue.get()));
+ r = pTimeZoneMap->Add(pTimeZone.get(), pDummyValue.get());
SysTryReturn(NID_LCL, !IsFailed(r), null, E_SYSTEM, "[E_SYSTEM] It is failed to add a TZ into Map.");
pTimeZone.release();
pDummyValue.release();
return pTimeZoneMap.release();
}
+#ifdef _FALLBACK_
+static const int TIMEZONE_MAX = 224;
+static const char* TimeZoneList[TIMEZONE_MAX] =
+{
+ "Africa/Abidjan",
+ "Africa/Accra",
+ "Africa/Addis_Ababa",
+ "Africa/Algiers",
+ "Africa/Asmara",
+ "Africa/Bamako",
+ "Africa/Bangui",
+ "Africa/Bissau",
+ "Africa/Cairo",
+ "Africa/Casablanca",
+ "Africa/Conakry",
+ "Africa/Dakar",
+ "Africa/Dar_es_Salaam",
+ "Africa/Djibouti",
+ "Africa/Douala",
+ "Africa/Freetown",
+ "Africa/Gaborone",
+ "Africa/Harare",
+ "Africa/Johannesburg",
+ "Africa/Kampala",
+ "Africa/Khartoum",
+ "Africa/Kinshasa",
+ "Africa/Lagos",
+ "Africa/Luanda",
+ "Africa/Lubumbashi",
+ "Africa/Lusaka",
+ "Africa/Malabo",
+ "Africa/Maputo",
+ "Africa/Mogadishu",
+ "Africa/Monrovia",
+ "Africa/Nairobi",
+ "Africa/Ndjamena",
+ "Africa/Niamey",
+ "Africa/Nouakchott",
+ "Africa/Ouagadougou",
+ "Africa/Tripoli",
+ "Africa/Tunis",
+ "America/Anchorage",
+ "America/Antigua",
+ "America/Argentina/Buenos_Aires",
+ "America/Asuncion",
+ "America/Barbados",
+ "America/Belize",
+ "America/Bogota",
+ "America/Caracas",
+ "America/Cayenne",
+ "America/Chicago",
+ "America/Costa_Rica",
+ "America/Denver",
+ "America/Detroit",
+ "America/El_Salvador",
+ "America/Godthab",
+ "America/Guadeloupe",
+ "America/Guatemala",
+ "America/Guayaquil",
+ "America/Guyana",
+ "America/Halifax",
+ "America/Havana",
+ "America/Indiana/Indianapolis",
+ "America/Jamaica",
+ "America/Kentucky/Louisville",
+ "America/La_Paz",
+ "America/Lima",
+ "America/Los_Angeles",
+ "America/Managua",
+ "America/Marigot",
+ "America/Martinique",
+ "America/Mazatlan",
+ "America/Mexico_City",
+ "America/Montevideo",
+ "America/Montreal",
+ "America/New_York",
+ "America/Nome",
+ "America/Panama",
+ "America/Paramaribo",
+ "America/Phoenix",
+ "America/Port-au-Prince",
+ "America/Puerto_Rico",
+ "America/Recife",
+ "America/Regina",
+ "America/Santiago",
+ "America/Santo_Domingo",
+ "America/Sao_Paulo",
+ "America/St_Johns",
+ "America/St_Thomas",
+ "America/Tegucigalpa",
+ "America/Tijuana",
+ "America/Toronto",
+ "America/Tortola",
+ "America/Vancouver",
+ "America/Winnipeg",
+ "Asia/Aden",
+ "Asia/Almaty",
+ "Asia/Amman",
+ "Asia/Anadyr",
+ "Asia/Ashgabat",
+ "Asia/Baghdad",
+ "Asia/Bahrain",
+ "Asia/Baku",
+ "Asia/Bangkok",
+ "Asia/Beirut",
+ "Asia/Bishkek",
+ "Asia/Colombo",
+ "Asia/Damascus",
+ "Asia/Dhaka",
+ "Asia/Dubai",
+ "Asia/Dushanbe",
+ "Asia/Ho_Chi_Minh",
+ "Asia/Hong_Kong",
+ "Asia/Hovd",
+ "Asia/Irkutsk",
+ "Asia/Istanbul",
+ "Asia/Jakarta",
+ "Asia/Jayapura",
+ "Asia/Jerusalem",
+ "Asia/Kabul",
+ "Asia/Kamchatka",
+ "Asia/Karachi",
+ "Asia/Kathmandu",
+ "Asia/Kolkata",
+ "Asia/Krasnoyarsk",
+ "Asia/Kuala_Lumpur",
+ "Asia/Kuwait",
+ "Asia/Macau",
+ "Asia/Magadan",
+ "Asia/Makassar",
+ "Asia/Manila",
+ "Asia/Muscat",
+ "Asia/Novokuznetsk",
+ "Asia/Novosibirsk",
+ "Asia/Omsk",
+ "Asia/Phnom_Penh",
+ "Asia/Pyongyang",
+ "Asia/Qatar",
+ "Asia/Rangoon",
+ "Asia/Riyadh",
+ "Asia/Sakhalin",
+ "Asia/Seoul",
+ "Asia/Shanghai",
+ "Asia/Singapore",
+ "Asia/Taipei",
+ "Asia/Tashkent",
+ "Asia/Tbilisi",
+ "Asia/Tehran",
+ "Asia/Tokyo",
+ "Asia/Ulan_Bator",
+ "Asia/Vladivostok",
+ "Asia/Yakutsk",
+ "Asia/Yekaterinburg",
+ "Asia/Yerevan",
+ "Atlantic/Azores",
+ "Atlantic/Canary",
+ "Atlantic/Reykjavik",
+ "Atlantic/South_Georgia",
+ "Australia/Adelaide",
+ "Australia/Brisbane",
+ "Australia/Canberra",
+ "Australia/Darwin",
+ "Australia/Hobart",
+ "Australia/Melbourne",
+ "Australia/Perth",
+ "Australia/Sydney",
+ "CST6CDT",
+ "EST5EDT",
+ "Europe/Amsterdam",
+ "Europe/Athens",
+ "Europe/Belgrade",
+ "Europe/Berlin",
+ "Europe/Bratislava",
+ "Europe/Brussels",
+ "Europe/Bucharest",
+ "Europe/Budapest",
+ "Europe/Chisinau",
+ "Europe/Copenhagen",
+ "Europe/Dublin",
+ "Europe/Helsinki",
+ "Europe/Istanbul",
+ "Europe/Kaliningrad",
+ "Europe/Kiev",
+ "Europe/Lisbon",
+ "Europe/Ljubljana",
+ "Europe/London",
+ "Europe/Luxembourg",
+ "Europe/Madrid",
+ "Europe/Malta",
+ "Europe/Minsk",
+ "Europe/Moscow",
+ "Europe/Paris",
+ "Europe/Podgorica",
+ "Europe/Prague",
+ "Europe/Riga",
+ "Europe/Rome",
+ "Europe/Samara",
+ "Europe/San_Marino",
+ "Europe/Skopje",
+ "Europe/Sofia",
+ "Europe/Stockholm",
+ "Europe/Tallinn",
+ "Europe/Vaduz",
+ "Europe/Vienna",
+ "Europe/Vilnius",
+ "Europe/Volgograd",
+ "Europe/Warsaw",
+ "Europe/Zagreb",
+ "Europe/Zurich",
+ "Indian/Antananarivo",
+ "Indian/Chagos",
+ "Indian/Maldives",
+ "Indian/Mauritius",
+ "Indian/Reunion",
+ "MST7MDT",
+ "Pacific/Auckland",
+ "Pacific/Easter",
+ "Pacific/Fiji",
+ "Pacific/Galapagos",
+ "Pacific/Guam",
+ "Pacific/Honolulu",
+ "Pacific/Midway",
+ "Pacific/Noumea",
+ "Pacific/Pago_Pago",
+ "Pacific/Tahiti",
+ "Pacific/Tarawa",
+ "Pacific/Tongatapu",
+ "PST8PDT"
+};
+
+
+IMap*
+_LocaleManagerImpl::GetAvailableTimeZonesN(void)
+{
+ std::unique_ptr<HashMap> pTimeZoneMap(new (std::nothrow) HashMap(SingleObjectDeleter));
+ SysTryReturn(NID_LCL, pTimeZoneMap, null, E_OUT_OF_MEMORY,
+ "[%s] Memory allocation failed", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = E_SUCCESS;
+ int index = 0;
+
+ pTimeZoneMap->Construct();
+
+ do
+ {
+ std::unique_ptr< String > pTimeZone(new (std::nothrow) String(TimeZoneList[index++]));
+ SysTryReturn(NID_LCL, pTimeZone, null, E_OUT_OF_MEMORY,
+ "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ if (!pTimeZoneMap->ContainsKey(*(pTimeZone.get())))
+ {
+ std::unique_ptr< String > pDummyValue (new (std::nothrow) String());
+ SysTryReturn(NID_LCL, pDummyValue, null, E_OUT_OF_MEMORY,"[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pTimeZoneMap->Add(pTimeZone.get(), pDummyValue.get());
+ SysTryReturn(NID_LCL, !IsFailed(r), null, E_SYSTEM, "It is failed to make Timezone list.");
+
+ pTimeZone.release();
+ pDummyValue.release();
+ }
+ }while (index < TIMEZONE_MAX);
+
+ SetLastResult(E_SUCCESS);
+ return pTimeZoneMap.release();
+}
+#else
IMap*
_LocaleManagerImpl::GetAvailableTimeZonesN(void)
{
SysTryReturn(NID_LCL, pDummyValue, null, E_OUT_OF_MEMORY,
"[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
- r = pTimeZoneMap->Add(*(pTimeZone.get()), *(pDummyValue.get()));
+ r = pTimeZoneMap->Add(pTimeZone.get(), pDummyValue.get());
SysTryReturn(NID_LCL, r == E_SUCCESS, null, r,"[%s] It is failed to make the tz list.", GetErrorMessage(r));
pTimeZone.release();
pDummyValue.release();
SetLastResult(E_SUCCESS);
return pTimeZoneMap.release();
}
-
+#endif
IMap*
_LocaleManagerImpl::GetAvailableTimeZonesN(int rawOffset)