wsdlpull 1.23
Loading...
Searching...
No Matches
XSDType.h
Go to the documentation of this file.
1/*
2 * wsdl2cpp - 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
22/*
23 * Abstract interface for all xsd types
24 */
25
26
27#ifndef _XSDTYPEH
28#define _XSDTYPEH
29
30#include <string>
31#include "xmlpull/Qname.h"
33#include "schemaparser/Schema.h"
34
35
36namespace Schema {
38{
39 public:
40
46 XSDType(const std::string & ns);
47 XSDType();
48 virtual ~ XSDType(){};
50
51
56 std::string getName() const ;
62 std::string getNamespace() const ;
67 Qname getQname() const;
72 Schema::ContentModelType getContentModel() const ;
73
78 int getTypeId() const ;
84 int getBaseTypeId()const;
89 Schema::Derivation getBaseDerivation()const;
95 bool isAnonymous() const ;
101 virtual bool isSimple()const =0;
102
104 virtual void setName(std::string);
105 virtual void setContentModel(Schema::ContentModelType );
106 virtual void setTypeId(int);
107 virtual void setAnonymous(bool);
108 void setBaseType(int id , Schema::Derivation type = Schema::Restriction);
109 void setBaseTypeNamespace(std::string ns);
111#ifdef LOGGING
112 virtual void print (std::ostream & out) { };
113#endif
114 private:
115 std::string nsUri_;
116 std::string name_;
117 int typeId_;
118 int baseType_;
119 Schema::Derivation baseDerivation_;
120 Schema::ContentModelType contentModel_;//simple,complex,mixed?
121 bool anonymous_;
122};
123
124inline
125XSDType::XSDType(const std::string & ns)
126 :nsUri_(ns),
127 typeId_(0),
128 baseType_(Schema::XSD_ANYTYPE),
129 baseDerivation_(Schema::Extension),
130 contentModel_(Schema::None),
131 anonymous_(false)
132{
133}
134
135inline
137 :nsUri_(Schema::SchemaUri),
138 typeId_(0),
139 baseType_(Schema::XSD_ANYTYPE),
140 baseDerivation_(Schema::Extension),
141 contentModel_(Schema::None),
142 anonymous_(false)
143{
144}
145
146inline
147std::string
149{
150 return name_;
151}
152
153inline
154Qname
156{
157 Qname qn(name_);
158 qn.setNamespace(nsUri_);
159 return qn;
160}
161
162inline
165{
166 return contentModel_;
167}
168
169inline
170int
172{
173 return typeId_;
174}
175
176inline
177bool
179{
180 return anonymous_;
181}
182
183inline
184int
186{
187 return baseType_;
188}
189
190inline
193{
194 return baseDerivation_;
195}
196
197inline
198void
200{
201 typeId_ = id;
202}
203
204inline
205void
208{
209 baseType_=id;
210 baseDerivation_=type;
211}
212
213inline
214void
216{
217 anonymous_ = flag;
218}
219
220inline
221void
222XSDType::setName(std::string name)
223{
224 name_ = name;
225}
226
227inline
228void
230{
231 contentModel_ = model;
232}
233
234inline
235std::string
237{
238 return nsUri_;
239}
240}
241#endif /* */
Definition Qname.h:31
void setNamespace(std::string uri)
Definition Qname.h:97
bool isAnonymous() const
Definition XSDType.h:178
std::string getNamespace() const
Definition XSDType.h:236
void setBaseType(int id, Schema::Derivation type=Schema::Restriction)
Definition XSDType.h:206
int getBaseTypeId() const
Definition XSDType.h:185
virtual void setAnonymous(bool)
Definition XSDType.h:215
std::string getName() const
Definition XSDType.h:148
virtual void setTypeId(int)
Definition XSDType.h:199
Schema::Derivation getBaseDerivation() const
Definition XSDType.h:192
virtual bool isSimple() const =0
virtual void setContentModel(Schema::ContentModelType)
Definition XSDType.h:229
void setBaseTypeNamespace(std::string ns)
Qname getQname() const
Definition XSDType.h:155
int getTypeId() const
Definition XSDType.h:171
Schema::ContentModelType getContentModel() const
Definition XSDType.h:164
virtual void setName(std::string)
Definition XSDType.h:222
Derivation
Definition Schema.h:38
@ Extension
Definition Schema.h:40
@ Restriction
Definition Schema.h:39
const std::string SchemaUri
Definition Schema.h:92
ContentModelType
Definition Schema.h:44
@ None
Definition Schema.h:45
@ XSD_ANYTYPE
Definition Schema.h:88
#define WSDLPULL_EXPORT