00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00028 #ifndef _RTXMLCPPXSDELEMENT_H_
00029 #define _RTXMLCPPXSDELEMENT_H_
00030
00031 #include "rtxsrc/rtxCppContext.h"
00032 #include "rtxsrc/rtxCppMsgBufIF.h"
00033 #include "rtxsrc/rtxErrCodes.h"
00034 #include "rtxmlsrc/osrtxml.h"
00035
00043 class EXTERNXML OSXSDGlobalElement {
00044 protected:
00051 OSCtxtPtr mpContext;
00052
00057 OSMessageBufferIF* mpMsgBuf;
00058
00063 const OSUTF8CHAR* mpSOAPFaultCode;
00064
00069 const OSUTF8CHAR* mpSOAPFaultString;
00070
00075 OSXSDGlobalElement () : mpContext (new OSContext()), mpMsgBuf(0),
00076 mpSOAPFaultCode(0), mpSOAPFaultString(0) {}
00077
00084 OSXSDGlobalElement (OSContext& ctxt) : mpContext (&ctxt), mpMsgBuf (0) {}
00085
00092 void setMsgBuf (OSMessageBufferIF& msgBuf);
00093
00094 public:
00104 OSXSDGlobalElement (OSMessageBufferIF& msgBuf) : mpMsgBuf(&msgBuf),
00105 mpSOAPFaultCode(0), mpSOAPFaultString(0) {
00106 mpContext = msgBuf.getContext();
00107 }
00108
00116 OSXSDGlobalElement (const OSXSDGlobalElement& o) :
00117 mpContext (o.mpContext), mpMsgBuf (o.mpMsgBuf),
00118 mpSOAPFaultCode (o.mpSOAPFaultCode),
00119 mpSOAPFaultString (o.mpSOAPFaultString) {}
00120
00125 virtual ~OSXSDGlobalElement () {}
00126
00131 inline int decode () { return decodeFrom (*mpMsgBuf); }
00132
00140 virtual int decodeFrom (OSMessageBufferIF& msgBuf) { return 0; }
00141
00146 inline int encode () { return encodeTo (*mpMsgBuf); }
00147
00155 virtual int encodeTo (OSMessageBufferIF& msgBuf) { return 0; }
00156
00161 inline OSCTXT* getCtxtPtr () {
00162 return (!mpContext.isNull ()) ? mpContext->getPtr() : 0;
00163 }
00164
00174 inline void* memAlloc (size_t numocts) {
00175 return rtxMemAlloc (getCtxtPtr(), numocts);
00176 }
00177
00188 inline void* memRealloc (void* ptr, size_t oldnumocts, size_t numocts) {
00189 return rtxMemRealloc (getCtxtPtr(), ptr, oldnumocts, numocts);
00190 }
00191
00200 inline void memFreePtr (void* ptr) {
00201 rtxMemFreePtr (getCtxtPtr(), ptr);
00202 }
00203
00210 inline void setDefaultNamespace (const OSUTF8CHAR* uri) {
00211 setNamespace (0, uri);
00212 }
00213
00221 inline void setNamespace (const OSUTF8CHAR* prefix, const OSUTF8CHAR* uri) {
00222 mpMsgBuf->setNamespace (prefix, uri);
00223 }
00224
00231 inline void setSOAPFaultCode (const OSUTF8CHAR* value) {
00232 mpSOAPFaultCode = value;
00233 }
00234
00241 inline void setSOAPFaultString (const OSUTF8CHAR* value) {
00242 mpSOAPFaultString = value;
00243 }
00244
00251 inline void setXSIType (const OSUTF8CHAR* typeName) {
00252 rtXmlSetXSITypeAttr (mpContext->getPtr(), typeName);
00253 }
00254
00259 inline int validate () { return validateFrom (*mpMsgBuf); }
00260
00268 virtual int validateFrom (OSMessageBufferIF& msgBuf)
00269 { return RTERR_NOTSUPP; }
00270 } ;
00271
00272 #endif