KEYXMLReader.h Source File documentation

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

KEYXMLReader.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * This file is part of the libetonyek project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10 #ifndef KEYXMLREADER_H_INCLUDED
11 #define KEYXMLREADER_H_INCLUDED
12
13 #include <boost/function.hpp>
14
15 #include <librevenge-stream/librevenge-stream.h>
16
17 namespace libetonyek
18 {
19
20 class KEYXMLReader
21 {
22 // -Weffc++
23 KEYXMLReader(const KEYXMLReader &other);
24 KEYXMLReader &operator=(const KEYXMLReader &other);
25
26 struct Impl;
27
28 enum Type
29 {
30 TYPE_ELEMENT = 0x1,
31 TYPE_TEXT = 0x2
32 };
33
34 class NodeIterator
35 {
36 friend class KEYXMLReader;
37
38 public:
39 NodeIterator(const KEYXMLReader &reader, int types);
40
41 bool next();
42
43 Impl *getImpl() const;
44
45 private:
46 bool test() const;
47
48 private:
49 Impl *const m_impl;
50 const int m_types;
51 int m_level;
52 bool m_last;
53 };
54
55 public:
56
57 class AttributeIterator
58 {
59 friend class KEYXMLReader;
60
61 public:
62 explicit AttributeIterator(const KEYXMLReader &reader);
63
64 bool next();
65
66 const char *getName() const;
67 const char *getNamespace() const;
68 const char *getValue() const;
69
70 int getToken(const char *token) const;
71
72 private:
73 bool move();
74 void read();
75 bool test();
76
77 private:
78 Impl *const m_impl;
79 bool m_first;
80 bool m_last;
81 };
82
83 class ElementIterator
84 {
85 public:
86 explicit ElementIterator(const KEYXMLReader &reader);
87
88 bool next();
89
90 const char *getName() const;
91 const char *getNamespace() const;
92 const char *getText() const;
93 bool isEmpty() const;
94
95 int getToken(const char *token) const;
96
97 const NodeIterator &getNodeIterator() const;
98
99 private:
100 NodeIterator m_iterator;
101 };
102
103 class MixedIterator
104 {
105 public:
106 explicit MixedIterator(const KEYXMLReader &reader);
107
108 bool next();
109
110 bool isElement() const;
111 bool isText() const;
112
113 const char *getName() const;
114 const char *getNamespace() const;
115 const char *getText() const;
116 bool isEmpty() const;
117
118 int getToken(const char *token) const;
119
120 const NodeIterator &getNodeIterator() const;
121
122 private:
123 NodeIterator m_iterator;
124 };
125
126 typedef boost::function<int(const char *)> TokenizerFunction_t;
127
128 public:
129 explicit KEYXMLReader(librevenge::RVNGInputStream *input);
130 KEYXMLReader(librevenge::RVNGInputStream *input, TokenizerFunction_t tokenizer);
131 KEYXMLReader(const ElementIterator &iterator);
132 KEYXMLReader(const MixedIterator &iterator);
133 ~KEYXMLReader();
134
139 const char *getName() const;
140
145 const char *getNamespace() const;
146
147 int getToken(const char *token) const;
148
149 private:
150 void initialize(librevenge::RVNGInputStream *input);
151
152 private:
153 Impl *const m_impl;
154 bool m_owner;
155 };
156
157 int getNameId(const KEYXMLReader::AttributeIterator &attribute);
158 int getNamespaceId(const KEYXMLReader::AttributeIterator &attribute);
159 int getId(const KEYXMLReader::AttributeIterator &attribute);
160 int getValueId(const KEYXMLReader::AttributeIterator &attribute);
161
162 int getNameId(const KEYXMLReader::ElementIterator &element);
163 int getNamespaceId(const KEYXMLReader::ElementIterator &element);
164 int getId(const KEYXMLReader::ElementIterator &element);
165 int getTextId(const KEYXMLReader::ElementIterator &element);
166
167 int getNameId(const KEYXMLReader &reader);
168 int getNamespaceId(const KEYXMLReader &reader);
169 int getId(const KEYXMLReader &reader);
170
171 }
172
173 #endif // KEYXMLREADER_H_INCLUDED
174
175 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */
libetonyek::KEYXMLReader::NodeIterator::NodeIterator
NodeIterator(const KEYXMLReader &reader, int types)
Definition: KEYXMLReader.cpp:100
libetonyek::KEYXMLReader::TYPE_ELEMENT
Definition: KEYXMLReader.h:30
libetonyek
Definition: EtonyekDocument.cpp:40
libetonyek::KEYXMLReader::ElementIterator::getToken
int getToken(const char *token) const
Definition: KEYXMLReader.cpp:268
libetonyek::KEYXMLReader::MixedIterator::getToken
int getToken(const char *token) const
Definition: KEYXMLReader.cpp:317
libetonyek::KEYXMLReader::ElementIterator::ElementIterator
ElementIterator(const KEYXMLReader &reader)
Definition: KEYXMLReader.cpp:233
libetonyek::KEYXMLReader::ElementIterator::isEmpty
bool isEmpty() const
Definition: KEYXMLReader.cpp:258
libetonyek::KEYXMLReader::ElementIterator::m_iterator
NodeIterator m_iterator
Definition: KEYXMLReader.h:100
libetonyek::KEYXMLReader::TYPE_TEXT
Definition: KEYXMLReader.h:31
libetonyek::KEYXMLReader::AttributeIterator::getToken
int getToken(const char *token) const
Definition: KEYXMLReader.cpp:227
libetonyek::getTextId
int getTextId(const KEYXMLReader::ElementIterator &element)
Definition: KEYXMLReader.cpp:445
libetonyek::KEYXMLReader::MixedIterator::isText
bool isText() const
Definition: KEYXMLReader.cpp:288
libetonyek::getNamespaceId
int getNamespaceId(const KEYXMLReader::AttributeIterator &attribute)
Definition: KEYXMLReader.cpp:415
libetonyek::KEY2Token::element
Definition: KEY2Token.h:186
libetonyek::KEYXMLReader::getToken
int getToken(const char *token) const
Definition: KEYXMLReader.cpp:387
libetonyek::getNameId
int getNameId(const KEYXMLReader::AttributeIterator &attribute)
Definition: KEYXMLReader.cpp:410
libetonyek::KEYXMLReader::ElementIterator::getNamespace
const char * getNamespace() const
Definition: KEYXMLReader.cpp:248
libetonyek::KEYXMLReader::AttributeIterator::getValue
const char * getValue() const
Definition: KEYXMLReader.cpp:222
libetonyek::KEYXMLReader::ElementIterator::getNodeIterator
const NodeIterator & getNodeIterator() const
Definition: KEYXMLReader.cpp:263
libetonyek::KEYXMLReader::MixedIterator::getNodeIterator
const NodeIterator & getNodeIterator() const
Definition: KEYXMLReader.cpp:322
libetonyek::KEYXMLReader::ElementIterator::next
bool next()
Definition: KEYXMLReader.cpp:238
libetonyek::KEYXMLReader::AttributeIterator::test
bool test()
Definition: KEYXMLReader.cpp:202
libetonyek::KEYXMLReader::NodeIterator::m_impl
Impl *const m_impl
Definition: KEYXMLReader.h:49
libetonyek::KEYXMLReader::NodeIterator::test
bool test() const
Definition: KEYXMLReader.cpp:146
libetonyek::KEYXMLReader::NodeIterator
Definition: KEYXMLReader.h:34
libetonyek::KEYXMLReader::MixedIterator::next
bool next()
Definition: KEYXMLReader.cpp:278
libetonyek::KEYXMLReader::NodeIterator::m_last
bool m_last
Definition: KEYXMLReader.h:52
libetonyek::KEYXMLReader::Type
Type
Definition: KEYXMLReader.h:28
libetonyek::getValueId
int getValueId(const KEYXMLReader::AttributeIterator &attribute)
Definition: KEYXMLReader.cpp:425
libetonyek::KEYXMLReader::AttributeIterator::getNamespace
const char * getNamespace() const
Definition: KEYXMLReader.cpp:217
libetonyek::KEYXMLReader::AttributeIterator::getName
const char * getName() const
Definition: KEYXMLReader.cpp:212
libetonyek::KEYXMLReader::MixedIterator::isEmpty
bool isEmpty() const
Definition: KEYXMLReader.cpp:311
libetonyek::KEYXMLReader::AttributeIterator::m_first
bool m_first
Definition: KEYXMLReader.h:79
libetonyek::KEYXMLReader::m_owner
bool m_owner
Definition: KEYXMLReader.h:154
libetonyek::KEYXMLReader::NodeIterator::getImpl
Impl * getImpl() const
Definition: KEYXMLReader.cpp:141
libetonyek::getId
int getId(const KEYXMLReader::AttributeIterator &attribute)
Definition: KEYXMLReader.cpp:420
libetonyek::KEYXMLReader::MixedIterator
Definition: KEYXMLReader.h:103
libetonyek::KEYXMLReader::initialize
void initialize(librevenge::RVNGInputStream *input)
Definition: KEYXMLReader.cpp:392
libetonyek::KEYXMLReader::NodeIterator::m_level
int m_level
Definition: KEYXMLReader.h:51
libetonyek::KEYXMLReader::MixedIterator::isElement
bool isElement() const
Definition: KEYXMLReader.cpp:283
libetonyek::KEYXMLReader::MixedIterator::getText
const char * getText() const
Definition: KEYXMLReader.cpp:305
libetonyek::KEYXMLReader::getName
const char * getName() const
Get the local name of the current element.
Definition: KEYXMLReader.cpp:377
libetonyek::KEYXMLReader::MixedIterator::getNamespace
const char * getNamespace() const
Definition: KEYXMLReader.cpp:299
libetonyek::KEYXMLReader::getNamespace
const char * getNamespace() const
Get the namespace URI of the current element.
Definition: KEYXMLReader.cpp:382
libetonyek::KEYXMLReader::AttributeIterator::m_last
bool m_last
Definition: KEYXMLReader.h:80
libetonyek::KEYXMLReader
Definition: KEYXMLReader.h:20
libetonyek::KEYXMLReader::~KEYXMLReader
~KEYXMLReader()
Definition: KEYXMLReader.cpp:371
libetonyek::KEYXMLReader::KEYXMLReader
KEYXMLReader(const KEYXMLReader &other)
libetonyek::KEYXMLReader::Impl
Definition: KEYXMLReader.cpp:72
libetonyek::KEYXMLReader::MixedIterator::MixedIterator
MixedIterator(const KEYXMLReader &reader)
Definition: KEYXMLReader.cpp:273
libetonyek::KEYXMLReader::MixedIterator::m_iterator
NodeIterator m_iterator
Definition: KEYXMLReader.h:123
libetonyek::KEYXMLReader::operator=
KEYXMLReader & operator=(const KEYXMLReader &other)
libetonyek::KEYXMLReader::AttributeIterator::read
void read()
input
RVNGInputStreamPtr_t input
Definition: EtonyekDocument.cpp:59
libetonyek::KEYXMLReader::AttributeIterator::m_impl
Impl *const m_impl
Definition: KEYXMLReader.h:78
libetonyek::KEYXMLReader::AttributeIterator
Definition: KEYXMLReader.h:57
libetonyek::KEYXMLReader::MixedIterator::getName
const char * getName() const
Definition: KEYXMLReader.cpp:293
libetonyek::KEYXMLReader::ElementIterator::getName
const char * getName() const
Definition: KEYXMLReader.cpp:243
libetonyek::KEYXMLReader::AttributeIterator::move
bool move()
Definition: KEYXMLReader.cpp:183
libetonyek::KEYXMLReader::m_impl
Impl *const m_impl
Definition: KEYXMLReader.h:153
libetonyek::KEYXMLReader::ElementIterator::getText
const char * getText() const
Definition: KEYXMLReader.cpp:253
libetonyek::KEYXMLReader::AttributeIterator::next
bool next()
Definition: KEYXMLReader.cpp:172
libetonyek::KEYXMLReader::TokenizerFunction_t
boost::function< int(const char *)> TokenizerFunction_t
Definition: KEYXMLReader.h:126
libetonyek::KEYXMLReader::NodeIterator::m_types
const int m_types
Definition: KEYXMLReader.h:50
libetonyek::KEYXMLReader::AttributeIterator::AttributeIterator
AttributeIterator(const KEYXMLReader &reader)
Definition: KEYXMLReader.cpp:158
libetonyek::KEYXMLReader::ElementIterator
Definition: KEYXMLReader.h:83
libetonyek::KEYXMLReader::NodeIterator::next
bool next()
Definition: KEYXMLReader.cpp:117