#include <ulxr_file_resource.h>
Inheritance diagram for ulxr::FileResource:
Public Member Functions | |
FileResource (const CppString &res_name, const CppString &file_name, bool do_read=true) | |
Creates the resource. | |
virtual | ~FileResource () |
Destroys the resource. | |
virtual void | open () |
Opens the resource and loads the file if it exists. | |
virtual void | open (bool do_read) |
Opens the resource and loads the file if it exists. | |
virtual void | close () |
Closes the resource and writes the current cache content to the file. | |
virtual bool | good () |
Tests the state of the resource and the success of the transfers from and to the corresponding file. | |
CppString | getFilename () const |
Gets the filename. | |
virtual void | clear () |
Clears the cache and removes the associated file. | |
virtual void | reset () |
Resets the read pointer and internal states. | |
Private Attributes | |
CppString | filename |
bool | error |
bool | opened |
Definition at line 43 of file ulxr_file_resource.h.
ulxr::FileResource::FileResource | ( | const CppString & | res_name, | |
const CppString & | file_name, | |||
bool | do_read = true | |||
) |
Creates the resource.
res_name | the name of the resource | |
file_name | the name of the corresponding file | |
do_read | true: actually read file, otherwise just create internal structures |
Definition at line 48 of file ulxr_file_resource.cpp.
References open().
ulxr::FileResource::~FileResource | ( | ) | [virtual] |
void ulxr::FileResource::open | ( | ) | [virtual] |
Opens the resource and loads the file if it exists.
Implements ulxr::CachedResource.
Definition at line 72 of file ulxr_file_resource.cpp.
Referenced by FileResource().
void ulxr::FileResource::open | ( | bool | do_read | ) | [virtual] |
Opens the resource and loads the file if it exists.
do_read | true: actually read file, otherwise just create internal structures |
Definition at line 78 of file ulxr_file_resource.cpp.
References ulxr::getLatin1(), ulxr_access, ulxr_fclose, ulxr_feof, ulxr_ferror, ulxr_FILE, ulxr_fopen, ulxr_fread, ULXR_PCHAR, and ULXR_TRACE.
void ulxr::FileResource::close | ( | ) | [virtual] |
Closes the resource and writes the current cache content to the file.
Implements ulxr::CachedResource.
Definition at line 115 of file ulxr_file_resource.cpp.
References ulxr::CachedResource::clear(), ulxr::getLatin1(), ulxr_fclose, ulxr_ferror, ulxr_FILE, ulxr_fopen, ulxr_fwrite, ULXR_PCHAR, and ULXR_TRACE.
Referenced by ~FileResource().
bool ulxr::FileResource::good | ( | ) | [virtual] |
Tests the state of the resource and the success of the transfers from and to the corresponding file.
false: an error occured
Implements ulxr::CachedResource.
Definition at line 167 of file ulxr_file_resource.cpp.
References ULXR_PCHAR, and ULXR_TRACE.
CppString ulxr::FileResource::getFilename | ( | ) | const |
void ulxr::FileResource::clear | ( | ) | [virtual] |
Clears the cache and removes the associated file.
The resource is also closed and has to be reopened for further use.
Reimplemented from ulxr::CachedResource.
Definition at line 151 of file ulxr_file_resource.cpp.
References ulxr::CachedResource::clear(), ulxr::getLatin1(), ulxr_access, ULXR_PCHAR, ulxr_remove, and ULXR_TRACE.
void ulxr::FileResource::reset | ( | ) | [virtual] |
Resets the read pointer and internal states.
Reimplemented from ulxr::CachedResource.
Definition at line 143 of file ulxr_file_resource.cpp.
References ulxr::CachedResource::reset(), ULXR_PCHAR, and ULXR_TRACE.
CppString ulxr::FileResource::filename [private] |
Definition at line 95 of file ulxr_file_resource.h.
bool ulxr::FileResource::error [private] |
Definition at line 96 of file ulxr_file_resource.h.
bool ulxr::FileResource::opened [private] |
Definition at line 97 of file ulxr_file_resource.h.