source: icXML/icXML-devel/src/icxmlc/XMLParserDefs.hpp @ 2720

Last change on this file since 2720 was 2720, checked in by cameron, 6 years ago

Initial check-in of icXML 0.8 source files

File size: 2.4 KB
Line 
1/*
2 *  Copyright © 2012 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icXML is a trademark of International Characters.
5 */
6
7/*
8 * @author Nigel Medforth, nigelm -at- interational-characters.com
9 * @version $Id: XMLParserDefs.hpp 209 2012-12-02 21:17:04Z robc $
10 *
11 */
12
13#ifndef XMLPARSERDEFS_HPP
14#define XMLPARSERDEFS_HPP
15
16#include <icxmlc/Array.hpp>
17#include <icxmlc/XMLConfig.hpp>
18
19XERCES_CPP_NAMESPACE_BEGIN
20
21#define INITIAL_LINE_COLUMN_SIZE ((INITIAL_CONTENT_BUFFER_SIZE / BLOCK_SIZE) + 2)
22#define INITIAL_STRING_LENGTH_SIZE (INITIAL_CONTENT_BUFFER_SIZE / 4)
23#define INITIAL_SYMBOL_SIZE (INITIAL_CONTENT_BUFFER_SIZE / 4)
24
25#if INITIAL_CONTENT_BUFFER_SIZE == 0
26#error "INITIAL_CONTENT_BUFFER_SIZE was not set or was set to 0!"
27#endif
28
29#ifndef USE_HEAP_ALLOCATION_FOR_XML_PARSER
30typedef DynamicArray<XMLCh, INITIAL_CONTENT_BUFFER_SIZE, sizeof(BytePack)> ContentStream;
31typedef DynamicArray<BitBlock, INITIAL_LINE_COLUMN_SIZE> LineColStream;
32typedef DynamicArray<unsigned int, INITIAL_SYMBOL_SIZE> SymbolUriArray;
33typedef DynamicArray<gid_t, INITIAL_SYMBOL_SIZE> SymbolArray;
34#else
35typedef DynamicArray<XMLCh, 0, sizeof(BytePack)> ContentStream;
36typedef DynamicArray<BitBlock, 0> LineColStream;
37typedef DynamicArray<unsigned int, 0> SymbolUriArray;
38typedef DynamicArray<gid_t, 0> SymbolArray;
39#endif
40
41enum MarkupType
42{
43        StartTagWithoutAttributes = 0
44        , StartTagWithAttributes = 1
45        , Attribute = 1
46        , EndTag = 2
47        , ProcessingInstruction = 4
48        , Comment = 5
49        , CDATA = 7
50        , EmptyTag = 8
51};
52
53class StringPtrArray : public
54        #ifndef USE_HEAP_ALLOCATION_FOR_XML_PARSER
55        DynamicArray<const XMLCh*, INITIAL_STRING_LENGTH_SIZE>
56        #else
57        DynamicArray<const XMLCh*, 0>
58        #endif
59{
60public:
61        #ifndef USE_HEAP_ALLOCATION_FOR_XML_PARSER
62        StringPtrArray() : DynamicArray<const XMLCh*, INITIAL_STRING_LENGTH_SIZE>() { }
63        StringPtrArray(const size_t capacity) : DynamicArray<const XMLCh*, INITIAL_STRING_LENGTH_SIZE>(capacity) { }
64        #else
65        StringPtrArray() : DynamicArray<const XMLCh*, 0>(INITIAL_STRING_LENGTH_SIZE) { }
66        StringPtrArray(const size_t capacity) : DynamicArray<const XMLCh*, 0>(capacity) { }
67        #endif
68
69        IDISA_ALWAYS_INLINE
70        void adjust(const size_t from, const size_t to, const size_t offset)
71        {
72                for (size_t i = from; i < to; i++)
73                {
74                        (*this)[i] -= offset;
75                }
76        }
77};
78
79struct XMLComplexRef
80{
81        gid_t           gid;
82        size_t          pos;
83};
84
85typedef DynamicArray<XMLComplexRef, 4>  XMLComplexRefArray;
86
87XERCES_CPP_NAMESPACE_END
88
89#endif // XMLPARSERDEFS_HPP
Note: See TracBrowser for help on using the repository browser.