00001
#ifndef XSOAP12_DESERIALIZER_H
00002
#define XSOAP12_DESERIALIZER_H
00003
00004
#include <assert.h>
00005
#include <vector>
00006
#include <ostream>
00007
#include <string>
00008
#include <stack>
00009
#include <sstream>
00010
#include <utility>
00011
#include <map>
00012
00013
#include <msl/Sptr.h>
00014
#include <msl/Mutex.h>
00015
00016
#include <wsit/Serializer.h>
00017
#include <wsit/Deserializer.h>
00018
#include <wsit/Vobject.h>
00019
#include <wsit/types.h>
00020
00021
#include <proteus/QualifiedName.h>
00022
#include <proteus/VobjectFactory.h>
00023
#include <proteus/Matter.h>
00024
00025
#include "Attributes.hpp"
00026
#include <xpp/XmlPullParser.h>
00027
00028
namespace xsoap {
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00061
00066 class XSoap12Deserializer :
public wsit::Deserializer {
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
public:
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
public:
00090
00093
XSoap12Deserializer(
const std::string& sin);
00094
00095
private:
00096
00097
00098
XSoap12Deserializer(
const XSoap12Deserializer &);
00099
XSoap12Deserializer &operator=(
const XSoap12Deserializer &);
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
public:
00114
00116 bool eof() {
return m_eof;}
00117
00119
bool endOfBody();
00120
00122
bool closeTag();
00123
00125 const char*
getQnameUri(
const char* qname) {
return m_xpp.getQNameUri(qname);}
00126
00128 const char*
getQnameLocal(
const char* qname) {
return m_xpp.getQNameLocal(qname);}
00129
00130
00131
00132
00134
00140
const xpp::StartTag* waitOpenTag(
const proteus::QualifiedName &name,
00141
bool advance=
true);
00142
00144
00149
const xpp::StartTag* waitAnyOpenTag(
bool advance=
true);
00150
00152
00155
void waitCloseTag();
00156
00158
void beginEnv();
00160
void beginBody();
00162
void endEnv();
00164
void endBody();
00166
void beginHeader();
00168
void endHeader();
00169
00171
00176
template <
typename T>
00177 T unpackPrimitive(
const char* n);
00178
00180
00187
template <
class T>
00188
void unpackGenericArray(
const char *name,
00189 T *val,
00190 size_t *len);
00191
00193
00200
void unpackBinaryArray(
const char *name,
00201
char *val,
00202 size_t *len);
00203
00204
00205
00206
00207
00209
virtual XSoap12Deserializer* beginVobject(
const char *name,
00210
const char *type);
00211
00212
XSoap12Deserializer *beginVobject(
const proteus::QualifiedName& name,
00213
const char *type);
00214
00216
virtual void endVobject();
00217
00219
virtual XSoap12Deserializer &unpackStdString(
const char *name,
00220 std::string *);
00221
00222
virtual std::string unpackStdString(
const char *name);
00223
00224
virtual XSoap12Deserializer &unpackString(
const char *name,
00225
char *,
int *len);
00226
00227
virtual char *unpackString(
const char *name);
00228
00229
virtual msl::Sptr<const wsit::Vobject> deserializeVobject();
00230
virtual msl::Sptr<const wsit::Vobject> deserializeVobject_untyped(
const proteus::VobjectFactory &) {
return NULL;}
00231
00232
00233
#define xyzzy(t) \
00234
virtual wsit::t \
00235
unpack_##t(const char *n); \
00236
virtual XSoap12Deserializer & \
00237
unpackArray(const char *name, wsit::t *val,size_t *len); \
00238
virtual array_rv<wsit::t> \
00239
unpackArray_##t(const char *name);
00240
00241 xyzzy(int8)
00242 xyzzy(int16)
00243 xyzzy(int32)
00244 xyzzy(int64)
00245 xyzzy(uint8)
00246 xyzzy(uint16)
00247 xyzzy(uint32)
00248 xyzzy(uint64)
00249 xyzzy(float32)
00250 xyzzy(float64)
00251
00252 #undef xyzzy
00253
00254 private:
00255
void next();
00256
bool matchTags(xpp::StartTag &stag, xpp::EndTag &etag) ;
00257
00258
00259
00260
00261 private:
00262
00263
00264
int m_current;
00265 xpp::StartTag *m_startTag;
00266 xpp::EndTag *m_endTag;
00267 std::string m_content;
00268 std::stack<xpp::StartTag*> m_tagStack;
00269
bool m_emptyEle;
00270
bool m_eof;
00271
00272
00273
00274 xpp::XmlPullParser m_xpp;
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289 };
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319 }
00320
00321 #endif
00322
00323
00324
00325
00326
00327
00328