| Index: source/common/unicode/ures.h
|
| diff --git a/source/common/unicode/ures.h b/source/common/unicode/ures.h
|
| index c91f030b1004541d13f83d88725f5de983bc4b38..620d9268aaceeb4bf678beacec8e004adc18d67d 100644
|
| --- a/source/common/unicode/ures.h
|
| +++ b/source/common/unicode/ures.h
|
| @@ -1,6 +1,8 @@
|
| +// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
| +// License & terms of use: http://www.unicode.org/copyright.html
|
| /*
|
| **********************************************************************
|
| -* Copyright (C) 1997-2012,2014, International Business Machines
|
| +* Copyright (C) 1997-2016, International Business Machines
|
| * Corporation and others. All Rights Reserved.
|
| **********************************************************************
|
| *
|
| @@ -12,7 +14,7 @@
|
| * 04/01/97 aliu Creation.
|
| * 02/22/99 damiba overhaul.
|
| * 04/04/99 helena Fixed internal header inclusion.
|
| -* 04/15/99 Madhu Updated Javadoc
|
| +* 04/15/99 Madhu Updated Javadoc
|
| * 06/14/99 stephen Removed functions taking a filename suffix.
|
| * 07/20/99 stephen Language-independent ypedef to void*
|
| * 11/09/99 weiv Added ures_getLocale()
|
| @@ -29,7 +31,7 @@
|
|
|
| /**
|
| * \file
|
| - * \brief C API: Resource Bundle
|
| + * \brief C API: Resource Bundle
|
| *
|
| * <h2>C API: Resource Bundle</h2>
|
| *
|
| @@ -40,7 +42,7 @@
|
| * <P>
|
| * Resource bundles in ICU4C are currently defined using text files which conform to the following
|
| * <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt">BNF definition</a>.
|
| - * More on resource bundle concepts and syntax can be found in the
|
| + * More on resource bundle concepts and syntax can be found in the
|
| * <a href="http://icu-project.org/userguide/ResourceManagement.html">Users Guide</a>.
|
| * <P>
|
| */
|
| @@ -119,10 +121,14 @@ typedef enum {
|
| /** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
| RES_INT_VECTOR=URES_INT_VECTOR,
|
| /** @deprecated ICU 2.6 Not used. */
|
| - RES_RESERVED=15,
|
| -#endif /* U_HIDE_DEPRECATED_API */
|
| + RES_RESERVED=15,
|
|
|
| + /**
|
| + * One more than the highest normal UResType value.
|
| + * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
|
| + */
|
| URES_LIMIT = 16
|
| +#endif // U_HIDE_DEPRECATED_API
|
| } UResType;
|
|
|
| /*
|
| @@ -134,15 +140,15 @@ typedef enum {
|
| * their corresponding keys.
|
| * Note that the caller is responsible of calling <TT>ures_close</TT> on each succesfully
|
| * opened resource bundle.
|
| - * @param packageName The packageName and locale together point to an ICU udata object,
|
| - * as defined by <code> udata_open( packageName, "res", locale, err) </code>
|
| + * @param packageName The packageName and locale together point to an ICU udata object,
|
| + * as defined by <code> udata_open( packageName, "res", locale, err) </code>
|
| * 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.
|
| * @param 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.
|
| - *
|
| + *
|
| * @param 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
|
| @@ -150,39 +156,39 @@ typedef enum {
|
| * 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
|
| + * 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.
|
| * @return a newly allocated resource bundle.
|
| * @see ures_close
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE UResourceBundle* U_EXPORT2
|
| +U_STABLE UResourceBundle* U_EXPORT2
|
| ures_open(const char* packageName,
|
| - const char* locale,
|
| + const char* locale,
|
| UErrorCode* status);
|
|
|
|
|
| -/** This function does not care what kind of localeID is passed in. It simply opens a bundle with
|
| +/** 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.
|
| - * @param packageName The packageName and locale together point to an ICU udata object,
|
| - * as defined by <code> udata_open( packageName, "res", locale, err) </code>
|
| + * @param packageName The packageName and locale together point to an ICU udata object,
|
| + * as defined by <code> udata_open( packageName, "res", locale, err) </code>
|
| * 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.
|
| * @param 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.
|
| - *
|
| + *
|
| * @param status fills in the outgoing error code. Either U_ZERO_ERROR or U_MISSING_RESOURCE_ERROR
|
| * @return a newly allocated resource bundle or NULL if it doesn't exist.
|
| * @see ures_close
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE UResourceBundle* U_EXPORT2
|
| -ures_openDirect(const char* packageName,
|
| - const char* locale,
|
| +U_STABLE UResourceBundle* U_EXPORT2
|
| +ures_openDirect(const char* packageName,
|
| + const char* locale,
|
| UErrorCode* status);
|
|
|
| /**
|
| @@ -190,8 +196,8 @@ ures_openDirect(const char* packageName,
|
| * This path will be converted to char * using the default converter,
|
| * then ures_open() is called.
|
| *
|
| - * @param packageName The packageName and locale together point to an ICU udata object,
|
| - * as defined by <code> udata_open( packageName, "res", locale, err) </code>
|
| + * @param packageName The packageName and locale together point to an ICU udata object,
|
| + * as defined by <code> udata_open( packageName, "res", locale, err) </code>
|
| * 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.
|
| @@ -203,21 +209,21 @@ ures_openDirect(const char* packageName,
|
| * @see ures_open
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE UResourceBundle* U_EXPORT2
|
| -ures_openU(const UChar* packageName,
|
| - const char* locale,
|
| +U_STABLE UResourceBundle* U_EXPORT2
|
| +ures_openU(const UChar* packageName,
|
| + const char* locale,
|
| UErrorCode* status);
|
|
|
| #ifndef U_HIDE_DEPRECATED_API
|
| /**
|
| * Returns the number of strings/arrays in resource bundles.
|
| - * Better to use ures_getSize, as this function will be deprecated.
|
| + * Better to use ures_getSize, as this function will be deprecated.
|
| *
|
| *@param resourceBundle resource bundle containing the desired strings
|
| *@param resourceKey key tagging the resource
|
| *@param err fills in the outgoing error code
|
| * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
| - * could be a non-failing error
|
| + * could be a non-failing error
|
| * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_FALLBACK_WARNING </TT>
|
| *@return: for <STRONG>Arrays</STRONG>: returns the number of resources in the array
|
| * <STRONG>Tables</STRONG>: returns the number of resources in the table
|
| @@ -225,7 +231,7 @@ ures_openU(const UChar* packageName,
|
| *@see ures_getSize
|
| * @deprecated ICU 2.8 User ures_getSize instead
|
| */
|
| -U_DEPRECATED int32_t U_EXPORT2
|
| +U_DEPRECATED int32_t U_EXPORT2
|
| ures_countArrayItems(const UResourceBundle* resourceBundle,
|
| const char* resourceKey,
|
| UErrorCode* err);
|
| @@ -239,7 +245,7 @@ ures_countArrayItems(const UResourceBundle* resourceBundle,
|
| * @see ures_open
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE void U_EXPORT2
|
| +U_STABLE void U_EXPORT2
|
| ures_close(UResourceBundle* resourceBundle);
|
|
|
| #if U_SHOW_CPLUSPLUS_API
|
| @@ -272,12 +278,12 @@ U_NAMESPACE_END
|
| * @see ures_getVersion
|
| * @deprecated ICU 2.8 Use ures_getVersion instead.
|
| */
|
| -U_DEPRECATED const char* U_EXPORT2
|
| +U_DEPRECATED const char* U_EXPORT2
|
| ures_getVersionNumber(const UResourceBundle* resourceBundle);
|
| #endif /* U_HIDE_DEPRECATED_API */
|
|
|
| /**
|
| - * Return the version number associated with this ResourceBundle as an
|
| + * Return the version number associated with this ResourceBundle as an
|
| * UVersionInfo array.
|
| *
|
| * @param resB The resource bundle for which the version is checked.
|
| @@ -285,15 +291,15 @@ ures_getVersionNumber(const UResourceBundle* resourceBundle);
|
| * as specified in the resource bundle or its parent.
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE void U_EXPORT2
|
| -ures_getVersion(const UResourceBundle* resB,
|
| +U_STABLE void U_EXPORT2
|
| +ures_getVersion(const UResourceBundle* resB,
|
| UVersionInfo versionInfo);
|
|
|
| #ifndef U_HIDE_DEPRECATED_API
|
| /**
|
| * 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.
|
| + * 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 occured, getLocale will reflect this.
|
| *
|
| @@ -302,13 +308,13 @@ ures_getVersion(const UResourceBundle* resB,
|
| * @return A Locale name
|
| * @deprecated ICU 2.8 Use ures_getLocaleByType instead.
|
| */
|
| -U_DEPRECATED const char* U_EXPORT2
|
| -ures_getLocale(const UResourceBundle* resourceBundle,
|
| +U_DEPRECATED const char* U_EXPORT2
|
| +ures_getLocale(const UResourceBundle* resourceBundle,
|
| UErrorCode* status);
|
| #endif /* U_HIDE_DEPRECATED_API */
|
|
|
| /**
|
| - * Return the name of the Locale associated with this ResourceBundle.
|
| + * Return the name of the Locale associated with this ResourceBundle.
|
| * You can choose between requested, valid and real locale.
|
| *
|
| * @param resourceBundle resource bundle in question
|
| @@ -319,9 +325,9 @@ ures_getLocale(const UResourceBundle* resourceBundle,
|
| * @return A Locale name
|
| * @stable ICU 2.8
|
| */
|
| -U_STABLE const char* U_EXPORT2
|
| -ures_getLocaleByType(const UResourceBundle* resourceBundle,
|
| - ULocDataLocaleType type,
|
| +U_STABLE const char* U_EXPORT2
|
| +ures_getLocaleByType(const UResourceBundle* resourceBundle,
|
| + ULocDataLocaleType type,
|
| UErrorCode* status);
|
|
|
|
|
| @@ -332,8 +338,8 @@ ures_getLocaleByType(const UResourceBundle* resourceBundle,
|
| * TODO need to revisit usefulness of this function
|
| * and usage model for fillIn parameters without knowing sizeof(UResourceBundle)
|
| * @param r The resourcebundle to open
|
| - * @param packageName The packageName and locale together point to an ICU udata object,
|
| - * as defined by <code> udata_open( packageName, "res", locale, err) </code>
|
| + * @param packageName The packageName and locale together point to an ICU udata object,
|
| + * as defined by <code> udata_open( packageName, "res", locale, err) </code>
|
| * 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.
|
| @@ -342,10 +348,10 @@ ures_getLocaleByType(const UResourceBundle* resourceBundle,
|
| * @return a newly allocated resource bundle or NULL if it doesn't exist.
|
| * @internal
|
| */
|
| -U_INTERNAL void U_EXPORT2
|
| -ures_openFillIn(UResourceBundle *r,
|
| +U_INTERNAL void U_EXPORT2
|
| +ures_openFillIn(UResourceBundle *r,
|
| const char* packageName,
|
| - const char* localeID,
|
| + const char* localeID,
|
| UErrorCode* status);
|
| #endif /* U_HIDE_INTERNAL_API */
|
|
|
| @@ -357,7 +363,7 @@ ures_openFillIn(UResourceBundle *r,
|
| * @param status fills in the outgoing error code
|
| * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
| * Always check the value of status. Don't count on returning NULL.
|
| - * could be a non-failing error
|
| + * could be a non-failing error
|
| * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
| * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file.
|
| * @see ures_getBinary
|
| @@ -366,9 +372,9 @@ ures_openFillIn(UResourceBundle *r,
|
| * @see ures_getUInt
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE const UChar* U_EXPORT2
|
| -ures_getString(const UResourceBundle* resourceBundle,
|
| - int32_t* len,
|
| +U_STABLE const UChar* U_EXPORT2
|
| +ures_getString(const UResourceBundle* resourceBundle,
|
| + int32_t* len,
|
| UErrorCode* status);
|
|
|
| /**
|
| @@ -425,14 +431,14 @@ ures_getUTF8String(const UResourceBundle *resB,
|
| UErrorCode *status);
|
|
|
| /**
|
| - * Returns a binary data from a binary resource.
|
| + * Returns a binary data from a binary resource.
|
| *
|
| * @param resourceBundle a string resource
|
| * @param len fills in the length of resulting byte chunk
|
| * @param status fills in the outgoing error code
|
| * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
| * Always check the value of status. Don't count on returning NULL.
|
| - * could be a non-failing error
|
| + * could be a non-failing error
|
| * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
| * @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file.
|
| * @see ures_getString
|
| @@ -441,20 +447,20 @@ ures_getUTF8String(const UResourceBundle *resB,
|
| * @see ures_getUInt
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE const uint8_t* U_EXPORT2
|
| -ures_getBinary(const UResourceBundle* resourceBundle,
|
| - int32_t* len,
|
| +U_STABLE const uint8_t* U_EXPORT2
|
| +ures_getBinary(const UResourceBundle* resourceBundle,
|
| + int32_t* len,
|
| UErrorCode* status);
|
|
|
| /**
|
| - * Returns a 32 bit integer array from a resource.
|
| + * Returns a 32 bit integer array from a resource.
|
| *
|
| * @param resourceBundle an int vector resource
|
| * @param len fills in the length of resulting byte chunk
|
| * @param status fills in the outgoing error code
|
| * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
| * Always check the value of status. Don't count on returning NULL.
|
| - * could be a non-failing error
|
| + * could be a non-failing error
|
| * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
| * @return a pointer to a chunk of integers which live in a memory mapped/DLL file.
|
| * @see ures_getBinary
|
| @@ -463,19 +469,19 @@ ures_getBinary(const UResourceBundle* resourceBundle,
|
| * @see ures_getUInt
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE const int32_t* U_EXPORT2
|
| -ures_getIntVector(const UResourceBundle* resourceBundle,
|
| - int32_t* len,
|
| +U_STABLE const int32_t* U_EXPORT2
|
| +ures_getIntVector(const UResourceBundle* resourceBundle,
|
| + int32_t* len,
|
| UErrorCode* status);
|
|
|
| /**
|
| - * Returns an unsigned integer from a resource.
|
| + * Returns an unsigned integer from a resource.
|
| * This integer is originally 28 bits.
|
| *
|
| * @param resourceBundle a string resource
|
| * @param status fills in the outgoing error code
|
| * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
| - * could be a non-failing error
|
| + * could be a non-failing error
|
| * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
| * @return an integer value
|
| * @see ures_getInt
|
| @@ -484,18 +490,18 @@ ures_getIntVector(const UResourceBundle* resourceBundle,
|
| * @see ures_getString
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE uint32_t U_EXPORT2
|
| -ures_getUInt(const UResourceBundle* resourceBundle,
|
| +U_STABLE uint32_t U_EXPORT2
|
| +ures_getUInt(const UResourceBundle* resourceBundle,
|
| UErrorCode *status);
|
|
|
| /**
|
| - * Returns a signed integer from a resource.
|
| + * Returns a signed integer from a resource.
|
| * This integer is originally 28 bit and the sign gets propagated.
|
| *
|
| * @param resourceBundle a string resource
|
| * @param status fills in the outgoing error code
|
| * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
| - * could be a non-failing error
|
| + * could be a non-failing error
|
| * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
| * @return an integer value
|
| * @see ures_getUInt
|
| @@ -504,21 +510,21 @@ ures_getUInt(const UResourceBundle* resourceBundle,
|
| * @see ures_getString
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE int32_t U_EXPORT2
|
| -ures_getInt(const UResourceBundle* resourceBundle,
|
| +U_STABLE int32_t U_EXPORT2
|
| +ures_getInt(const UResourceBundle* resourceBundle,
|
| UErrorCode *status);
|
|
|
| /**
|
| - * Returns the size of a resource. Size for scalar types is always 1,
|
| + * Returns the size of a resource. Size for scalar types is always 1,
|
| * and for vector/table types is the number of child resources.
|
| - * @warning Integer array is treated as a scalar type. There are no
|
| + * @warning Integer array is treated as a scalar type. There are no
|
| * APIs to access individual members of an integer array. It
|
| * is always returned as a whole.
|
| * @param resourceBundle a resource
|
| * @return number of resources in a given resource.
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE int32_t U_EXPORT2
|
| +U_STABLE int32_t U_EXPORT2
|
| ures_getSize(const UResourceBundle *resourceBundle);
|
|
|
| /**
|
| @@ -529,21 +535,21 @@ ures_getSize(const UResourceBundle *resourceBundle);
|
| * @see UResType
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE UResType U_EXPORT2
|
| +U_STABLE UResType U_EXPORT2
|
| ures_getType(const UResourceBundle *resourceBundle);
|
|
|
| /**
|
| - * Returns the key associated with a given resource. Not all the resources have a key - only
|
| + * Returns the key associated with a given resource. Not all the resources have a key - only
|
| * those that are members of a table.
|
| *
|
| * @param resourceBundle a resource
|
| * @return a key associated to this resource, or NULL if it doesn't have a key
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE const char * U_EXPORT2
|
| +U_STABLE const char * U_EXPORT2
|
| ures_getKey(const UResourceBundle *resourceBundle);
|
|
|
| -/* ITERATION API
|
| +/* ITERATION API
|
| This API provides means for iterating through a resource
|
| */
|
|
|
| @@ -553,7 +559,7 @@ ures_getKey(const UResourceBundle *resourceBundle);
|
| * @param resourceBundle a resource
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE void U_EXPORT2
|
| +U_STABLE void U_EXPORT2
|
| ures_resetIterator(UResourceBundle *resourceBundle);
|
|
|
| /**
|
| @@ -563,12 +569,12 @@ ures_resetIterator(UResourceBundle *resourceBundle);
|
| * @return TRUE if there are more elements, FALSE if there is no more elements
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE UBool U_EXPORT2
|
| +U_STABLE UBool U_EXPORT2
|
| ures_hasNext(const UResourceBundle *resourceBundle);
|
|
|
| /**
|
| - * Returns the next resource in a given resource or NULL if there are no more resources
|
| - * to iterate over. Features a fill-in parameter.
|
| + * Returns the next resource in a given resource or NULL if there are no more resources
|
| + * to iterate over. Features a fill-in parameter.
|
| *
|
| * @param resourceBundle a resource
|
| * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller.
|
| @@ -578,14 +584,14 @@ ures_hasNext(const UResourceBundle *resourceBundle);
|
| * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE UResourceBundle* U_EXPORT2
|
| -ures_getNextResource(UResourceBundle *resourceBundle,
|
| - UResourceBundle *fillIn,
|
| +U_STABLE UResourceBundle* U_EXPORT2
|
| +ures_getNextResource(UResourceBundle *resourceBundle,
|
| + UResourceBundle *fillIn,
|
| UErrorCode *status);
|
|
|
| /**
|
| - * Returns the next string in a given resource or NULL if there are no more resources
|
| - * to iterate over.
|
| + * Returns the next string in a given resource or NULL if there are no more resources
|
| + * to iterate over.
|
| *
|
| * @param resourceBundle a resource
|
| * @param len fill in length of the string
|
| @@ -595,14 +601,14 @@ ures_getNextResource(UResourceBundle *resourceBundle,
|
| * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file.
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE const UChar* U_EXPORT2
|
| -ures_getNextString(UResourceBundle *resourceBundle,
|
| - int32_t* len,
|
| - const char ** key,
|
| +U_STABLE const UChar* U_EXPORT2
|
| +ures_getNextString(UResourceBundle *resourceBundle,
|
| + int32_t* len,
|
| + const char ** key,
|
| UErrorCode *status);
|
|
|
| /**
|
| - * Returns the resource in a given resource at the specified index. Features a fill-in parameter.
|
| + * Returns the resource in a given resource at the specified index. Features a fill-in parameter.
|
| *
|
| * @param resourceBundle the resource bundle from which to get a sub-resource
|
| * @param indexR an index to the wanted resource.
|
| @@ -613,10 +619,10 @@ ures_getNextString(UResourceBundle *resourceBundle,
|
| * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE UResourceBundle* U_EXPORT2
|
| -ures_getByIndex(const UResourceBundle *resourceBundle,
|
| - int32_t indexR,
|
| - UResourceBundle *fillIn,
|
| +U_STABLE UResourceBundle* U_EXPORT2
|
| +ures_getByIndex(const UResourceBundle *resourceBundle,
|
| + int32_t indexR,
|
| + UResourceBundle *fillIn,
|
| UErrorCode *status);
|
|
|
| /**
|
| @@ -630,10 +636,10 @@ ures_getByIndex(const UResourceBundle *resourceBundle,
|
| * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file.
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE const UChar* U_EXPORT2
|
| -ures_getStringByIndex(const UResourceBundle *resourceBundle,
|
| - int32_t indexS,
|
| - int32_t* len,
|
| +U_STABLE const UChar* U_EXPORT2
|
| +ures_getStringByIndex(const UResourceBundle *resourceBundle,
|
| + int32_t indexS,
|
| + int32_t* len,
|
| UErrorCode *status);
|
|
|
| /**
|
| @@ -693,7 +699,7 @@ ures_getUTF8StringByIndex(const UResourceBundle *resB,
|
|
|
| /**
|
| * Returns a resource in a given resource that has a given key. This procedure works only with table
|
| - * resources. Features a fill-in parameter.
|
| + * resources. Features a fill-in parameter.
|
| *
|
| * @param resourceBundle a resource
|
| * @param key a key associated with the wanted resource
|
| @@ -703,15 +709,15 @@ ures_getUTF8StringByIndex(const UResourceBundle *resB,
|
| * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE UResourceBundle* U_EXPORT2
|
| -ures_getByKey(const UResourceBundle *resourceBundle,
|
| - const char* key,
|
| - UResourceBundle *fillIn,
|
| +U_STABLE UResourceBundle* U_EXPORT2
|
| +ures_getByKey(const UResourceBundle *resourceBundle,
|
| + const char* key,
|
| + UResourceBundle *fillIn,
|
| UErrorCode *status);
|
|
|
| /**
|
| * Returns a string in a given resource that has a given key. This procedure works only with table
|
| - * resources.
|
| + * resources.
|
| *
|
| * @param resB a resource
|
| * @param key a key associated with the wanted string
|
| @@ -721,10 +727,10 @@ ures_getByKey(const UResourceBundle *resourceBundle,
|
| * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file.
|
| * @stable ICU 2.0
|
| */
|
| -U_STABLE const UChar* U_EXPORT2
|
| -ures_getStringByKey(const UResourceBundle *resB,
|
| - const char* key,
|
| - int32_t* len,
|
| +U_STABLE const UChar* U_EXPORT2
|
| +ures_getStringByKey(const UResourceBundle *resB,
|
| + const char* key,
|
| + int32_t* len,
|
| UErrorCode *status);
|
|
|
| /**
|
| @@ -789,82 +795,97 @@ ures_getUTF8StringByKey(const UResourceBundle *resB,
|
|
|
| U_NAMESPACE_BEGIN
|
| /**
|
| - * returns a string from a string resource type
|
| + * Returns the string value from a string resource bundle.
|
| *
|
| - * @param resB a resource
|
| + * @param resB a resource, should have type URES_STRING
|
| * @param status: fills in the outgoing error code
|
| * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
| - * could be a non-failing error
|
| + * could be a non-failing error
|
| * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
| - * @return a UnicodeString object. If there is an error, string is bogus
|
| + * @return The string value, or a bogus string if there is a failure UErrorCode.
|
| * @stable ICU 2.0
|
| */
|
| -inline UnicodeString
|
| -ures_getUnicodeString(const UResourceBundle *resB,
|
| - UErrorCode* status)
|
| -{
|
| +inline UnicodeString
|
| +ures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) {
|
| + UnicodeString result;
|
| int32_t len = 0;
|
| const UChar *r = ures_getString(resB, &len, status);
|
| - return UnicodeString(TRUE, r, len);
|
| + if(U_SUCCESS(*status)) {
|
| + result.setTo(TRUE, r, len);
|
| + } else {
|
| + result.setToBogus();
|
| + }
|
| + return result;
|
| }
|
|
|
| /**
|
| - * Returns the next string in a resource or NULL if there are no more resources
|
| - * to iterate over.
|
| + * Returns the next string in a resource, or an empty string if there are no more resources
|
| + * to iterate over.
|
| + * Use ures_getNextString() instead to distinguish between
|
| + * the end of the iteration and a real empty string value.
|
| *
|
| * @param resB a resource
|
| * @param key fill in for key associated with this string
|
| * @param status fills in the outgoing error code
|
| - * @return an UnicodeString object.
|
| + * @return The string value, or a bogus string if there is a failure UErrorCode.
|
| * @stable ICU 2.0
|
| */
|
| -inline UnicodeString
|
| -ures_getNextUnicodeString(UResourceBundle *resB,
|
| - const char ** key,
|
| - UErrorCode* status)
|
| -{
|
| +inline UnicodeString
|
| +ures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) {
|
| + UnicodeString result;
|
| int32_t len = 0;
|
| const UChar* r = ures_getNextString(resB, &len, key, status);
|
| - return UnicodeString(TRUE, r, len);
|
| + if(U_SUCCESS(*status)) {
|
| + result.setTo(TRUE, r, len);
|
| + } else {
|
| + result.setToBogus();
|
| + }
|
| + return result;
|
| }
|
|
|
| /**
|
| - * Returns the string in a given resource at the specified index.
|
| + * Returns the string in a given resource array or table at the specified index.
|
| *
|
| * @param resB a resource
|
| * @param indexS an index to the wanted string.
|
| * @param status fills in the outgoing error code
|
| - * @return an UnicodeString object. If there is an error, string is bogus
|
| + * @return The string value, or a bogus string if there is a failure UErrorCode.
|
| * @stable ICU 2.0
|
| */
|
| -inline UnicodeString
|
| -ures_getUnicodeStringByIndex(const UResourceBundle *resB,
|
| - int32_t indexS,
|
| - UErrorCode* status)
|
| -{
|
| +inline UnicodeString
|
| +ures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) {
|
| + UnicodeString result;
|
| int32_t len = 0;
|
| const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
|
| - return UnicodeString(TRUE, r, len);
|
| + if(U_SUCCESS(*status)) {
|
| + result.setTo(TRUE, r, len);
|
| + } else {
|
| + result.setToBogus();
|
| + }
|
| + return result;
|
| }
|
|
|
| /**
|
| - * Returns a string in a resource that has a given key. This procedure works only with table
|
| - * resources.
|
| + * Returns a string in a resource that has a given key.
|
| + * This procedure works only with table resources.
|
| *
|
| * @param resB a resource
|
| * @param key a key associated with the wanted string
|
| * @param status fills in the outgoing error code
|
| - * @return an UnicodeString object. If there is an error, string is bogus
|
| + * @return The string value, or a bogus string if there is a failure UErrorCode.
|
| * @stable ICU 2.0
|
| */
|
| -inline UnicodeString
|
| -ures_getUnicodeStringByKey(const UResourceBundle *resB,
|
| - const char* key,
|
| - UErrorCode* status)
|
| -{
|
| +inline UnicodeString
|
| +ures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) {
|
| + UnicodeString result;
|
| int32_t len = 0;
|
| const UChar* r = ures_getStringByKey(resB, key, &len, status);
|
| - return UnicodeString(TRUE, r, len);
|
| + if(U_SUCCESS(*status)) {
|
| + result.setTo(TRUE, r, len);
|
| + } else {
|
| + result.setToBogus();
|
| + }
|
| + return result;
|
| }
|
|
|
| U_NAMESPACE_END
|
| @@ -872,7 +893,7 @@ U_NAMESPACE_END
|
| #endif
|
|
|
| /**
|
| - * Create a string enumerator, owned by the caller, of all locales located within
|
| + * Create a string enumerator, owned by the caller, of all locales located within
|
| * the specified resource tree.
|
| * @param packageName name of the tree, such as (NULL) or U_ICUDATA_ALIAS or or "ICUDATA-coll"
|
| * This call is similar to uloc_getAvailable().
|
|
|