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. More... | |
const string & | get_data () const |
Returns the entire buffer contents as a string, regardless of the current data pointer. More... | |
size_t | get_data_size () const |
Returns the size of the entire buffer contents. More... | |
string | read (size_t length) |
Extracts and returns the indicated number of characters from the current data pointer, and advances the data pointer. More... | |
string | readline () |
Assumes the stream represents a text file, and extracts one line up to and including the trailing newline character. More... | |
void | seek (size_t pos) |
Moves the data pointer to the indicated byte position. More... | |
size_t | tell () const |
Returns the current data pointer position as a byte offset from the beginning of the stream. More... | |
Public Attributes | |
string | _data |
size_t | _pos |
An in-memory buffer specifically designed for downloading files to memory.
|
inline |
Empties the current buffer contents.
Definition at line 75 of file ramfile.I.
Referenced by get_data_size().
|
inline |
Returns the entire buffer contents as a string, regardless of the current data pointer.
Definition at line 55 of file ramfile.I.
References get_data_size().
Referenced by tell().
|
inline |
Returns the size of the entire buffer contents.
Definition at line 65 of file ramfile.I.
References clear().
Referenced by get_data().
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.
References readline().
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.
Referenced by read().
|
inline |
|
inline |
Returns the current data pointer position as a byte offset from the beginning of the stream.
Definition at line 44 of file ramfile.I.
References get_data().
Referenced by seek().