]> git.saurik.com Git - apple/icu.git/blame - icuSources/tools/genrb/reslist.h
ICU-8.11.1.tar.gz
[apple/icu.git] / icuSources / tools / genrb / reslist.h
CommitLineData
b75a7d8f
A
1/*
2*******************************************************************************
3*
73c04bcf 4* Copyright (C) 2000-2006, International Business Machines
b75a7d8f
A
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
374ca955 21#define KEY_SPACE_SIZE 65536
b75a7d8f
A
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"
374ca955 31#include "ustr.h"
b75a7d8f
A
32
33U_CDECL_BEGIN
34
35/* Resource bundle root table */
36struct SRBRoot {
37 char *fLocale;
374ca955 38 int32_t fKeyPoint;
b75a7d8f 39 char *fKeys;
374ca955 40 int32_t fKeysCapacity;
b75a7d8f 41 int32_t fCount;
374ca955
A
42 struct SResource *fRoot;
43 int32_t fMaxTableLength;
73c04bcf 44 UBool noFallback; /* see URES_ATT_NO_FALLBACK */
b75a7d8f
A
45};
46
374ca955 47struct SRBRoot *bundle_open(const struct UString* comment, UErrorCode *status);
b75a7d8f
A
48void bundle_write(struct SRBRoot *bundle, const char *outputDir, const char *outputPkg, char *writtenFilename, int writtenFilenameLen, UErrorCode *status);
49
50/* write a java resource file */
51void bundle_write_java(struct SRBRoot *bundle, const char *outputDir, const char* outputEnc, char *writtenFilename,
52 int writtenFilenameLen, const char* packageName, const char* bundleName, UErrorCode *status);
53
54/* write a xml resource file */
55/* commented by Jing*/
56/* void bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outputEnc,
57 char *writtenFilename, int writtenFilenameLen,UErrorCode *status); */
58
59/* added by Jing*/
60void bundle_write_xml(struct SRBRoot *bundle, const char *outputDir,const char* outputEnc, const char* rbname,
61 char *writtenFilename, int writtenFilenameLen, const char* language, const char* package, UErrorCode *status);
62
63void bundle_close(struct SRBRoot *bundle, UErrorCode *status);
64void bundle_setlocale(struct SRBRoot *bundle, UChar *locale, UErrorCode *status);
374ca955 65int32_t bundle_addtag(struct SRBRoot *bundle, const char *tag, UErrorCode *status);
b75a7d8f
A
66
67/* Various resource types */
374ca955 68struct SResource* res_open(const struct UString* comment, UErrorCode* status);
b75a7d8f
A
69
70struct SResTable {
374ca955 71 uint32_t fCount;
b75a7d8f
A
72 uint32_t fChildrenSize;
73 struct SResource *fFirst;
74 struct SRBRoot *fRoot;
75};
76
374ca955 77struct SResource* table_open(struct SRBRoot *bundle, char *tag, const struct UString* comment, UErrorCode *status);
b75a7d8f
A
78void table_close(struct SResource *table, UErrorCode *status);
79void table_add(struct SResource *table, struct SResource *res, int linenumber, UErrorCode *status);
80
81struct SResArray {
82 uint32_t fCount;
83 uint32_t fChildrenSize;
84 struct SResource *fFirst;
85 struct SResource *fLast;
86};
87
73c04bcf 88struct SResource* array_open(struct SRBRoot *bundle, const char *tag, const struct UString* comment, UErrorCode *status);
b75a7d8f
A
89void array_close(struct SResource *array, UErrorCode *status);
90void array_add(struct SResource *array, struct SResource *res, UErrorCode *status);
91
92struct SResString {
93 uint32_t fLength;
94 UChar *fChars;
95};
96
374ca955 97struct SResource *string_open(struct SRBRoot *bundle, char *tag, const UChar *value, int32_t len, const struct UString* comment, UErrorCode *status);
b75a7d8f
A
98void string_close(struct SResource *string, UErrorCode *status);
99
374ca955 100struct SResource *alias_open(struct SRBRoot *bundle, char *tag, UChar *value, int32_t len, const struct UString* comment, UErrorCode *status);
b75a7d8f
A
101void alias_close(struct SResource *string, UErrorCode *status);
102
103struct SResIntVector {
104 uint32_t fCount;
105 uint32_t *fArray;
106};
107
374ca955 108struct SResource* intvector_open(struct SRBRoot *bundle, char *tag, const struct UString* comment, UErrorCode *status);
b75a7d8f
A
109void intvector_close(struct SResource *intvector, UErrorCode *status);
110void intvector_add(struct SResource *intvector, int32_t value, UErrorCode *status);
111
112struct SResInt {
113 uint32_t fValue;
114};
115
374ca955 116struct SResource *int_open(struct SRBRoot *bundle, char *tag, int32_t value, const struct UString* comment, UErrorCode *status);
b75a7d8f
A
117void int_close(struct SResource *intres, UErrorCode *status);
118
119struct SResBinary {
120 uint32_t fLength;
121 uint8_t *fData;
122 char* fFileName; /* file name for binary or import binary tags if any */
123};
124
374ca955 125struct SResource *bin_open(struct SRBRoot *bundle, const char *tag, uint32_t length, uint8_t *data, const char* fileName, const struct UString* comment, UErrorCode *status);
b75a7d8f
A
126void bin_close(struct SResource *binres, UErrorCode *status);
127
128/* Resource place holder */
129
130struct SResource {
131 UResType fType;
374ca955 132 int32_t fKey;
b75a7d8f
A
133 uint32_t fSize; /* Size in bytes outside the header part */
134 int line; /* used internally to report duplicate keys in tables */
135 struct SResource *fNext; /*This is for internal chaining while building*/
374ca955 136 struct UString *fComment;
b75a7d8f
A
137 union {
138 struct SResTable fTable;
139 struct SResArray fArray;
140 struct SResString fString;
141 struct SResIntVector fIntVector;
142 struct SResInt fIntValue;
143 struct SResBinary fBinaryValue;
144 } u;
145};
146
147void res_close(struct SResource *res, UErrorCode *status);
148void setIncludeCopyright(UBool val);
149UBool getIncludeCopyright(void);
150
151U_CDECL_END
152#endif /* #ifndef RESLIST_H */