164339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert// Copyright (C) 2016 and later: Unicode, Inc. and others. 264339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert// License & terms of use: http://www.unicode.org/copyright.html 3b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* 4b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru********************************************************************** 58de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert* Copyright (C) 1997-2016, International Business Machines 6b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Corporation and others. All Rights Reserved. 7b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru********************************************************************** 8b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 9b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* File URES.H (formerly CRESBUND.H) 10b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 11b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Modification History: 12b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 13b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* Date Name Description 14b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 04/01/97 aliu Creation. 15b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 02/22/99 damiba overhaul. 16b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 04/04/99 helena Fixed internal header inclusion. 178de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert* 04/15/99 Madhu Updated Javadoc 18b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 06/14/99 stephen Removed functions taking a filename suffix. 19b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 07/20/99 stephen Language-independent ypedef to void* 20b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 11/09/99 weiv Added ures_getLocale() 21b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru* 06/24/02 weiv Added support for resource sharing 22b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru****************************************************************************** 23b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/ 24b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 25b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef URES_H 26b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define URES_H 27b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 28b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/utypes.h" 29b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/uloc.h" 3050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#include "unicode/localpointer.h" 31b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 32b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 33b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * \file 348de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * \brief C API: Resource Bundle 35b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 36b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <h2>C API: Resource Bundle</h2> 37b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 38b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * C API representing a collection of resource information pertaining to a given 39b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * locale. A resource bundle provides a way of accessing locale- specific information in 40b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a data file. You create a resource bundle that manages the resources for a given 41b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * locale and then ask it for individual resources. 42b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <P> 43b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Resource bundles in ICU4C are currently defined using text files which conform to the following 44b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <a href="http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt">BNF definition</a>. 458de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * More on resource bundle concepts and syntax can be found in the 46b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <a href="http://icu-project.org/userguide/ResourceManagement.html">Users Guide</a>. 47b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <P> 48b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 49b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 50b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 51b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UResourceBundle is an opaque type for handles for resource bundles in C APIs. 52b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 53b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 54b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querustruct UResourceBundle; 55b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 56b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 57b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 58b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 59b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef struct UResourceBundle UResourceBundle; 60b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 61b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 62b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Numeric constants for types of resource items. 63b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getType 64b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 65b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 66b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum { 67b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** Resource type constant for "no resource". @stable ICU 2.6 */ 68b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru URES_NONE=-1, 69b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 70b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** Resource type constant for 16-bit Unicode strings. @stable ICU 2.6 */ 71b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru URES_STRING=0, 72b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 73b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** Resource type constant for binary data. @stable ICU 2.6 */ 74b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru URES_BINARY=1, 75b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 76b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** Resource type constant for tables of key-value pairs. @stable ICU 2.6 */ 77b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru URES_TABLE=2, 78b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 79b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 80b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Resource type constant for aliases; 81b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * internally stores a string which identifies the actual resource 82b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * storing the data (can be in a different resource bundle). 83b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Resolved internally before delivering the actual resource through the API. 84b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 85b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 86b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru URES_ALIAS=3, 87b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 88b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 89b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Resource type constant for a single 28-bit integer, interpreted as 90b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * signed or unsigned by the ures_getInt() or ures_getUInt() function. 91b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getInt 92b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getUInt 93b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 94b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 95b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru URES_INT=7, 96b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 97b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** Resource type constant for arrays of resources. @stable ICU 2.6 */ 98b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru URES_ARRAY=8, 99b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 100b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** 101b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Resource type constant for vectors of 32-bit integers. 102b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getIntVector 103b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.6 104b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 105b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru URES_INT_VECTOR = 14, 106b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef U_HIDE_DEPRECATED_API 107b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** @deprecated ICU 2.6 Use the URES_ constant instead. */ 108b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RES_NONE=URES_NONE, 109b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** @deprecated ICU 2.6 Use the URES_ constant instead. */ 110b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RES_STRING=URES_STRING, 111b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** @deprecated ICU 2.6 Use the URES_ constant instead. */ 112b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RES_BINARY=URES_BINARY, 113b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** @deprecated ICU 2.6 Use the URES_ constant instead. */ 114b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RES_TABLE=URES_TABLE, 115b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** @deprecated ICU 2.6 Use the URES_ constant instead. */ 116b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RES_ALIAS=URES_ALIAS, 117b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** @deprecated ICU 2.6 Use the URES_ constant instead. */ 118b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RES_INT=URES_INT, 119b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** @deprecated ICU 2.6 Use the URES_ constant instead. */ 120b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RES_ARRAY=URES_ARRAY, 121b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** @deprecated ICU 2.6 Use the URES_ constant instead. */ 122b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru RES_INT_VECTOR=URES_INT_VECTOR, 123b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** @deprecated ICU 2.6 Not used. */ 1248de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert RES_RESERVED=15, 125b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 12664339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert /** 12764339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert * One more than the highest normal UResType value. 12864339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. 12964339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert */ 130b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru URES_LIMIT = 16 13164339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert#endif // U_HIDE_DEPRECATED_API 132b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} UResType; 133b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 134b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/* 135b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Functions to create and destroy resource bundles. 136b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 137b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 138b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 139b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Opens a UResourceBundle, from which users can extract strings by using 140b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * their corresponding keys. 141b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Note that the caller is responsible of calling <TT>ures_close</TT> on each succesfully 142b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * opened resource bundle. 1438de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * @param packageName The packageName and locale together point to an ICU udata object, 1448de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * as defined by <code> udata_open( packageName, "res", locale, err) </code> 145b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or equivalent. Typically, packageName will refer to a (.dat) file, or to 146b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a package registered with udata_setAppData(). Using a full file or directory 147b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pathname for packageName is deprecated. If NULL, ICU data will be used. 148b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale specifies the locale for which we want to open the resource 149b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if NULL, the default locale will be used. If strlen(locale) == 0 150b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * root locale will be used. 1518de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * 152b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code. 153b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The UErrorCode err parameter is used to return status information to the user. To 154b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * check whether the construction succeeded or not, you should check the value of 155b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_SUCCESS(err). If you wish more detailed information, you can check for 156b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * informational status results which still indicate success. U_USING_FALLBACK_WARNING 157b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * indicates that a fall back locale was used. For example, 'de_CH' was requested, 158b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * but nothing was found there, so 'de' was used. U_USING_DEFAULT_WARNING indicates that 1598de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * the default locale data or root locale data was used; neither the requested locale 1608de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * nor any of its fall back locales could be found. Please see the users guide for more 161b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * information on this topic. 162b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a newly allocated resource bundle. 163b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_close 164b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 165b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1668de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE UResourceBundle* U_EXPORT2 167b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_open(const char* packageName, 1688de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert const char* locale, 169b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 170b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 171b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1728de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert/** This function does not care what kind of localeID is passed in. It simply opens a bundle with 173b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that name. Fallback mechanism is disabled for the new bundle. If the requested bundle contains 174b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * an %%ALIAS directive, the results are undefined. 1758de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * @param packageName The packageName and locale together point to an ICU udata object, 1768de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * as defined by <code> udata_open( packageName, "res", locale, err) </code> 177b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or equivalent. Typically, packageName will refer to a (.dat) file, or to 178b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a package registered with udata_setAppData(). Using a full file or directory 179b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pathname for packageName is deprecated. If NULL, ICU data will be used. 180b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale specifies the locale for which we want to open the resource 181b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if NULL, the default locale will be used. If strlen(locale) == 0 182b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * root locale will be used. 1838de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * 184b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code. Either U_ZERO_ERROR or U_MISSING_RESOURCE_ERROR 185b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a newly allocated resource bundle or NULL if it doesn't exist. 186b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_close 187b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 188b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 1898de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE UResourceBundle* U_EXPORT2 1908de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_openDirect(const char* packageName, 1918de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert const char* locale, 192b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 193b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 194b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 195b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Same as ures_open() but takes a const UChar *path. 196b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This path will be converted to char * using the default converter, 197b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * then ures_open() is called. 198b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 1998de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * @param packageName The packageName and locale together point to an ICU udata object, 2008de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * as defined by <code> udata_open( packageName, "res", locale, err) </code> 201b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or equivalent. Typically, packageName will refer to a (.dat) file, or to 202b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a package registered with udata_setAppData(). Using a full file or directory 203b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pathname for packageName is deprecated. If NULL, ICU data will be used. 204b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale specifies the locale for which we want to open the resource 205b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if NULL, the default locale will be used. If strlen(locale) == 0 206b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * root locale will be used. 207b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code. 208b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a newly allocated resource bundle. 209b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_open 210b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 211b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 2128de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE UResourceBundle* U_EXPORT2 2138de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_openU(const UChar* packageName, 2148de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert const char* locale, 215b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 216b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 217103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_DEPRECATED_API 218b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 219b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the number of strings/arrays in resource bundles. 2208de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Better to use ures_getSize, as this function will be deprecated. 221b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 222b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *@param resourceBundle resource bundle containing the desired strings 223b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *@param resourceKey key tagging the resource 224b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *@param err fills in the outgoing error code 225b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found 2268de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * could be a non-failing error 227b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_FALLBACK_WARNING </TT> 228b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *@return: for <STRONG>Arrays</STRONG>: returns the number of resources in the array 229b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <STRONG>Tables</STRONG>: returns the number of resources in the table 230b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <STRONG>single string</STRONG>: returns 1 231b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru *@see ures_getSize 232b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @deprecated ICU 2.8 User ures_getSize instead 233b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 2348de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_DEPRECATED int32_t U_EXPORT2 235b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_countArrayItems(const UResourceBundle* resourceBundle, 236b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* resourceKey, 237b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* err); 238103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif /* U_HIDE_DEPRECATED_API */ 239fceb39872958b9fa2505e63f8b8699a9e0f882f4ccornelius 240b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 241b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Close a resource bundle, all pointers returned from the various ures_getXXX calls 242b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * on this particular bundle should be considered invalid henceforth. 243b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 244b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a pointer to a resourceBundle struct. Can be NULL. 245b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_open 246b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 247b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 2488de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE void U_EXPORT2 249b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_close(UResourceBundle* resourceBundle); 250b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 25150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#if U_SHOW_CPLUSPLUS_API 25250294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 25350294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_NAMESPACE_BEGIN 25450294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 25550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho/** 25650294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * \class LocalUResourceBundlePointer 25750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * "Smart pointer" class, closes a UResourceBundle via ures_close(). 25850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * For most methods see the LocalPointerBase base class. 25950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * 26050294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @see LocalPointerBase 26150294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @see LocalPointer 26227f654740f2a26ad62a5c155af9199af9e69b889claireho * @stable ICU 4.4 26350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho */ 26450294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close); 26550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 26650294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_NAMESPACE_END 26750294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 26850294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#endif 26950294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho 270103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_DEPRECATED_API 271b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 272b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Return the version number associated with this ResourceBundle as a string. Please 273b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * use ures_getVersion as this function is going to be deprecated. 274b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 275b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle The resource bundle for which the version is checked. 276b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A version number string as specified in the resource bundle or its parent. 277b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The caller does not own this string. 278b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getVersion 279b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @deprecated ICU 2.8 Use ures_getVersion instead. 280b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 2818de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_DEPRECATED const char* U_EXPORT2 282b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_getVersionNumber(const UResourceBundle* resourceBundle); 283103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif /* U_HIDE_DEPRECATED_API */ 284b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 285b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 2868de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Return the version number associated with this ResourceBundle as an 287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UVersionInfo array. 288b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 289b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resB The resource bundle for which the version is checked. 290b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param versionInfo A UVersionInfo array that is filled with the version number 291b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * as specified in the resource bundle or its parent. 292b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 293b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 2948de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE void U_EXPORT2 2958de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getVersion(const UResourceBundle* resB, 296b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UVersionInfo versionInfo); 297b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 298103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_DEPRECATED_API 299b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 300b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Return the name of the Locale associated with this ResourceBundle. This API allows 3018de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * you to query for the real locale of the resource. For example, if you requested 3028de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * "en_US_CALIFORNIA" and only "en_US" bundle exists, "en_US" will be returned. 303b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For subresources, the locale where this resource comes from will be returned. 304b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If fallback has occured, getLocale will reflect this. 305b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 306b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle resource bundle in question 307b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status just for catching illegal arguments 308b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A Locale name 309b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @deprecated ICU 2.8 Use ures_getLocaleByType instead. 310b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 3118de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_DEPRECATED const char* U_EXPORT2 3128de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getLocale(const UResourceBundle* resourceBundle, 313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 314103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif /* U_HIDE_DEPRECATED_API */ 315b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 316b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 3178de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Return the name of the Locale associated with this ResourceBundle. 318b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * You can choose between requested, valid and real locale. 319b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 320b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle resource bundle in question 321b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param type You can choose between requested, valid and actual 322b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * locale. For description see the definition of 323b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ULocDataLocaleType in uloc.h 324b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status just for catching illegal arguments 325b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return A Locale name 326b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 327b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 3288de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE const char* U_EXPORT2 3298de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getLocaleByType(const UResourceBundle* resourceBundle, 3308de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert ULocDataLocaleType type, 331b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 332b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 333b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 334103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#ifndef U_HIDE_INTERNAL_API 335b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 336b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Same as ures_open() but uses the fill-in parameter instead of allocating 337b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a bundle, if r!=NULL. 338b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * TODO need to revisit usefulness of this function 339b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and usage model for fillIn parameters without knowing sizeof(UResourceBundle) 340b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param r The resourcebundle to open 3418de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * @param packageName The packageName and locale together point to an ICU udata object, 3428de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * as defined by <code> udata_open( packageName, "res", locale, err) </code> 343b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or equivalent. Typically, packageName will refer to a (.dat) file, or to 344b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a package registered with udata_setAppData(). Using a full file or directory 345b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pathname for packageName is deprecated. If NULL, ICU data will be used. 346b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID specifies the locale for which we want to open the resource 347b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status The error code 348b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a newly allocated resource bundle or NULL if it doesn't exist. 349b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @internal 350b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 3518de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_INTERNAL void U_EXPORT2 3528de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_openFillIn(UResourceBundle *r, 353b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* packageName, 3548de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert const char* localeID, 355b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 356103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius#endif /* U_HIDE_INTERNAL_API */ 357b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 359b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns a string from a string resource type 360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 361b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a string resource 362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param len fills in the length of resulting string 363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code 364b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found 365b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Always check the value of status. Don't count on returning NULL. 3668de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * could be a non-failing error 367b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> 368b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. 369b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getBinary 370b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getIntVector 371b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getInt 372b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getUInt 373b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 374b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 3758de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE const UChar* U_EXPORT2 3768de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getString(const UResourceBundle* resourceBundle, 3778de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert int32_t* len, 378b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 379b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 380b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 381b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns a UTF-8 string from a string resource. 382b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The UTF-8 string may be returnable directly as a pointer, or 383b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() 384b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or equivalent. 385b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 386b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If forceCopy==TRUE, then the string is always written to the dest buffer 387b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and dest is returned. 388b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 389b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If forceCopy==FALSE, then the string is returned as a pointer if possible, 390b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * without needing a dest buffer (it can be NULL). If the string needs to be 391b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * copied or transformed, then it may be placed into dest at an arbitrary offset. 392b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 393b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and 394b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual. 395b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 396b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the string is transformed from UTF-16, then a conversion error may occur 397b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if an unpaired surrogate is encountered. If the function is successful, then 398b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the output UTF-8 string is always well-formed. 399b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 400b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resB Resource bundle. 401b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest Destination buffer. Can be NULL only if capacity=*length==0. 402b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param length Input: Capacity of destination buffer. 403b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Output: Actual length of the UTF-8 string, not counting the 404b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. 405b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Can be NULL, meaning capacity=0 and the string length is not 406b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * returned to the caller. 407b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param forceCopy If TRUE, then the output string will always be written to 408b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest, with U_BUFFER_OVERFLOW_ERROR and 409b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_STRING_NOT_TERMINATED_WARNING set if appropriate. 410b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If FALSE, then the dest buffer may or may not contain a 411b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * copy of the string. dest may or may not be modified. 412b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If a copy needs to be written, then the UErrorCode parameter 413b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * indicates overflow etc. as usual. 414b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status Pointer to a standard ICU error code. Its input value must 415b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pass the U_SUCCESS() test, or else the function returns 416b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * immediately. Check for U_FAILURE() on output or use with 417b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * function chaining. (See User Guide for details.) 418b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The pointer to the UTF-8 string. It may be dest, or at some offset 419b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * from dest (only if !forceCopy), or in unrelated memory. 420b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Always NUL-terminated unless the string was written to dest and 421b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * length==capacity (in which case U_STRING_NOT_TERMINATED_WARNING is set). 422b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 423b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getString 424b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strToUTF8 425b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.6 426b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 427b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const char * U_EXPORT2 428b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_getUTF8String(const UResourceBundle *resB, 429b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char *dest, int32_t *length, 430b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UBool forceCopy, 431b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 432b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 433b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 4348de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns a binary data from a binary resource. 435b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 436b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a string resource 437b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param len fills in the length of resulting byte chunk 438b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code 439b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found 440b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Always check the value of status. Don't count on returning NULL. 4418de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * could be a non-failing error 442b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> 44350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return a pointer to a chunk of unsigned bytes which live in a memory mapped/DLL file. 444b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getString 445b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getIntVector 446b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getInt 447b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getUInt 448b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 449b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 4508de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE const uint8_t* U_EXPORT2 4518de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getBinary(const UResourceBundle* resourceBundle, 4528de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert int32_t* len, 453b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 454b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 455b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 4568de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns a 32 bit integer array from a resource. 457b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 458b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle an int vector resource 459b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param len fills in the length of resulting byte chunk 460b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code 461b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found 462b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Always check the value of status. Don't count on returning NULL. 4638de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * could be a non-failing error 464b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> 46550294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho * @return a pointer to a chunk of integers which live in a memory mapped/DLL file. 466b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getBinary 467b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getString 468b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getInt 469b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getUInt 470b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 471b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 4728de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE const int32_t* U_EXPORT2 4738de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getIntVector(const UResourceBundle* resourceBundle, 4748de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert int32_t* len, 475b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 476b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 477b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 4788de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns an unsigned integer from a resource. 479b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This integer is originally 28 bits. 480b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 481b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a string resource 482b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code 483b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found 4848de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * could be a non-failing error 485b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> 486b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return an integer value 487b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getInt 488b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getIntVector 489b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getBinary 490b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getString 491b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 492b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 4938de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE uint32_t U_EXPORT2 4948de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getUInt(const UResourceBundle* resourceBundle, 495b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 496b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 497b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 4988de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns a signed integer from a resource. 499b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This integer is originally 28 bit and the sign gets propagated. 500b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 501b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a string resource 502b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code 503b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found 5048de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * could be a non-failing error 505b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> 506b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return an integer value 507b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getUInt 508b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getIntVector 509b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getBinary 510b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getString 511b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 512b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 5138de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE int32_t U_EXPORT2 5148de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getInt(const UResourceBundle* resourceBundle, 515b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 516b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 517b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 5188de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns the size of a resource. Size for scalar types is always 1, 519b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and for vector/table types is the number of child resources. 5208de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * @warning Integer array is treated as a scalar type. There are no 521b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * APIs to access individual members of an integer array. It 522b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is always returned as a whole. 523b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a resource 524b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return number of resources in a given resource. 525b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 526b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 5278de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE int32_t U_EXPORT2 528b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_getSize(const UResourceBundle *resourceBundle); 529b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 530b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 531b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the type of a resource. Available types are defined in enum UResType 532b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 533b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a resource 534b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return type of the given resource. 535b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see UResType 536b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 537b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 5388de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE UResType U_EXPORT2 539b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_getType(const UResourceBundle *resourceBundle); 540b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 541b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 5428de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns the key associated with a given resource. Not all the resources have a key - only 543b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * those that are members of a table. 544b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 545b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a resource 546b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a key associated to this resource, or NULL if it doesn't have a key 547b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 548b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 5498de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE const char * U_EXPORT2 550b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_getKey(const UResourceBundle *resourceBundle); 551b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 5528de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert/* ITERATION API 553b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru This API provides means for iterating through a resource 554b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru*/ 555b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 556b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 557b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Resets the internal context of a resource so that iteration starts from the first element. 558b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 559b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a resource 560b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 561b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 5628de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE void U_EXPORT2 563b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_resetIterator(UResourceBundle *resourceBundle); 564b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 565b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 566b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Checks whether the given resource has another element to iterate over. 567b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 568b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a resource 569b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return TRUE if there are more elements, FALSE if there is no more elements 570b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 571b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 5728de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE UBool U_EXPORT2 573b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_hasNext(const UResourceBundle *resourceBundle); 574b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 575b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 5768de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns the next resource in a given resource or NULL if there are no more resources 5778de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * to iterate over. Features a fill-in parameter. 578b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 579b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a resource 580b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. 581b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Alternatively, you can supply a struct to be filled by this function. 582b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code. You may still get a non NULL result even if an 583b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * error occured. Check status instead. 584b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it 585b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 586b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 5878de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE UResourceBundle* U_EXPORT2 5888de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getNextResource(UResourceBundle *resourceBundle, 5898de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert UResourceBundle *fillIn, 590b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 591b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 592b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 5938de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns the next string in a given resource or NULL if there are no more resources 5948de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * to iterate over. 595b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 596b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a resource 597b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param len fill in length of the string 598b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param key fill in for key associated with this string. NULL if no key 599b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code. If an error occured, we may return NULL, but don't 600b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * count on it. Check status instead! 601b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. 602b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 603b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 6048de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE const UChar* U_EXPORT2 6058de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getNextString(UResourceBundle *resourceBundle, 6068de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert int32_t* len, 6078de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert const char ** key, 608b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 609b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 610b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 6118de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns the resource in a given resource at the specified index. Features a fill-in parameter. 612b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 613b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle the resource bundle from which to get a sub-resource 614b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param indexR an index to the wanted resource. 615b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. 616b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Alternatively, you can supply a struct to be filled by this function. 617b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code. Don't count on NULL being returned if an error has 618b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * occured. Check status instead. 619b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it 620b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 621b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 6228de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE UResourceBundle* U_EXPORT2 6238de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getByIndex(const UResourceBundle *resourceBundle, 6248de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert int32_t indexR, 6258de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert UResourceBundle *fillIn, 626b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 627b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 628b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 629b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns the string in a given resource at the specified index. 630b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 631b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a resource 632b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param indexS an index to the wanted string. 633b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param len fill in length of the string 634b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code. If an error occured, we may return NULL, but don't 635b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * count on it. Check status instead! 636b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. 637b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 638b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 6398de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE const UChar* U_EXPORT2 6408de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getStringByIndex(const UResourceBundle *resourceBundle, 6418de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert int32_t indexS, 6428de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert int32_t* len, 643b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 644b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 645b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 646b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns a UTF-8 string from a resource at the specified index. 647b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The UTF-8 string may be returnable directly as a pointer, or 648b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() 649b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or equivalent. 650b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 651b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If forceCopy==TRUE, then the string is always written to the dest buffer 652b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and dest is returned. 653b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 654b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If forceCopy==FALSE, then the string is returned as a pointer if possible, 655b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * without needing a dest buffer (it can be NULL). If the string needs to be 656b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * copied or transformed, then it may be placed into dest at an arbitrary offset. 657b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 658b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and 659b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual. 660b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 661b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the string is transformed from UTF-16, then a conversion error may occur 662b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if an unpaired surrogate is encountered. If the function is successful, then 663b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the output UTF-8 string is always well-formed. 664b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 665b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resB Resource bundle. 666b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param stringIndex An index to the wanted string. 667b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest Destination buffer. Can be NULL only if capacity=*length==0. 668b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pLength Input: Capacity of destination buffer. 669b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Output: Actual length of the UTF-8 string, not counting the 670b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. 671b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Can be NULL, meaning capacity=0 and the string length is not 672b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * returned to the caller. 673b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param forceCopy If TRUE, then the output string will always be written to 674b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest, with U_BUFFER_OVERFLOW_ERROR and 675b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_STRING_NOT_TERMINATED_WARNING set if appropriate. 676b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If FALSE, then the dest buffer may or may not contain a 677b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * copy of the string. dest may or may not be modified. 678b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If a copy needs to be written, then the UErrorCode parameter 679b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * indicates overflow etc. as usual. 680b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status Pointer to a standard ICU error code. Its input value must 681b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pass the U_SUCCESS() test, or else the function returns 682b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * immediately. Check for U_FAILURE() on output or use with 683b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * function chaining. (See User Guide for details.) 684b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The pointer to the UTF-8 string. It may be dest, or at some offset 685b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * from dest (only if !forceCopy), or in unrelated memory. 686b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Always NUL-terminated unless the string was written to dest and 687b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * length==capacity (in which case U_STRING_NOT_TERMINATED_WARNING is set). 688b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 689b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getStringByIndex 690b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strToUTF8 691b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.6 692b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 693b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const char * U_EXPORT2 694b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_getUTF8StringByIndex(const UResourceBundle *resB, 695b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru int32_t stringIndex, 696b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char *dest, int32_t *pLength, 697b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UBool forceCopy, 698b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 699b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 700b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 701b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns a resource in a given resource that has a given key. This procedure works only with table 7028de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * resources. Features a fill-in parameter. 703b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 704b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resourceBundle a resource 705b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param key a key associated with the wanted resource 706b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param fillIn if NULL a new UResourceBundle struct is allocated and must be closed by the caller. 707b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Alternatively, you can supply a struct to be filled by this function. 708b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code. 709b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a pointer to a UResourceBundle struct. If fill in param was NULL, caller must close it 710b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 711b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 7128de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE UResourceBundle* U_EXPORT2 7138de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getByKey(const UResourceBundle *resourceBundle, 7148de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert const char* key, 7158de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert UResourceBundle *fillIn, 716b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 717b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 718b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 719b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns a string in a given resource that has a given key. This procedure works only with table 7208de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * resources. 721b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 722b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resB a resource 723b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param key a key associated with the wanted string 724b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param len fill in length of the string 725b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code. If an error occured, we may return NULL, but don't 726b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * count on it. Check status instead! 727b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a pointer to a zero-terminated UChar array which lives in a memory mapped/DLL file. 728b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 729b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 7308de051c3d18a56cc126f0f44e368495a52f9148cFredrik RoubertU_STABLE const UChar* U_EXPORT2 7318de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getStringByKey(const UResourceBundle *resB, 7328de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert const char* key, 7338de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert int32_t* len, 734b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 735b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 736b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 737b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Returns a UTF-8 string from a resource and a key. 738b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This function works only with table resources. 739b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 740b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The UTF-8 string may be returnable directly as a pointer, or 741b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * it may need to be copied, or transformed from UTF-16 using u_strToUTF8() 742b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * or equivalent. 743b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 744b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If forceCopy==TRUE, then the string is always written to the dest buffer 745b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and dest is returned. 746b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 747b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If forceCopy==FALSE, then the string is returned as a pointer if possible, 748b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * without needing a dest buffer (it can be NULL). If the string needs to be 749b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * copied or transformed, then it may be placed into dest at an arbitrary offset. 750b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 751b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the string is to be written to dest, then U_BUFFER_OVERFLOW_ERROR and 752b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_STRING_NOT_TERMINATED_WARNING are set if appropriate, as usual. 753b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 754b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the string is transformed from UTF-16, then a conversion error may occur 755b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if an unpaired surrogate is encountered. If the function is successful, then 756b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the output UTF-8 string is always well-formed. 757b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 758b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resB Resource bundle. 759b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param key A key associated with the wanted resource 760b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest Destination buffer. Can be NULL only if capacity=*length==0. 761b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param pLength Input: Capacity of destination buffer. 762b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Output: Actual length of the UTF-8 string, not counting the 763b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * terminating NUL, even in case of U_BUFFER_OVERFLOW_ERROR. 764b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Can be NULL, meaning capacity=0 and the string length is not 765b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * returned to the caller. 766b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param forceCopy If TRUE, then the output string will always be written to 767b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest, with U_BUFFER_OVERFLOW_ERROR and 768b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * U_STRING_NOT_TERMINATED_WARNING set if appropriate. 769b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If FALSE, then the dest buffer may or may not contain a 770b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * copy of the string. dest may or may not be modified. 771b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If a copy needs to be written, then the UErrorCode parameter 772b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * indicates overflow etc. as usual. 773b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status Pointer to a standard ICU error code. Its input value must 774b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pass the U_SUCCESS() test, or else the function returns 775b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * immediately. Check for U_FAILURE() on output or use with 776b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * function chaining. (See User Guide for details.) 777b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The pointer to the UTF-8 string. It may be dest, or at some offset 778b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * from dest (only if !forceCopy), or in unrelated memory. 779b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Always NUL-terminated unless the string was written to dest and 780b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * length==capacity (in which case U_STRING_NOT_TERMINATED_WARNING is set). 781b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 782b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see ures_getStringByKey 783b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see u_strToUTF8 784b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.6 785b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 786b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const char * U_EXPORT2 787b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_getUTF8StringByKey(const UResourceBundle *resB, 788b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char *key, 789b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char *dest, int32_t *pLength, 790b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UBool forceCopy, 791b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 792b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 79350294ead5e5d23f5bbfed76e00e6b510bd41eee1claireho#if U_SHOW_CPLUSPLUS_API 794b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#include "unicode/unistr.h" 795b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 796b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_NAMESPACE_BEGIN 797b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 7988de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns the string value from a string resource bundle. 799b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 8008de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * @param resB a resource, should have type URES_STRING 801b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status: fills in the outgoing error code 802b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * could be <TT>U_MISSING_RESOURCE_ERROR</TT> if the key is not found 8038de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * could be a non-failing error 804b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * e.g.: <TT>U_USING_FALLBACK_WARNING</TT>,<TT>U_USING_DEFAULT_WARNING </TT> 8058de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * @return The string value, or a bogus string if there is a failure UErrorCode. 806b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 807b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 8088de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertinline UnicodeString 8098de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getUnicodeString(const UResourceBundle *resB, UErrorCode* status) { 8108de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert UnicodeString result; 811b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t len = 0; 812b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar *r = ures_getString(resB, &len, status); 8138de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert if(U_SUCCESS(*status)) { 8148de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert result.setTo(TRUE, r, len); 8158de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert } else { 8168de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert result.setToBogus(); 8178de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert } 8188de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert return result; 819b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} 820b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 821b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 8228de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns the next string in a resource, or an empty string if there are no more resources 8238de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * to iterate over. 8248de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Use ures_getNextString() instead to distinguish between 8258de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * the end of the iteration and a real empty string value. 826b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 827b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resB a resource 828b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param key fill in for key associated with this string 829b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code 8308de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * @return The string value, or a bogus string if there is a failure UErrorCode. 831b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 832b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 8338de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertinline UnicodeString 8348de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getNextUnicodeString(UResourceBundle *resB, const char ** key, UErrorCode* status) { 8358de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert UnicodeString result; 836b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t len = 0; 837b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar* r = ures_getNextString(resB, &len, key, status); 8388de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert if(U_SUCCESS(*status)) { 8398de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert result.setTo(TRUE, r, len); 8408de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert } else { 8418de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert result.setToBogus(); 8428de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert } 8438de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert return result; 844b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} 845b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 846b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 8478de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns the string in a given resource array or table at the specified index. 848b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 849b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resB a resource 85054dcd9b6a06071f647dac967e9e267abb9410720Craig Cornelius * @param indexS an index to the wanted string. 851b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code 8528de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * @return The string value, or a bogus string if there is a failure UErrorCode. 853b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 854b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 8558de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertinline UnicodeString 8568de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getUnicodeStringByIndex(const UResourceBundle *resB, int32_t indexS, UErrorCode* status) { 8578de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert UnicodeString result; 858b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t len = 0; 859b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar* r = ures_getStringByIndex(resB, indexS, &len, status); 8608de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert if(U_SUCCESS(*status)) { 8618de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert result.setTo(TRUE, r, len); 8628de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert } else { 8638de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert result.setToBogus(); 8648de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert } 8658de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert return result; 866b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} 867b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 868b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 8698de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Returns a string in a resource that has a given key. 8708de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * This procedure works only with table resources. 871b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 872b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resB a resource 873b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param key a key associated with the wanted string 874b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status fills in the outgoing error code 8758de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * @return The string value, or a bogus string if there is a failure UErrorCode. 876b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 877b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 8788de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertinline UnicodeString 8798de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubertures_getUnicodeStringByKey(const UResourceBundle *resB, const char* key, UErrorCode* status) { 8808de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert UnicodeString result; 881b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t len = 0; 882b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const UChar* r = ures_getStringByKey(resB, key, &len, status); 8838de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert if(U_SUCCESS(*status)) { 8848de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert result.setTo(TRUE, r, len); 8858de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert } else { 8868de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert result.setToBogus(); 8878de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert } 8888de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert return result; 889b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} 890b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 891b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_NAMESPACE_END 892b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 893b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif 894b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 895b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 8968de051c3d18a56cc126f0f44e368495a52f9148cFredrik Roubert * Create a string enumerator, owned by the caller, of all locales located within 897b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the specified resource tree. 898b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param packageName name of the tree, such as (NULL) or U_ICUDATA_ALIAS or or "ICUDATA-coll" 899b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This call is similar to uloc_getAvailable(). 900b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error code 901b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.2 902b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 903b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UEnumeration* U_EXPORT2 904b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruures_openAvailableLocales(const char *packageName, UErrorCode *status); 905b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 906b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 907b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /*_URES*/ 908b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/*eof*/ 909