|
1 /* |
|
2 * Copyright (c) 2000 - 2001 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /** ----------------------------------------------------------------------- ** |
|
20 @package: NW_WBXML |
|
21 |
|
22 @synopsis: default |
|
23 |
|
24 @description: Wbxml token definitions |
|
25 |
|
26 ** ----------------------------------------------------------------------- **/ |
|
27 |
|
28 /* ----------------------------------------------------------------------- ** |
|
29 Definitions for the WBXML parser's reader |
|
30 ** ----------------------------------------------------------------------- **/ |
|
31 |
|
32 #ifndef NW_PARSER_WBXML_READER_H |
|
33 #define NW_PARSER_WBXML_READER_H |
|
34 |
|
35 #include "cxml_proj.h" |
|
36 #include "nw_wbxml_document.h" |
|
37 #include "nw_wbxml_opaque.h" |
|
38 #include "nw_wbxml_parse.h" |
|
39 |
|
40 #ifdef __cplusplus |
|
41 extern "C" { |
|
42 #endif /* __cplusplus */ |
|
43 |
|
44 |
|
45 /* The "parser-reader" interface */ |
|
46 |
|
47 /** ----------------------------------------------------------------------- ** |
|
48 @function: NW_WBXML_Parser_advance |
|
49 |
|
50 @synopsis: Advance parser. |
|
51 |
|
52 @scope: public |
|
53 |
|
54 @parameters: |
|
55 [in-out] NW_WBXML_Parser_t parser* parser |
|
56 The parser. |
|
57 |
|
58 [in] NW_Int32 count |
|
59 Amount to advance the parser. |
|
60 |
|
61 @description: Safely advance the parser through bytecode. The functions |
|
62 which read values from the parser don't advance the parser |
|
63 since this may not be necessary or safe (e.g. when reading |
|
64 the last data item.). |
|
65 |
|
66 @returns: NW_Int32 |
|
67 Amount advanced or -1 if out of range. |
|
68 |
|
69 ** ----------------------------------------------------------------------- **/ |
|
70 NW_Int32 |
|
71 NW_WBXML_Parser_advance (NW_WBXML_Parser_t* parser, |
|
72 NW_Int32 count); |
|
73 |
|
74 |
|
75 /** ----------------------------------------------------------------------- ** |
|
76 @function: NW_WBXML_Parser_hasMoreBytecode |
|
77 |
|
78 @synopsis: Check if there is more NW_Byte code to read. |
|
79 @scope: public |
|
80 |
|
81 @parameters: |
|
82 [in] NW_WBXML_Parser_t* parser |
|
83 The parser. |
|
84 |
|
85 @description: Check if there is more NW_Byte code to read. |
|
86 |
|
87 @returns: NW_Int32 |
|
88 1 if more left otherwise 0. |
|
89 |
|
90 ** ----------------------------------------------------------------------- **/ |
|
91 NW_Int32 |
|
92 NW_WBXML_Parser_hasMoreBytecode (NW_WBXML_Parser_t* parser); |
|
93 |
|
94 |
|
95 /** ----------------------------------------------------------------------- ** |
|
96 @function: NW_WBXML_Parser_readUint8 |
|
97 |
|
98 @synopsis: Read 8 bit unsigned integer. |
|
99 |
|
100 @scope: public |
|
101 |
|
102 @parameters: |
|
103 [in-out] NW_WBXML_Parser_t* parser |
|
104 The parser. |
|
105 |
|
106 @description: Read 8 bit unsigned integer. |
|
107 |
|
108 @returns: NW_Uint8 |
|
109 The integer. |
|
110 |
|
111 ** ----------------------------------------------------------------------- **/ |
|
112 NW_Uint8 |
|
113 NW_WBXML_Parser_readUint8 (NW_WBXML_Parser_t* parser); |
|
114 |
|
115 |
|
116 /** ----------------------------------------------------------------------- ** |
|
117 @function: NW_WBXML_Parser_readMbUint32 |
|
118 |
|
119 @synopsis: Read 32 bit unsigned integer. |
|
120 |
|
121 @scope: public |
|
122 |
|
123 @parameters: |
|
124 [in-out] NW_WBXML_Parser_t* parser |
|
125 The parser. |
|
126 |
|
127 [in] NW_Uint32* val |
|
128 The value. |
|
129 |
|
130 @description: Read 32 bit unsigned integer. |
|
131 |
|
132 @returns: NW_Int32 |
|
133 Number of bytes read or -1 if failed.. |
|
134 |
|
135 ** ----------------------------------------------------------------------- **/ |
|
136 NW_Int32 |
|
137 NW_WBXML_Parser_readMbUint32 (NW_WBXML_Parser_t* parser, |
|
138 NW_Uint32* val); |
|
139 |
|
140 |
|
141 /** ----------------------------------------------------------------------- ** |
|
142 @function: NW_WBXML_Parser_getInlineStrLen |
|
143 |
|
144 @synopsis: Get inline string length. |
|
145 |
|
146 @scope: public |
|
147 |
|
148 @parameters: |
|
149 [in] NW_WBXML_Parser_t* parser |
|
150 The parser. |
|
151 |
|
152 [in] NW_WBXML_Document_t* doc |
|
153 The document. |
|
154 |
|
155 @description: Safely get the length of an inline string at current |
|
156 parser position. |
|
157 |
|
158 @returns: NW_Int32 |
|
159 Number of bytes read or -1 if failed. |
|
160 |
|
161 ** ----------------------------------------------------------------------- **/ |
|
162 NW_Int32 |
|
163 NW_WBXML_Parser_getInlineStrLen (NW_WBXML_Parser_t* parser, |
|
164 NW_WBXML_Document_t* doc); |
|
165 |
|
166 |
|
167 /** ----------------------------------------------------------------------- ** |
|
168 @function: NW_WBXML_Parser_getStringInline |
|
169 |
|
170 @synopsis: Get inline string. |
|
171 |
|
172 @scope: public |
|
173 |
|
174 @parameters: |
|
175 [in-out] NW_WBXML_Parser_t* parser |
|
176 The parser. |
|
177 |
|
178 [in] NW_WBXML_Document_t* doc |
|
179 The document. |
|
180 |
|
181 [out] NW_String_t* s |
|
182 The returned string.default |
|
183 |
|
184 @description: Safely read an inline string at the current parser position. |
|
185 |
|
186 @returns: NW_Status_t |
|
187 Status of operation. |
|
188 |
|
189 [NW_STAT_SUCCESS] |
|
190 String read. |
|
191 |
|
192 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
193 Read error. |
|
194 |
|
195 ** ----------------------------------------------------------------------- **/ |
|
196 IMPORT_C NW_Status_t |
|
197 NW_WBXML_Parser_getStringInline(NW_WBXML_Parser_t* parser, |
|
198 NW_WBXML_Document_t* doc, |
|
199 NW_String_t* s); |
|
200 |
|
201 |
|
202 /** ----------------------------------------------------------------------- ** |
|
203 @function: NW_WBXML_Parser_getOpaque |
|
204 |
|
205 @synopsis: Get opaque. |
|
206 |
|
207 @scope: public |
|
208 |
|
209 @parameters: |
|
210 [in-out] NW_WBXML_Parser_t* parser |
|
211 The parser. |
|
212 |
|
213 [in] NW_Uint32 length |
|
214 Maximum nuber of bytes to read. |
|
215 |
|
216 [out] NW_WBXML_Opaque_t* o |
|
217 Opaque storage. |
|
218 |
|
219 @description: Safely get an opaque at the current parser position. |
|
220 |
|
221 @returns: NW_Status_t |
|
222 Status of operation. |
|
223 |
|
224 [NW_STAT_SUCCESS] |
|
225 Always returns success. |
|
226 |
|
227 ** ----------------------------------------------------------------------- **/ |
|
228 IMPORT_C NW_Status_t |
|
229 NW_WBXML_Parser_getOpaque(NW_WBXML_Parser_t* parser, |
|
230 NW_Uint32 length, |
|
231 NW_WBXML_Opaque_t* o); |
|
232 |
|
233 |
|
234 /** ----------------------------------------------------------------------- ** |
|
235 @function: NW_WBXML_Parser_readStringTable |
|
236 |
|
237 @synopsis: Read string table. |
|
238 |
|
239 @scope: public |
|
240 |
|
241 @parameters: |
|
242 [in-out] NW_WBXML_Parser_t* parser |
|
243 The parser. |
|
244 |
|
245 [in] NW_WBXML_Document_t* doc |
|
246 The document. |
|
247 |
|
248 [out] NW_Byte** table |
|
249 The loaded table. |
|
250 |
|
251 @description: Read in the string table. |
|
252 |
|
253 @returns: NW_Status_t |
|
254 Status of operation. |
|
255 |
|
256 [NW_STAT_SUCCESS] |
|
257 String table read. |
|
258 |
|
259 [NW_STAT_WBXML_ERROR_BYTECODE] |
|
260 Read error. |
|
261 |
|
262 ** ----------------------------------------------------------------------- **/ |
|
263 NW_Status_t |
|
264 NW_WBXML_Parser_readStringTable(NW_WBXML_Parser_t* parser, |
|
265 NW_WBXML_Document_t* doc, |
|
266 NW_Byte** table); |
|
267 |
|
268 |
|
269 #ifdef __cplusplus |
|
270 } /* extern "C" { */ |
|
271 #endif /* __cplusplus */ |
|
272 |
|
273 #endif /* NW_PARSER_WBXML_READER_H */ |