wsdlpull 1.23
Loading...
Searching...
No Matches
Message.h
Go to the documentation of this file.
1/*
2 * wsdlpull - A C++ parser for WSDL (Web services description language)
3 * Copyright (C) 2005-2007 Vivek Krishna
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 */
20#ifndef _MESSAGEH
21#define _MESSAGEH
22
23#include <string>
24#include <vector>
25#include "xmlpull/Qname.h"
30
31namespace WsdlPull {
32//Message part
34 public:
35
36 typedef enum
37 {
40 Type
41 }PartRefType;
42
43 Part(const std::string& n);
44 ~Part();
45 PartRefType refType()const;
46 std::string name()const;
47 int type()const;
48 const Element* element()const;
49 int schemaId()const;
50 void setPartType(int typeId,int schema);
51 void setPartElement(const Element* e,int schema);
52 private:
53 std::string pname;
54 PartRefType discriminator;
55 union {
57 const Element * e;
58 };
59 int schema_id;
60};
61
62//Implementation of Wsdl message element
64{
65 public:
66
68 ~Message();
71
76 int getNumParts(void) const;
83 int getPartIndex(std::string & nam) const ;
84 /* @name getPartType
85 * @param the index of the part index:0..nParts-1
86 * @return type id of the part
87 * for ex if we have <part name="one" type="xsd:int">
88 * the id returned represents xsd:int,the schema type for integers
89 */
90 int getPartType(int index) const;
91 int getPartType(const std::string & nam) const;
92
93 /* @name getPartElement
94 * @param the index of the part index:0..nParts-1
95 * @return pointer to the Element which the part uses
96 * for ex if we have <part name="one" element="ns:elem">
97 * a pointer to the Element representing ns:elem is returned
98 * I the part's reftype is Type ,0 is returned
99 */
100 const Element * getPartElement(int index)const;
101
102 /* @name getMessagePart
103 * @param the index of the part,or the name
104 * @return pointer to the Part
105 */
106 const Part* getMessagePart(size_t index)const;
107 const Part* getMessagePart(const std::string & nam)const;
108
109 /* @name getPartContentSchemaId
110 * @param the index of the part,or the name
111 * @return schema id to which the part's type or element belongs to
112 */
113 int getPartContentSchemaId(int index) const;
114 int getPartContentSchemaId(const std::string & nam) const;
115
116 std::string getPartName(int index) const;
117 Part::PartRefType getPartRefType(const std::string & nam) const;
118 Part::PartRefType getPartRefType(int index) const;
119
120
121
123
126 void addPart(std::string pname,
127 Part::PartRefType reftype,
128 void* d,
129 int schema_id);
130
132
133 // void print(ostream & out);
134 private:
135 std::vector<Part> parts;
136};
137
138inline
140 :WsdlElement(w)
141{
142 parts.clear();
143}
144
145inline
149
150
151inline
152int
154{
155 return parts.size();
156}
157
158inline
159std::string
160Message::getPartName(int index) const
161{
162 return parts[index].name();
163}
164
165inline
166int
168{
169 return parts[index].schemaId();
170}
171
172inline
173int
174Message::getPartType(int index) const
175{
176 return parts[index].type();
177}
178
179inline
180const Element *
182{
183 return parts[index].element();
184}
185
186inline
187Part::Part(const std::string& n)
188 :pname(n),
189 discriminator(Part::None),
190 e(0)
191{
192}
193
194inline
196
197inline
200{
201 return discriminator;
202}
203inline
204std::string
206{
207 return pname;
208}
209
210inline
211int
213{
214 return schema_id;
215}
216}
217#endif /* */
int getPartContentSchemaId(int index) const
Definition Message.h:167
int getPartType(int index) const
Definition Message.h:174
Message(WsdlParser &w)
Definition Message.h:139
int getNumParts(void) const
Definition Message.h:153
std::string getPartName(int index) const
Definition Message.h:160
const Element * getPartElement(int index) const
Definition Message.h:181
std::string name() const
Definition Message.h:205
const Element * e
Definition Message.h:57
int schemaId() const
Definition Message.h:212
Part(const std::string &n)
Definition Message.h:187
PartRefType refType() const
Definition Message.h:199
@ None
Definition Schema.h:45
#define WSDLPULL_EXPORT