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
class
WPXInputStream;
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
(WPXInputStream *input);
130
KEYXMLReader
(WPXInputStream *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
(WPXInputStream *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: */
Generated for libetonyek by
doxygen
1.8.3.1