ulxr::CachedResource Class Reference
[General helper classes]

Abstraction of a resource accessed via xmlrpc or http. More...

#include <ulxr_cached_resource.h>

Inheritance diagram for ulxr::CachedResource:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 CachedResource (const CppString &name)
 Creates the resource.
virtual ~CachedResource ()
 Destroys the resource.
CppString getResourceName () const
 Gets the resource name.
virtual void open ()=0
 Opens the resource.
virtual void close ()=0
 Closes the resource.
virtual bool good ()=0
 Tests the state of the resource.
std::string read ()
 Reads the remaining data from the current position.
std::string read (unsigned len)
 Reads a chunk of data the remaining data from the current position.
void write (const std::string &s)
 Appends a chunk of data at the end of the cache string.
void write (const char *str, unsigned len)
 Appends a chunk of data at the end of the cache string.
virtual void clear ()
 Clears the internal cache and resets the read pointer.
virtual void reset ()
 Resets the read pointer to the beginning.
std::string data () const
 Reads the complete cached data.

Private Attributes

CppString name
std::string cache
unsigned read_pointer

Detailed Description

Abstraction of a resource accessed via xmlrpc or http.

The data is stored in a stream alike fashion. It is possible to read from and write to the same object. Writing simply appends to the object. Reading is done with a stream pointer.

Definition at line 45 of file ulxr_cached_resource.h.


Constructor & Destructor Documentation

ulxr::CachedResource::CachedResource ( const CppString name  ) 

Creates the resource.

Parameters:
name the name of the resource

Definition at line 43 of file ulxr_cached_resource.cpp.

References reset().

ulxr::CachedResource::~CachedResource (  )  [virtual]

Destroys the resource.

Definition at line 57 of file ulxr_cached_resource.cpp.

References name, ULXR_PCHAR, and ULXR_TRACE.


Member Function Documentation

CppString ulxr::CachedResource::getResourceName (  )  const

Gets the resource name.

Definition at line 50 of file ulxr_cached_resource.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

virtual void ulxr::CachedResource::open (  )  [pure virtual]

Opens the resource.

Implemented in ulxr::FileResource, and ulxr::VirtualResource.

Referenced by ulxr::HttpServer::executeHttpGET().

virtual void ulxr::CachedResource::close (  )  [pure virtual]

Closes the resource.

Implemented in ulxr::FileResource, and ulxr::VirtualResource.

virtual bool ulxr::CachedResource::good (  )  [pure virtual]

Tests the state of the resource.

Returns:
true: state is ok

false: an error occured

Implemented in ulxr::FileResource, and ulxr::VirtualResource.

Referenced by ulxr::HttpServer::executeHttpDELETE(), ulxr::HttpServer::executeHttpGET(), and ulxr::HttpServer::executeHttpPUT().

std::string ulxr::CachedResource::read (  ) 

Reads the remaining data from the current position.

Returns:
remaining data

Definition at line 70 of file ulxr_cached_resource.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

std::string ulxr::CachedResource::read ( unsigned  len  ) 

Reads a chunk of data the remaining data from the current position.

Parameters:
len number of chracters to read
Returns:
remaining data

Definition at line 79 of file ulxr_cached_resource.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

void ulxr::CachedResource::write ( const std::string &  s  ) 

Appends a chunk of data at the end of the cache string.

Parameters:
s string to append

Definition at line 91 of file ulxr_cached_resource.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

Referenced by ulxr::HttpServer::executeHttpPUT().

void ulxr::CachedResource::write ( const char *  str,
unsigned  len 
)

Appends a chunk of data at the end of the cache string.

Parameters:
str start of string to append
len number of characters to write

Definition at line 98 of file ulxr_cached_resource.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

void ulxr::CachedResource::clear (  )  [virtual]

Clears the internal cache and resets the read pointer.

Reimplemented in ulxr::FileResource.

Definition at line 105 of file ulxr_cached_resource.cpp.

Referenced by ulxr::FileResource::clear(), ulxr::FileResource::close(), ulxr::HttpServer::executeHttpDELETE(), and ulxr::HttpServer::executeHttpPUT().

void ulxr::CachedResource::reset (  )  [virtual]

Resets the read pointer to the beginning.

Reimplemented in ulxr::FileResource.

Definition at line 112 of file ulxr_cached_resource.cpp.

Referenced by CachedResource(), ulxr::HttpServer::executeHttpGET(), and ulxr::FileResource::reset().

std::string ulxr::CachedResource::data (  )  const

Reads the complete cached data.

Returns:
complete data

Definition at line 63 of file ulxr_cached_resource.cpp.

References ULXR_PCHAR, and ULXR_TRACE.

Referenced by ulxr::HttpServer::executeHttpGET().


Member Data Documentation

CppString ulxr::CachedResource::name [private]

Definition at line 113 of file ulxr_cached_resource.h.

Referenced by ~CachedResource().

std::string ulxr::CachedResource::cache [private]

Definition at line 114 of file ulxr_cached_resource.h.

unsigned ulxr::CachedResource::read_pointer [private]

Definition at line 115 of file ulxr_cached_resource.h.


The documentation for this class was generated from the following files:
Generated on Sun Aug 19 20:09:01 2007 for ulxmlrpcpp by  doxygen 1.5.1