00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _MESSAGEH
00021 #define _MESSAGEH
00022
00023 #include <string>
00024 #include <vector>
00025 #include "xmlpull/Qname.h"
00026 #include "schemaparser/Element.h"
00027 #include "wsdlparser/WsdlException.h"
00028 #include "wsdlparser/WsdlElement.h"
00029
00030 namespace WsdlPull {
00031
00032 class WSDLPULL_EXPORT Part{
00033 public:
00034
00035 typedef enum
00036 {
00037 None,
00038 Elem,
00039 Type
00040 }PartRefType;
00041
00042 Part(const std::string& n);
00043 ~Part();
00044 PartRefType refType()const;
00045 std::string name()const;
00046 int type()const;
00047 const Element* element()const;
00048 int schemaId()const;
00049 void setPartType(int typeId,int schema);
00050 void setPartElement(const Element* e,int schema);
00051 private:
00052 std::string pname;
00053 PartRefType discriminator;
00054 union {
00055 int type_id;
00056 const Element * e;
00057 };
00058 int schema_id;
00059 };
00060
00061
00062 class WSDLPULL_EXPORT Message:public WsdlElement
00063 {
00064 public:
00065
00066 Message(WsdlParser& w);
00067 ~Message();
00070
00075 int getNumParts(void) const;
00082 int getPartIndex(std::string & nam) const ;
00083
00084
00085
00086
00087
00088
00089 int getPartType(int index) const;
00090 int getPartType(const std::string & nam) const;
00091
00092
00093
00094
00095
00096
00097
00098
00099 const Element * getPartElement(int index)const;
00100
00101
00102
00103
00104
00105 const Part* getMessagePart(size_t index)const;
00106 const Part* getMessagePart(const std::string & nam)const;
00107
00108
00109
00110
00111
00112 int getPartContentSchemaId(int index) const;
00113 int getPartContentSchemaId(const std::string & nam) const;
00114
00115 std::string getPartName(int index) const;
00116 Part::PartRefType getPartRefType(const std::string & nam) const;
00117 Part::PartRefType getPartRefType(int index) const;
00118
00119
00120
00122
00125 void addPart(std::string pname,
00126 Part::PartRefType reftype,
00127 void* d,
00128 int schema_id);
00129
00131
00132
00133 private:
00134 std::vector<Part> parts;
00135 };
00136
00137 inline
00138 Message::Message(WsdlParser & w)
00139 :WsdlElement(w)
00140 {
00141 parts.clear();
00142 }
00143
00144 inline
00145 Message::~Message()
00146 {
00147 };
00148
00149
00150 inline
00151 int
00152 Message::getNumParts(void) const
00153 {
00154 return parts.size();
00155 }
00156
00157 inline
00158 std::string
00159 Message::getPartName(int index) const
00160 {
00161 return parts[index].name();
00162 }
00163
00164 inline
00165 int
00166 Message::getPartContentSchemaId(int index) const
00167 {
00168 return parts[index].schemaId();
00169 }
00170
00171 inline
00172 int
00173 Message::getPartType(int index) const
00174 {
00175 return parts[index].type();
00176 }
00177
00178 inline
00179 const Element *
00180 Message::getPartElement(int index)const
00181 {
00182 return parts[index].element();
00183 }
00184
00185 inline
00186 Part::Part(const std::string& n)
00187 :pname(n),
00188 discriminator(Part::None),
00189 e(0)
00190 {
00191 }
00192
00193 inline
00194 Part::~Part(){}
00195
00196 inline
00197 Part::PartRefType
00198 Part::refType()const
00199 {
00200 return discriminator;
00201 }
00202 inline
00203 std::string
00204 Part::name()const
00205 {
00206 return pname;
00207 }
00208
00209 inline
00210 int
00211 Part::schemaId()const
00212 {
00213 return schema_id;
00214 }
00215 }
00216 #endif