#include <ulxr_cached_resource.h>
Inheritance diagram for ulxr::CachedResource:

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 |
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.
| ulxr::CachedResource::CachedResource | ( | const CppString & | name | ) |
Creates the resource.
| 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.
| 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] |
| virtual bool ulxr::CachedResource::good | ( | ) | [pure virtual] |
Tests the state of the resource.
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.
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.
| len | number of chracters to read |
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.
| 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.
| 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.
Definition at line 63 of file ulxr_cached_resource.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
Referenced by ulxr::HttpServer::executeHttpGET().
CppString ulxr::CachedResource::name [private] |
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.
1.5.1