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
17namespace libetonyek
18{
19
21{
22 // -Weffc++
25
26 struct Impl;
27
28 enum Type
29 {
31 TYPE_TEXT = 0x2
32 };
33
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;
52 bool m_last;
53 };
54
55public:
56
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
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:
101 };
102
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:
124 };
125
126 typedef boost::function<int(const char *)> TokenizerFunction_t;
127
128public:
129 explicit KEYXMLReader(librevenge::RVNGInputStream *input);
130 KEYXMLReader(librevenge::RVNGInputStream *input, TokenizerFunction_t tokenizer);
131 KEYXMLReader(const ElementIterator &iterator);
132 KEYXMLReader(const MixedIterator &iterator);
134
139 const char *getName() const;
140
145 const char *getNamespace() const;
146
147 int getToken(const char *token) const;
148
149private:
150 void initialize(librevenge::RVNGInputStream *input);
151
152private:
153 Impl *const m_impl;
155};
156
157int getNameId(const KEYXMLReader::AttributeIterator &attribute);
159int getId(const KEYXMLReader::AttributeIterator &attribute);
160int getValueId(const KEYXMLReader::AttributeIterator &attribute);
161
166
167int getNameId(const KEYXMLReader &reader);
168int getNamespaceId(const KEYXMLReader &reader);
169int getId(const KEYXMLReader &reader);
170
171}
172
173#endif // KEYXMLREADER_H_INCLUDED
174
175/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
RVNGInputStreamPtr_t input
Definition: EtonyekDocument.cpp:59
Definition: KEYXMLReader.h:58
bool move()
Definition: KEYXMLReader.cpp:183
AttributeIterator(const KEYXMLReader &reader)
Definition: KEYXMLReader.cpp:158
bool test()
Definition: KEYXMLReader.cpp:202
bool next()
Definition: KEYXMLReader.cpp:172
int getToken(const char *token) const
Definition: KEYXMLReader.cpp:227
bool m_first
Definition: KEYXMLReader.h:79
const char * getNamespace() const
Definition: KEYXMLReader.cpp:217
const char * getValue() const
Definition: KEYXMLReader.cpp:222
const char * getName() const
Definition: KEYXMLReader.cpp:212
Impl *const m_impl
Definition: KEYXMLReader.h:78
bool m_last
Definition: KEYXMLReader.h:80
Definition: KEYXMLReader.h:84
bool isEmpty() const
Definition: KEYXMLReader.cpp:258
NodeIterator m_iterator
Definition: KEYXMLReader.h:100
int getToken(const char *token) const
Definition: KEYXMLReader.cpp:268
const NodeIterator & getNodeIterator() const
Definition: KEYXMLReader.cpp:263
bool next()
Definition: KEYXMLReader.cpp:238
const char * getText() const
Definition: KEYXMLReader.cpp:253
const char * getName() const
Definition: KEYXMLReader.cpp:243
ElementIterator(const KEYXMLReader &reader)
Definition: KEYXMLReader.cpp:233
const char * getNamespace() const
Definition: KEYXMLReader.cpp:248
Definition: KEYXMLReader.h:104
const char * getText() const
Definition: KEYXMLReader.cpp:305
int getToken(const char *token) const
Definition: KEYXMLReader.cpp:317
const char * getNamespace() const
Definition: KEYXMLReader.cpp:299
bool isEmpty() const
Definition: KEYXMLReader.cpp:311
bool isElement() const
Definition: KEYXMLReader.cpp:283
bool next()
Definition: KEYXMLReader.cpp:278
const NodeIterator & getNodeIterator() const
Definition: KEYXMLReader.cpp:322
const char * getName() const
Definition: KEYXMLReader.cpp:293
NodeIterator m_iterator
Definition: KEYXMLReader.h:123
MixedIterator(const KEYXMLReader &reader)
Definition: KEYXMLReader.cpp:273
bool isText() const
Definition: KEYXMLReader.cpp:288
Definition: KEYXMLReader.h:35
NodeIterator(const KEYXMLReader &reader, int types)
Definition: KEYXMLReader.cpp:100
bool m_last
Definition: KEYXMLReader.h:52
const int m_types
Definition: KEYXMLReader.h:50
int m_level
Definition: KEYXMLReader.h:51
Impl *const m_impl
Definition: KEYXMLReader.h:49
Impl * getImpl() const
Definition: KEYXMLReader.cpp:141
bool test() const
Definition: KEYXMLReader.cpp:146
bool next()
Definition: KEYXMLReader.cpp:117
Definition: KEYXMLReader.h:21
KEYXMLReader(const KEYXMLReader &other)
Impl *const m_impl
Definition: KEYXMLReader.h:153
void initialize(librevenge::RVNGInputStream *input)
Definition: KEYXMLReader.cpp:392
~KEYXMLReader()
Definition: KEYXMLReader.cpp:371
const char * getNamespace() const
Get the namespace URI of the current element.
Definition: KEYXMLReader.cpp:382
Type
Definition: KEYXMLReader.h:29
@ TYPE_ELEMENT
Definition: KEYXMLReader.h:30
@ TYPE_TEXT
Definition: KEYXMLReader.h:31
bool m_owner
Definition: KEYXMLReader.h:154
KEYXMLReader & operator=(const KEYXMLReader &other)
boost::function< int(const char *)> TokenizerFunction_t
Definition: KEYXMLReader.h:126
const char * getName() const
Get the local name of the current element.
Definition: KEYXMLReader.cpp:377
int getToken(const char *token) const
Definition: KEYXMLReader.cpp:387
@ element
Definition: KEY2Token.h:186
Definition: EtonyekDocument.cpp:41
int getNameId(const KEYXMLReader::AttributeIterator &attribute)
Definition: KEYXMLReader.cpp:410
int getTextId(const KEYXMLReader::ElementIterator &element)
Definition: KEYXMLReader.cpp:445
int getValueId(const KEYXMLReader::AttributeIterator &attribute)
Definition: KEYXMLReader.cpp:425
int getNamespaceId(const KEYXMLReader::AttributeIterator &attribute)
Definition: KEYXMLReader.cpp:415
int getId(const KEYXMLReader::AttributeIterator &attribute)
Definition: KEYXMLReader.cpp:420
Definition: KEYXMLReader.cpp:73

Generated for libetonyek by doxygen 1.9.3