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 
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_;//simple,complex,mixed?
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                                            /*  */

Generated on Mon Feb 6 23:02:42 2006 for wsdlpull by  doxygen 1.3.9.1