An in-memory buffer specifically designed for downloading files to memory.
More...
#include "ramfile.h"
|
void | clear () |
| Empties the current buffer contents. More...
|
|
const std::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...
|
|
std::string | read (size_t length) |
| Extracts and returns the indicated number of characters from the current data pointer, and advances the data pointer. More...
|
|
std::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...
|
|
|
std::string | _data |
|
size_t | _pos |
|
|
class | Extension< Ramfile > |
|
An in-memory buffer specifically designed for downloading files to memory.
Definition at line 25 of file ramfile.h.
◆ clear()
Empties the current buffer contents.
Definition at line 61 of file ramfile.I.
◆ get_data()
const std::string & Ramfile::get_data |
( |
| ) |
const |
|
inline |
Returns the entire buffer contents as a string, regardless of the current data pointer.
Definition at line 45 of file ramfile.I.
◆ get_data_size()
size_t Ramfile::get_data_size |
( |
| ) |
const |
|
inline |
Returns the size of the entire buffer contents.
Definition at line 53 of file ramfile.I.
◆ read()
std::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 25 of file ramfile.cxx.
◆ readline()
std::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 40 of file ramfile.cxx.
◆ seek()
void Ramfile::seek |
( |
size_t |
pos | ) |
|
|
inline |
Moves the data pointer to the indicated byte position.
It is not an error to move the pointer past the end of data.
Definition at line 27 of file ramfile.I.
◆ tell()
size_t Ramfile::tell |
( |
| ) |
const |
|
inline |
Returns the current data pointer position as a byte offset from the beginning of the stream.
Definition at line 36 of file ramfile.I.
The documentation for this class was generated from the following files: