ICU 4.8.1.1  4.8.1.1
 All Data Structures 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-2010, 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 
161 ures_open(const char* packageName,
162  const char* locale,
163  UErrorCode* status);
164 
165 
184 ures_openDirect(const char* packageName,
185  const char* locale,
186  UErrorCode* status);
187 
207 ures_openU(const UChar* packageName,
208  const char* locale,
209  UErrorCode* status);
210 
227 U_DEPRECATED int32_t U_EXPORT2
228 ures_countArrayItems(const UResourceBundle* resourceBundle,
229  const char* resourceKey,
230  UErrorCode* err);
239 U_STABLE void U_EXPORT2
240 ures_close(UResourceBundle* resourceBundle);
241 
242 #if U_SHOW_CPLUSPLUS_API
243 
245 
255 U_DEFINE_LOCAL_OPEN_POINTER(LocalUResourceBundlePointer, UResourceBundle, ures_close);
256 
258 
259 #endif
260 
271 U_DEPRECATED const char* U_EXPORT2
272 ures_getVersionNumber(const UResourceBundle* resourceBundle);
273 
283 U_STABLE void U_EXPORT2
284 ures_getVersion(const UResourceBundle* resB,
285  UVersionInfo versionInfo);
286 
299 U_DEPRECATED const char* U_EXPORT2
300 ures_getLocale(const UResourceBundle* resourceBundle,
301  UErrorCode* status);
302 
303 
316 U_STABLE const char* U_EXPORT2
317 ures_getLocaleByType(const UResourceBundle* resourceBundle,
318  ULocDataLocaleType type,
319  UErrorCode* status);
320 
321 
338 U_INTERNAL void U_EXPORT2
340  const char* packageName,
341  const char* localeID,
342  UErrorCode* status);
343 
361 U_STABLE const UChar* U_EXPORT2
362 ures_getString(const UResourceBundle* resourceBundle,
363  int32_t* len,
364  UErrorCode* status);
365 
413 U_STABLE const char * U_EXPORT2
415  char *dest, int32_t *length,
416  UBool forceCopy,
417  UErrorCode *status);
418 
436 U_STABLE const uint8_t* U_EXPORT2
437 ures_getBinary(const UResourceBundle* resourceBundle,
438  int32_t* len,
439  UErrorCode* status);
440 
458 U_STABLE const int32_t* U_EXPORT2
459 ures_getIntVector(const UResourceBundle* resourceBundle,
460  int32_t* len,
461  UErrorCode* status);
462 
479 U_STABLE uint32_t U_EXPORT2
480 ures_getUInt(const UResourceBundle* resourceBundle,
481  UErrorCode *status);
482 
499 U_STABLE int32_t U_EXPORT2
500 ures_getInt(const UResourceBundle* resourceBundle,
501  UErrorCode *status);
502 
513 U_STABLE int32_t U_EXPORT2
514 ures_getSize(const UResourceBundle *resourceBundle);
515 
525 ures_getType(const UResourceBundle *resourceBundle);
526 
535 U_STABLE const char * U_EXPORT2
536 ures_getKey(const UResourceBundle *resourceBundle);
537 
538 /* ITERATION API
539  This API provides means for iterating through a resource
540 */
541 
548 U_STABLE void U_EXPORT2
549 ures_resetIterator(UResourceBundle *resourceBundle);
550 
559 ures_hasNext(const UResourceBundle *resourceBundle);
560 
574 ures_getNextResource(UResourceBundle *resourceBundle,
575  UResourceBundle *fillIn,
576  UErrorCode *status);
577 
590 U_STABLE const UChar* U_EXPORT2
591 ures_getNextString(UResourceBundle *resourceBundle,
592  int32_t* len,
593  const char ** key,
594  UErrorCode *status);
595 
609 ures_getByIndex(const UResourceBundle *resourceBundle,
610  int32_t indexR,
611  UResourceBundle *fillIn,
612  UErrorCode *status);
613 
625 U_STABLE const UChar* U_EXPORT2
626 ures_getStringByIndex(const UResourceBundle *resourceBundle,
627  int32_t indexS,
628  int32_t* len,
629  UErrorCode *status);
630 
679 U_STABLE const char * U_EXPORT2
681  int32_t stringIndex,
682  char *dest, int32_t *pLength,
683  UBool forceCopy,
684  UErrorCode *status);
685 
699 ures_getByKey(const UResourceBundle *resourceBundle,
700  const char* key,
701  UResourceBundle *fillIn,
702  UErrorCode *status);
703 
716 U_STABLE const UChar* U_EXPORT2
718  const char* key,
719  int32_t* len,
720  UErrorCode *status);
721 
772 U_STABLE const char * U_EXPORT2
774  const char *key,
775  char *dest, int32_t *pLength,
776  UBool forceCopy,
777  UErrorCode *status);
778 
779 #if U_SHOW_CPLUSPLUS_API
780 #include "unicode/unistr.h"
781 
794 inline UnicodeString
795 ures_getUnicodeString(const UResourceBundle *resB,
796  UErrorCode* status)
797 {
798  int32_t len = 0;
799  const UChar *r = ures_getString(resB, &len, status);
800  return UnicodeString(TRUE, r, len);
801 }
802 
813 inline UnicodeString
814 ures_getNextUnicodeString(UResourceBundle *resB,
815  const char ** key,
816  UErrorCode* status)
817 {
818  int32_t len = 0;
819  const UChar* r = ures_getNextString(resB, &len, key, status);
820  return UnicodeString(TRUE, r, len);
821 }
822 
832 inline UnicodeString
833 ures_getUnicodeStringByIndex(const UResourceBundle *resB,
834  int32_t indexS,
835  UErrorCode* status)
836 {
837  int32_t len = 0;
838  const UChar* r = ures_getStringByIndex(resB, indexS, &len, status);
839  return UnicodeString(TRUE, r, len);
840 }
841 
852 inline UnicodeString
853 ures_getUnicodeStringByKey(const UResourceBundle *resB,
854  const char* key,
855  UErrorCode* status)
856 {
857  int32_t len = 0;
858  const UChar* r = ures_getStringByKey(resB, key, &len, status);
859  return UnicodeString(TRUE, r, len);
860 }
861 
863 
864 #endif
865 
875 ures_openAvailableLocales(const char *packageName, UErrorCode *status);
876 
877 
878 #endif /*_URES*/
879 /*eof*/