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