Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

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 <schemaparser/Schema.h>
00033 #ifdef HAVE_CONFIG_H //
00034 #include <config.h>
00035 #endif             
00036 
00037 using namespace std;
00038 
00039 class XSDType
00040 {
00041  public:
00042 
00048   XSDType(const std::string & ns);
00049   XSDType();
00050   virtual ~ XSDType(){};
00052 
00053 
00058   std::string getName() const ;
00064   std::string getNamespace() const ;
00069   Qname getQname() const;
00074   Schema::ContentModelType getContentModel() const ;    
00075 
00080   int getTypeId() const ;
00086   int getBaseTypeId()const;
00091   Schema::Derivation getBaseDerivation()const;
00097   bool isAnonymous() const ;
00103   virtual bool isSimple()const =0;
00104   
00106   virtual void setName(std::string);
00107   virtual void setContentModel(Schema::ContentModelType );
00108   virtual void setTypeId(int);
00109   virtual void setAnonymous(bool);
00110   void setBaseType(int id , Schema::Derivation type = Schema::Restriction);
00112 #ifdef LOGGING
00113   virtual void print (ostream & out) { };
00114 #endif
00115  private:
00116   std::string nsUri_;
00117   std::string name_;
00118   int typeId_;
00119   int baseType_;
00120   Schema::Derivation baseDerivation_;
00121   Schema::ContentModelType contentModel_;//simple,complex,mixed?
00122   bool anonymous_;
00123 };
00124 
00125 inline
00126 XSDType::XSDType(const std::string & ns)
00127   :nsUri_(ns),
00128      typeId_(0),
00129      baseType_(Schema::ANYTYPE),
00130      baseDerivation_(Schema::Extension),
00131      contentModel_(Schema::None),
00132      anonymous_(false)
00133 {
00134 }
00135 
00136 inline
00137 XSDType::XSDType()
00138   :nsUri_(Schema::SchemaUri),
00139      typeId_(0),
00140      baseType_(Schema::ANYTYPE),
00141      baseDerivation_(Schema::Extension),
00142      contentModel_(Schema::None),
00143      anonymous_(false)
00144 {
00145 }
00146 
00147 inline
00148 string 
00149 XSDType::getName() const
00150 {
00151   return name_;
00152 }
00153 
00154 inline
00155 Qname 
00156 XSDType::getQname() const
00157 {
00158   Qname qn(name_);
00159   qn.setNamespace(nsUri_);
00160   return qn;
00161 }
00162 
00163 inline
00164 Schema::ContentModelType
00165 XSDType::getContentModel() const
00166 {
00167   return contentModel_;
00168 }
00169 
00170 inline
00171 int 
00172 XSDType::getTypeId() const
00173 {
00174   return typeId_;
00175 }
00176 
00177 inline
00178 bool 
00179 XSDType::isAnonymous() const
00180 {
00181   return anonymous_;
00182 }
00183 
00184 inline
00185 int
00186 XSDType::getBaseTypeId()const
00187 {
00188   return baseType_;
00189 }
00190 
00191 inline
00192 Schema::Derivation 
00193 XSDType::getBaseDerivation()const
00194 {
00195   return baseDerivation_;
00196 }
00197 
00198 inline
00199 void 
00200 XSDType::setTypeId(int id)
00201 {
00202   typeId_ = id;
00203 }
00204 
00205 inline
00206 void
00207 XSDType:: setBaseType(int id ,
00208                       Schema::Derivation type)
00209 {
00210   baseType_=id;
00211   baseDerivation_=type;
00212 }
00213 
00214 inline
00215 void 
00216 XSDType::setAnonymous(bool flag)
00217 {
00218   anonymous_ = flag;
00219 }
00220 
00221 inline
00222 void 
00223 XSDType::setName(string name)
00224 {
00225   name_ = name;
00226 }
00227 
00228 inline
00229 void 
00230 XSDType::setContentModel(Schema::ContentModelType model)
00231 {
00232     contentModel_ = model;
00233 }
00234 
00235 inline
00236 std::string
00237 XSDType::getNamespace() const
00238 {
00239   return nsUri_;
00240 }
00241 #endif                                            /*  */

Generated on Sun Oct 16 10:11:52 2005 for wsdlpull by  doxygen 1.3.9.1