Bayonne2 / Common C++ 2 Framework
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Attributes
XMLRPC Class Referenceabstract

This class impliments a core XMLRPC service without the underlying transports. More...

#include <xml.h>

Inheritance diagram for XMLRPC:
Inheritance graph
[legend]
Collaboration diagram for XMLRPC:
Collaboration graph
[legend]

Public Member Functions

 XMLRPC (size_t bufferSize=512)
 Construct XMLRPC workspace. More...
 
virtual ~XMLRPC ()
 Destroy XMLRPC object. More...
 
void begArray (void)
 Create an array. More...
 
void endArray (void)
 end an array. More...
 
void invoke (const char *method)
 Create XMLRPC "method" call in buffer. More...
 
void response (bool fault)
 Create XMLRPC "reply" to a method call. More...
 
void addParam (bool value)
 Add bool param to XMLRPC request. More...
 
void addMember (const char *name, bool value)
 Add bool member to a XMLRPC struct. More...
 
void addParam (long value)
 Add an integer paramater to XMLRPC request. More...
 
void addMember (const char *name, long value)
 Add an integer member to XMLRPC struct. More...
 
void addParam (const char *string)
 Add a string paramater to XMLRPC request. More...
 
void addMember (const char *name, const char *value)
 Add a string member to XMLRPC struct. More...
 
void endStruct (void)
 Clear a struct. More...
 
bool send (const char *resource)
 Complete buffer and send well formed XMLRPC request thru post. More...
 
virtual bool open (const char *resource)
 May perform an open operation on behalf of a parsed resource. More...
 
virtual void close (void)
 May perform a close operation of an i/o source when the parser has completed operation. More...
 
virtual Slog::Level getLogging (void)
 Get error logging level. More...
 
virtual void comment (const unsigned char *text, size_t len)
 Virtual to receive embedded comments in an XML document being parsed. More...
 
virtual int read (unsigned char *buffer, size_t len)=0
 Read method to aquire data for the parser. More...
 
virtual void characters (const unsigned char *text, size_t len)=0
 Virtual to receive character text extracted from the document in the current element. More...
 
virtual void startDocument (void)
 Identify start of document event. More...
 
virtual void endDocument (void)
 Identify end of document event. More...
 
virtual void startElement (const unsigned char *name, const unsigned char **attr)=0
 Identify start of an element in the document. More...
 
virtual void endElement (const unsigned char *name)=0
 Identify end of an element in the document. More...
 
bool parse (const char *resource=NULL)
 Parse a resource as a stream thru the virtual read method. More...
 

Protected Member Functions

virtual bool post (const char *resource, const char *msg)=0
 Used in a derived transport class to deliver the XMLRPC encoded request and return true if successful. More...
 
void begStruct (void)
 Start member struct. More...
 

Private Attributes

char * buffer
 
std::strstream * oldStrBuf
 
size_t bufSize
 
bool structFlag
 
bool reply
 
bool fault
 
unsigned array
 

Detailed Description

This class impliments a core XMLRPC service without the underlying transports.

It is meant to create and parse XMLRPC messages. To use for a fit purpose, one might combine it with URLStream, although this implimentation makes no requirement for http based transport.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m XML-RPC service building class

Definition at line 184 of file xml.h.

Constructor & Destructor Documentation

XMLRPC::XMLRPC ( size_t  bufferSize = 512)

Construct XMLRPC workspace.

Parameters
bufferSizesize of buffer when using old C++ strstreams. When the newer stringstream (<sstream>) is available, this parameter is silently ignored.
virtual XMLRPC::~XMLRPC ( )
virtual

Destroy XMLRPC object.

Member Function Documentation

void XMLRPC::addMember ( const char *  name,
bool  value 
)

Add bool member to a XMLRPC struct.

Parameters
nameof member.
valueof member.
void XMLRPC::addMember ( const char *  name,
long  value 
)

Add an integer member to XMLRPC struct.

Parameters
nameof member.
valueof member.
void XMLRPC::addMember ( const char *  name,
const char *  value 
)

