00001
00002
00003 #ifndef BASE_SOAP_SOAPSTRUCT_H
00004 #define BASE_SOAP_SOAPSTRUCT_H
00005
00006 #include <map>
00007 #include <vector>
00008 #include <xercesc/dom/DOMDocument.hpp>
00009 #include <xercesc/dom/DOMElement.hpp>
00010 #include "libppbase/base/DateTime.h"
00011 #include "SOAPTranscoder.h"
00012
00013 namespace base_soap {
00015
00019 class PPBASE_SOAP_EXPORT SOAPStruct {
00020 public:
00022
00027 SOAPStruct(xercesc::DOMDocument *document = NULL, xercesc::DOMElement *base = NULL, SOAPTranscoder *transcoder = NULL);
00028
00030 ~SOAPStruct();
00031
00033
00037 SOAPStruct *add(const base::String &name);
00038
00040
00044 void add(const base::String &name, bool value);
00045
00047
00051 void add(const base::String &name, const base::DateTime &value);
00052
00054
00058 void add(const base::String &name, double value);
00059
00061
00065 void add(const base::String &name, int value);
00066
00068
00072 void add(const base::String &name, unsigned int value);
00073
00075
00079 void add(const base::String &name, long value);
00080
00082
00086 void add(const base::String &name, unsigned long value);
00087
00089
00093 void add(const base::String &name, base::longlong_t value);
00094
00096
00100 void add(const base::String &name, base::u_longlong_t value);
00101
00103
00107 void add(const base::String &name, const char *value);
00108
00110
00114 void add(const base::String &name, const base::String &value);
00115
00117
00121 void add(const std::vector<base::String> &names, const std::vector<base::String> &values);
00122
00124
00129 void add(const base::String &name, const std::vector<base::String> &names, const std::vector<base::String> &values);
00130
00132
00137 void add(const base::String &name, const std::vector<std::pair<base::String,base::String> > &value, bool lower = true);
00138
00140
00145 void add(const base::String &name, const std::map<base::String,base::String> &value, bool lower = true);
00146
00148
00152 void add(const base::String &name, const std::vector<base::String> &value);
00153
00155
00160 void add(const base::String &name, const std::vector<std::map<base::String,base::String> > &value, bool lower = true);
00161
00163
00166 void erase(const base::String &name);
00167
00169
00173 bool exists(const base::String &name) const;
00174
00176
00180 bool existsNotNull(const base::String &name) const;
00181
00183
00186 xercesc::DOMElement *getBase() const;
00187
00189
00195 bool getBool(const base::String &name, bool *exist = NULL, bool *isnull = NULL) const;
00196
00198
00204 base::DateTime getDateTime(const base::String &name, bool *exist = NULL, bool *isnull = NULL) const;
00205
00207
00213 double getDouble(const base::String &name, bool *exist = NULL, bool *isnull = NULL) const;
00214
00216
00222 int getInt(const base::String &name, bool *exist = NULL, bool *isnull = NULL) const;
00223
00225
00231 long getLong(const base::String &name, bool *exist = NULL, bool *isnull = NULL) const;
00232
00234
00240 base::longlong_t getLongLong(const base::String &name, bool *exist = NULL, bool *isnull = NULL) const;
00241
00243
00248 std::map<base::String, base::String> *getMap(const base::String &name, bool *exist = NULL) const;
00249
00251
00257 base::String getString(const base::String &name, bool *exist = NULL, bool *isnull = NULL) const;
00258
00260
00265 SOAPStruct *getStruct(const base::String &name, bool *exist = NULL);
00266
00268
00273 std::vector<SOAPStruct*> getStructArray(const base::String &name, bool *exist = NULL);
00274
00276
00282 unsigned int getUInt(const base::String &name, bool *exist = NULL, bool *isnull = NULL) const;
00283
00285
00291 unsigned long getULong(const base::String &name, bool *exist = NULL, bool *isnull = NULL) const;
00292
00294
00300 base::u_longlong_t getULongLong(const base::String &name, bool *exist = NULL, bool *isnull = NULL) const;
00301
00303
00308 std::vector<std::pair<base::String,base::String> > *getVectorOfPairs(const base::String &name, bool *exist = NULL) const;
00309
00311
00316 std::vector<base::String> *getVectorOfStrings(const base::String &name, bool *exist = NULL) const;
00317
00319
00324 std::vector<std::map<base::String,base::String> > *getVectorOfMaps(const base::String &name, bool *exist = NULL) const;
00325
00327
00330 void setTranscoder(SOAPTranscoder *transcoder);
00331
00332 protected:
00333 xercesc::DOMElement *_base;
00334 xercesc::DOMDocument *_document;
00335 std::vector<SOAPStruct*> _structs;
00336 SOAPTranscoder *_transcoder;
00337 };
00338 }
00339
00340 #endif