Panda3D
|
An in-memory buffer specifically designed for downloading files to memory. More...
#include "ramfile.h"
Public Member Functions | |
void | clear () |
Empties the current buffer contents. | |
const string & | get_data () const |
Returns the entire buffer contents as a string, regardless of the current data pointer. | |
size_t | get_data_size () const |
Returns the size of the entire buffer contents. | |
string | read (size_t length) |
Extracts and returns the indicated number of characters from the current data pointer, and advances the data pointer. | |
string | readline () |
Assumes the stream represents a text file, and extracts one line up to and including the trailing newline character. | |
void | seek (size_t pos) |
Moves the data pointer to the indicated byte position. | |
size_t | tell () const |
Returns the current data pointer position as a byte offset from the beginning of the stream. | |
Public Attributes | |
string | _data |
size_t | _pos |
An in-memory buffer specifically designed for downloading files to memory.
void Ramfile::clear | ( | ) | [inline] |
const string & Ramfile::get_data | ( | ) | const [inline] |
size_t Ramfile::get_data_size | ( | ) | const [inline] |
string Ramfile::read | ( | size_t | length | ) |
Extracts and returns the indicated number of characters from the current data pointer, and advances the data pointer.
If the data pointer exceeds the end of the buffer, returns empty string.
The interface here is intentionally designed to be similar to that for Python's file.read() function.
Definition at line 29 of file ramfile.cxx.
string Ramfile::readline | ( | ) |
Assumes the stream represents a text file, and extracts one line up to and including the trailing newline character.
Returns empty string when the end of file is reached.
The interface here is intentionally designed to be similar to that for Python's file.readline() function.
Definition at line 48 of file ramfile.cxx.
void Ramfile::seek | ( | size_t | pos | ) | [inline] |
size_t Ramfile::tell | ( | ) | const [inline] |