00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #ifndef CCXX_XML_H_
00042 #define CCXX_XML_H_
00043
00044 #ifndef CCXX_CONFIG_H_
00045 #include <cc++/config.h>
00046 #endif
00047
00048 #ifndef CCXX_THREAD_H_
00049 #include <cc++/thread.h>
00050 #endif
00051
00052 #ifndef CCXX_SLOG_H_
00053 #include <cc++/slog.h>
00054 #endif
00055
00056 #ifdef CCXX_NAMESPACES
00057 namespace ost {
00058 #endif
00059
00070 class XMLStream
00071 {
00072 public:
00082 virtual bool Open(const char *resource)
00083 {return true;};
00084
00089 virtual void Close(void)
00090 {return;};
00091
00097 virtual slog_level_t getLogging(void)
00098 {return SLOG_CRITICAL;};
00099
00106 virtual void comment(const unsigned char *text)
00107 {return;};
00108
00116 virtual int Read(unsigned char *buffer, int len) = 0;
00117
00125 virtual void characters(const unsigned char *text, unsigned len) = 0;
00126
00130 virtual void startDocument(void)
00131 {return;};
00132
00136 virtual void endDocument(void)
00137 {return;};
00138
00145 virtual void startElement(const unsigned char *name, const unsigned char **attr) = 0;
00146
00152 virtual void endElement(const unsigned char *name) = 0;
00153
00160 bool Parse(const char *resource = NULL);
00161 };
00162
00172 class XMLRPC : public XMLStream
00173 {
00174 private:
00175 char *buffer;
00176 strstream *strbuf;
00177 size_t bufsize;
00178 bool structflag;
00179 bool reply, fault;
00180 unsigned array;
00181
00182 protected:
00192 virtual bool Post(const char *resource, const char *msg);
00193
00197 void begStruct(void);
00198
00199 public:
00205 XMLRPC(size_t bufsize);
00206
00210 virtual ~XMLRPC();
00211
00215 void begArray(void);
00216
00220 void endArray(void);
00221
00227 void Invoke(const char *method);
00228
00234 void Response(bool fault);
00235
00241 void addParam(bool value);
00242
00249 void addMember(const char *name, bool value);
00250
00256 void addParam(long value);
00257
00264 void addMember(const char *name, long value);
00265
00271 void addParam(const char *string);
00272
00279 void addMember(const char *name, const char *value);
00280
00284 void endStruct(void);
00285
00292 bool Send(const char *resource);
00293 };
00294
00295 #ifdef CCXX_NAMESPACES
00296 };
00297 #endif
00298
00299 #endif
00300