ICU 49.1.1  49.1.1
ures.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (C) 1997-2011, 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 
58 
64 typedef enum {
67 
70 
73 
76 
85 
94 
97 
104 #ifndef U_HIDE_DEPRECATED_API
105 
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 
241 U_STABLE void U_EXPORT2
242 ures_close(UResourceBundle* resourceBundle);
243 
244 #if U_SHOW_CPLUSPLUS_API
245 
247 
257 U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close);
258 
260 
261 #endif
262 
263 #ifndef U_HIDE_DEPRECATED_API
264 
274 U_DEPRECATED const char* U_EXPORT2
275 ures_getVersionNumber(const UResourceBundle* resourceBundle);
276 #endif /* U_HIDE_DEPRECATED_API */
277 
287 U_STABLE void U_EXPORT2
288 ures_getVersion(const UResourceBundle* resB,
289  UVersionInfo versionInfo);
290 
291 #ifndef U_HIDE_DEPRECATED_API
292 
304 U_DEPRECATED const char* U_EXPORT2
305 ures_getLocale(const UResourceBundle* resourceBundle,
306  UErrorCode* status);
307 #endif /* U_HIDE_DEPRECATED_API */
308 
321 U_STABLE const char* U_EXPORT2
322 ures_getLocaleByType(const UResourceBundle* resourceBundle,
323  ULocDataLocaleType type,
324  UErrorCode* status);
325 
326 
327 #ifndef U_HIDE_INTERNAL_API
328 
344 U_INTERNAL void U_EXPORT2
346  const char* packageName,
347  const char* localeID,
348  UErrorCode* status);
349 #endif /* U_HIDE_INTERNAL_API */
350 
368 U_STABLE const UChar* U_EXPORT2
369 ures_getString(const UResourceBundle* resourceBundle,
370  int32_t* len,
371  UErrorCode* status);
372 
420 U_STABLE const char * U_EXPORT2
422  char *dest, int32_t *length,
423  UBool forceCopy,
424  UErrorCode *status);
425 
443 U_STABLE const uint8_t* U_EXPORT2
444 ures_getBinary(const UResourceBundle* resourceBundle,
445  int32_t* len,
446  UErrorCode* status);
447 
465 U_STABLE const int32_t* U_EXPORT2
466 ures_getIntVector(const UResourceBundle* resourceBundle,
467  int32_t* len,
468  UErrorCode* status);
469 
486 U_STABLE uint32_t U_EXPORT2
487 ures_getUInt(const UResourceBundle* resourceBundle,
488  UErrorCode *status);
489 
506 U_STABLE int32_t U_EXPORT2
507 ures_getInt(const UResourceBundle* resourceBundle,
508  UErrorCode *status);
509 
520 U_STABLE int32_t U_EXPORT2
521 ures_getSize(const UResourceBundle *resourceBundle);
522 
531 U_STABLE UResType U_EXPORT2
532 ures_getType(const UResourceBundle *resourceBundle);
533 
542 U_STABLE const char * U_EXPORT2
543 ures_getKey(const UResourceBundle *resourceBundle);
544 
545 /* ITERATION API
546  This API provides means for iterating through a resource
547 */
548 
555 U_STABLE void U_EXPORT2
556 ures_resetIterator(UResourceBundle *resourceBundle);
557 
565 U_STABLE UBool U_EXPORT2
566 ures_hasNext(const UResourceBundle *resourceBundle);
567 
580 U_STABLE UResourceBundle* U_EXPORT2
581 ures_getNextResource(UResourceBundle *resourceBundle,
582  UResourceBundle *fillIn,
583  UErrorCode *status);
584 
597 U_STABLE const UChar* U_EXPORT2
598 ures_getNextString(UResourceBundle *resourceBundle,
599  int32_t* len,
600  const char ** key,
601  UErrorCode *status);
602 
615 U_STABLE UResourceBundle* U_EXPORT2
616 ures_getByIndex(const UResourceBundle *resourceBundle,
617  int32_t indexR,
618  UResourceBundle *fillIn,
619  UErrorCode *status);
620 
632 U_STABLE const UChar* U_EXPORT2
633 ures_getStringByIndex(const UResourceBundle *resourceBundle,
634  int32_t indexS,
635  int32_t* len,
636  UErrorCode *status);
637 
686 U_STABLE const char * U_EXPORT2
688  int32_t stringIndex,
689  char *dest, int32_t *pLength,
690  UBool forceCopy,
691  UErrorCode *status);
692 
705 U_STABLE UResourceBundle* U_EXPORT2
706 ures_getByKey(const UResourceBundle *resourceBundle,
707  const char* key,
708  UResourceBundle *fillIn,
709  UErrorCode *status);
710 
723 U_STABLE const UChar* U_EXPORT2
725  const char* key,
726  int32_t* len,
727  UErrorCode *status);
728 
779 U_STABLE const char * U_EXPORT2
781  const char *key,
782  char *dest, int32_t *pLength,
783  UBool forceCopy,
784  UErrorCode *status);
785 
786 #if U_SHOW_CPLUSPLUS_API
787 #include "unicode/unistr.h"
788 
801 inline UnicodeString
802 ures_getUnicodeString(const UResourceBundle *resB,
803  UErrorCode* status)
804 {
805  int32_t len = 0;
806  const UChar *r = ures_getString(resB, &len, status);
807  return UnicodeString(TRUE, r, len);
808 }
809 
820 inline UnicodeString
821 ures_getNextUnicodeString(UResourceBundle *resB,
822  const char ** key,
823  UErrorCode* status)
824 {
825  int32_t len = 0;
826  const UChar* r = ures_getNextString(resB, &len, key, status);
827  return UnicodeString(TRUE, r, len);
828 }
829 
839 inline UnicodeString
840 ures_getUnicodeStringByIndex(const UResourceBundle *resB,
841  int32_t indexS,
842  UErrorCode* status)
843 {
844  int32_t len = 0;
845  const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
846  return UnicodeString(TRUE, r, len);
847 }
848 
859 inline UnicodeString
860 ures_getUnicodeStringByKey(const UResourceBundle *resB,
861  const char* key,
862  UErrorCode* status)
863 {
864  int32_t len = 0;
865  const UChar* r = ures_getStringByKey(resB, key, &len, status);
866  return UnicodeString(TRUE, r, len);
867 }
868 
870 
871 #endif
872 
881 U_STABLE UEnumeration* U_EXPORT2
882 ures_openAvailableLocales(const char *packageName, UErrorCode *status);
883 
884 
885 #endif /*_URES*/
886 /*eof*/