Main Page | Class Hierarchy | Class List | File List | Class Members

XSoap12Serializer.hpp

00001 #ifndef XSOAP12_SERIALIZER_H 00002 #define XSOAP12_SERIALIZER_H 00003 00004 #include <assert.h> 00005 #include <vector> 00006 #include <ostream> 00007 #include <string> 00008 #include <stack> 00009 #include <utility> 00010 00011 #include <proteus/QualifiedName.h> 00012 #include <wsit/Serializer.h> 00013 #include <wsit/Vobject.h> 00014 #include <proteus/SVobjectPart.h> 00015 #include <proteus/SMatterPart.h> 00016 #include <proteus/SWormholeMatterPart.h> 00017 00018 #include "CommunicationChannel.hpp" 00019 #include "SerializationContext.hpp" 00020 #include "Attributes.hpp" 00021 00022 namespace xsoap { 00023 00025 00030 class XSoap12Serializer : public wsit::Serializer { 00031 00032 /*-------------------------------------------------------------------------- 00033 00034 Forwards */ 00035 00036 /*-------------------------------------------------------------------------- 00037 00038 Types and Constants */ 00039 public: 00040 00041 /*-------------------------------------------------------------------------- 00042 00043 Friends */ 00044 00045 /*-------------------------------------------------------------------------- 00046 00047 Constructors, Initters, Assignments, and Destructors */ 00048 00049 public: 00050 00052 00057 explicit XSoap12Serializer(CommunicationChannel* com, 00058 const SerializationContext& context) 00059 : m_ch(com) , m_context(context) {} 00060 00061 private: 00062 00063 // Disallow these unless specifically allowed. 00064 XSoap12Serializer(const XSoap12Serializer &); 00065 XSoap12Serializer &operator=(const XSoap12Serializer &); 00066 00067 /*-------------------------------------------------------------------------- 00068 00069 Accessors and Convertors */ 00070 00071 /*-------------------------------------------------------------------------- 00072 00073 Operators */ 00074 00075 /*-------------------------------------------------------------------------- 00076 00077 Methods */ 00078 00079 public: 00080 00081 // specific interface for SOAP1.2 00083 00089 void emitOpenTag(const proteus::QualifiedName &name, 00090 const proteus::QualifiedName &etype=proteus::QualifiedName(""), 00091 const attribute_list_t *attrs=NULL, 00092 bool close=false); 00093 00095 00100 void emitOpenCloseTag(const proteus::QualifiedName &name, 00101 const proteus::QualifiedName &etype=proteus::QualifiedName(""), 00102 const attribute_list_t *attrs=NULL); 00103 00105 void emitCloseTag(); 00106 00108 void beginEnv(); 00109 00111 void beginBody(); 00112 00114 void endEnv(); 00115 00117 void endBody(); 00118 00120 void beginHeader(); 00121 00123 void endHeader(); 00124 00126 00131 template <typename T> 00132 void packPrimitive(const char *n, T& v, bool needType=true); 00133 00135 00140 template <typename T> 00141 void packArray_k(const char *n, const T *val, size_t len); 00142 00144 00149 void packBinaryArray(const char *n, const char *v, size_t len); 00150 00152 00156 XSoap12Serializer& packStdString(const char *n, const std::string &s); 00157 00159 00163 XSoap12Serializer& packVobject(const char *n, const wsit::Vobject &v); 00164 00165 // inherited interface from WSIT 00166 virtual void serializeVobjectPart(const proteus::SVobjectPart &vp); 00167 virtual void serializeMatterPart(const proteus::SMatterPart &vp); 00168 virtual void serializeWormholeMatterPart(const proteus::SWormholeMatterPart &vp); 00169 // XXX to define 00170 virtual void serializeVobject(const wsit::Vobject &) {assert(false);}; 00171 virtual void serializeVobject_untyped(const wsit::Vobject &) {assert(false);}; 00172 00173 #define xyzzy(t) \ 00174 virtual XSoap12Serializer & \ 00175 pack_##t(const char *n, wsit::t v); \ 00176 virtual XSoap12Serializer & \ 00177 packArray(const char *name, const wsit::t *val, size_t len); 00178 00179 xyzzy(int8) 00180 xyzzy(int16) 00181 xyzzy(int32) 00182 xyzzy(int64) 00183 xyzzy(uint8) 00184 xyzzy(uint16) 00185 xyzzy(uint32) 00186 xyzzy(uint64) 00187 xyzzy(float32) 00188 xyzzy(float64) 00189 00190 #undef xyzzy 00191 00192 virtual XSoap12Serializer &packString(const char* n, const char*); 00193 00195 virtual void beginVobject(const proteus::QualifiedName &name, const wsit::Vobject &vo); 00197 virtual void endVobject(); 00198 00199 private: 00200 std::string getPrefixedName(proteus::QualifiedName& qname); 00201 /*-------------------------------------------------------------------------- 00202 00203 Data */ 00204 00205 private: 00206 00207 CommunicationChannel* m_ch; 00208 SerializationContext m_context; 00209 std::stack<std::string> m_tagStack; 00210 00211 /*-------------------------------------------------------------------------- 00212 00213 Static Methods */ 00214 00215 /*-------------------------------------------------------------------------- 00216 00217 Static Data */ 00218 00219 /*-------------------------------------------------------------------------- 00220 00221 Access Specifiers */ 00222 }; 00223 } 00224 #endif 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238

Generated on Sat Jun 5 00:52:18 2004 for XSoap-C++ by doxygen 1.3.7