ICU 54.1 54.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ures.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (C) 1997-2012,2014, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 *
7 * File URES.H (formerly CRESBUND.H)
8 *
9 * Modification History:
10 *
11 * Date Name Description
12 * 04/01/97 aliu Creation.
13 * 02/22/99 damiba overhaul.
14 * 04/04/99 helena Fixed internal header inclusion.
15 * 04/15/99 Madhu Updated Javadoc
16 * 06/14/99 stephen Removed functions taking a filename suffix.
17 * 07/20/99 stephen Language-independent ypedef to void*
18 * 11/09/99 weiv Added ures_getLocale()
19 * 06/24/02 weiv Added support for resource sharing
20 ******************************************************************************
21 */
22
23 #ifndef URES_H
24 #define URES_H
25
26 #include "unicode/utypes.h"
27 #include "unicode/uloc.h"
28 #include "unicode/localpointer.h"
29
52 struct UResourceBundle;
53
57 typedef struct UResourceBundle UResourceBundle;
58
64 typedef enum {
66 URES_NONE=-1,
67
69 URES_STRING=0,
70
72 URES_BINARY=1,
73
75 URES_TABLE=2,
76
84 URES_ALIAS=3,
85
93 URES_INT=7,
94
96 URES_ARRAY=8,
97
103 URES_INT_VECTOR = 14,
104 #ifndef U_HIDE_DEPRECATED_API
105
106 RES_NONE=URES_NONE,
108 RES_STRING=URES_STRING,
110 RES_BINARY=URES_BINARY,
112 RES_TABLE=URES_TABLE,
114 RES_ALIAS=URES_ALIAS,
116 RES_INT=URES_INT,
118 RES_ARRAY=URES_ARRAY,
120 RES_INT_VECTOR=URES_INT_VECTOR,
122 RES_RESERVED=15,
123 #endif /* U_HIDE_DEPRECATED_API */
124
125 URES_LIMIT = 16
126 } UResType;
127
128 /*
129 * Functions to create and destroy resource bundles.
130 */
131
160 U_STABLE UResourceBundle* U_EXPORT2
161 ures_open(const char* packageName,
162 const char* locale,
163 UErrorCode* status);
164
165
183 U_STABLE UResourceBundle* U_EXPORT2
184 ures_openDirect(const char* packageName,
185 const char* locale,
186 UErrorCode* status);
187
206 U_STABLE UResourceBundle* U_EXPORT2
207 ures_openU(const UChar* packageName,
208 const char* locale,
209 UErrorCode* status);
210
211 #ifndef U_HIDE_DEPRECATED_API
212
228 U_DEPRECATED int32_t U_EXPORT2
229 ures_countArrayItems(const UResourceBundle* resourceBundle,
230 const char* resourceKey,
231 UErrorCode* err);
232 #endif /* U_HIDE_DEPRECATED_API */
233
242 U_STABLE void U_EXPORT2
243 ures_close(UResourceBundle* resourceBundle);
244
245 #if U_SHOW_CPLUSPLUS_API
246
247 U_NAMESPACE_BEGIN
248
258 U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close);
259
260 U_NAMESPACE_END
261
262 #endif
263
264 #ifndef U_HIDE_DEPRECATED_API
265
275 U_DEPRECATED const char* U_EXPORT2
276 ures_getVersionNumber(const UResourceBundle* resourceBundle);
277 #endif /* U_HIDE_DEPRECATED_API */
278
288 U_STABLE void U_EXPORT2
289 ures_getVersion(const UResourceBundle* resB,
290 UVersionInfo versionInfo);
291
292 #ifndef U_HIDE_DEPRECATED_API
293
305 U_DEPRECATED const char* U_EXPORT2
306 ures_getLocale(const UResourceBundle* resourceBundle,
307 UErrorCode* status);
308 #endif /* U_HIDE_DEPRECATED_API */
309
322 U_STABLE const char* U_EXPORT2
323 ures_getLocaleByType(const UResourceBundle* resourceBundle,
324 ULocDataLocaleType type,
325 UErrorCode* status);
326
327
328 #ifndef U_HIDE_INTERNAL_API
329
345 U_INTERNAL void U_EXPORT2
346 ures_openFillIn(UResourceBundle *r,
347 const char* packageName,
348 const char* localeID,
349 UErrorCode* status);
350 #endif /* U_HIDE_INTERNAL_API */
351
369 U_STABLE const UChar* U_EXPORT2
370 ures_getString(const UResourceBundle* resourceBundle,
371 int32_t* len,
372 UErrorCode* status);
373
421 U_STABLE const char * U_EXPORT2
422 ures_getUTF8String(const UResourceBundle *resB,
423 char *dest, int32_t *length,
424 UBool forceCopy,
425 UErrorCode *status);
426
444 U_STABLE const uint8_t* U_EXPORT2
445 ures_getBinary(const UResourceBundle* resourceBundle,
446 int32_t* len,
447 UErrorCode* status);
448
466 U_STABLE const int32_t* U_EXPORT2
467 ures_getIntVector(const UResourceBundle* resourceBundle,
468 int32_t* len,
469 UErrorCode* status);
470
487 U_STABLE uint32_t U_EXPORT2
488 ures_getUInt(const UResourceBundle* resourceBundle,
489 UErrorCode *status);
490
507 U_STABLE int32_t U_EXPORT2
508 ures_getInt(const UResourceBundle* resourceBundle,
509 UErrorCode *status);
510
521 U_STABLE int32_t U_EXPORT2
522 ures_getSize(const UResourceBundle *resourceBundle);
523
532 U_STABLE UResType U_EXPORT2
533 ures_getType(const UResourceBundle *resourceBundle);
534
543 U_STABLE const char * U_EXPORT2
544 ures_getKey(const UResourceBundle *resourceBundle);
545
546 /* ITERATION API
547 This API provides means for iterating through a resource
548 */
549
556 U_STABLE void U_EXPORT2
557 ures_resetIterator(UResourceBundle *resourceBundle);
558
566 U_STABLE UBool U_EXPORT2
567 ures_hasNext(const UResourceBundle *resourceBundle);
568
581 U_STABLE UResourceBundle* U_EXPORT2
582 ures_getNextResource(UResourceBundle *resourceBundle,
583 UResourceBundle *fillIn,
584 UErrorCode *status);
585
598 U_STABLE const UChar* U_EXPORT2
599 ures_getNextString(UResourceBundle *resourceBundle,
600 int32_t* len,
601 const char ** key,
602 UErrorCode *status);
603
616 U_STABLE UResourceBundle* U_EXPORT2
617 ures_getByIndex(const UResourceBundle *resourceBundle,
618 int32_t indexR,
619 UResourceBundle *fillIn,
620 UErrorCode *status);
621
633 U_STABLE const UChar* U_EXPORT2
634 ures_getStringByIndex(const UResourceBundle *resourceBundle,
635 int32_t indexS,
636 int32_t* len,
637 UErrorCode *status);
638
687 U_STABLE const char * U_EXPORT2
688 ures_getUTF8StringByIndex(const UResourceBundle *resB,
689 int32_t stringIndex,
690 char *dest, int32_t *pLength,
691 UBool forceCopy,
692 UErrorCode *status);
693
706 U_STABLE UResourceBundle* U_EXPORT2
707 ures_getByKey(const UResourceBundle *resourceBundle,
708 const char* key,
709 UResourceBundle *fillIn,
710 UErrorCode *status);
711
724 U_STABLE const UChar* U_EXPORT2
725 ures_getStringByKey(const UResourceBundle *resB,
726 const char* key,
727 int32_t* len,
728 UErrorCode *status);
729
780 U_STABLE const char * U_EXPORT2
781 ures_getUTF8StringByKey(const UResourceBundle *resB,
782 const char *key,
783 char *dest, int32_t *pLength,
784 UBool forceCopy,
785 UErrorCode *status);
786
787 #if U_SHOW_CPLUSPLUS_API
788 #include "unicode/unistr.h"
789
790 U_NAMESPACE_BEGIN
802 inline UnicodeString
803 ures_getUnicodeString(const UResourceBundle *resB,
804 UErrorCode* status)
805 {
806 int32_t len = 0;
807 const UChar *r = ures_getString(resB, &len, status);
808 return UnicodeString(TRUE, r, len);
809 }
810
821 inline UnicodeString
822 ures_getNextUnicodeString(UResourceBundle *resB,
823 const char ** key,
824 UErrorCode* status)
825 {
826 int32_t len = 0;
827 const UChar* r = ures_getNextString(resB, &len, key, status);
828 return UnicodeString(TRUE, r, len);
829 }
830
840 inline UnicodeString
841 ures_getUnicodeStringByIndex(const UResourceBundle *resB,
842 int32_t indexS,
843 UErrorCode* status)
844 {
845 int32_t len = 0;
846 const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
847 return UnicodeString(TRUE, r, len);
848 }
849
860 inline UnicodeString
861 ures_getUnicodeStringByKey(const UResourceBundle *resB,
862 const char* key,
863 UErrorCode* status)
864 {
865 int32_t len = 0;
866 const UChar* r = ures_getStringByKey(resB, key, &len, status);
867 return UnicodeString(TRUE, r, len);
868 }
869
870 U_NAMESPACE_END
871
872 #endif
873
882 U_STABLE UEnumeration* U_EXPORT2
883 ures_openAvailableLocales(const char *packageName, UErrorCode *status);
884
885
886 #endif /*_URES*/
887 /*eof*/