XSDType.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _XSDTYPEH
00028 #define _XSDTYPEH
00029
00030 #include <string>
00031 #include "xmlpull/Qname.h"
00032 #include "xmlpull/wsdlpull_export.h"
00033 #include "schemaparser/Schema.h"
00034
00035
00036 namespace Schema {
00037 class WSDLPULL_EXPORT XSDType
00038 {
00039 public:
00040
00046 XSDType(const std::string & ns);
00047 XSDType();
00048 virtual ~ XSDType(){};
00050
00051
00056 std::string getName() const ;
00062 std::string getNamespace() const ;
00067 Qname getQname() const;
00072 Schema::ContentModelType getContentModel() const ;
00073
00078 int getTypeId() const ;
00084 int getBaseTypeId()const;
00089 Schema::Derivation getBaseDerivation()const;
00095 bool isAnonymous() const ;
00101 virtual bool isSimple()const =0;
00102
00104 virtual void setName(std::string);
00105 virtual void setContentModel(Schema::ContentModelType );
00106 virtual void setTypeId(int);
00107 virtual void setAnonymous(bool);
00108 void setBaseType(int id , Schema::Derivation type = Schema::Restriction);
00109 void setBaseTypeNamespace(std::string ns);
00111 #ifdef LOGGING
00112 virtual void print (std::ostream & out) { };
00113 #endif
00114 private:
00115 std::string nsUri_;
00116 std::string name_;
00117 int typeId_;
00118 int baseType_;
00119 Schema::Derivation baseDerivation_;
00120 Schema::ContentModelType contentModel_;
00121 bool anonymous_;
00122 };
00123
00124 inline
00125 XSDType::XSDType(const std::string & ns)
00126 :nsUri_(ns),
00127 typeId_(0),
00128 baseType_(Schema::XSD_ANYTYPE),
00129 baseDerivation_(Schema::Extension),
00130 contentModel_(Schema::None),
00131 anonymous_(false)
00132 {
00133 }
00134
00135 inline
00136 XSDType::XSDType()
00137 :nsUri_(Schema::SchemaUri),
00138 typeId_(0),
00139 baseType_(Schema::XSD_ANYTYPE),
00140 baseDerivation_(Schema::Extension),
00141 contentModel_(Schema::None),
00142 anonymous_(false)
00143 {
00144 }
00145
00146 inline
00147 std::string
00148 XSDType::getName() const
00149 {
00150 return name_;
00151 }
00152
00153 inline
00154 Qname
00155 XSDType::getQname() const
00156 {
00157 Qname qn(name_);
00158 qn.setNamespace(nsUri_);
00159 return qn;
00160 }
00161
00162 inline
00163 Schema::ContentModelType
00164 XSDType::getContentModel() const
00165 {
00166 return contentModel_;
00167 }
00168
00169 inline
00170 int
00171 XSDType::getTypeId() const
00172 {
00173 return typeId_;
00174 }
00175
00176 inline
00177 bool
00178 XSDType::isAnonymous() const
00179 {
00180 return anonymous_;
00181 }
00182
00183 inline
00184 int
00185 XSDType::getBaseTypeId()const
00186 {
00187 return baseType_;
00188 }
00189
00190 inline
00191 Schema::Derivation
00192 XSDType::getBaseDerivation()const
00193 {
00194 return baseDerivation_;
00195 }
00196
00197 inline
00198 void
00199 XSDType::setTypeId(int id)
00200 {
00201 typeId_ = id;
00202 }
00203
00204 inline
00205 void
00206 XSDType:: setBaseType(int id ,
00207 Schema::Derivation type)
00208 {
00209 baseType_=id;
00210 baseDerivation_=type;
00211 }
00212
00213 inline
00214 void
00215 XSDType::setAnonymous(bool flag)
00216 {
00217 anonymous_ = flag;
00218 }
00219
00220 inline
00221 void
00222 XSDType::setName(std::string name)
00223 {
00224 name_ = name;
00225 }
00226
00227 inline
00228 void
00229 XSDType::setContentModel(Schema::ContentModelType model)
00230 {
00231 contentModel_ = model;
00232 }
00233
00234 inline
00235 std::string
00236 XSDType::getNamespace() const
00237 {
00238 return nsUri_;
00239 }
00240 }
00241 #endif