1999-12-28 23:39:02 +00:00
|
|
|
/*
|
|
|
|
**********************************************************************
|
2006-01-18 03:34:19 +00:00
|
|
|
* Copyright (C) 1997-2006, International Business Machines
|
1999-12-28 23:39:02 +00:00
|
|
|
* Corporation and others. All Rights Reserved.
|
|
|
|
**********************************************************************
|
|
|
|
*
|
|
|
|
* File URES.H (formerly CRESBUND.H)
|
|
|
|
*
|
|
|
|
* Modification History:
|
|
|
|
*
|
|
|
|
* Date Name Description
|
|
|
|
* 04/01/97 aliu Creation.
|
|
|
|
* 02/22/99 damiba overhaul.
|
|
|
|
* 04/04/99 helena Fixed internal header inclusion.
|
|
|
|
* 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*
|
2000-09-22 23:03:40 +00:00
|
|
|
* 11/09/99 weiv Added ures_getLocale()
|
2002-06-24 20:58:17 +00:00
|
|
|
* 06/24/02 weiv Added support for resource sharing
|
2001-03-21 20:44:20 +00:00
|
|
|
******************************************************************************
|
1999-12-28 23:39:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef URES_H
|
|
|
|
#define URES_H
|
|
|
|
|
|
|
|
#include "unicode/utypes.h"
|
|
|
|
#include "unicode/uloc.h"
|
|
|
|
|
|
|
|
/**
|
2000-12-08 18:43:57 +00:00
|
|
|
* \file
|
2000-12-15 03:58:31 +00:00
|
|
|
* \brief C API: Resource Bundle
|
2000-12-08 18:43:57 +00:00
|
|
|
*
|
2000-12-15 03:58:31 +00:00
|
|
|
* <h2>C API: Resource Bundle</h2>
|
1999-12-28 23:39:02 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
* <P>
|
2002-08-08 21:24:52 +00:00
|
|
|
* Resource bundles in ICU4C are currently defined using text files which conform to the following
|
2005-06-15 04:31:40 +00:00
|
|
|
* <a href="http://dev.icu-project.org/cgi-bin/viewcvs.cgi/~checkout~/icuhtml/design/bnf_rb.txt">BNF definition</a>.
|
2002-08-08 21:24:52 +00:00
|
|
|
* More on resource bundle concepts and syntax can be found in the
|
2005-02-18 00:19:33 +00:00
|
|
|
* <a href="http://icu.sourceforge.net/userguide/ResourceManagement.html">Users Guide</a>.
|
1999-12-28 23:39:02 +00:00
|
|
|
* <P>
|
|
|
|
*/
|
|
|
|
|
2001-11-13 22:47:47 +00:00
|
|
|
/**
|
|
|
|
* UResourceBundle is an opaque type for handles for resource bundles in C APIs.
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:39:02 +00:00
|
|
|
*/
|
2000-05-15 18:39:17 +00:00
|
|
|
struct UResourceBundle;
|
|
|
|
|
2001-11-13 22:47:47 +00:00
|
|
|
/**
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2001-11-13 22:47:47 +00:00
|
|
|
*/
|
2000-05-15 18:39:17 +00:00
|
|
|
typedef struct UResourceBundle UResourceBundle;
|
|
|
|
|
2001-11-13 22:47:47 +00:00
|
|
|
/**
|
|
|
|
* Numeric constants for types of resource items.
|
2003-04-16 23:52:32 +00:00
|
|
|
* @see ures_getType
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2001-11-13 22:47:47 +00:00
|
|
|
*/
|
2000-05-15 18:39:17 +00:00
|
|
|
typedef enum {
|
2004-11-02 07:28:07 +00:00
|
|
|
/** Resource type constant for "no resource". @stable ICU 2.6 */
|
2003-04-16 23:52:32 +00:00
|
|
|
URES_NONE=-1,
|
|
|
|
|
2004-11-02 07:28:07 +00:00
|
|
|
/** Resource type constant for 16-bit Unicode strings. @stable ICU 2.6 */
|
2003-04-16 23:52:32 +00:00
|
|
|
URES_STRING=0,
|
|
|
|
|
2004-11-02 07:28:07 +00:00
|
|
|
/** Resource type constant for binary data. @stable ICU 2.6 */
|
2003-04-16 23:52:32 +00:00
|
|
|
URES_BINARY=1,
|
|
|
|
|
2004-11-02 07:28:07 +00:00
|
|
|
/** Resource type constant for tables of key-value pairs. @stable ICU 2.6 */
|
2003-04-16 23:52:32 +00:00
|
|
|
URES_TABLE=2,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
2004-11-02 07:28:07 +00:00
|
|
|
* @stable ICU 2.6
|
2003-04-16 23:52:32 +00:00
|
|
|
*/
|
|
|
|
URES_ALIAS=3,
|
|
|
|
|
2006-02-07 01:54:15 +00:00
|
|
|
#ifndef U_HIDE_INTERNAL_API
|
|
|
|
|
2003-09-24 17:52:44 +00:00
|
|
|
/**
|
|
|
|
* Internal use only.
|
|
|
|
* Alternative resource type constant for tables of key-value pairs.
|
|
|
|
* Never returned by ures_getType().
|
|
|
|
* @internal
|
|
|
|
*/
|
|
|
|
URES_TABLE32=4,
|
|
|
|
|
2006-02-07 01:54:15 +00:00
|
|
|
#endif /* U_HIDE_INTERNAL_API */
|
|
|
|
|
2003-04-16 23:52:32 +00:00
|
|
|
/**
|
|
|
|
* Resource type constant for a single 28-bit integer, interpreted as
|
|
|
|
* signed or unsigned by the ures_getInt() or ures_getUInt() function.
|
|
|
|
* @see ures_getInt
|
|
|
|
* @see ures_getUInt
|
2004-11-02 07:28:07 +00:00
|
|
|
* @stable ICU 2.6
|
2003-04-16 23:52:32 +00:00
|
|
|
*/
|
|
|
|
URES_INT=7,
|
|
|
|
|
2004-11-02 07:28:07 +00:00
|
|
|
/** Resource type constant for arrays of resources. @stable ICU 2.6 */
|
2003-04-16 23:52:32 +00:00
|
|
|
URES_ARRAY=8,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resource type constant for vectors of 32-bit integers.
|
|
|
|
* @see ures_getIntVector
|
2004-11-02 07:28:07 +00:00
|
|
|
* @stable ICU 2.6
|
2003-04-16 23:52:32 +00:00
|
|
|
*/
|
2006-02-07 01:54:15 +00:00
|
|
|
URES_INT_VECTOR = 14,
|
2004-03-26 19:42:04 +00:00
|
|
|
#ifndef U_HIDE_DEPRECATED_API
|
2003-04-16 23:52:32 +00:00
|
|
|
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
|
|
|
RES_NONE=URES_NONE,
|
|
|
|
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
|
|
|
RES_STRING=URES_STRING,
|
|
|
|
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
|
|
|
RES_BINARY=URES_BINARY,
|
|
|
|
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
|
|
|
RES_TABLE=URES_TABLE,
|
|
|
|
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
|
|
|
RES_ALIAS=URES_ALIAS,
|
|
|
|
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
|
|
|
RES_INT=URES_INT,
|
|
|
|
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
|
|
|
RES_ARRAY=URES_ARRAY,
|
|
|
|
/** @deprecated ICU 2.6 Use the URES_ constant instead. */
|
|
|
|
RES_INT_VECTOR=URES_INT_VECTOR,
|
2006-02-07 01:54:15 +00:00
|
|
|
/** @deprecated ICU 2.6 Not used. */
|
|
|
|
RES_RESERVED=15,
|
2004-03-26 19:42:04 +00:00
|
|
|
#endif /* U_HIDE_DEPRECATED_API */
|
|
|
|
|
2006-02-07 19:56:11 +00:00
|
|
|
URES_LIMIT = 16
|
2000-05-15 18:39:17 +00:00
|
|
|
} UResType;
|
1999-12-28 23:39:02 +00:00
|
|
|
|
2001-11-13 22:47:47 +00:00
|
|
|
/*
|
1999-12-28 23:39:02 +00:00
|
|
|
* Functions to create and destroy resource bundles.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2000-06-30 20:24:59 +00:00
|
|
|
* Opens a UResourceBundle, from which users can extract strings by using
|
|
|
|
* their corresponding keys.
|
|
|
|
* Note that the caller is responsible of calling <TT>ures_close</TT> on each succesfully
|
|
|
|
* opened resource bundle.
|
2005-06-24 22:02:42 +00:00
|
|
|
* @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.
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param locale specifies the locale for which we want to open the resource
|
2000-06-30 20:24:59 +00:00
|
|
|
* if NULL, the default locale will be used. If strlen(locale) == 0
|
|
|
|
* root locale will be used.
|
|
|
|
*
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param status fills in the outgoing error code.
|
2000-06-30 20:24:59 +00:00
|
|
|
* 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
|
2003-01-29 17:58:29 +00:00
|
|
|
* informational status results which still indicate success. U_USING_FALLBACK_WARNING
|
2000-06-30 20:24:59 +00:00
|
|
|
* indicates that a fall back locale was used. For example, 'de_CH' was requested,
|
2003-01-29 17:58:29 +00:00
|
|
|
* but nothing was found there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that
|
2000-06-30 20:24:59 +00:00
|
|
|
* the default locale data or root locale data was used; neither the requested locale
|
2003-01-29 17:58:29 +00:00
|
|
|
* nor any of its fall back locales could be found. Please see the users guide for more
|
|
|
|
* information on this topic.
|
2000-06-30 20:24:59 +00:00
|
|
|
* @return a newly allocated resource bundle.
|
|
|
|
* @see ures_close
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-06-30 20:24:59 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE UResourceBundle* U_EXPORT2
|
2005-06-24 22:02:42 +00:00
|
|
|
ures_open(const char* packageName,
|
2002-08-08 21:24:52 +00:00
|
|
|
const char* locale,
|
|
|
|
UErrorCode* status);
|
1999-12-28 23:39:02 +00:00
|
|
|
|
|
|
|
|
2001-10-10 01:13:01 +00:00
|
|
|
/** This function does not care what kind of localeID is passed in. It simply opens a bundle with
|
2001-10-11 18:44:25 +00:00
|
|
|
* that name. Fallback mechanism is disabled for the new bundle. If the requested bundle contains
|
|
|
|
* an %%ALIAS directive, the results are undefined.
|
2005-06-24 22:02:42 +00:00
|
|
|
* @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.
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param locale specifies the locale for which we want to open the resource
|
2001-10-10 01:13:01 +00:00
|
|
|
* if NULL, the default locale will be used. If strlen(locale) == 0
|
|
|
|
* root locale will be used.
|
|
|
|
*
|
2001-11-13 22:47:47 +00:00
|
|
|
* @param status fills in the outgoing error code. Either U_ZERO_ERROR or U_MISSING_RESOURCE_ERROR
|
2001-10-10 01:13:01 +00:00
|
|
|
* @return a newly allocated resource bundle or NULL if it doesn't exist.
|
|
|
|
* @see ures_close
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2001-10-10 01:13:01 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE UResourceBundle* U_EXPORT2
|
2005-06-24 22:02:42 +00:00
|
|
|
ures_openDirect(const char* packageName,
|
2002-08-08 21:24:52 +00:00
|
|
|
const char* locale,
|
|
|
|
UErrorCode* status);
|
2001-10-10 01:13:01 +00:00
|
|
|
|
2001-11-13 22:47:47 +00:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
2005-06-24 22:02:42 +00:00
|
|
|
* @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.
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param locale specifies the locale for which we want to open the resource
|
2002-07-03 12:05:56 +00:00
|
|
|
* if NULL, the default locale will be used. If strlen(locale) == 0
|
|
|
|
* root locale will be used.
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param status fills in the outgoing error code.
|
2002-07-03 12:05:56 +00:00
|
|
|
* @return a newly allocated resource bundle.
|
2003-01-29 17:58:29 +00:00
|
|
|
* @see ures_open
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2001-11-13 22:47:47 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE UResourceBundle* U_EXPORT2
|
2005-06-24 22:02:42 +00:00
|
|
|
ures_openU(const UChar* packageName,
|
2002-08-08 21:24:52 +00:00
|
|
|
const char* locale,
|
|
|
|
UErrorCode* status);
|
2000-06-30 20:24:59 +00:00
|
|
|
|
1999-12-28 23:39:02 +00:00
|
|
|
/**
|
|
|
|
* Returns the number of strings/arrays in resource bundles.
|
2002-12-06 00:19:24 +00:00
|
|
|
* Better to use ures_getSize, as this function will be deprecated.
|
1999-12-28 23:39:02 +00:00
|
|
|
*
|
2003-04-26 00:12:33 +00:00
|
|
|
*@param resourceBundle resource bundle containing the desired strings
|
|
|
|
*@param resourceKey key tagging the resource
|
|
|
|
*@param err fills in the outgoing error code
|
2004-06-08 20:11:40 +00:00
|
|
|
* could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
1999-12-28 23:39:02 +00:00
|
|
|
* could be a non-failing error
|
2003-01-29 17:58:29 +00:00
|
|
|
* e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_FALLBACK_WARNING </TT>
|
2002-08-08 21:24:52 +00:00
|
|
|
*@return: for <STRONG>Arrays</STRONG>: returns the number of resources in the array
|
|
|
|
* <STRONG>Tables</STRONG>: returns the number of resources in the table
|
1999-12-28 23:39:02 +00:00
|
|
|
* <STRONG>single string</STRONG>: returns 1
|
2002-08-08 21:24:52 +00:00
|
|
|
*@see ures_getSize
|
2003-11-07 08:58:19 +00:00
|
|
|
* @deprecated ICU 2.8 User ures_getSize instead
|
1999-12-28 23:39:02 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_DEPRECATED int32_t U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_countArrayItems(const UResourceBundle* resourceBundle,
|
|
|
|
const char* resourceKey,
|
|
|
|
UErrorCode* err);
|
1999-12-28 23:39:02 +00:00
|
|
|
/**
|
2002-08-08 21:24:52 +00:00
|
|
|
* Close a resource bundle, all pointers returned from the various ures_getXXX calls
|
|
|
|
* on this particular bundle should be considered invalid henceforth.
|
1999-12-28 23:39:02 +00:00
|
|
|
*
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param resourceBundle a pointer to a resourceBundle struct. Can be NULL.
|
1999-12-28 23:39:02 +00:00
|
|
|
* @see ures_open
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
1999-12-28 23:39:02 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE void U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_close(UResourceBundle* resourceBundle);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
1999-12-28 23:39:02 +00:00
|
|
|
/**
|
2002-08-08 21:24:52 +00:00
|
|
|
* Return the version number associated with this ResourceBundle as a string. Please
|
|
|
|
* use ures_getVersion as this function is going to be deprecated.
|
2001-11-13 22:47:47 +00:00
|
|
|
*
|
|
|
|
* @param resourceBundle The resource bundle for which the version is checked.
|
|
|
|
* @return A version number string as specified in the resource bundle or its parent.
|
|
|
|
* The caller does not own this string.
|
2002-08-08 21:24:52 +00:00
|
|
|
* @see ures_getVersion
|
2003-11-07 08:58:19 +00:00
|
|
|
* @deprecated ICU 2.8 Use ures_getVersion instead.
|
1999-12-28 23:39:02 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_DEPRECATED const char* U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getVersionNumber(const UResourceBundle* resourceBundle);
|
1999-12-28 23:39:02 +00:00
|
|
|
|
2001-11-13 22:47:47 +00:00
|
|
|
/**
|
2002-08-08 21:24:52 +00:00
|
|
|
* Return the version number associated with this ResourceBundle as an
|
|
|
|
* UVersionInfo array.
|
2001-11-13 22:47:47 +00:00
|
|
|
*
|
2002-07-03 12:05:56 +00:00
|
|
|
* @param resB The resource bundle for which the version is checked.
|
2001-11-13 22:47:47 +00:00
|
|
|
* @param versionInfo A UVersionInfo array that is filled with the version number
|
|
|
|
* as specified in the resource bundle or its parent.
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2001-11-13 22:47:47 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE void U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getVersion(const UResourceBundle* resB,
|
|
|
|
UVersionInfo versionInfo);
|
2000-06-30 20:24:59 +00:00
|
|
|
|
1999-12-28 23:39:02 +00:00
|
|
|
/**
|
2002-08-13 23:59:11 +00:00
|
|
|
* 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 occured, getLocale will reflect this.
|
2003-04-26 00:12:33 +00:00
|
|
|
*
|
|
|
|
* @param resourceBundle resource bundle in question
|
|
|
|
* @param status just for catching illegal arguments
|
1999-12-28 23:39:02 +00:00
|
|
|
* @return A Locale name
|
2003-11-07 08:58:19 +00:00
|
|
|
* @deprecated ICU 2.8 Use ures_getLocaleByType instead.
|
1999-12-28 23:39:02 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_DEPRECATED const char* U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getLocale(const UResourceBundle* resourceBundle,
|
|
|
|
UErrorCode* status);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
2003-11-07 08:58:19 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
* @param type You can choose between requested, valid and actual
|
|
|
|
* locale. For description see the definition of
|
|
|
|
* ULocDataLocaleType in uloc.h
|
|
|
|
* @param status just for catching illegal arguments
|
|
|
|
* @return A Locale name
|
2006-01-18 03:34:19 +00:00
|
|
|
* @stable ICU 2.8
|
2003-11-07 08:58:19 +00:00
|
|
|
*/
|
2006-01-18 03:34:19 +00:00
|
|
|
U_STABLE const char* U_EXPORT2
|
2003-11-07 08:58:19 +00:00
|
|
|
ures_getLocaleByType(const UResourceBundle* resourceBundle,
|
|
|
|
ULocDataLocaleType type,
|
|
|
|
UErrorCode* status);
|
|
|
|
|
|
|
|
|
2001-11-13 22:47:47 +00:00
|
|
|
/**
|
|
|
|
* Same as ures_open() but uses the fill-in parameter instead of allocating
|
|
|
|
* a bundle, if r!=NULL.
|
|
|
|
* TODO need to revisit usefulness of this function
|
|
|
|
* and usage model for fillIn parameters without knowing sizeof(UResourceBundle)
|
2002-07-03 12:05:56 +00:00
|
|
|
* @param r The resourcebundle to open
|
2005-06-24 22:02:42 +00:00
|
|
|
* @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.
|
2002-07-03 12:05:56 +00:00
|
|
|
* @param localeID specifies the locale for which we want to open the resource
|
|
|
|
* @param status The error code
|
|
|
|
* @return a newly allocated resource bundle or NULL if it doesn't exist.
|
2002-08-08 21:24:52 +00:00
|
|
|
* @internal
|
2001-11-13 22:47:47 +00:00
|
|
|
*/
|
2004-06-12 00:56:53 +00:00
|
|
|
U_INTERNAL void U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_openFillIn(UResourceBundle *r,
|
2005-06-24 22:02:42 +00:00
|
|
|
const char* packageName,
|
2002-08-08 21:24:52 +00:00
|
|
|
const char* localeID,
|
|
|
|
UErrorCode* status);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
|
|
|
/**
|
2002-08-08 21:24:52 +00:00
|
|
|
* Returns a string from a string resource type
|
2000-05-15 18:39:17 +00:00
|
|
|
*
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param resourceBundle a string resource
|
|
|
|
* @param len fills in the length of resulting string
|
|
|
|
* @param status fills in the outgoing error code
|
2004-06-08 20:11:40 +00:00
|
|
|
* could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
2002-08-13 23:59:11 +00:00
|
|
|
* Always check the value of status. Don't count on returning NULL.
|
2000-05-15 18:39:17 +00:00
|
|
|
* could be a non-failing error
|
2003-01-29 17:58:29 +00:00
|
|
|
* e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
2000-05-15 18:39:17 +00:00
|
|
|
* @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file.
|
2002-08-08 21:24:52 +00:00
|
|
|
* @see ures_getBinary
|
|
|
|
* @see ures_getIntVector
|
|
|
|
* @see ures_getInt
|
|
|
|
* @see ures_getUInt
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-15 18:39:17 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE const UChar* U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getString(const UResourceBundle* resourceBundle,
|
|
|
|
int32_t* len,
|
|
|
|
UErrorCode* status);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
2000-05-18 21:25:51 +00:00
|
|
|
/**
|
2002-08-08 21:24:52 +00:00
|
|
|
* Returns a binary data from a binary resource.
|
2000-05-18 21:25:51 +00:00
|
|
|
*
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param resourceBundle a string resource
|
|
|
|
* @param len fills in the length of resulting byte chunk
|
|
|
|
* @param status fills in the outgoing error code
|
2004-06-08 20:11:40 +00:00
|
|
|
* could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
2002-08-13 23:59:11 +00:00
|
|
|
* Always check the value of status. Don't count on returning NULL.
|
2000-05-18 21:25:51 +00:00
|
|
|
* could be a non-failing error
|
2003-01-29 17:58:29 +00:00
|
|
|
* e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
2000-05-18 21:25:51 +00:00
|
|
|
* @return a pointer to a chuck of unsigned bytes which live in a memory mapped/DLL file.
|
2002-08-08 21:24:52 +00:00
|
|
|
* @see ures_getString
|
|
|
|
* @see ures_getIntVector
|
|
|
|
* @see ures_getInt
|
|
|
|
* @see ures_getUInt
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-18 21:25:51 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE const uint8_t* U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getBinary(const UResourceBundle* resourceBundle,
|
|
|
|
int32_t* len,
|
|
|
|
UErrorCode* status);
|
2001-08-01 17:08:07 +00:00
|
|
|
|
|
|
|
/**
|
2002-08-08 21:24:52 +00:00
|
|
|
* Returns a 32 bit integer array from a resource.
|
2001-08-01 17:08:07 +00:00
|
|
|
*
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param resourceBundle an int vector resource
|
|
|
|
* @param len fills in the length of resulting byte chunk
|
|
|
|
* @param status fills in the outgoing error code
|
2004-06-08 20:11:40 +00:00
|
|
|
* could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
2002-08-13 23:59:11 +00:00
|
|
|
* Always check the value of status. Don't count on returning NULL.
|
2001-08-01 17:08:07 +00:00
|
|
|
* could be a non-failing error
|
2003-01-29 17:58:29 +00:00
|
|
|
* e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
2002-08-13 23:59:11 +00:00
|
|
|
* @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file.
|
2002-08-08 21:24:52 +00:00
|
|
|
* @see ures_getBinary
|
|
|
|
* @see ures_getString
|
|
|
|
* @see ures_getInt
|
|
|
|
* @see ures_getUInt
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2001-08-01 17:08:07 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE const int32_t* U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getIntVector(const UResourceBundle* resourceBundle,
|
|
|
|
int32_t* len,
|
|
|
|
UErrorCode* status);
|
2000-05-18 21:25:51 +00:00
|
|
|
|
|
|
|
/**
|
2002-08-08 21:24:52 +00:00
|
|
|
* Returns an unsigned integer from a resource.
|
2001-09-17 23:05:08 +00:00
|
|
|
* This integer is originally 28 bits.
|
2000-05-18 21:25:51 +00:00
|
|
|
*
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param resourceBundle a string resource
|
|
|
|
* @param status fills in the outgoing error code
|
2004-06-08 20:11:40 +00:00
|
|
|
* could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
2000-05-18 21:25:51 +00:00
|
|
|
* could be a non-failing error
|
2003-01-29 17:58:29 +00:00
|
|
|
* e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
2000-05-18 21:25:51 +00:00
|
|
|
* @return an integer value
|
2002-08-08 21:24:52 +00:00
|
|
|
* @see ures_getInt
|
|
|
|
* @see ures_getIntVector
|
|
|
|
* @see ures_getBinary
|
|
|
|
* @see ures_getString
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-18 21:25:51 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE uint32_t U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getUInt(const UResourceBundle* resourceBundle,
|
|
|
|
UErrorCode *status);
|
2001-09-17 23:05:08 +00:00
|
|
|
|
|
|
|
/**
|
2002-08-08 21:24:52 +00:00
|
|
|
* Returns a signed integer from a resource.
|
2001-09-17 23:05:08 +00:00
|
|
|
* This integer is originally 28 bit and the sign gets propagated.
|
|
|
|
*
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param resourceBundle a string resource
|
|
|
|
* @param status fills in the outgoing error code
|
2004-06-08 20:11:40 +00:00
|
|
|
* could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
2001-09-17 23:05:08 +00:00
|
|
|
* could be a non-failing error
|
2003-01-29 17:58:29 +00:00
|
|
|
* e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
2001-09-17 23:05:08 +00:00
|
|
|
* @return an integer value
|
2002-08-08 21:24:52 +00:00
|
|
|
* @see ures_getUInt
|
|
|
|
* @see ures_getIntVector
|
|
|
|
* @see ures_getBinary
|
|
|
|
* @see ures_getString
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2001-09-17 23:05:08 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE int32_t U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getInt(const UResourceBundle* resourceBundle,
|
|
|
|
UErrorCode *status);
|
2000-05-18 21:25:51 +00:00
|
|
|
|
2000-05-15 18:39:17 +00:00
|
|
|
/**
|
2002-08-08 21:24:52 +00:00
|
|
|
* Returns the size of a resource. Size for scalar types is always 1,
|
|
|
|
* and for vector/table types is the number of child resources.
|
2003-11-07 08:58:19 +00:00
|
|
|
* @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.
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param resourceBundle a resource
|
2000-05-15 18:39:17 +00:00
|
|
|
* @return number of resources in a given resource.
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-15 18:39:17 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE int32_t U_EXPORT2
|
2004-03-30 23:17:44 +00:00
|
|
|
ures_getSize(const UResourceBundle *resourceBundle);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the type of a resource. Available types are defined in enum UResType
|
|
|
|
*
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param resourceBundle a resource
|
2000-05-15 18:39:17 +00:00
|
|
|
* @return type of the given resource.
|
2002-08-08 21:24:52 +00:00
|
|
|
* @see UResType
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-15 18:39:17 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE UResType U_EXPORT2
|
2004-03-30 23:17:44 +00:00
|
|
|
ures_getType(const UResourceBundle *resourceBundle);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the key associated with a given resource. Not all the resources have a key - only
|
|
|
|
* those that are members of a table.
|
|
|
|
*
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param resourceBundle a resource
|
2000-05-15 18:39:17 +00:00
|
|
|
* @return a key associated to this resource, or NULL if it doesn't have a key
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-15 18:39:17 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE const char * U_EXPORT2
|
2004-03-30 23:17:44 +00:00
|
|
|
ures_getKey(const UResourceBundle *resourceBundle);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
|
|
|
/* ITERATION API
|
|
|
|
This API provides means for iterating through a resource
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resets the internal context of a resource so that iteration starts from the first element.
|
|
|
|
*
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param resourceBundle a resource
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-15 18:39:17 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE void U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_resetIterator(UResourceBundle *resourceBundle);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether the given resource has another element to iterate over.
|
|
|
|
*
|
|
|
|
* @param resourceBundle a resource
|
|
|
|
* @return TRUE if there are more elements, FALSE if there is no more elements
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-15 18:39:17 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE UBool U_EXPORT2
|
2004-03-30 23:17:44 +00:00
|
|
|
ures_hasNext(const UResourceBundle *resourceBundle);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2006-03-17 08:18:45 +00:00
|
|
|
* @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller.
|
2000-05-15 18:39:17 +00:00
|
|
|
* Alternatively, you can supply a struct to be filled by this function.
|
2002-08-13 23:59:11 +00:00
|
|
|
* @param status fills in the outgoing error code. You may still get a non NULL result even if an
|
|
|
|
* error occured. Check status instead.
|
2006-03-17 08:18:45 +00:00
|
|
|
* @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-15 18:39:17 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE UResourceBundle* U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getNextResource(UResourceBundle *resourceBundle,
|
|
|
|
UResourceBundle *fillIn,
|
|
|
|
UErrorCode *status);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2002-08-08 21:24:52 +00:00
|
|
|
* @param key fill in for key associated with this string. NULL if no key
|
2002-08-13 23:59:11 +00:00
|
|
|
* @param status fills in the outgoing error code. If an error occured, we may return NULL, but don't
|
|
|
|
* count on it. Check status instead!
|
2000-05-15 18:39:17 +00:00
|
|
|
* @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file.
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-15 18:39:17 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE const UChar* U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getNextString(UResourceBundle *resourceBundle,
|
|
|
|
int32_t* len,
|
|
|
|
const char ** key,
|
|
|
|
UErrorCode *status);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the resource in a given resource at the specified index. Features a fill-in parameter.
|
|
|
|
*
|
2003-04-26 00:12:33 +00:00
|
|
|
* @param resourceBundle the resource bundle from which to get a sub-resource
|
2000-05-15 18:39:17 +00:00
|
|
|
* @param indexR an index to the wanted resource.
|
2006-03-17 08:18:45 +00:00
|
|
|
* @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller.
|
2000-05-15 18:39:17 +00:00
|
|
|
* Alternatively, you can supply a struct to be filled by this function.
|
2002-08-13 23:59:11 +00:00
|
|
|
* @param status fills in the outgoing error code. Don't count on NULL being returned if an error has
|
|
|
|
* occured. Check status instead.
|
2006-03-17 08:18:45 +00:00
|
|
|
* @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-15 18:39:17 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE UResourceBundle* U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getByIndex(const UResourceBundle *resourceBundle,
|
|
|
|
int32_t indexR,
|
|
|
|
UResourceBundle *fillIn,
|
|
|
|
UErrorCode *status);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the string in a given resource at the specified index.
|
|
|
|
*
|
|
|
|
* @param resourceBundle a resource
|
|
|
|
* @param indexS an index to the wanted string.
|
|
|
|
* @param len fill in length of the string
|
2002-08-13 23:59:11 +00:00
|
|
|
* @param status fills in the outgoing error code. If an error occured, we may return NULL, but don't
|
|
|
|
* count on it. Check status instead!
|
2000-05-15 18:39:17 +00:00
|
|
|
* @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file.
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-15 18:39:17 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE const UChar* U_EXPORT2
|
2003-04-26 00:12:33 +00:00
|
|
|
ures_getStringByIndex(const UResourceBundle *resourceBundle,
|
2002-08-08 21:24:52 +00:00
|
|
|
int32_t indexS,
|
|
|
|
int32_t* len,
|
|
|
|
UErrorCode *status);
|
2002-06-24 20:58:17 +00:00
|
|
|
|
2000-05-15 18:39:17 +00:00
|
|
|
/**
|
|
|
|
* Returns a resource in a given resource that has a given key. This procedure works only with table
|
|
|
|
* resources. Features a fill-in parameter.
|
|
|
|
*
|
|
|
|
* @param resourceBundle a resource
|
|
|
|
* @param key a key associated with the wanted resource
|
2006-03-17 08:18:45 +00:00
|
|
|
* @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller.
|
2000-05-15 18:39:17 +00:00
|
|
|
* Alternatively, you can supply a struct to be filled by this function.
|
|
|
|
* @param status fills in the outgoing error code.
|
2006-03-17 08:18:45 +00:00
|
|
|
* @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-15 18:39:17 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE UResourceBundle* U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getByKey(const UResourceBundle *resourceBundle,
|
|
|
|
const char* key,
|
|
|
|
UResourceBundle *fillIn,
|
|
|
|
UErrorCode *status);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a string in a given resource that has a given key. This procedure works only with table
|
|
|
|
* resources.
|
|
|
|
*
|
2001-09-17 22:04:48 +00:00
|
|
|
* @param resB a resource
|
2000-05-15 18:39:17 +00:00
|
|
|
* @param key a key associated with the wanted string
|
|
|
|
* @param len fill in length of the string
|
2002-08-13 23:59:11 +00:00
|
|
|
* @param status fills in the outgoing error code. If an error occured, we may return NULL, but don't
|
|
|
|
* count on it. Check status instead!
|
2000-05-15 18:39:17 +00:00
|
|
|
* @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file.
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2000-05-15 18:39:17 +00:00
|
|
|
*/
|
2004-03-26 19:42:04 +00:00
|
|
|
U_STABLE const UChar* U_EXPORT2
|
2002-08-08 21:24:52 +00:00
|
|
|
ures_getStringByKey(const UResourceBundle *resB,
|
|
|
|
const char* key,
|
|
|
|
int32_t* len,
|
|
|
|
UErrorCode *status);
|
2000-05-15 18:39:17 +00:00
|
|
|
|
2001-09-17 22:04:48 +00:00
|
|
|
#ifdef XP_CPLUSPLUS
|
|
|
|
#include "unicode/unistr.h"
|
|
|
|
|
2001-10-08 23:26:58 +00:00
|
|
|
U_NAMESPACE_BEGIN
|
2001-09-17 22:04:48 +00:00
|
|
|
/**
|
|
|
|
* returns a string from a string resource type
|
|
|
|
*
|
|
|
|
* @param resB a resource
|
|
|
|
* @param status: fills in the outgoing error code
|
2004-06-08 20:11:40 +00:00
|
|
|
* could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found
|
2001-09-17 22:04:48 +00:00
|
|
|
* could be a non-failing error
|
2003-01-29 17:58:29 +00:00
|
|
|
* e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT>
|
2001-09-17 22:04:48 +00:00
|
|
|
* @return an UnicodeString object. If there is an error, string is bogus
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2001-09-17 22:04:48 +00:00
|
|
|
*/
|
2002-08-08 21:24:52 +00:00
|
|
|
inline UnicodeString
|
|
|
|
ures_getUnicodeString(const UResourceBundle *resB,
|
|
|
|
UErrorCode* status)
|
|
|
|
{
|
2001-09-17 22:04:48 +00:00
|
|
|
int32_t len = 0;
|
|
|
|
const UChar *r = ures_getString(resB, &len, status);
|
|
|
|
return UnicodeString(TRUE, r, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the next string in a resource or NULL if there are no more resources
|
|
|
|
* to iterate over.
|
|
|
|
*
|
|
|
|
* @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.
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2001-09-17 22:04:48 +00:00
|
|
|
*/
|
2002-08-08 21:24:52 +00:00
|
|
|
inline UnicodeString
|
|
|
|
ures_getNextUnicodeString(UResourceBundle *resB,
|
|
|
|
const char ** key,
|
|
|
|
UErrorCode* status)
|
|
|
|
{
|
2001-09-17 22:04:48 +00:00
|
|
|
int32_t len = 0;
|
|
|
|
const UChar* r = ures_getNextString(resB, &len, key, status);
|
|
|
|
return UnicodeString(TRUE, r, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the string in a given resource at the specified index.
|
|
|
|
*
|
|
|
|
* @param resB a resource
|
|
|
|
* @param index 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
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2001-09-17 22:04:48 +00:00
|
|
|
*/
|
2002-08-08 21:24:52 +00:00
|
|
|
inline UnicodeString
|
|
|
|
ures_getUnicodeStringByIndex(const UResourceBundle *resB,
|
|
|
|
int32_t indexS,
|
|
|
|
UErrorCode* status)
|
|
|
|
{
|
2001-09-17 22:04:48 +00:00
|
|
|
int32_t len = 0;
|
|
|
|
const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
|
|
|
|
return UnicodeString(TRUE, r, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2002-12-04 23:39:56 +00:00
|
|
|
* @stable ICU 2.0
|
2001-09-17 22:04:48 +00:00
|
|
|
*/
|
2002-08-08 21:24:52 +00:00
|
|
|
inline UnicodeString
|
|
|
|
ures_getUnicodeStringByKey(const UResourceBundle *resB,
|
|
|
|
const char* key,
|
|
|
|
UErrorCode* status)
|
|
|
|
{
|
2001-09-17 22:04:48 +00:00
|
|
|
int32_t len = 0;
|
|
|
|
const UChar* r = ures_getStringByKey(resB, key, &len, status);
|
|
|
|
return UnicodeString(TRUE, r, len);
|
|
|
|
}
|
|
|
|
|
2001-10-08 23:26:58 +00:00
|
|
|
U_NAMESPACE_END
|
|
|
|
|
2001-09-17 22:04:48 +00:00
|
|
|
#endif
|
|
|
|
|
2004-10-28 15:08:47 +00:00
|
|
|
/**
|
|
|
|
* Create a string enumerator, owned by the caller, of all locales located within
|
|
|
|
* the specified resource tree.
|
2005-06-24 22:02:42 +00:00
|
|
|
* @param packageName name of the tree, such as (NULL) or U_ICUDATA_ALIAS or or "ICUDATA-coll"
|
2004-10-28 15:08:47 +00:00
|
|
|
* This call is similar to uloc_getAvailable().
|
|
|
|
* @param status error code
|
2006-01-18 03:34:19 +00:00
|
|
|
* @stable ICU 3.2
|
2004-10-28 15:08:47 +00:00
|
|
|
*/
|
2006-01-18 03:34:19 +00:00
|
|
|
U_STABLE UEnumeration* U_EXPORT2
|
2005-06-24 22:02:42 +00:00
|
|
|
ures_openAvailableLocales(const char *packageName, UErrorCode *status);
|
2004-10-28 15:08:47 +00:00
|
|
|
|
|
|
|
|
1999-12-28 23:39:02 +00:00
|
|
|
#endif /*_URES*/
|
|
|
|
/*eof*/
|