ICU-146 deprecate uloc_get/setDataDirectory()
X-SVN-Rev: 409
This commit is contained in:
parent
d8b42cec53
commit
4694b93a81
@ -804,7 +804,7 @@ Locale::getLanguagesForCountry(const UnicodeString& country, int32_t& count)
|
|||||||
*/
|
*/
|
||||||
const char* Locale::getDataDirectory()
|
const char* Locale::getDataDirectory()
|
||||||
{
|
{
|
||||||
return uloc_getDataDirectory();
|
return u_getDataDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -812,7 +812,7 @@ const char* Locale::getDataDirectory()
|
|||||||
*/
|
*/
|
||||||
void Locale::setDataDirectory(const char* path)
|
void Locale::setDataDirectory(const char* path)
|
||||||
{
|
{
|
||||||
uloc_setDataDirectory(path);
|
u_setDataDirectory(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ================= privates =====================================
|
// ================= privates =====================================
|
||||||
|
@ -487,7 +487,7 @@ public:
|
|||||||
static const UnicodeString* getISOLanguages(int32_t& count);
|
static const UnicodeString* getISOLanguages(int32_t& count);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path to the ResourceBundle locale files. This path will be a
|
* Deprecated 1999dec14 - Get the path to the ResourceBundle locale files. This path will be a
|
||||||
* platform-specific path name ending in a directory separator, so that file
|
* platform-specific path name ending in a directory separator, so that file
|
||||||
* names may be concatenated to it. This path may be changed by calling
|
* names may be concatenated to it. This path may be changed by calling
|
||||||
* setDataDirectory(). If setDataDirectory() has not been called yet,
|
* setDataDirectory(). If setDataDirectory() has not been called yet,
|
||||||
@ -499,13 +499,14 @@ public:
|
|||||||
static const char* getDataDirectory(void);
|
static const char* getDataDirectory(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the path to the ResourceBundle locale files. After making this call,
|
* Deprecated 1999dec14 - Set the path to the ResourceBundle locale files. After making this call,
|
||||||
* all objects in the Unicode Analytics package will read ResourceBundle
|
* all objects in the Unicode Analytics package will read ResourceBundle
|
||||||
* data files in the specified directory in order to obtain locale data.
|
* data files in the specified directory in order to obtain locale data.
|
||||||
*
|
*
|
||||||
* @param path The new data path to be set to.
|
* @param path The new data path to be set to.
|
||||||
*/
|
*/
|
||||||
static void setDataDirectory(const char* path);
|
static void setDataDirectory(const char* path);
|
||||||
|
|
||||||
Locale& init(const char* cLocaleID);
|
Locale& init(const char* cLocaleID);
|
||||||
|
|
||||||
protected: // only protected for testing purposes. DO NOT USE.
|
protected: // only protected for testing purposes. DO NOT USE.
|
||||||
|
@ -508,7 +508,7 @@ uint32_t uloc_getLCID(const char* localeID)
|
|||||||
char temp[30];
|
char temp[30];
|
||||||
const UChar* lcid = NULL;
|
const UChar* lcid = NULL;
|
||||||
uint32_t result = 0;
|
uint32_t result = 0;
|
||||||
UResourceBundle* bundle = ures_open(uloc_getDataDirectory(), localeID, &err);
|
UResourceBundle* bundle = ures_open(u_getDataDirectory(), localeID, &err);
|
||||||
|
|
||||||
if (U_SUCCESS(err))
|
if (U_SUCCESS(err))
|
||||||
{
|
{
|
||||||
@ -541,7 +541,7 @@ int32_t uloc_getDisplayLanguage(const char* locale,
|
|||||||
UResourceBundle* bundle;
|
UResourceBundle* bundle;
|
||||||
const UChar* temp = NULL;
|
const UChar* temp = NULL;
|
||||||
bool_t isDefaultLocale = FALSE;
|
bool_t isDefaultLocale = FALSE;
|
||||||
const char* dataDir = uloc_getDataDirectory();
|
const char* dataDir = u_getDataDirectory();
|
||||||
bool_t done = FALSE;
|
bool_t done = FALSE;
|
||||||
|
|
||||||
if (U_FAILURE(*status)) return 0;
|
if (U_FAILURE(*status)) return 0;
|
||||||
@ -666,7 +666,7 @@ int32_t uloc_getDisplayCountry(const char* locale,
|
|||||||
UResourceBundle* bundle = NULL;
|
UResourceBundle* bundle = NULL;
|
||||||
char inLocaleBuffer[TEMPBUFSIZE];
|
char inLocaleBuffer[TEMPBUFSIZE];
|
||||||
bool_t isDefaultLocale = FALSE;
|
bool_t isDefaultLocale = FALSE;
|
||||||
const char* dataDir = uloc_getDataDirectory();
|
const char* dataDir = u_getDataDirectory();
|
||||||
bool_t done = FALSE;
|
bool_t done = FALSE;
|
||||||
|
|
||||||
if (U_FAILURE(*status)) return 0;
|
if (U_FAILURE(*status)) return 0;
|
||||||
@ -790,7 +790,7 @@ int32_t uloc_getDisplayVariant(const char* locale,
|
|||||||
bool_t isDefaultLocale = FALSE;
|
bool_t isDefaultLocale = FALSE;
|
||||||
char inVariantTagBuffer[TEMPBUFSIZE+2];
|
char inVariantTagBuffer[TEMPBUFSIZE+2];
|
||||||
char* inVariantTag = inVariantTagBuffer;
|
char* inVariantTag = inVariantTagBuffer;
|
||||||
const char* dataDir = uloc_getDataDirectory();
|
const char* dataDir = u_getDataDirectory();
|
||||||
bool_t done = FALSE;
|
bool_t done = FALSE;
|
||||||
|
|
||||||
if (U_FAILURE(*status)) return 0;
|
if (U_FAILURE(*status)) return 0;
|
||||||
@ -1054,7 +1054,7 @@ void _lazyEvaluate_installedLocales()
|
|||||||
int32_t strSize;
|
int32_t strSize;
|
||||||
if (_installedLocales == NULL)
|
if (_installedLocales == NULL)
|
||||||
{
|
{
|
||||||
temp = T_ResourceBundle_listInstalledLocales(uloc_getDataDirectory(),
|
temp = T_ResourceBundle_listInstalledLocales(u_getDataDirectory(),
|
||||||
&_installedLocalesCount);
|
&_installedLocalesCount);
|
||||||
temp2 = (char **) icu_malloc(sizeof(char*) * (_installedLocalesCount+1));
|
temp2 = (char **) icu_malloc(sizeof(char*) * (_installedLocalesCount+1));
|
||||||
|
|
||||||
@ -1160,19 +1160,3 @@ const char* const* uloc_getISOCountries()
|
|||||||
}
|
}
|
||||||
return (const char* const*)_isoCountries;
|
return (const char* const*)_isoCountries;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Functions to get and set the directory containing the locale data files.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const char*
|
|
||||||
uloc_getDataDirectory()
|
|
||||||
{
|
|
||||||
return u_getDataDirectory();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
uloc_setDataDirectory(const char* newDirectory)
|
|
||||||
{
|
|
||||||
u_setDataDirectory(newDirectory);
|
|
||||||
}
|
|
||||||
|
@ -440,21 +440,18 @@ U_CAPI const char* const* U_EXPORT2
|
|||||||
uloc_getISOCountries(void);
|
uloc_getISOCountries(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the directory containing the locale data files.
|
* Deprecated 1999dec14 - Gets the directory containing the locale data files.
|
||||||
*
|
*
|
||||||
* @return the locale data file directory
|
* @return the locale data file directory
|
||||||
*/
|
*/
|
||||||
U_CAPI const char* U_EXPORT2
|
#define uloc_getDataDirectory u_getDataDirectory
|
||||||
uloc_getDataDirectory(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the directory containing the locale data files.
|
* Deprecated 1999dec14 - Sets the directory containing the locale data files.
|
||||||
*
|
*
|
||||||
* @return the new directory to fetch locale data from
|
* @return the new directory to fetch locale data from
|
||||||
*/
|
*/
|
||||||
|
#define uloc_setDataDirectory u_setDataDirectory
|
||||||
U_CAPI void U_EXPORT2
|
|
||||||
uloc_setDataDirectory(const char* newDirectory);
|
|
||||||
|
|
||||||
/*Internal function */
|
/*Internal function */
|
||||||
int32_t U_EXPORT2
|
int32_t U_EXPORT2
|
||||||
|
@ -34,7 +34,7 @@ U_CAPI UResourceBundle* ures_open( const char* myPath,
|
|||||||
|
|
||||||
|
|
||||||
if (myPath != 0) uPath = myPath;
|
if (myPath != 0) uPath = myPath;
|
||||||
else uPath = uloc_getDataDirectory();
|
else uPath = u_getDataDirectory();
|
||||||
|
|
||||||
if (localeID == 0) localeID = uloc_getDefault();
|
if (localeID == 0) localeID = uloc_getDefault();
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ void TestGetAvailableLocales()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* test for uloc_getDataDirectory, uloc_setDataDirectory, uloc_getISO3Language */
|
/* test for u_getDataDirectory, u_setDataDirectory, uloc_getISO3Language */
|
||||||
void TestDataDirectory()
|
void TestDataDirectory()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ void TestDataDirectory()
|
|||||||
const char path[40] ="d:\\icu\\source\\test\\intltest" U_FILE_SEP_STRING; /*give the required path */
|
const char path[40] ="d:\\icu\\source\\test\\intltest" U_FILE_SEP_STRING; /*give the required path */
|
||||||
|
|
||||||
log_verbose("Testing getDataDirectory()\n");
|
log_verbose("Testing getDataDirectory()\n");
|
||||||
temp = uloc_getDataDirectory();
|
temp = u_getDataDirectory();
|
||||||
strcpy(oldDirectory, temp);
|
strcpy(oldDirectory, temp);
|
||||||
|
|
||||||
testValue1=uloc_getISO3Language("en_US");
|
testValue1=uloc_getISO3Language("en_US");
|
||||||
@ -321,16 +321,16 @@ void TestDataDirectory()
|
|||||||
|
|
||||||
/*defining the path for DataDirectory */
|
/*defining the path for DataDirectory */
|
||||||
log_verbose("Testing setDataDirectory\n");
|
log_verbose("Testing setDataDirectory\n");
|
||||||
uloc_setDataDirectory( path );
|
u_setDataDirectory( path );
|
||||||
if(strcmp(path, uloc_getDataDirectory())==0)
|
if(strcmp(path, u_getDataDirectory())==0)
|
||||||
log_verbose("setDataDirectory working fine\n");
|
log_verbose("setDataDirectory working fine\n");
|
||||||
else
|
else
|
||||||
log_err("Error in setDataDirectory. Directory not set correctly - came back as [%s], expected [%s]\n", uloc_getDataDirectory(), path);
|
log_err("Error in setDataDirectory. Directory not set correctly - came back as [%s], expected [%s]\n", u_getDataDirectory(), path);
|
||||||
|
|
||||||
testValue2=uloc_getISO3Language("en_US");
|
testValue2=uloc_getISO3Language("en_US");
|
||||||
log_verbose("second fetch of language retrieved %s \n", testValue2);
|
log_verbose("second fetch of language retrieved %s \n", testValue2);
|
||||||
|
|
||||||
uloc_setDataDirectory(oldDirectory);
|
u_setDataDirectory(oldDirectory);
|
||||||
testValue3=uloc_getISO3Language("en_US");
|
testValue3=uloc_getISO3Language("en_US");
|
||||||
log_verbose("third fetch of language retrieved %s \n", testValue3);
|
log_verbose("third fetch of language retrieved %s \n", testValue3);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user