]> git.saurik.com Git - apple/icu.git/blame - icuSources/tools/genrb/reslist.h
ICU-3.13.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
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
32U_CDECL_BEGIN
33
34/* Resource bundle root table */
35struct SRBRoot {
36 char *fLocale;
37 uint32_t fKeyPoint;
38 char *fKeys;
39 int32_t fCount;
40 struct SResource *fRoot;
41};
42
43struct SRBRoot *bundle_open(UErrorCode *status);
44void bundle_write(struct SRBRoot *bundle, const char *outputDir, const char *outputPkg, char *writtenFilename, int writtenFilenameLen, UErrorCode *status);
45
46/* write a java resource file */
47void 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*/
56void 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
59void bundle_close(struct SRBRoot *bundle, UErrorCode *status);
60void bundle_setlocale(struct SRBRoot *bundle, UChar *locale, UErrorCode *status);
61uint16_t bundle_addtag(struct SRBRoot *bundle, const char *tag, UErrorCode *status);
62
63/* Various resource types */
64
65struct SResTable {
66 uint16_t fCount;
67 uint32_t fChildrenSize;
68 struct SResource *fFirst;
69 struct SRBRoot *fRoot;
70};
71
72struct SResource* table_open(struct SRBRoot *bundle, char *tag, UErrorCode *status);
73void table_close(struct SResource *table, UErrorCode *status);
74void table_add(struct SResource *table, struct SResource *res, int linenumber, UErrorCode *status);
75
76struct SResArray {
77 uint32_t fCount;
78 uint32_t fChildrenSize;
79 struct SResource *fFirst;
80 struct SResource *fLast;
81};
82
83struct SResource* array_open(struct SRBRoot *bundle, char *tag, UErrorCode *status);
84void array_close(struct SResource *array, UErrorCode *status);
85void array_add(struct SResource *array, struct SResource *res, UErrorCode *status);
86
87struct SResString {
88 uint32_t fLength;
89 UChar *fChars;
90};
91
92struct SResource *string_open(struct SRBRoot *bundle, char *tag, const UChar *value, int32_t len, UErrorCode *status);
93void string_close(struct SResource *string, UErrorCode *status);
94
95struct SResource *alias_open(struct SRBRoot *bundle, char *tag, UChar *value, int32_t len, UErrorCode *status);
96void alias_close(struct SResource *string, UErrorCode *status);
97
98struct SResIntVector {
99 uint32_t fCount;
100 uint32_t *fArray;
101};
102
103struct SResource* intvector_open(struct SRBRoot *bundle, char *tag, UErrorCode *status);
104void intvector_close(struct SResource *intvector, UErrorCode *status);
105void intvector_add(struct SResource *intvector, int32_t value, UErrorCode *status);
106
107struct SResInt {
108 uint32_t fValue;
109};
110
111struct SResource *int_open(struct SRBRoot *bundle, char *tag, int32_t value, UErrorCode *status);
112void int_close(struct SResource *intres, UErrorCode *status);
113
114struct SResBinary {
115 uint32_t fLength;
116 uint8_t *fData;
117 char* fFileName; /* file name for binary or import binary tags if any */
118};
119
120struct SResource *bin_open(struct SRBRoot *bundle, const char *tag, uint32_t length, uint8_t *data, const char* fileName, UErrorCode *status);
121void bin_close(struct SResource *binres, UErrorCode *status);
122
123/* Resource place holder */
124
125struct 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
141void res_close(struct SResource *res, UErrorCode *status);
142void setIncludeCopyright(UBool val);
143UBool getIncludeCopyright(void);
144
145U_CDECL_END
146#endif /* #ifndef RESLIST_H */