|
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_XML |
|
21 |
|
22 @synopsis: default |
|
23 |
|
24 @description: default |
|
25 |
|
26 ** ----------------------------------------------------------------------- **/ |
|
27 |
|
28 #ifndef NW_XML_READER_H |
|
29 #define NW_XML_READER_H |
|
30 |
|
31 #include <xml/cxml/cxml_proj.h> |
|
32 /** ----------------------------------------------------------------------- ** |
|
33 @enum: NW_XML_Endianness |
|
34 |
|
35 @synopsis: Endian indication. |
|
36 |
|
37 @scope: public |
|
38 @names: |
|
39 [NW_NATIVE_ENDIAN] |
|
40 Use native endianness. |
|
41 |
|
42 [NW_BIG_ENDIAN] |
|
43 The leftmost bytes (those with a lower address) are |
|
44 most significant. |
|
45 |
|
46 [NW_LITTLE_ENDIAN] |
|
47 The rightmost bytes (those with a higher address) are |
|
48 most significant |
|
49 |
|
50 @description: Endian indication. |
|
51 ** ----------------------------------------------------------------------- **/ |
|
52 typedef enum NW_XML_Endianness_e { |
|
53 NW_NATIVE_ENDIAN, |
|
54 NW_BIG_ENDIAN, |
|
55 NW_LITTLE_ENDIAN |
|
56 } NW_XML_Endianness_t; |
|
57 |
|
58 /* Remove references to this deprecated typedef */ |
|
59 typedef NW_XML_Endianness_t NW_Endianness_t; |
|
60 |
|
61 /** ----------------------------------------------------------------------- ** |
|
62 @struct: NW_XML_Reader_LineColumn |
|
63 |
|
64 @synopsis: Line and column cursor. |
|
65 |
|
66 @scope: public |
|
67 @variables: |
|
68 NW_Uint32 crCount |
|
69 Carriage return count. |
|
70 |
|
71 NW_Uint32 lfCount |
|
72 Line feed count. |
|
73 |
|
74 NW_Uint32 charsSinceLastCR |
|
75 Chars since last CR |
|
76 |
|
77 NW_Uint32 charsSinceLastLF |
|
78 Chars since last LF |
|
79 |
|
80 @description: Line and column cursor. |
|
81 |
|
82 ** ----------------------------------------------------------------------- **/ |
|
83 typedef struct NW_XML_Reader_LineColumn_s{ |
|
84 NW_Uint32 crCount; |
|
85 NW_Uint32 lfCount; |
|
86 NW_Uint32 charsSinceLastCR; |
|
87 NW_Uint32 charsSinceLastLF; |
|
88 }NW_XML_Reader_LineColumn_t; |
|
89 |
|
90 |
|
91 /** ----------------------------------------------------------------------- ** |
|
92 @struct: NW_XML_Reader |
|
93 |
|
94 @synopsis: The XML reader structure. |
|
95 |
|
96 @scope: public |
|
97 @variables: |
|
98 NW_Uint32 encoding |
|
99 Character set encoding code in force at this index, |
|
100 may change. |
|
101 |
|
102 NW_XML_Endianness_t endianness |
|
103 Big, little or native endianness indicator. |
|
104 |
|
105 NW_Uint32 index |
|
106 Current read position in pBuf, a byte index moved |
|
107 by character according to the encoding. |
|
108 |
|
109 NW_Uint32 charIndex |
|
110 Similar to index but in terms of characters not bytes. |
|
111 |
|
112 NW_XML_Reader_LineColumn_t lineColumn |
|
113 Information for giving text position as line and column, |
|
114 useful for reporting parsing failure. |
|
115 |
|
116 NW_Uint32 length |
|
117 Length of data. |
|
118 |
|
119 NW_Uint8* pBuf |
|
120 Text is stored in pBuf and the Reader functions provide |
|
121 the interface to the characters in pBuf. |
|
122 |
|
123 NW_Bool end |
|
124 End (like EOF): 0 = not at end, 1 = at end. |
|
125 |
|
126 @description: Users of Reader should not look directly inside the structure. |
|
127 Instead, use access functions and macros. |
|
128 |
|
129 ** ----------------------------------------------------------------------- **/ |
|
130 typedef struct NW_XML_Reader_s{ |
|
131 NW_Uint32 encoding; |
|
132 NW_XML_Endianness_t endianness; |
|
133 NW_Uint32 index; |
|
134 NW_Uint32 charIndex; |
|
135 NW_XML_Reader_LineColumn_t lineColumn; |
|
136 NW_Uint32 length; |
|
137 NW_Uint8* pBuf; |
|
138 NW_Bool end; |
|
139 } NW_XML_Reader_t; |
|
140 |
|
141 |
|
142 /** ----------------------------------------------------------------------- ** |
|
143 @struct: NW_XML_Reader_Interval |
|
144 |
|
145 @synopsis: XML reader interval structure. |
|
146 |
|
147 @scope: public |
|
148 @variables: |
|
149 NW_Uint32 start |
|
150 Byte index. |
|
151 |
|
152 NW_Uint32 stop |
|
153 Byte index. |
|
154 |
|
155 NW_Uint32 charStart |
|
156 Character index. |
|
157 |
|
158 NW_Uint32 charStop |
|
159 Character index. |
|
160 |
|
161 @description: Holds Reader index values defining an interval. |
|
162 Useful to mark a substring in a Reader. If the text |
|
163 is "this is a sample" and the interval has start = 0, |
|
164 stop = 4 then the substring is "this". Length is stop |
|
165 - start. If both values are NW_UINT32_MAX then these |
|
166 are sentinel values meaning an initialized but unset |
|
167 interval, otherwise, if both are the same, it means |
|
168 start has been set but stop hasn't been set. Don't |
|
169 directly set, use appropriate interval functions. |
|
170 |
|
171 Note: You may also need to record the encoding that |
|
172 applies to this interval if Reader encoding has changed. |
|
173 |
|
174 ** ----------------------------------------------------------------------- **/ |
|
175 typedef struct NW_XML_Reader_Interval_s{ |
|
176 NW_Uint32 start; |
|
177 NW_Uint32 stop; |
|
178 NW_Uint32 charStart; |
|
179 NW_Uint32 charStop; |
|
180 } NW_XML_Reader_Interval_t; |
|
181 |
|
182 |
|
183 #ifdef __cplusplus |
|
184 extern "C" |
|
185 { |
|
186 #endif /* __cplusplus */ |
|
187 |
|
188 /* ----------------------------------------------------------------------- ** |
|
189 Reader Functions |
|
190 ** ----------------------------------------------------------------------- **/ |
|
191 |
|
192 |
|
193 /** ----------------------------------------------------------------------- ** |
|
194 @function: NW_XML_Reader_InitFromBuffer |
|
195 |
|
196 @synopsis: Initialize from buffer. |
|
197 |
|
198 @scope: public |
|
199 |
|
200 @parameters: |
|
201 [in-out] NW_XML_Reader_t* pT |
|
202 The XML reader. |
|
203 |
|
204 [in] NW_Uint32 length |
|
205 Length of buffer. |
|
206 |
|
207 [in] unsigned char* pBuf |
|
208 The buffer. |
|
209 |
|
210 @description: Pass in pBuf, the pointer (not the data) will be copied |
|
211 into the NW_XML_Reader_t.pBuf. |
|
212 |
|
213 @returns: NW_Status_t |
|
214 Status of operation. |
|
215 |
|
216 [NW_STAT_SUCCESS] |
|
217 Always returns success. |
|
218 |
|
219 ** ----------------------------------------------------------------------- **/ |
|
220 IMPORT_C NW_Status_t |
|
221 NW_XML_Reader_InitFromBuffer(NW_XML_Reader_t* pT, NW_Uint32 length, unsigned char* pBuf); |
|
222 |
|
223 |
|
224 /** ----------------------------------------------------------------------- ** |
|
225 @function: NW_XML_Reader_DataAddressFromBuffer |
|
226 |
|
227 @synopsis: Gets pointer into buffer. |
|
228 |
|
229 @scope: public |
|
230 |
|
231 @parameters: |
|
232 [in] NW_XML_Reader_t* pT |
|
233 The XML reader. |
|
234 |
|
235 [in] NW_Uint32 startByteIndex |
|
236 The index. |
|
237 |
|
238 [in-out] NW_Uint32* byteLength |
|
239 IN as desired length, OUT as either desired length or |
|
240 remainder of buffer, whichever is less. |
|
241 |
|
242 [out] NW_Uint8** ppData |
|
243 Pointer to data. |
|
244 |
|
245 @description: Returns a pointer into pBuf in *ppData, clips length |
|
246 to fit in buffer limits. |
|
247 |
|
248 @returns: NW_Status_t |
|
249 Status of operation. |
|
250 |
|
251 [NW_STAT_SUCCESS] |
|
252 Address resolved. |
|
253 |
|
254 [NW_STAT_FAILURE] |
|
255 Index out of range. |
|
256 |
|
257 ** ----------------------------------------------------------------------- **/ |
|
258 IMPORT_C NW_Status_t |
|
259 NW_XML_Reader_DataAddressFromBuffer(NW_XML_Reader_t* pT, NW_Uint32 startByteIndex, |
|
260 NW_Uint32* byteLength, NW_Uint8** ppData); |
|
261 |
|
262 #define NW_XML_Reader_GetEncoding(pT) (((const NW_XML_Reader_t*)pT)->encoding) |
|
263 #define NW_XML_Reader_SetEncoding(pT, e) ((pT)->encoding = (e)) |
|
264 |
|
265 #define NW_XML_Reader_GetEndianness(pT) (((const NW_XML_Reader_t*)pT)->endianness) |
|
266 #define NW_XML_Reader_SetEndianness(pT, e) ((pT)->endianness = (e)) |
|
267 |
|
268 |
|
269 /** ----------------------------------------------------------------------- ** |
|
270 @function: NW_XML_Reader_GetPosition |
|
271 |
|
272 @synopsis: Returns current position. |
|
273 |
|
274 @scope: public |
|
275 |
|
276 @parameters: |
|
277 [in] NW_XML_Reader_t* pT |
|
278 The XML reader. |
|
279 |
|
280 [out] NW_Uint32* pByteIndex |
|
281 Current byte index. |
|
282 |
|
283 [out] NW_Uint32* pCharIndex |
|
284 Current character index. |
|
285 |
|
286 [out] NW_XML_Reader_LineColumn_t* pLineColumn |
|
287 Current line and column. |
|
288 |
|
289 @description: Returns current position. |
|
290 |
|
291 ** ----------------------------------------------------------------------- **/ |
|
292 IMPORT_C |
|
293 void NW_XML_Reader_GetPosition(NW_XML_Reader_t* pT, NW_Uint32* pByteIndex, |
|
294 NW_Uint32* pCharIndex, |
|
295 NW_XML_Reader_LineColumn_t* pLineColumn); |
|
296 |
|
297 |
|
298 /** ----------------------------------------------------------------------- ** |
|
299 @function: NW_XML_Reader_SetPosition |
|
300 |
|
301 @synopsis: Sets position in reader. |
|
302 |
|
303 @scope: public |
|
304 |
|
305 @parameters: |
|
306 [in] NW_XML_Reader_t* pT |
|
307 The XML reader. |
|
308 |
|
309 [in] NW_Uint32 byteIndex |
|
310 The byte index. |
|
311 |
|
312 [in] NW_Uint32 charIndex |
|
313 The character index. |
|
314 |
|
315 [in] const pLineColumn |
|
316 The line and column. |
|
317 |
|
318 @description: Setting the position (similar to seeking in a file) is |
|
319 in general not possible without reading the characters |
|
320 (usually reading forward) because character encoding |
|
321 may use a variable numbers of bytes per character. This |
|
322 is here so that if you have defined a valid interval, |
|
323 then you can reposition to the beginning of the interval. |
|
324 Setting to the position to a bad value will not always be |
|
325 caught immediately. |
|
326 ** ----------------------------------------------------------------------- **/ |
|
327 IMPORT_C |
|
328 void NW_XML_Reader_SetPosition(NW_XML_Reader_t* pT, NW_Uint32 byteIndex, |
|
329 NW_Uint32 charIndex, |
|
330 const NW_XML_Reader_LineColumn_t* pLineColumn); |
|
331 |
|
332 |
|
333 /** ----------------------------------------------------------------------- ** |
|
334 @function: NW_XML_Reader_GetLineColumn |
|
335 |
|
336 @synopsis: Gets estimate of line and column. |
|
337 |
|
338 @scope: public |
|
339 |
|
340 @parameters: |
|
341 [in] NW_XML_Reader_t* pT |
|
342 The XML reader. |
|
343 |
|
344 [out] NW_Uint32* pLine |
|
345 The current line. |
|
346 |
|
347 [out] NW_Uint32* pColumn |
|
348 The current column. |
|
349 |
|
350 @description: Returns an estimate of the current line and column |
|
351 position in the text. It is an estimate because it has |
|
352 to guess at what the intended line ending sequence is |
|
353 using a count of CR and LF characters. Line and Column |
|
354 indices are 1-based not 0-based. |
|
355 ** ----------------------------------------------------------------------- **/ |
|
356 IMPORT_C |
|
357 void NW_XML_Reader_GetLineColumn(NW_XML_Reader_t* pT, NW_Uint32* pLine, |
|
358 NW_Uint32* pColumn); |
|
359 |
|
360 #define NW_XML_Reader_AtEnd(pT) (((const NW_XML_Reader_t*)pT)->end) |
|
361 |
|
362 |
|
363 /** ----------------------------------------------------------------------- ** |
|
364 @function: NW_XML_Reader_PeekOffset |
|
365 |
|
366 @synopsis: Peeks at offset. |
|
367 |
|
368 @scope: public |
|
369 |
|
370 @parameters: |
|
371 [in] NW_XML_Reader_t* pT |
|
372 The XML reader. |
|
373 |
|
374 [in] NW_Uint32 nChars |
|
375 Offset in characters. |
|
376 |
|
377 [out] NW_Uint32* pC |
|
378 Address of character at offset. |
|
379 |
|
380 @description: Fails on encountering illegal char anywhere from current |
|
381 read position to offset position or if position is illegal |
|
382 (e.g., off end). Leaves read position unchanged. |
|
383 |
|
384 @returns: NW_Status_t |
|
385 Status of operation. |
|
386 |
|
387 [NW_STAT_SUCCESS] |
|
388 Address returned. |
|
389 |
|
390 [NW_STAT_FAILURE] |
|
391 Invalid offset or at end of file. |
|
392 |
|
393 ** ----------------------------------------------------------------------- **/ |
|
394 IMPORT_C NW_Status_t |
|
395 NW_XML_Reader_PeekOffset(NW_XML_Reader_t* pT, NW_Uint32 nChars, NW_Uint32* pC); |
|
396 |
|
397 #define NW_XML_Reader_Peek(pT, pC) NW_XML_Reader_PeekOffset((pT), 0, (pC)) |
|
398 |
|
399 |
|
400 /** ----------------------------------------------------------------------- ** |
|
401 @function: NW_XML_Reader_AdvanceOffset |
|
402 |
|
403 @synopsis: Advances offset in reader. |
|
404 |
|
405 @scope: public |
|
406 |
|
407 @parameters: |
|
408 [in-out] NW_XML_Reader_t* pT |
|
409 The XML reader. |
|
410 |
|
411 [in] NW_Uint32 nChars |
|
412 Offset to move in characters. |
|
413 |
|
414 @description: Fails on encountering illegal char anywhere from |
|
415 current read position to offset position or if |
|
416 position is illegal (e.g., off end). Moves read |
|
417 position to current + offset. |
|
418 |
|
419 @returns: NW_Status_t |
|
420 Status of operation. |
|
421 |
|
422 [NW_STAT_SUCCESS] |
|
423 Read position advanced nChars. |
|
424 |
|
425 [NW_STAT_FAILURE] |
|
426 Invalid offset or at end of file, reader not advanced. |
|
427 |
|
428 ** ----------------------------------------------------------------------- **/ |
|
429 IMPORT_C NW_Status_t |
|
430 NW_XML_Reader_AdvanceOffset(NW_XML_Reader_t* pT, NW_Uint32 nChars); |
|
431 |
|
432 #define NW_XML_Reader_Advance(pT) NW_XML_Reader_AdvanceOffset((pT), 1) |
|
433 |
|
434 |
|
435 /** ----------------------------------------------------------------------- ** |
|
436 @function: NW_XML_Reader_AsciiCharMatch |
|
437 |
|
438 @synopsis: Tests for character match. |
|
439 @scope: public |
|
440 |
|
441 @parameters: |
|
442 [in] NW_XML_Reader_t* pT |
|
443 The XML reader. |
|
444 |
|
445 [in] NW_Uint32 c |
|
446 The character to match. |
|
447 |
|
448 [out] NW_Uint32* pMatch |
|
449 default |
|
450 |
|
451 @description: pMatch is 1 if ASCII character c matches Reader char in its encoding. |
|
452 |
|
453 @returns: NW_Status_t |
|
454 Status of operation. |
|
455 |
|
456 [NW_STAT_SUCCESS] |
|
457 Match results are valid. |
|
458 |
|
459 [NW_STAT_FAILURE] |
|
460 Match results are not valid. Invalid offset or at end of file. |
|
461 |
|
462 ** ----------------------------------------------------------------------- **/ |
|
463 IMPORT_C NW_Status_t |
|
464 NW_XML_Reader_AsciiCharMatch(NW_XML_Reader_t* pT, NW_Uint32 c, NW_Uint32* pMatch); |
|
465 |
|
466 |
|
467 /** ----------------------------------------------------------------------- ** |
|
468 @function: NW_XML_Reader_AsciiStringMatch |
|
469 |
|
470 @synopsis: Tests for character match. |
|
471 |
|
472 @scope: public |
|
473 |
|
474 @parameters: |
|
475 [in] NW_XML_Reader_t* pT |
|
476 The XML reader. |
|
477 |
|
478 [in] NW_Uint32 length |
|
479 String length. |
|
480 |
|
481 [in] const NW_Uint8* pString, |
|
482 String characters. |
|
483 |
|
484 [out] NW_Uint32* pMatch |
|
485 1 if match, otherwise 0. |
|
486 |
|
487 @description: pMatch is 1 if ASCII string matches Reader sequence in its encoding. |
|
488 |
|
489 @returns: NW_Status_t |
|
490 Status of operation. |
|
491 |
|
492 [NW_STAT_SUCCESS] |
|
493 Match results are valid. |
|
494 |
|
495 [NW_STAT_FAILURE] |
|
496 Match results are not valid. Invalid offset or at end of file. |
|
497 |
|
498 ** ----------------------------------------------------------------------- **/ |
|
499 IMPORT_C NW_Status_t |
|
500 NW_XML_Reader_AsciiStringMatch(NW_XML_Reader_t* pT, NW_Uint32 length, const NW_Uint8* pString, |
|
501 NW_Uint32* pMatch); |
|
502 |
|
503 |
|
504 /** ----------------------------------------------------------------------- ** |
|
505 @function: NW_XML_Reader_SkipSpace |
|
506 |
|
507 @synopsis: Skip a space. |
|
508 |
|
509 @scope: public |
|
510 |
|
511 @parameters: |
|
512 [in-out] NW_XML_Reader_t* pT |
|
513 The XML reader. |
|
514 |
|
515 @description: Skip a space. For XML, whitespace is only ASCII |
|
516 0x20 (space), 0x09 (tab), 0x0d (CR), 0x0a (LF). |
|
517 The base test used here, NW_Str_Isspace(), includes |
|
518 two other forms of whitespace. |
|
519 |
|
520 @returns: NW_Status_t |
|
521 Status of operation. |
|
522 |
|
523 [NW_STAT_SUCCESS] |
|
524 Skip successful. |
|
525 |
|
526 [NW_STAT_FAILURE] |
|
527 Skip not done. Invalid offset or at end of file. |
|
528 |
|
529 ** ----------------------------------------------------------------------- **/ |
|
530 IMPORT_C NW_Status_t |
|
531 NW_XML_Reader_SkipSpace(NW_XML_Reader_t* pT); |
|
532 |
|
533 |
|
534 /** ----------------------------------------------------------------------- ** |
|
535 @function: NW_XML_Reader_IsSpace |
|
536 |
|
537 @synopsis: Tests for space. |
|
538 |
|
539 @scope: public |
|
540 |
|
541 @parameters: |
|
542 [in] NW_XML_Reader_t* pT |
|
543 The XML reader. |
|
544 |
|
545 [out] NW_Uint32* pMatch |
|
546 1 if space, otherwise 0. |
|
547 |
|
548 @description: Tests for space. For XML, whitespace is only ASCII |
|
549 0x20 (space), 0x09 (tab), 0x0d (CR), 0x0a (LF). The |
|
550 base test used here, NW_Str_Isspace(), includes two |
|
551 other forms of whitespace. |
|
552 |
|
553 @returns: NW_Status_t |
|
554 Status of operation. |
|
555 |
|
556 [NW_STAT_SUCCESS] |
|
557 Test results are valid. |
|
558 |
|
559 [NW_STAT_FAILURE] |
|
560 Test results are not valid. Invalid offset or at end of file. |
|
561 |
|
562 ** ----------------------------------------------------------------------- **/ |
|
563 IMPORT_C NW_Status_t |
|
564 NW_XML_Reader_IsSpace(NW_XML_Reader_t* pT, NW_Uint32* pMatch); |
|
565 |
|
566 |
|
567 /** ----------------------------------------------------------------------- ** |
|
568 @function: NW_XML_Reader_IsLetter |
|
569 |
|
570 @synopsis: Tests for letter. |
|
571 |
|
572 @scope: public |
|
573 |
|
574 @parameters: |
|
575 [in] NW_XML_Reader_t* pT |
|
576 The XML reader. |
|
577 |
|
578 [out] NW_Uint32* pMatch |
|
579 1 if letter, otherwise 0. |
|
580 |
|
581 @description: Tests for letter. |
|
582 |
|
583 @returns: NW_Status_t |
|
584 Status of operation. |
|
585 |
|
586 [NW_STAT_SUCCESS] |
|
587 Test results are valid. |
|
588 |
|
589 [NW_STAT_FAILURE] |
|
590 Test results are not valid. Invalid offset or at end of file. |
|
591 |
|
592 ** ----------------------------------------------------------------------- **/ |
|
593 IMPORT_C NW_Status_t |
|
594 NW_XML_Reader_IsLetter(NW_XML_Reader_t* pT, NW_Uint32* pMatch); |
|
595 |
|
596 |
|
597 /** ----------------------------------------------------------------------- ** |
|
598 @function: NW_XML_Reader_IsDigit |
|
599 |
|
600 @synopsis: Tests for digit. |
|
601 |
|
602 @scope: public |
|
603 |
|
604 @parameters: |
|
605 [in] NW_XML_Reader_t* pT |
|
606 The XML reader. |
|
607 |
|
608 [out] NW_Uint32* pMatch |
|
609 1 if letter, otherwise 0. |
|
610 |
|
611 @description: Tests for digit. Digits include not only the ASCII |
|
612 digits but other language forms of digits. The base |
|
613 test used here, NW_Str_Isdigit() only tests for ASCII |
|
614 digits. |
|
615 |
|
616 @returns: NW_Status_t |
|
617 Status of operation. |
|
618 |
|
619 [NW_STAT_SUCCESS] |
|
620 Test results are valid. |
|
621 |
|
622 [NW_STAT_FAILURE] |
|
623 Test results are not valid. Invalid offset or at end of file. |
|
624 |
|
625 ** ----------------------------------------------------------------------- **/ |
|
626 IMPORT_C NW_Status_t |
|
627 NW_XML_Reader_IsDigit(NW_XML_Reader_t* pT, NW_Uint32* pMatch); |
|
628 |
|
629 |
|
630 /* ----------------------------------------------------------------------- ** |
|
631 Reader Interval Functions |
|
632 ** ----------------------------------------------------------------------- **/ |
|
633 |
|
634 |
|
635 /* Always initialize the interval. */ |
|
636 #define NW_XML_Reader_Interval_Init(pI) \ |
|
637 ((pI)->start = (pI)->stop = (pI)->charStart = (pI)->charStop = NW_UINT32_MAX) |
|
638 |
|
639 /* Useful in error tests and asserts. */ |
|
640 #define NW_XML_Reader_Interval_IsWellFormed(pI) \ |
|
641 (((pI)->stop > (pI)->start) && ((pI)->charStop > (pI)->charStart)) |
|
642 |
|
643 |
|
644 /** ----------------------------------------------------------------------- ** |
|
645 @function: NW_XML_Reader_Interval_Start |
|
646 |
|
647 @synopsis: Initializes interval to current position. |
|
648 |
|
649 @scope: public |
|
650 |
|
651 @parameters: |
|
652 [out] NW_XML_Reader_Interval_t* pI |
|
653 The XML reader interval. |
|
654 |
|
655 [in] NW_XML_Reader_t* pT |
|
656 The XML reader. |
|
657 |
|
658 @description: Sets start, stop, charStart, charStop to current |
|
659 Reader position. |
|
660 ** ----------------------------------------------------------------------- **/ |
|
661 IMPORT_C void |
|
662 NW_XML_Reader_Interval_Start(NW_XML_Reader_Interval_t* pI, NW_XML_Reader_t* pT); |
|
663 |
|
664 |
|
665 /** ----------------------------------------------------------------------- ** |
|
666 @function: NW_XML_Reader_Interval_Stop |
|
667 |
|
668 @synopsis: Sets stop to Reader read index. |
|
669 |
|
670 @scope: public |
|
671 |
|
672 @parameters: |
|
673 [out] NW_XML_Reader_Interval_t* pI |
|
674 The XML reader interval. |
|
675 |
|
676 [in] NW_XML_Reader_t* pT |
|
677 The XML reader. |
|
678 |
|
679 @description: Sets stop to Reader read index. |
|
680 |
|
681 ** ----------------------------------------------------------------------- **/ |
|
682 IMPORT_C void |
|
683 NW_XML_Reader_Interval_Stop(NW_XML_Reader_Interval_t* pI, NW_XML_Reader_t* pT); |
|
684 |
|
685 #ifdef __cplusplus |
|
686 } /* extern "C" { */ |
|
687 #endif /* __cplusplus */ |
|
688 |
|
689 #endif /* NW_XML_READER_H */ |