wsdlpull
1.23
Toggle main menu visibility
Loading...
Searching...
No Matches
src
schemaparser
Element.h
Go to the documentation of this file.
1
/*
2
* wsdlpull - A C++ parser for WSDL (Web services description language)
3
* Copyright (C) 2005-2007 Vivek Krishna
4
*
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
14
*
15
* You should have received a copy of the GNU Library General Public
16
* License along with this library; if not, write to the Free
17
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
*
19
*
20
*/
21
#ifndef _ELEMENTH
22
#define _ELEMENTH
23
24
#include <string>
25
#include "
xmlpull/wsdlpull_export.h
"
26
#include "
schemaparser/Constraint.h
"
27
28
namespace
Schema
{
29
#define UNBOUNDED INT_MAX
30
class
WSDLPULL_EXPORT
Element
31
{
32
public
:
33
Element
(
const
std::string & name,
34
const
std::string & elemNs,
35
const
std::string & typeNs,
36
int
type_id,
37
int
minimum = 1,
38
int
maximum = 1,
39
bool
qualified =
false
,
40
std::string def =
""
,
41
std::string fixed =
""
);
42
43
Element
(
void
);
44
void
setType
(
int
id
);
45
std::string
getName
()
const
;
46
void
setTypeNamespace
(
const
std::string & ns);
47
std::string
getTypeNamespace
()
const
;
48
void
setNamespace
(
const
std::string &ns);
49
std::string
getNamespace
()
const
;
50
int
getType
()
const
;
51
int
getMax
()
const
;
52
int
getMin
()
const
;
53
std::string &
defaultVal
();
54
std::string &
fixedVal
();
55
bool
isQualified
()
const
;
56
Element
& operator = (
const
Element
& e);
57
void
setMin
(
int
m);
58
void
setMax
(
int
m);
59
//add a key/keyref/unique constraint
60
void
addConstraint
(
Constraint
* c);
61
Constraint
*
constraint
();
62
const
std::list<std::string> &
getConstraints
();
// Proposed modification: return a list of constraints, every constraint identified by its name.
63
int
nOccurrences
;
64
65
private
:
66
std::string elemName;
67
std::string dval, fval;
68
int
elemType;
69
bool
bQualified;
70
int
minOccurs, maxOccurs;
71
std::string elemNamespace;
//namespace where the element is defined
72
std::string typeNamespace;
//namespace where the type of this element is defined
73
74
Constraint
* cstr;
75
};
76
77
#ifdef LOGGING
78
std::ostream &
operator <<
(std::ostream & stream,
Element
& e);
79
#endif
80
81
inline
82
Element::Element
(
const
std::string & name,
83
const
std::string & elemNs,
84
const
std::string & typeNs,
85
int
type_id,
86
int
minimum,
87
int
maximum,
88
bool
qualified,
89
std::string def ,
90
std::string fixed)
91
:
nOccurrences
(0),
92
elemName(name),
93
dval(def),
94
fval(fixed),
95
elemType(type_id),
96
bQualified(qualified),
97
minOccurs(minimum),
98
maxOccurs(maximum),
99
elemNamespace(elemNs),
100
typeNamespace(typeNs),
101
cstr(0)
102
{
103
}
104
105
inline
106
Element::Element
(
void
)
107
:
nOccurrences
(0),
108
elemType(0),
109
bQualified (false),
110
minOccurs (1),
111
maxOccurs (1),
112
cstr(0)
113
{
114
}
115
116
inline
117
void
118
Element::setType
(
int
id
)
119
{
120
elemType = id;
121
}
122
123
inline
124
std::string
125
Element::getName
()
const
126
{
127
return
elemName;
128
}
129
130
inline
131
void
132
Element::setTypeNamespace
(
const
std::string& ns)
133
{
134
typeNamespace = ns;
135
}
136
137
inline
138
std::string
139
Element::getTypeNamespace
()
const
140
{
141
return
typeNamespace;
142
}
143
144
145
inline
146
int
147
Element::getType
()
const
148
{
149
return
elemType;
150
}
151
152
inline
153
int
154
Element::getMax
()
const
155
{
156
return
maxOccurs;
157
}
158
inline
159
int
160
Element::getMin
()
const
161
{
162
return
minOccurs;
163
}
164
165
inline
166
std::string &
167
Element::defaultVal
()
168
{
169
return
dval;
170
}
171
172
inline
173
std::string &
174
Element::fixedVal
()
175
{
176
return
fval;
177
}
178
179
inline
180
bool
181
Element::isQualified
()
const
182
{
183
return
bQualified;
184
}
185
186
inline
187
Element
&
188
Element::operator =
(
const
Element
& e)
189
{
190
elemName = e.elemName;
191
elemType = e.elemType;
192
bQualified = e.
isQualified
();
193
dval = e.dval;
194
fval = e.fval;
195
typeNamespace = e.typeNamespace;
196
cstr = e.cstr;
197
return
*
this
;
198
//minimum and maximum are not copied because they are specific to the
199
//occurrence
200
}
201
inline
202
void
203
Element::setMin
(
int
m)
204
{
205
minOccurs=m;
206
}
207
208
inline
209
void
210
Element::setMax
(
int
m)
211
{
212
maxOccurs=m;
213
}
214
215
inline
216
void
217
Element::addConstraint
(
Constraint
* c)
218
{
219
cstr=c;
220
}
221
222
inline
223
Constraint
*
224
Element::constraint
()
225
{
226
return
cstr;
227
}
228
229
230
inline
231
void
232
Element::setNamespace
(
const
std::string& ns)
233
{
234
elemNamespace = ns;
235
}
236
237
inline
238
std::string
239
Element::getNamespace
()
const
240
{
241
return
elemNamespace;
242
}
243
244
245
246
}
247
#endif
/* */
Constraint.h
Schema::Constraint
Definition
Constraint.h:34
Schema::Element
Definition
Element.h:31
Schema::Element::getType
int getType() const
Definition
Element.h:147
Schema::Element::setNamespace
void setNamespace(const std::string &ns)
Definition
Element.h:232
Schema::Element::getConstraints
const std::list< std::string > & getConstraints()
Schema::Element::getMax
int getMax() const
Definition
Element.h:154
Schema::Element::defaultVal
std::string & defaultVal()
Definition
Element.h:167
Schema::Element::Element
Element(const std::string &name, const std::string &elemNs, const std::string &typeNs, int type_id, int minimum=1, int maximum=1, bool qualified=false, std::string def="", std::string fixed="")
Definition
Element.h:82
Schema::Element::setMax
void setMax(int m)
Definition
Element.h:210
Schema::Element::addConstraint
void addConstraint(Constraint *c)
Definition
Element.h:217
Schema::Element::getName
std::string getName() const
Definition
Element.h:125
Schema::Element::Element
Element(void)
Definition
Element.h:106
Schema::Element::setMin
void setMin(int m)
Definition
Element.h:203
Schema::Element::getTypeNamespace
std::string getTypeNamespace() const
Definition
Element.h:139
Schema::Element::fixedVal
std::string & fixedVal()
Definition
Element.h:174
Schema::Element::operator=
Element & operator=(const Element &e)
Definition
Element.h:188
Schema::Element::getNamespace
std::string getNamespace() const
Definition
Element.h:239
Schema::Element::getMin
int getMin() const
Definition
Element.h:160
Schema::Element::nOccurrences
int nOccurrences
Definition
Element.h:63
Schema::Element::constraint
Constraint * constraint()
Definition
Element.h:224
Schema::Element::setType
void setType(int id)
Definition
Element.h:118
Schema::Element::setTypeNamespace
void setTypeNamespace(const std::string &ns)
Definition
Element.h:132
Schema::Element::isQualified
bool isQualified() const
Definition
Element.h:181
Schema
Definition
Annotation.h:27
Schema::operator<<
std::ostream & operator<<(std::ostream &os, TypeContainer &tc)
Definition
TypeContainer.cpp:365
wsdlpull_export.h
WSDLPULL_EXPORT
#define WSDLPULL_EXPORT
Definition
wsdlpull_export.h:30
Generated by
1.17.0