]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /* |
2 | ******************************************************************************* | |
3 | * | |
4 | * Copyright (C) 2000-2003, International Business Machines | |
5 | * Corporation and others. All Rights Reserved. | |
6 | * | |
7 | ******************************************************************************* | |
8 | * | |
9 | * File reslist.h | |
10 | * | |
11 | * Modification History: | |
12 | * | |
13 | * Date Name Description | |
14 | * 02/21/00 weiv Creation. | |
15 | ******************************************************************************* | |
16 | */ | |
17 | ||
18 | #ifndef RESLIST_H | |
19 | #define RESLIST_H | |
20 | ||
21 | #define KEY_SPACE_SIZE 65532 | |
22 | #define RESLIST_MAX_INT_VECTOR 2048 | |
23 | ||
24 | #include "unicode/utypes.h" | |
25 | #include "unicode/ures.h" | |
26 | #include "unicode/ustring.h" | |
27 | #include "uresdata.h" | |
28 | #include "cmemory.h" | |
29 | #include "cstring.h" | |
30 | #include "unewdata.h" | |
31 | ||
32 | U_CDECL_BEGIN | |
33 | ||
34 | /* Resource bundle root table */ | |
35 | struct SRBRoot { | |
36 | char *fLocale; | |
37 | uint32_t fKeyPoint; | |
38 | char *fKeys; | |
39 | int32_t fCount; | |
40 | struct SResource *fRoot; | |
41 | }; | |
42 | ||
43 | struct SRBRoot *bundle_open(UErrorCode *status); | |
44 | void bundle_write(struct SRBRoot *bundle, const char *outputDir, const char *outputPkg, char *writtenFilename, int writtenFilenameLen, UErrorCode *status); | |
45 | ||
46 | /* write a java resource file */ | |
47 | void bundle_write_java(struct SRBRoot *bundle, const char *outputDir, const char* outputEnc, char *writtenFilename, | |
48 | int writtenFilenameLen, const char* packageName, const char* bundleName, UErrorCode *status); | |
49 | ||
50 | /* write a xml resource file */ | |
51 | /* commented by Jing*/ | |
52 | /* void bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outputEnc, | |
53 | char *writtenFilename, int writtenFilenameLen,UErrorCode *status); */ | |
54 | ||
55 | /* added by Jing*/ | |
56 | void bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outputEnc, const char* rbname, | |
57 | char *writtenFilename, int writtenFilenameLen, const char* language, const char* package, UErrorCode *status); | |
58 | ||
59 | void bundle_close(struct SRBRoot *bundle, UErrorCode *status); | |
60 | void bundle_setlocale(struct SRBRoot *bundle, UChar *locale, UErrorCode *status); | |
61 | uint16_t bundle_addtag(struct SRBRoot *bundle, const char *tag, UErrorCode *status); | |
62 | ||
63 | /* Various resource types */ | |
64 | ||
65 | struct SResTable { | |
66 | uint16_t fCount; | |
67 | uint32_t fChildrenSize; | |
68 | struct SResource *fFirst; | |
69 | struct SRBRoot *fRoot; | |
70 | }; | |
71 | ||
72 | struct SResource* table_open(struct SRBRoot *bundle, char *tag, UErrorCode *status); | |
73 | void table_close(struct SResource *table, UErrorCode *status); | |
74 | void table_add(struct SResource *table, struct SResource *res, int linenumber, UErrorCode *status); | |
75 | ||
76 | struct SResArray { | |
77 | uint32_t fCount; | |
78 | uint32_t fChildrenSize; | |
79 | struct SResource *fFirst; | |
80 | struct SResource *fLast; | |
81 | }; | |
82 | ||
83 | struct SResource* array_open(struct SRBRoot *bundle, char *tag, UErrorCode *status); | |
84 | void array_close(struct SResource *array, UErrorCode *status); | |
85 | void array_add(struct SResource *array, struct SResource *res, UErrorCode *status); | |
86 | ||
87 | struct SResString { | |
88 | uint32_t fLength; | |
89 | UChar *fChars; | |
90 | }; | |
91 | ||
92 | struct SResource *string_open(struct SRBRoot *bundle, char *tag, const UChar *value, int32_t len, UErrorCode *status); | |
93 | void string_close(struct SResource *string, UErrorCode *status); | |
94 | ||
95 | struct SResource *alias_open(struct SRBRoot *bundle, char *tag, UChar *value, int32_t len, UErrorCode *status); | |
96 | void alias_close(struct SResource *string, UErrorCode *status); | |
97 | ||
98 | struct SResIntVector { | |
99 | uint32_t fCount; | |
100 | uint32_t *fArray; | |
101 | }; | |
102 | ||
103 | struct SResource* intvector_open(struct SRBRoot *bundle, char *tag, UErrorCode *status); | |
104 | void intvector_close(struct SResource *intvector, UErrorCode *status); | |
105 | void intvector_add(struct SResource *intvector, int32_t value, UErrorCode *status); | |
106 | ||
107 | struct SResInt { | |
108 | uint32_t fValue; | |
109 | }; | |
110 | ||
111 | struct SResource *int_open(struct SRBRoot *bundle, char *tag, int32_t value, UErrorCode *status); | |
112 | void int_close(struct SResource *intres, UErrorCode *status); | |
113 | ||
114 | struct SResBinary { | |
115 | uint32_t fLength; | |
116 | uint8_t *fData; | |
117 | char* fFileName; /* file name for binary or import binary tags if any */ | |
118 | }; | |
119 | ||
120 | struct SResource *bin_open(struct SRBRoot *bundle, const char *tag, uint32_t length, uint8_t *data, const char* fileName, UErrorCode *status); | |
121 | void bin_close(struct SResource *binres, UErrorCode *status); | |
122 | ||
123 | /* Resource place holder */ | |
124 | ||
125 | struct SResource { | |
126 | UResType fType; | |
127 | uint16_t fKey; | |
128 | uint32_t fSize; /* Size in bytes outside the header part */ | |
129 | int line; /* used internally to report duplicate keys in tables */ | |
130 | struct SResource *fNext; /*This is for internal chaining while building*/ | |
131 | union { | |
132 | struct SResTable fTable; | |
133 | struct SResArray fArray; | |
134 | struct SResString fString; | |
135 | struct SResIntVector fIntVector; | |
136 | struct SResInt fIntValue; | |
137 | struct SResBinary fBinaryValue; | |
138 | } u; | |
139 | }; | |
140 | ||
141 | void res_close(struct SResource *res, UErrorCode *status); | |
142 | void setIncludeCopyright(UBool val); | |
143 | UBool getIncludeCopyright(void); | |
144 | ||
145 | U_CDECL_END | |
146 | #endif /* #ifndef RESLIST_H */ |