2
******************************************************************************
4
* Copyright (C) 1999-2001, International Business Machines *
5
* Corporation and others. All Rights Reserved. *
7
******************************************************************************
8
* file name: uresdata.h
10
* tab size: 8 (not used)
13
* created on: 1999dec08
14
* created by: Markus W. Scherer
20
#include "unicode/utypes.h"
21
#include "unicode/udata.h"
24
* A Resource is a 32-bit value that has 2 bit fields:
25
* 31..28 4-bit type, see enum below
26
* 27..0 28-bit four-byte-offset or value according to the type
28
typedef uint32_t Resource;
30
#define RES_BOGUS 0xffffffff
32
#define RES_GET_TYPE(res) ((res)>>28UL)
33
#define RES_GET_OFFSET(res) ((res)&0x0fffffff)
34
#define RES_GET_POINTER(pRoot, res) ((pRoot)+RES_GET_OFFSET(res))
36
/* get signed and unsigned integer values directly from the Resource handle */
37
#define RES_GET_INT(res) (((int32_t)((res)<<4L))>>4L)
38
#define RES_GET_UINT(res) ((res)&0x0fffffff)
42
* Most resources have their values stored at four-byte offsets from the start
43
* of the resource data. These values are at least 4-aligned.
44
* Some resource values are stored directly in the offset field of the Resource itself.
46
* Type Name Memory layout of values
47
* (in parentheses: scalar, non-offset values)
49
* 0 Unicode String: int32_t length, UChar[length], (UChar)0, (padding)
50
* or (empty string ("") if offset==0)
51
* 1 Binary: int32_t length, uint8_t[length], (padding)
52
* - this value should be 32-aligned -
53
* 2 Table: uint16_t count, uint16_t keyStringOffsets[count], (uint16_t padding), Resource[count]
55
* 7 Integer: (28-bit offset is integer value)
56
* 8 Array: int32_t count, Resource[count]
58
* 14 Integer Vector: int32_t length, int32_t[length]
59
* 15 Reserved: This value denotes special purpose resources and is for internal use.
64
* Structure for a single, memory-mapped ResourceBundle.
73
* Load a resource bundle file.
74
* The ResourceData structure must be allocated externally.
77
res_load(ResourceData *pResData,
78
const char *path, const char *name, UErrorCode *errorCode);
81
* Release a resource bundle file.
82
* This does not release the ResourceData structure itself.
85
res_unload(ResourceData *pResData);
88
* Return a pointer to a zero-terminated, const UChar* string
89
* and set its length in *pLength.
90
* Returns NULL if not found.
93
res_getString(const ResourceData *pResData, const Resource res, int32_t *pLength);
95
U_CFUNC const uint8_t *
96
res_getBinary(const ResourceData *pResData, const Resource res, int32_t *pLength);
98
U_CFUNC const int32_t *
99
res_getIntVector(const ResourceData *pResData, const Resource res, int32_t *pLength);
102
res_getResource(const ResourceData *pResData, const char *key);
105
res_countArrayItems(const ResourceData *pResData, const Resource res);
107
U_CFUNC int32_t res_getTableSize(const ResourceData *pResData, Resource table);
109
U_CFUNC Resource res_getArrayItem(const ResourceData *pResData, const Resource array, const int32_t indexS);
110
U_CFUNC Resource res_getTableItemByIndex(const ResourceData *pResData, const Resource table, int32_t indexS, const char ** key);
111
U_CFUNC Resource res_getTableItemByKey(const ResourceData *pResData, const Resource table, int32_t *indexS, const char* * key);