00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __RESDATA_H__
00018 #define __RESDATA_H__
00019
00020 #include "unicode/utypes.h"
00021 #include "unicode/udata.h"
00022
00023
00024
00025
00026
00027
00028 typedef uint32_t Resource;
00029
00030 #define RES_BOGUS 0xffffffff
00031
00032 #define RES_GET_TYPE(res) ((res)>>28UL)
00033 #define RES_GET_OFFSET(res) ((res)&0x0fffffff)
00034 #define RES_GET_POINTER(pRoot, res) ((pRoot)+RES_GET_OFFSET(res))
00035
00036
00037 #define RES_GET_INT(res) (((int32_t)((res)<<4L))>>4L)
00038 #define RES_GET_UINT(res) ((res)&0x0fffffff)
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 typedef struct {
00067 UDataMemory *data;
00068 Resource *pRoot;
00069 Resource rootRes;
00070 } ResourceData;
00071
00072
00073
00074
00075
00076 U_CFUNC UBool
00077 res_load(ResourceData *pResData,
00078 const char *path, const char *name, UErrorCode *errorCode);
00079
00080
00081
00082
00083
00084 U_CFUNC void
00085 res_unload(ResourceData *pResData);
00086
00087
00088
00089
00090
00091
00092 U_CFUNC const UChar *
00093 res_getString(const ResourceData *pResData, const Resource res, int32_t *pLength);
00094
00095 U_CFUNC const uint8_t *
00096 res_getBinary(const ResourceData *pResData, const Resource res, int32_t *pLength);
00097
00098 U_CFUNC Resource
00099 res_getResource(const ResourceData *pResData, const char *key);
00100
00101 U_CFUNC int32_t
00102 res_countArrayItems(const ResourceData *pResData, const Resource res);
00103
00104 U_CFUNC void
00105 res_getNextStringTableItem(const ResourceData *pResData, Resource table,
00106 const UChar **value, const char **key, int32_t *len,
00107 int16_t *indexS);
00108 U_CFUNC int32_t res_getTableSize(const ResourceData *pResData, Resource table);
00109
00110 U_CFUNC Resource res_getArrayItem(const ResourceData *pResData, const Resource array, const int32_t indexS);
00111 U_CFUNC Resource res_getTableItemByIndex(const ResourceData *pResData, const Resource table, int32_t indexS, const char ** key);
00112 U_CFUNC Resource res_getTableItemByKey(const ResourceData *pResData, const Resource table, int32_t *indexS, const char* * key);
00113
00114 #endif