wsdlpull
1.23
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
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
/* */
Generated by
1.8.1.2