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 "schemaparser/Schema.h"
00033
00034 #ifndef WSDLPULL_EXPORT
00035 #if (defined _MSC_VER) && (defined _MT)
00036 #define WSDLPULL_EXPORT __declspec (dllimport)
00037 #else
00038 #define WSDLPULL_EXPORT
00039 #endif
00040 #endif
00041
00042 namespace Schema {
00043 class WSDLPULL_EXPORT XSDType
00044 {
00045 public:
00046
00052 XSDType(const std::string & ns);
00053 XSDType();
00054 virtual ~ XSDType(){};
00056
00057
00062 std::string getName() const ;
00068 std::string getNamespace() const ;
00073 Qname getQname() const;
00078 Schema::ContentModelType getContentModel() const ;
00079
00084 int getTypeId() const ;
00090 int getBaseTypeId()const;
00095 Schema::Derivation getBaseDerivation()const;
00101 bool isAnonymous() const ;
00107 virtual bool isSimple()const =0;
00108
00110 virtual void setName(std::string);
00111 virtual void setContentModel(Schema::ContentModelType );
00112 virtual void setTypeId(int);
00113 virtual void setAnonymous(bool);
00114 void setBaseType(int id , Schema::Derivation type = Schema::Restriction);
00116 #ifdef LOGGING
00117 virtual void print (std::ostream & out) { };
00118 #endif
00119 private:
00120 std::string nsUri_;
00121 std::string name_;
00122 int typeId_;
00123 int baseType_;
00124 Schema::Derivation baseDerivation_;
00125 Schema::ContentModelType contentModel_;
00126 bool anonymous_;
00127 };
00128
00129 inline
00130 XSDType::XSDType(const std::string & ns)
00131 :nsUri_(ns),
00132 typeId_(0),
00133 baseType_(Schema::XSD_ANYTYPE),
00134 baseDerivation_(Schema::Extension),
00135 contentModel_(Schema::None),
00136 anonymous_(false)
00137 {
00138 }
00139
00140 inline
00141 XSDType::XSDType()
00142 :nsUri_(Schema::SchemaUri),
00143 typeId_(0),
00144 baseType_(Schema::XSD_ANYTYPE),
00145 baseDerivation_(Schema::Extension),
00146 contentModel_(Schema::None),
00147 anonymous_(false)
00148 {
00149 }
00150
00151 inline
00152 std::string
00153 XSDType::getName() const
00154 {
00155 return name_;
00156 }
00157
00158 inline
00159 Qname
00160 XSDType::getQname() const
00161 {
00162 Qname qn(name_);
00163 qn.setNamespace(nsUri_);
00164 return qn;
00165 }
00166
00167 inline
00168 Schema::ContentModelType
00169 XSDType::getContentModel() const
00170 {
00171 return contentModel_;
00172 }
00173
00174 inline
00175 int
00176 XSDType::getTypeId() const
00177 {
00178 return typeId_;
00179 }
00180
00181 inline
00182 bool
00183 XSDType::isAnonymous() const
00184 {
00185 return anonymous_;
00186 }
00187
00188 inline
00189 int
00190 XSDType::getBaseTypeId()const
00191 {
00192 return baseType_;
00193 }
00194
00195 inline
00196 Schema::Derivation
00197 XSDType::getBaseDerivation()const
00198 {
00199 return baseDerivation_;
00200 }
00201
00202 inline
00203 void
00204 XSDType::setTypeId(int id)
00205 {
00206 typeId_ = id;
00207 }
00208
00209 inline
00210 void
00211 XSDType:: setBaseType(int id ,
00212 Schema::Derivation type)
00213 {
00214 baseType_=id;
00215 baseDerivation_=type;
00216 }
00217
00218 inline
00219 void
00220 XSDType::setAnonymous(bool flag)
00221 {
00222 anonymous_ = flag;
00223 }
00224
00225 inline
00226 void
00227 XSDType::setName(std::string name)
00228 {
00229 name_ = name;
00230 }
00231
00232 inline
00233 void
00234 XSDType::setContentModel(Schema::ContentModelType model)
00235 {
00236 contentModel_ = model;
00237 }
00238
00239 inline
00240 std::string
00241 XSDType::getNamespace() const
00242 {
00243 return nsUri_;
00244 }
00245 }
00246 #endif