00001 #ifndef URESIMP_H
00002 #define URESIMP_H
00003
00004 #include "unicode/ures.h"
00005
00006 #include "unicode/uloc.h"
00007 #include "unicode/ustring.h"
00008 #include "cmemory.h"
00009 #include "cstring.h"
00010 #include "uresdata.h"
00011 #include "uhash.h"
00012 #include "umutex.h"
00013
00014 #define kRootLocaleName "root"
00015 #define kIndexLocaleName "index"
00016 #define kIndexTag "InstalledLocales"
00017
00018
00019
00020
00021
00022
00023 #define kDefaultMinorVersion "0"
00024 #define kVersionSeparator "."
00025 #define kVersionTag "Version"
00026
00027 #define MAGIC1 19700503
00028 #define MAGIC2 19641227
00029
00030
00031 enum UResEntryType {
00032 ENTRY_OK = 0,
00033 ENTRY_GOTO_ROOT = 1,
00034 ENTRY_GOTO_DEFAULT = 2,
00035 ENTRY_INVALID = 3
00036 };
00037
00038 typedef enum UResEntryType UResEntryType;
00039
00040 struct UResourceDataEntry;
00041 typedef struct UResourceDataEntry UResourceDataEntry;
00042
00043 struct UResourceDataEntry {
00044 char *fName;
00045 char *fPath;
00046 uint32_t fCountExisting;
00047 ResourceData fData;
00048 UResourceDataEntry *fParent;
00049 UResEntryType fStatus;
00050 UErrorCode fBogus;
00051 int32_t fHashKey;
00052 };
00053
00054 struct UResourceBundle {
00055 const char *fKey;
00056 char *fVersion;
00057 UBool fHasFallback;
00058 UBool fIsTopLevel;
00059 uint32_t fMagic1;
00060 uint32_t fMagic2;
00061
00062 UResourceDataEntry *fData;
00063 int32_t fIndex;
00064 int32_t fSize;
00065 ResourceData fResData;
00066 Resource fRes;
00067 };
00068
00069 U_CFUNC UResourceBundle* ures_openNoFallback(const char* path, const char* localeID, UErrorCode* status);
00070 U_CFUNC const char* ures_getRealLocale(const UResourceBundle* resourceBundle, UErrorCode* status);
00071 U_CAPI void ures_setIsStackObject( UResourceBundle* resB, UBool state);
00072 U_CAPI UBool ures_isStackObject( UResourceBundle* resB, UErrorCode *status);
00073
00074 U_CFUNC const ResourceData *getFallbackData(const UResourceBundle* resBundle, const char* * resTag, UResourceDataEntry* *realData, Resource *res, UErrorCode *status);
00075 U_CFUNC int32_t hashBundle(const void *parm);
00076 U_CFUNC UBool compareBundles(const void *p1, const void *p2);
00077
00078
00079 U_CFUNC UResourceBundle *copyResb(UResourceBundle *r, const UResourceBundle *original, UErrorCode *status);
00080 U_CFUNC const ResourceData * ures_getResData(const UResourceBundle* resB);
00081 #endif