ICU 72.1 72.1
|
C API: Resource Bundle. More...
#include "unicode/utypes.h"
#include "unicode/uloc.h"
#include "unicode/localpointer.h"
#include "unicode/unistr.h"
Go to the source code of this file.
Namespaces | |
namespace | icu |
File coll.h. | |
Typedefs | |
typedef struct UResourceBundle | UResourceBundle |
Enumerations | |
enum | UResType { URES_NONE =-1 , URES_STRING =0 , URES_BINARY =1 , URES_TABLE =2 , URES_ALIAS =3 , URES_INT =7 , URES_ARRAY =8 , URES_INT_VECTOR = 14 , RES_NONE =URES_NONE , RES_STRING =URES_STRING , RES_BINARY =URES_BINARY , RES_TABLE =URES_TABLE , RES_ALIAS =URES_ALIAS , RES_INT =URES_INT , RES_ARRAY =URES_ARRAY , RES_INT_VECTOR =URES_INT_VECTOR , RES_RESERVED =15 , URES_LIMIT = 16 } |
Numeric constants for types of resource items. More... | |
Functions | |
U_CAPI UResourceBundle * | ures_open (const char *packageName, const char *locale, UErrorCode *status) |
Opens a UResourceBundle, from which users can extract strings by using their corresponding keys. More... | |
U_CAPI UResourceBundle * | ures_openDirect (const char *packageName, const char *locale, UErrorCode *status) |
This function does not care what kind of localeID is passed in. More... | |
U_CAPI UResourceBundle * | ures_openU (const UChar *packageName, const char *locale, UErrorCode *status) |
Same as ures_open() but takes a const UChar *path. More... | |
int32_t | ures_countArrayItems (const UResourceBundle *resourceBundle, const char *resourceKey, UErrorCode *err) |
Returns the number of strings/arrays in resource bundles. More... | |
U_CAPI void | ures_close (UResourceBundle *resourceBundle) |
Close a resource bundle, all pointers returned from the various ures_getXXX calls on this particular bundle should be considered invalid henceforth. More... | |
const char * | ures_getVersionNumber (const UResourceBundle *resourceBundle) |
Return the version number associated with this ResourceBundle as a string. More... | |
U_CAPI void | ures_getVersion (const UResourceBundle *resB, UVersionInfo versionInfo) |
Return the version number associated with this ResourceBundle as an UVersionInfo array. More... | |
const char * | ures_getLocale (const UResourceBundle *resourceBundle, UErrorCode *status) |
Return the name of the Locale associated with this ResourceBundle. More... | |
U_CAPI const char * | ures_getLocaleByType (const UResourceBundle *resourceBundle, ULocDataLocaleType type, UErrorCode *status) |
Return the name of the Locale associated with this ResourceBundle. More... | |
U_CAPI void | ures_openFillIn (UResourceBundle *r, const char *packageName, const char *localeID, UErrorCode *status) |
Same as ures_open() but uses the fill-in parameter instead of allocating a new bundle. More... | |
U_CAPI const UChar * | ures_getString (const UResourceBundle *resourceBundle, int32_t *len, UErrorCode *status) |
Returns a string from a string resource type. More... | |
U_CAPI const char * | ures_getUTF8String (const UResourceBundle *resB, char *dest, int32_t *length, UBool forceCopy, UErrorCode *status) |
Returns a UTF-8 string from a string resource. More... | |
U_CAPI const uint8_t * | ures_getBinary (const UResourceBundle *resourceBundle, int32_t *len, UErrorCode *status) |
Returns a binary data from a binary resource. More... | |
U_CAPI const int32_t * | ures_getIntVector (const UResourceBundle *resourceBundle, int32_t *len, UErrorCode *status) |
Returns a 32 bit integer array from a resource. More... | |
U_CAPI uint32_t | ures_getUInt (const UResourceBundle *resourceBundle, UErrorCode *status) |
Returns an unsigned integer from a resource. More... | |
U_CAPI int32_t | ures_getInt (const UResourceBundle *resourceBundle, UErrorCode *status) |
Returns a signed integer from a resource. More... | |
U_CAPI int32_t | ures_getSize (const UResourceBundle *resourceBundle) |
Returns the size of a resource. More... | |
U_CAPI UResType | ures_getType (const UResourceBundle *resourceBundle) |
Returns the type of a resource. More... | |
U_CAPI const char * | ures_getKey (const UResourceBundle *resourceBundle) |
Returns the key associated with a given resource. More... | |
U_CAPI void | ures_resetIterator (UResourceBundle *resourceBundle) |
Resets the internal context of a resource so that iteration starts from the first element. More... | |
U_CAPI UBool | ures_hasNext (const UResourceBundle *resourceBundle) |
Checks whether the given resource has another element to iterate over. More... | |
U_CAPI UResourceBundle * | ures_getNextResource (UResourceBundle *resourceBundle, UResourceBundle *fillIn, UErrorCode *status) |
Returns the next resource in a given resource or NULL if there are no more resources to iterate over. More... | |
U_CAPI const UChar * | ures_getNextString (UResourceBundle *resourceBundle, int32_t *len, const char **key, UErrorCode *status) |
Returns the next string in a given resource or NULL if there are no more resources to iterate over. More... | |
U_CAPI UResourceBundle * | ures_getByIndex (const UResourceBundle *resourceBundle, int32_t indexR, UResourceBundle *fillIn, UErrorCode *status) |
Returns the resource in a given resource at the specified index. More... | |
U_CAPI const UChar * | ures_getStringByIndex (const UResourceBundle *resourceBundle, int32_t indexS, int32_t *len, UErrorCode *status) |
Returns the string in a given resource at the specified index. More... | |
U_CAPI const char * | ures_getUTF8StringByIndex (const UResourceBundle *resB, int32_t stringIndex, char *dest, int32_t *pLength, UBool forceCopy, UErrorCode *status) |
Returns a UTF-8 string from a resource at the specified index. More... | |
U_CAPI UResourceBundle * | ures_getByKey (const UResourceBundle *resourceBundle, const char *key, UResourceBundle *fillIn, UErrorCode *status) |
Returns a resource in a given resource that has a given key. More... | |
U_CAPI const UChar * | ures_getStringByKey (const UResourceBundle *resB, const char *key, int32_t *len, UErrorCode *status) |
Returns a string in a given resource that has a given key. More... | |
U_CAPI const char * | ures_getUTF8StringByKey (const UResourceBundle *resB, const char *key, char *dest, int32_t *pLength, UBool forceCopy, UErrorCode *status) |
Returns a UTF-8 string from a resource and a key. More... | |
UnicodeString | icu::ures_getUnicodeString (const UResourceBundle *resB, UErrorCode *status) |
Returns the string value from a string resource bundle. More... | |
UnicodeString | icu::ures_getNextUnicodeString (UResourceBundle *resB, const char **key, UErrorCode *status) |
Returns the next string in a resource, or an empty string if there are no more resources to iterate over. More... | |
UnicodeString | icu::ures_getUnicodeStringByIndex (const UResourceBundle *resB, int32_t indexS, UErrorCode *status) |
Returns the string in a given resource array or table at the specified index. More... | |
UnicodeString | icu::ures_getUnicodeStringByKey (const UResourceBundle *resB, const char *key, UErrorCode *status) |
Returns a string in a resource that has a given key. More... | |
U_CAPI UEnumeration * | ures_openAvailableLocales (const char *packageName, UErrorCode *status) |
Create a string enumerator, owned by the caller, of all locales located within the specified resource tree. More... | |
C API: Resource Bundle.
C API representing a collection of resource information pertaining to a given locale. A resource bundle provides a way of accessing locale- specific information in a data file. You create a resource bundle that manages the resources for a given locale and then ask it for individual resources.
Resource bundles in ICU4C are currently defined using text files which conform to the following BNF definition. More on resource bundle concepts and syntax can be found in the Users Guide.
Definition in file ures.h.
typedef struct UResourceBundle UResourceBundle |
enum UResType |
Numeric constants for types of resource items.
Enumerator | |
---|---|
URES_NONE | Resource type constant for "no resource".
|
URES_STRING | Resource type constant for 16-bit Unicode strings.
|
URES_BINARY | Resource type constant for binary data.
|
URES_TABLE | Resource type constant for tables of key-value pairs.
|
URES_ALIAS | Resource type constant for aliases; internally stores a string which identifies the actual resource storing the data (can be in a different resource bundle). Resolved internally before delivering the actual resource through the API.
|
URES_INT | Resource type constant for a single 28-bit integer, interpreted as signed or unsigned by the ures_getInt() or ures_getUInt() function.
|
URES_ARRAY | Resource type constant for arrays of resources.
|
URES_INT_VECTOR | Resource type constant for vectors of 32-bit integers.
|
RES_NONE |
|
RES_STRING |
|
RES_BINARY |
|
RES_TABLE |
|
RES_ALIAS |
|
RES_INT |
|
RES_ARRAY |
|
RES_INT_VECTOR |
|
RES_RESERVED |
|
URES_LIMIT | One more than the highest normal UResType value.
|
U_CAPI void ures_close | ( | UResourceBundle * | resourceBundle | ) |
int32_t ures_countArrayItems | ( | const UResourceBundle * | resourceBundle, |
const char * | resourceKey, | ||
UErrorCode * | err | ||
) |
Returns the number of strings/arrays in resource bundles.
Better to use ures_getSize, as this function will be deprecated.
resourceBundle | resource bundle containing the desired strings |
resourceKey | key tagging the resource |
err | fills in the outgoing error code could be U_MISSING_RESOURCE_ERROR if the key is not found could be a non-failing error e.g.: U_USING_FALLBACK_WARNING ,U_USING_FALLBACK_WARNING |
U_CAPI const uint8_t * ures_getBinary | ( | const UResourceBundle * | resourceBundle, |
int32_t * | len, | ||
UErrorCode * | status | ||
) |
Returns a binary data from a binary resource.
resourceBundle | a string resource |
len | fills in the length of resulting byte chunk |
status | fills in the outgoing error code could be U_MISSING_RESOURCE_ERROR if the key is not found Always check the value of status. Don't count on returning NULL. could be a non-failing error e.g.: U_USING_FALLBACK_WARNING ,U_USING_DEFAULT_WARNING |
U_CAPI UResourceBundle * ures_getByIndex | ( | const UResourceBundle * | resourceBundle, |
int32_t | indexR, | ||
UResourceBundle * | fillIn, | ||
UErrorCode * | status | ||
) |
Returns the resource in a given resource at the specified index.
Features a fill-in parameter.
resourceBundle | the resource bundle from which to get a sub-resource |
indexR | an index to the wanted resource. |
fillIn | if NULL a new UResourceBundle struct is allocated and must be closed by the caller. Alternatively, you can supply a struct to be filled by this function. |
status | fills in the outgoing error code. Don't count on NULL being returned if an error has occurred. Check status instead. |
U_CAPI UResourceBundle * ures_getByKey | ( | const UResourceBundle * | resourceBundle, |
const char * | key, | ||
UResourceBundle * | fillIn, | ||
UErrorCode * | status | ||
) |
Returns a resource in a given resource that has a given key.
This procedure works only with table resources. Features a fill-in parameter.
resourceBundle | a resource |
key | a key associated with the wanted resource |
fillIn | if NULL a new UResourceBundle struct is allocated and must be closed by the caller. Alternatively, you can supply a struct to be filled by this function. |
status | fills in the outgoing error code. |
U_CAPI int32_t ures_getInt | ( | const UResourceBundle * | resourceBundle, |
UErrorCode * | status | ||
) |
Returns a signed integer from a resource.
This integer is originally 28 bit and the sign gets propagated.
resourceBundle | a string resource |
status | fills in the outgoing error code could be U_MISSING_RESOURCE_ERROR if the key is not found could be a non-failing error e.g.: U_USING_FALLBACK_WARNING ,U_USING_DEFAULT_WARNING |
U_CAPI const int32_t * ures_getIntVector | ( | const UResourceBundle * | resourceBundle, |
int32_t * | len, | ||
UErrorCode * | status | ||
) |
Returns a 32 bit integer array from a resource.
resourceBundle | an int vector resource |
len | fills in the length of resulting byte chunk |
status | fills in the outgoing error code could be U_MISSING_RESOURCE_ERROR if the key is not found Always check the value of status. Don't count on returning NULL. could be a non-failing error e.g.: U_USING_FALLBACK_WARNING ,U_USING_DEFAULT_WARNING |
U_CAPI const char * ures_getKey | ( | const UResourceBundle * | resourceBundle | ) |
Returns the key associated with a given resource.
Not all the resources have a key - only those that are members of a table.
resourceBundle | a resource |
const char * ures_getLocale | ( | const UResourceBundle * | resourceBundle, |
UErrorCode * | status | ||
) |
Return the name of the Locale associated with this ResourceBundle.
This API allows you to query for the real locale of the resource. For example, if you requested "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned. For subresources, the locale where this resource comes from will be returned. If fallback has occurred, getLocale will reflect this.
resourceBundle | resource bundle in question |
status | just for catching illegal arguments |
U_CAPI const char * ures_getLocaleByType | ( | const UResourceBundle * | resourceBundle, |
ULocDataLocaleType | type, | ||
UErrorCode * | status | ||
) |
Return the name of the Locale associated with this ResourceBundle.
You can choose between requested, valid and real locale.
resourceBundle | resource bundle in question |
type | You can choose between requested, valid and actual locale. For description see the definition of ULocDataLocaleType in uloc.h |
status | just for catching illegal arguments |
U_CAPI UResourceBundle * ures_getNextResource | ( | UResourceBundle * | resourceBundle, |
UResourceBundle * | fillIn, | ||
UErrorCode * | status | ||
) |
Returns the next resource in a given resource or NULL if there are no more resources to iterate over.
Features a fill-in parameter.
resourceBundle | a resource |
fillIn | if NULL a new UResourceBundle struct is allocated and must be closed by the caller. Alternatively, you can supply a struct to be filled by this function. |
status | fills in the outgoing error code. You may still get a non NULL result even if an error occurred. Check status instead. |
U_CAPI const UChar * ures_getNextString | ( | UResourceBundle * | resourceBundle, |
int32_t * | len, | ||
const char ** | key, | ||
UErrorCode * | status | ||
) |
Returns the next string in a given resource or NULL if there are no more resources to iterate over.
resourceBundle | a resource |
len | fill in length of the string |
key | fill in for key associated with this string. NULL if no key |
status | fills in the outgoing error code. If an error occurred, we may return NULL, but don't count on it. Check status instead! |
Referenced by icu::ures_getNextUnicodeString().
U_CAPI int32_t ures_getSize | ( | const UResourceBundle * | resourceBundle | ) |
Returns the size of a resource.
Size for scalar types is always 1, and for vector/table types is the number of child resources.
resourceBundle | a resource |
U_CAPI const UChar * ures_getString | ( | const UResourceBundle * | resourceBundle, |
int32_t * | len, | ||
UErrorCode * | status | ||
) |
Returns a string from a string resource type.
resourceBundle | a string resource |
len | fills in the length of resulting string |
status | fills in the outgoing error code could be U_MISSING_RESOURCE_ERROR if the key is not found Always check the value of status. Don't count on returning NULL. could be a non-failing error e.g.: U_USING_FALLBACK_WARNING ,U_USING_DEFAULT_WARNING |
Referenced by icu::ures_getUnicodeString().
U_CAPI const UChar * ures_getStringByIndex | ( | const UResourceBundle * | resourceBundle, |
int32_t | indexS, | ||
int32_t * | len, | ||
UErrorCode * | status | ||
) |
Returns the string in a given resource at the specified index.
resourceBundle | a resource |
indexS | an index to the wanted string. |
len | fill in length of the string |
status | fills in the outgoing error code. If an error occurred, we may return NULL, but don't count on it. Check status instead! |
Referenced by icu::ures_getUnicodeStringByIndex().
U_CAPI const UChar * ures_getStringByKey | ( | const UResourceBundle * | resB, |
const char * | key, | ||
int32_t * | len, | ||
UErrorCode * | status | ||
) |
Returns a string in a given resource that has a given key.
This procedure works only with table resources.
resB | a resource |
key | a key associated with the wanted string |
len | fill in length of the string |
status | fills in the outgoing error code. If an error occurred, we may return NULL, but don't count on it. Check status instead! |
Referenced by icu::ures_getUnicodeStringByKey().
U_CAPI UResType ures_getType | ( | const UResourceBundle * | resourceBundle | ) |
U_CAPI uint32_t ures_getUInt | ( | const UResourceBundle * | resourceBundle, |
UErrorCode * | status | ||
) |
Returns an unsigned integer from a resource.
This integer is originally 28 bits.
resourceBundle | a string resource |
status | fills in the outgoing error code could be U_MISSING_RESOURCE_ERROR if the key is not found could be a non-failing error e.g.: U_USING_FALLBACK_WARNING ,U_USING_DEFAULT_WARNING |
U_CAPI const char * ures_getUTF8String | ( | const UResourceBundle * | resB, |
char * | dest, | ||
int32_t * | length, | ||
UBool | forceCopy, | ||
UErrorCode * | status | ||
) |
Returns a UTF-8 string from a string resource.
The UTF-8 string may be returnable directly as a pointer, or it may need to be copied, or transformed from UTF-16 using u_strToUTF8() or equivalent.
If forceCopy==true, then the string is always written to the dest buffer and dest is returned.
If forceCopy==false, then the string is returned as a pointer if possible, without needing a dest buffer (it can be NULL). If the string needs to be copied or transformed, then it may be placed into dest at an arbitrary offset.
If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual.
If the string is transformed from UTF-16, then a conversion error may occur if an unpaired surrogate is encountered. If the function is successful, then the output UTF-8 string is always well-formed.
resB | Resource bundle. |
dest | Destination buffer. Can be NULL only if capacity=*length==0. |
length | Input: Capacity of destination buffer. Output: Actual length of the UTF-8 string, not counting the terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. Can be NULL, meaning capacity=0 and the string length is not returned to the caller. |
forceCopy | If true, then the output string will always be written to dest, with U_BUFFER_OVERFLOW_ERROR and U_STRING_NOT_TERMINATED_WARNING set if appropriate. If false, then the dest buffer may or may not contain a copy of the string. dest may or may not be modified. If a copy needs to be written, then the UErrorCode parameter indicates overflow etc. as usual. |
status | Pointer to a standard ICU error code. Its input value must pass the U_SUCCESS() test, or else the function returns immediately. Check for U_FAILURE() on output or use with function chaining. (See User Guide for details.) |
U_CAPI const char * ures_getUTF8StringByIndex | ( | const UResourceBundle * | resB, |
int32_t | stringIndex, | ||
char * | dest, | ||
int32_t * | pLength, | ||
UBool | forceCopy, | ||
UErrorCode * | status | ||
) |
Returns a UTF-8 string from a resource at the specified index.
The UTF-8 string may be returnable directly as a pointer, or it may need to be copied, or transformed from UTF-16 using u_strToUTF8() or equivalent.
If forceCopy==true, then the string is always written to the dest buffer and dest is returned.
If forceCopy==false, then the string is returned as a pointer if possible, without needing a dest buffer (it can be NULL). If the string needs to be copied or transformed, then it may be placed into dest at an arbitrary offset.
If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual.
If the string is transformed from UTF-16, then a conversion error may occur if an unpaired surrogate is encountered. If the function is successful, then the output UTF-8 string is always well-formed.
resB | Resource bundle. |
stringIndex | An index to the wanted string. |
dest | Destination buffer. Can be NULL only if capacity=*length==0. |
pLength | Input: Capacity of destination buffer. Output: Actual length of the UTF-8 string, not counting the terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. Can be NULL, meaning capacity=0 and the string length is not returned to the caller. |
forceCopy | If true, then the output string will always be written to dest, with U_BUFFER_OVERFLOW_ERROR and U_STRING_NOT_TERMINATED_WARNING set if appropriate. If false, then the dest buffer may or may not contain a copy of the string. dest may or may not be modified. If a copy needs to be written, then the UErrorCode parameter indicates overflow etc. as usual. |
status | Pointer to a standard ICU error code. Its input value must pass the U_SUCCESS() test, or else the function returns immediately. Check for U_FAILURE() on output or use with function chaining. (See User Guide for details.) |
U_CAPI const char * ures_getUTF8StringByKey | ( | const UResourceBundle * | resB, |
const char * | key, | ||
char * | dest, | ||
int32_t * | pLength, | ||
UBool | forceCopy, | ||
UErrorCode * | status | ||
) |
Returns a UTF-8 string from a resource and a key.
This function works only with table resources.
The UTF-8 string may be returnable directly as a pointer, or it may need to be copied, or transformed from UTF-16 using u_strToUTF8() or equivalent.
If forceCopy==true, then the string is always written to the dest buffer and dest is returned.
If forceCopy==false, then the string is returned as a pointer if possible, without needing a dest buffer (it can be NULL). If the string needs to be copied or transformed, then it may be placed into dest at an arbitrary offset.
If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual.
If the string is transformed from UTF-16, then a conversion error may occur if an unpaired surrogate is encountered. If the function is successful, then the output UTF-8 string is always well-formed.
resB | Resource bundle. |
key | A key associated with the wanted resource |
dest | Destination buffer. Can be NULL only if capacity=*length==0. |
pLength | Input: Capacity of destination buffer. Output: Actual length of the UTF-8 string, not counting the terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. Can be NULL, meaning capacity=0 and the string length is not returned to the caller. |
forceCopy | If true, then the output string will always be written to dest, with U_BUFFER_OVERFLOW_ERROR and U_STRING_NOT_TERMINATED_WARNING set if appropriate. If false, then the dest buffer may or may not contain a copy of the string. dest may or may not be modified. If a copy needs to be written, then the UErrorCode parameter indicates overflow etc. as usual. |
status | Pointer to a standard ICU error code. Its input value must pass the U_SUCCESS() test, or else the function returns immediately. Check for U_FAILURE() on output or use with function chaining. (See User Guide for details.) |
U_CAPI void ures_getVersion | ( | const UResourceBundle * | resB, |
UVersionInfo | versionInfo | ||
) |
Return the version number associated with this ResourceBundle as an UVersionInfo array.
resB | The resource bundle for which the version is checked. |
versionInfo | A UVersionInfo array that is filled with the version number as specified in the resource bundle or its parent. |
const char * ures_getVersionNumber | ( | const UResourceBundle * | resourceBundle | ) |
Return the version number associated with this ResourceBundle as a string.
Please use ures_getVersion as this function is going to be deprecated.
resourceBundle | The resource bundle for which the version is checked. |
U_CAPI UBool ures_hasNext | ( | const UResourceBundle * | resourceBundle | ) |
Checks whether the given resource has another element to iterate over.
resourceBundle | a resource |
U_CAPI UResourceBundle * ures_open | ( | const char * | packageName, |
const char * | locale, | ||
UErrorCode * | status | ||
) |
Opens a UResourceBundle, from which users can extract strings by using their corresponding keys.
Note that the caller is responsible of calling ures_close
on each successfully opened resource bundle.
packageName | The packageName and locale together point to an ICU udata object, as defined by udata_open( packageName, "res", locale, err) or equivalent. Typically, packageName will refer to a (.dat) file, or to a package registered with udata_setAppData(). Using a full file or directory pathname for packageName is deprecated. If NULL, ICU data will be used. |
locale | specifies the locale for which we want to open the resource if NULL, the default locale will be used. If strlen(locale) == 0 root locale will be used. |
status | fills in the outgoing error code. The UErrorCode err parameter is used to return status information to the user. To check whether the construction succeeded or not, you should check the value of U_SUCCESS(err). If you wish more detailed information, you can check for informational status results which still indicate success. U_USING_FALLBACK_WARNING indicates that a fall back locale was used. For example, 'de_CH' was requested, but nothing was found there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that the default locale data or root locale data was used; neither the requested locale nor any of its fall back locales could be found. Please see the users guide for more information on this topic. |
U_CAPI UEnumeration * ures_openAvailableLocales | ( | const char * | packageName, |
UErrorCode * | status | ||
) |
Create a string enumerator, owned by the caller, of all locales located within the specified resource tree.
packageName | name of the tree, such as (NULL) or U_ICUDATA_ALIAS or or "ICUDATA-coll" This call is similar to uloc_getAvailable(). |
status | error code |
U_CAPI UResourceBundle * ures_openDirect | ( | const char * | packageName, |
const char * | locale, | ||
UErrorCode * | status | ||
) |
This function does not care what kind of localeID is passed in.
It simply opens a bundle with that name. Fallback mechanism is disabled for the new bundle. If the requested bundle contains an %ALIAS directive, the results are undefined.
packageName | The packageName and locale together point to an ICU udata object, as defined by udata_open( packageName, "res", locale, err) or equivalent. Typically, packageName will refer to a (.dat) file, or to a package registered with udata_setAppData(). Using a full file or directory pathname for packageName is deprecated. If NULL, ICU data will be used. |
locale | specifies the locale for which we want to open the resource if NULL, the default locale will be used. If strlen(locale) == 0 root locale will be used. |
status | fills in the outgoing error code. Either U_ZERO_ERROR or U_MISSING_RESOURCE_ERROR |
U_CAPI void ures_openFillIn | ( | UResourceBundle * | r, |
const char * | packageName, | ||
const char * | localeID, | ||
UErrorCode * | status | ||
) |
Same as ures_open() but uses the fill-in parameter instead of allocating a new bundle.
TODO need to revisit usefulness of this function and usage model for fillIn parameters without knowing sizeof(UResourceBundle)
r | The existing UResourceBundle to fill in. If NULL then status will be set to U_ILLEGAL_ARGUMENT_ERROR. |
packageName | The packageName and locale together point to an ICU udata object, as defined by udata_open( packageName, "res", locale, err) or equivalent. Typically, packageName will refer to a (.dat) file, or to a package registered with udata_setAppData(). Using a full file or directory pathname for packageName is deprecated. If NULL, ICU data will be used. |
localeID | specifies the locale for which we want to open the resource |
status | The error code. |
U_CAPI UResourceBundle * ures_openU | ( | const UChar * | packageName, |
const char * | locale, | ||
UErrorCode * | status | ||
) |
Same as ures_open() but takes a const UChar *path.
This path will be converted to char * using the default converter, then ures_open() is called.
packageName | The packageName and locale together point to an ICU udata object, as defined by udata_open( packageName, "res", locale, err) or equivalent. Typically, packageName will refer to a (.dat) file, or to a package registered with udata_setAppData(). Using a full file or directory pathname for packageName is deprecated. If NULL, ICU data will be used. |
locale | specifies the locale for which we want to open the resource if NULL, the default locale will be used. If strlen(locale) == 0 root locale will be used. |
status | fills in the outgoing error code. |
U_CAPI void ures_resetIterator | ( | UResourceBundle * | resourceBundle | ) |
Resets the internal context of a resource so that iteration starts from the first element.
resourceBundle | a resource |