00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _COMPLEXTYPEH
00021 #define _COMPLEXTYPEH
00022
00023 #include <list>
00024 #include "xmlpull/wsdlpull_export.h"
00025 #include "xmlpull/Qname.h"
00026 #include "xmlpull/XmlUtils.h"
00027 #include "schemaparser/XSDType.h"
00028 #include "schemaparser/ContentModel.h"
00029 #include "schemaparser/Attribute.h"
00030 #include "schemaparser/SchemaParserException.h"
00031
00032 namespace Schema {
00033
00034 class WSDLPULL_EXPORT ComplexType:public XSDType
00035 {
00036 public:
00037
00038 ComplexType(const std::string& );
00039 ~ComplexType();
00040
00041
00042
00043
00044
00045
00046 bool isSimple() const;
00047
00048
00049 int getContentType() const;
00050
00051
00052 int getNumAttributes() const;
00053
00054
00055 int getAttributeType(int index);
00056
00057
00058 std::string getAttributeName(int index)const;
00059
00060
00061 ContentModel* getContents()const;
00062
00063
00064 const Attribute *getAttribute(const std::string & name)const;
00065
00066 const Attribute *getAttribute(int index)const;
00067
00068 std::list < Attribute > & pAttributeList() ;
00069
00070
00071
00072
00073
00074 void setSimpleContentType(int id);
00075
00076 void setContents(ContentModel* ct);
00077
00078 void addAttribute(const Attribute &a,
00079 bool fwdRef=false);
00080
00081 void addAttributeGroupName(const Qname & qn);
00082
00083 void matchAttributeRef(const std::string & name, Attribute & a);
00084 void matchElementRef(const std::string & name, Element & e);
00085 bool checkOccurrences(void);
00086 void resetCounters(void);
00087
00088
00089 #ifdef LOGGING
00090 void print(std::ostream & out);
00091 #endif
00092
00093 private:
00094 std::list < Attribute > attList_;
00095 int simpleContentTypeId_;
00096 ContentModel* cm_;
00097 void error(std::string msg) const;
00098 bool fwdElemRef_, fwdAttrRef_;
00099 };
00100
00101
00102 inline
00103 int
00104 ComplexType::getContentType() const
00105 {
00106 return simpleContentTypeId_;
00107 }
00108
00109 inline
00110 bool
00111 ComplexType::isSimple() const
00112 {
00113 return false;
00114 }
00115
00116 inline
00117 int
00118 ComplexType::getNumAttributes() const
00119 {
00120 return attList_.size();
00121 }
00122
00123 inline
00124 int
00125 ComplexType::getAttributeType(int index)
00126 {
00127 return getAttribute(index)->getType();
00128 }
00129
00130 inline
00131 std::string
00132 ComplexType::getAttributeName(int index)const
00133 {
00134 return getAttribute(index)->getName();
00135 }
00136
00137 inline
00138 std::list < Attribute > &
00139 ComplexType::pAttributeList()
00140 {
00141 return attList_;
00142 }
00143
00144
00145 inline
00146 void
00147 ComplexType::setSimpleContentType(int id)
00148 {
00149 simpleContentTypeId_ = id;
00150 }
00151
00152
00153 inline
00154 ContentModel*
00155 ComplexType::getContents()const
00156 {
00157 return cm_;
00158
00159 }
00160
00161 inline
00162 void
00163 ComplexType::setContents(ContentModel* ct)
00164 {
00165 cm_=ct;
00166 }
00167
00168
00169 inline
00170 ComplexType::~ComplexType()
00171 {
00172 if(cm_)
00173 delete cm_;
00174 }
00175 }
00176 #endif