wsdlpull
1.23
src
wsdlparser
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
"
26
#include "
xmlpull/wsdlpull_export.h
"
27
#include "
schemaparser/Element.h
"
28
#include "
wsdlparser/WsdlException.h
"
29
#include "
wsdlparser/WsdlElement.h
"
30
31
namespace
WsdlPull
{
32
//Message part
33
class
WSDLPULL_EXPORT
Part
{
34
public
:
35
36
typedef
enum
37
{
38
None
,
39
Elem
,
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
{
56
int
type_id
;
57
const
Element
*
e
;
58
};
59
int
schema_id;
60
};
61
62
//Implementation of Wsdl message element
63
class
WSDLPULL_EXPORT
Message
:
public
WsdlElement
64
{
65
public
:
66
67
Message
(
WsdlParser
& w);
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
138
inline
139
Message::Message
(
WsdlParser
& w)
140
:
WsdlElement
(w)
141
{
142
parts.clear();
143
}
144
145
inline
146
Message::~Message
()
147
{
148
}
149
150
151
inline
152
int
153
Message::getNumParts
(
void
)
const
154
{
155
return
parts.size();
156
}
157
158
inline
159
std::string
160
Message::getPartName
(
int
index)
const
161
{
162
return
parts[index].name();
163
}
164
165
inline
166
int
167
Message::getPartContentSchemaId
(
int
index)
const
168
{
169
return
parts[index].schemaId();
170
}
171
172
inline
173
int
174
Message::getPartType
(
int
index)
const
175
{
176
return
parts[index].type();
177
}
178
179
inline
180
const
Element
*
181
Message::getPartElement
(
int
index)
const
182
{
183
return
parts[index].element();
184
}
185
186
inline
187
Part::Part
(
const
std::string& n)
188
:pname(n),
189
discriminator(
Part
::
None
),
190
e(0)
191
{
192
}
193
194
inline
195
Part::~Part
(){}
196
197
inline
198
Part::PartRefType
199
Part::refType
()
const
200
{
201
return
discriminator;
202
}
203
inline
204
std::string
205
Part::name
()
const
206
{
207
return
pname;
208
}
209
210
inline
211
int
212
Part::schemaId
()
const
213
{
214
return
schema_id;
215
}
216
}
217
#endif
/* */
WsdlPull::WsdlParser
Definition:
WsdlParser.h:43
WsdlPull::Part::None
@ None
Definition:
Message.h:38
WsdlElement.h
WsdlPull::Message::getPartType
int getPartType(int index) const
Definition:
Message.h:174
WsdlPull::Part::e
const Element * e
Definition:
Message.h:57
WsdlPull
Definition:
Binding.h:27
WsdlPull::Part::schemaId
int schemaId() const
Definition:
Message.h:212
WsdlPull::Part::Elem
@ Elem
Definition:
Message.h:39
WsdlPull::Part
Definition:
Message.h:33
WsdlPull::Message::~Message
~Message()
Definition:
Message.h:146
WsdlPull::Part::refType
PartRefType refType() const
Definition:
Message.h:199
Element.h
Qname.h
WsdlPull::Message::getPartElement
const Element * getPartElement(int index) const
Definition:
Message.h:181
WSDLPULL_EXPORT
#define WSDLPULL_EXPORT
Definition:
wsdlpull_export.h:33
WsdlPull::Part::type_id
int type_id
Definition:
Message.h:56
Schema::Type
Type
Definition:
Schema.h:59
WsdlPull::Message::getPartName
std::string getPartName(int index) const
Definition:
Message.h:160
WsdlPull::Part::PartRefType
PartRefType
Definition:
Message.h:36
WsdlPull::Part::Part
Part(const std::string &n)
Definition:
Message.h:187
wsdlpull_export.h
Schema::None
@ None
Definition:
Schema.h:45
WsdlPull::Part::~Part
~Part()
Definition:
Message.h:195
WsdlPull::Message::getPartContentSchemaId
int getPartContentSchemaId(int index) const
Definition:
Message.h:167
Schema::Element
Definition:
Element.h:30
WsdlPull::Message::getNumParts
int getNumParts(void) const
Definition:
Message.h:153
WsdlPull::Message::Message
Message(WsdlParser &w)
Definition:
Message.h:139
WsdlException.h
WsdlPull::Message
Definition:
Message.h:63
WsdlPull::Part::name
std::string name() const
Definition:
Message.h:205
WsdlPull::WsdlElement
Definition:
WsdlElement.h:38
Generated by
1.8.17