Add a string member to XMLRPC struct.

Parameters
nameof member.
valueof member.
void XMLRPC::addParam ( bool  value)

Add bool param to XMLRPC request.

Parameters
valueto add.
void XMLRPC::addParam ( long  value)

Add an integer paramater to XMLRPC request.

Parameters
valueto add.
void XMLRPC::addParam ( const char *  string)

Add a string paramater to XMLRPC request.

Parameters
stringto add.
void XMLRPC::begArray ( void  )

Create an array.

void XMLRPC::begStruct ( void  )
protected

Start member struct.

virtual void XMLStream::characters ( const unsigned char *  text,
size_t  len 
)
pure virtualinherited

Virtual to receive character text extracted from the document in the current element.

Parameters
textreceived.
lenlength of text received.
virtual void XMLStream::close ( void  )
virtualinherited

May perform a close operation of an i/o source when the parser has completed operation.

virtual void XMLStream::comment ( const unsigned char *  text,
size_t  len 
)
virtualinherited

Virtual to receive embedded comments in an XML document being parsed.

Parameters
texttext comment extracted.
lenlength of comment.
void XMLRPC::endArray ( void  )

end an array.

virtual void XMLStream::endDocument ( void  )
virtualinherited

Identify end of document event.

virtual void XMLStream::endElement ( const unsigned char *  name)
pure virtualinherited

Identify end of an element in the document.

Parameters
nameof element found.
void XMLRPC::endStruct ( void  )

Clear a struct.

virtual Slog::Level XMLStream::getLogging ( void  )
virtualinherited

Get error logging level.

Returns
error logging level.
void XMLRPC::invoke ( const char *  method)

Create XMLRPC "method" call in buffer.

Parameters
methodname of method being called.
virtual bool XMLStream::open ( const char *  resource)
virtualinherited

May perform an open operation on behalf of a parsed resource.

In some cases, the parser may be merged with a class that already has performed some kind of open, and this method can then be ignored.

Returns
true if open is successful.
Parameters
resourcepassed to Parse methods.
bool XMLStream::parse ( const char *  resource = NULL)
inherited

Parse a resource as a stream thru the virtual read method.

Returns
true if well formed document has been fully parsed.
Parameters
resourceoptional name of resource.
virtual bool XMLRPC::post ( const char *  resource,
const char *  msg 
)
protectedpure virtual

Used in a derived transport class to deliver the XMLRPC encoded request and return true if successful.

The Parse method can then be used to decode the reply.

Returns
true if successful.
Parameters
resourceto send to (such as url).
msgwell formed XMLRPC request message.
virtual int XMLStream::read ( unsigned char *  buffer,
size_t  len 
)
pure virtualinherited

Read method to aquire data for the parser.

Returns
number of bytes actually read.
Parameters
bufferto read data into.
lennumber of bytes to read.
void XMLRPC::response ( bool  fault)

Create XMLRPC "reply" to a method call.

Parameters
faultset true for fault message.
bool XMLRPC::send ( const char *  resource)

Complete buffer and send well formed XMLRPC request thru post.

Returns
true if successful.
Parameters
resourceto send to.
virtual void XMLStream::startDocument ( void  )
virtualinherited

Identify start of document event.

virtual void XMLStream::startElement ( const unsigned char *  name,
const unsigned char **  attr 
)
pure virtualinherited

Identify start of an element in the document.

Parameters
nameof element found.
attrlist of attributes extracted.

Field Documentation

unsigned XMLRPC::array
private

Definition at line 196 of file xml.h.

char* XMLRPC::buffer
private

Definition at line 190 of file xml.h.

size_t XMLRPC::bufSize
private

Definition at line 192 of file xml.h.

bool XMLRPC::fault
private

Definition at line 195 of file xml.h.

std::strstream* XMLRPC::oldStrBuf
private

Definition at line 191 of file xml.h.

bool XMLRPC::reply
private

Definition at line 195 of file xml.h.

bool XMLRPC::structFlag
private

Definition at line 194 of file xml.h.


The documentation for this class was generated from the following file: