wsdlpull
1.23
Toggle main menu visibility
Loading...
Searching...
No Matches
src
schemaparser
SimpleType.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 _SIMPLETYPEH
22
#define _SIMPLETYPEH
23
#include <list>
24
#include <map>
25
#include <vector>
26
27
#include "
schemaparser/XSDType.h
"
28
#include "
xmlpull/wsdlpull_export.h
"
29
#include "
xmlpull/Qname.h
"
30
#include "
xmlpull/XmlUtils.h
"
31
#include "
schemaparser/SchemaParserException.h
"
32
33
namespace
Schema
{
34
//union to store the values for various facets
35
typedef
union
36
{
37
int
length
;
38
struct
39
{
40
int
minlen
,
maxlen
;
41
} lenRange;
42
int
numEnums
;
43
int
wsp
;
44
struct
45
{
46
int
maxinc
,
mininc
,
maxex
,
minex
;
47
} valRange;
48
int
tot
;
49
int
frac
;
50
const
char
*
pattern
;
51
}
facetValueType
;
52
53
class
WSDLPULL_EXPORT
SimpleType
:
public
XSDType
54
{
55
public
:
58
61
SimpleType
(
const
std::string & ns);
62
~SimpleType
();
64
67
71
bool
isList
()
const
;
76
bool
isUnion
()
const
;
81
bool
isSimple
()
const
;
82
83
//facet and restriction methods
84
bool
isvalidFacet
(std::string facet);
85
bool
isValidInt
(
int
val)
const
;
86
bool
isValidFloat
(
float
val)
const
;
87
bool
isValidString
(std::string val)
const
;
88
bool
getFacetValue
(
int
facet,
void
* &val);
89
const
std::list<int>*
unionTypes
()
const
;
90
92
94
void
setUnionType
(
int
id
);
95
void
setListType
(
int
id
);
96
void
setFacetValue
(std::string facet,std::string val);
98
99
//enum for facet Ids
100
enum
101
{
102
NONE
= 0,
103
LENGTH
= 0x1,
104
MINLEN
= 0x2,
105
MAXLEN
= 0x4,
106
ENUM
=0x8,
107
WSP
= 0x10,
108
MAXINC
= 0x20,
109
MININC
= 0x40,
110
MAXEX
=0x80,
111
MINEX
= 0x100,
112
TOTALDIGITS
= 0x200,
113
FRAC
= 0x400,
114
PATTERN
= 0x800
115
};
116
117
//whitespace values
118
enum
119
{
120
PRESERVE
= 1,
121
REPLACE
,
122
COLLAPSE
123
};
124
#ifdef LOGGING
125
void
print(std::ostream & out);
126
#endif
127
private
:
128
std::vector<int> facetId_;
129
std::map<std::string,int> facets_;
130
std::list < std::string > enumValues_;
131
int
*validFacets_;
132
facetValueType
facetValue_;
133
void
error(std::string msg);
134
bool
isList_;
135
bool
isUnion_;
136
std::list<int> * uTypes_;
137
};
138
139
inline
140
bool
141
SimpleType::isList
()
const
142
{
143
return
isList_;
144
}
145
146
inline
147
bool
148
SimpleType::isUnion
()
const
149
{
150
return
isUnion_;
151
}
152
153
inline
154
void
155
SimpleType::setListType
(
int
typeId)
156
{
157
isList_ =
true
;
158
setBaseType
(typeId);
159
}
160
161
inline
162
void
163
SimpleType::setUnionType
(
int
typeId)
164
{
165
isUnion_ =
true
;
166
if
(uTypes_ == 0){
167
uTypes_ =
new
std::list<int>();
168
}
169
uTypes_->push_back(typeId);
170
}
171
172
inline
173
bool
174
SimpleType::isSimple
()
const
175
{
176
return
true
;
177
}
178
inline
179
const
std::list<int>*
180
SimpleType::unionTypes
()
const
181
{
182
return
uTypes_;
183
}
184
}
185
#endif
/* */
Qname.h
SchemaParserException.h
XSDType.h
XmlUtils.h
Schema::SimpleType::isUnion
bool isUnion() const
Definition
SimpleType.h:148
Schema::SimpleType::isSimple
bool isSimple() const
Definition
SimpleType.h:174
Schema::SimpleType::isList
bool isList() const
Definition
SimpleType.h:141
Schema::SimpleType::setFacetValue
void setFacetValue(std::string facet, std::string val)
Definition
SimpleType.cpp:98
Schema::SimpleType::SimpleType
SimpleType(const std::string &ns)
Definition
SimpleType.cpp:27
Schema::SimpleType::setListType
void setListType(int id)
Definition
SimpleType.h:155
Schema::SimpleType::isValidFloat
bool isValidFloat(float val) const
Definition
SimpleType.cpp:242
Schema::SimpleType::isValidInt
bool isValidInt(int val) const
Definition
SimpleType.cpp:172
Schema::SimpleType::setUnionType
void setUnionType(int id)
Definition
SimpleType.h:163
Schema::SimpleType::isValidString
bool isValidString(std::string val) const
Definition
SimpleType.cpp:251
Schema::SimpleType::MAXLEN
@ MAXLEN
Definition
SimpleType.h:105
Schema::SimpleType::MINLEN
@ MINLEN
Definition
SimpleType.h:104
Schema::SimpleType::NONE
@ NONE
Definition
SimpleType.h:102
Schema::SimpleType::WSP
@ WSP
Definition
SimpleType.h:107
Schema::SimpleType::MININC
@ MININC
Definition
SimpleType.h:109
Schema::SimpleType::LENGTH
@ LENGTH
Definition
SimpleType.h:103
Schema::SimpleType::MAXINC
@ MAXINC
Definition
SimpleType.h:108
Schema::SimpleType::FRAC
@ FRAC
Definition
SimpleType.h:113
Schema::SimpleType::MINEX
@ MINEX
Definition
SimpleType.h:111
Schema::SimpleType::PATTERN
@ PATTERN
Definition
SimpleType.h:114
Schema::SimpleType::ENUM
@ ENUM
Definition
SimpleType.h:106
Schema::SimpleType::TOTALDIGITS
@ TOTALDIGITS
Definition
SimpleType.h:112
Schema::SimpleType::MAXEX
@ MAXEX
Definition
SimpleType.h:110
Schema::SimpleType::isvalidFacet
bool isvalidFacet(std::string facet)
Definition
SimpleType.cpp:82
Schema::SimpleType::unionTypes
const std::list< int > * unionTypes() const
Definition
SimpleType.h:180
Schema::SimpleType::getFacetValue
bool getFacetValue(int facet, void *&val)
Definition
SimpleType.cpp:316
Schema::SimpleType::PRESERVE
@ PRESERVE
Definition
SimpleType.h:120
Schema::SimpleType::COLLAPSE
@ COLLAPSE
Definition
SimpleType.h:122
Schema::SimpleType::REPLACE
@ REPLACE
Definition
SimpleType.h:121
Schema::XSDType::XSDType
XSDType(const std::string &ns)
Definition
XSDType.h:125
Schema::XSDType::setBaseType
void setBaseType(int id, Schema::Derivation type=Schema::Restriction)
Definition
XSDType.h:206
Schema
Definition
Annotation.h:27
Schema::facetValueType
Definition
SimpleType.h:36
Schema::facetValueType::numEnums
int numEnums
Definition
SimpleType.h:42
Schema::facetValueType::maxlen
int maxlen
Definition
SimpleType.h:40
Schema::facetValueType::length
int length
Definition
SimpleType.h:37
Schema::facetValueType::minlen
int minlen
Definition
SimpleType.h:40
Schema::facetValueType::maxinc
int maxinc
Definition
SimpleType.h:46
Schema::facetValueType::tot
int tot
Definition
SimpleType.h:48
Schema::facetValueType::pattern
const char * pattern
Definition
SimpleType.h:50
Schema::facetValueType::wsp
int wsp
Definition
SimpleType.h:43
Schema::facetValueType::frac
int frac
Definition
SimpleType.h:49
Schema::facetValueType::mininc
int mininc
Definition
SimpleType.h:46
Schema::facetValueType::maxex
int maxex
Definition
SimpleType.h:46
Schema::facetValueType::minex
int minex
Definition
SimpleType.h:46
wsdlpull_export.h
WSDLPULL_EXPORT
#define WSDLPULL_EXPORT
Definition
wsdlpull_export.h:30
Generated by
1.17.0