Public Member Functions | |
MemIOCallback (uint64 DefaultSize=128) | |
uint32 | read (void *Buffer, size_t Size) |
void | setFilePointer (int64 Offset, seek_mode Mode=seek_beginning) |
size_t | write (const void *Buffer, size_t Size) |
virtual uint64 | getFilePointer () |
void | close () |
binary * | GetDataBuffer () const |
uint64 | GetDataBufferSize () |
void | SetDataBufferSize (uint64 newDataBufferSize) |
uint32 | write (IOCallback &IOToRead, size_t Size) |
bool | IsOk () |
const std::string & | GetLastErrorStr () |
Protected Attributes | |
bool | mOk |
std::string | mLastErrorStr |
binary * | dataBuffer |
uint64 | dataBufferPos |
uint64 | dataBufferTotalSize |
uint64 | dataBufferMemorySize |
void MemIOCallback::close | ( | ) | [inline, virtual] |
The close callback flushes the file buffers to disk and closes the file. When using the stdio library, this is equivalent to calling fclose. When the close is not successful, an exception should be thrown.
Implements IOCallback.
virtual uint64 MemIOCallback::getFilePointer | ( | ) | [inline, virtual] |
Although the position is always positive, the return value of this callback is signed to easily allow negative values for returning errors. When an error occurs, the implementor should return -1 and the file pointer otherwise.
If an error occurs, an exception should be thrown.
Implements IOCallback.
uint32 MemIOCallback::read | ( | void * | Buffer, | |
size_t | Size | |||
) | [virtual] |
Use this to copy some data to the Buffer from this classes data
Implements IOCallback.
void MemIOCallback::setFilePointer | ( | int64 | Offset, | |
seek_mode | Mode = seek_beginning | |||
) | [virtual] |
Seek to the specified position. The mode can have either SEEK_SET, SEEK_CUR or SEEK_END. The callback should return true(1) if the seek operation succeeded or false (0), when the seek fails.
Implements IOCallback.
uint32 MemIOCallback::write | ( | IOCallback & | IOToRead, | |
size_t | Size | |||
) |
Use this to write some data from another IOCallback
size_t MemIOCallback::write | ( | const void * | Buffer, | |
size_t | Size | |||
) | [virtual] |
This callback just works like its read pendant. It returns the number of bytes written.
Implements IOCallback.
uint64 MemIOCallback::dataBufferMemorySize [protected] |
Size of the memory malloc()/realloc()
uint64 MemIOCallback::dataBufferPos [protected] |
Postion where we start 'writing' to the dataBuffer
uint64 MemIOCallback::dataBufferTotalSize [protected] |
Size of the data in the dataBuffer