XSDType.h

Go to the documentation of this file.
00001 /* 
00002  * wsdl2cpp - A C++ parser  for WSDL  (Web services description language)
00003  * Copyright (C) 2005-2007 Vivek Krishna
00004  *
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Library General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  *
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Library General Public
00016  * License along with this library; if not, write to the Free
00017  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018  *
00019  *
00020  */
00021 
00022 /* 
00023  * Abstract interface for all xsd types
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_;//simple,complex,mixed?
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                                            /*  */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by  doxygen 1.6.2