Streambuf-like class for input from C char* buffers. More...
Public Member Functions | |
Constructors etc. | |
micbuffer (const void *data, size_t len) | |
micbuffer (const micbuffer &cb) | |
virtual | ~micbuffer (void) |
void | clear (void) |
void | release (void) |
void | assign (const void *data, size_t len) |
Checks and Properties | |
virtual bool | valid (void) |
virtual bool | eof (void) |
Input Methods | |
virtual ByteCount | read (char *buf, size_t n) |
virtual int | getbyte (void) |
Utilities | |
const char * | data (void) const |
size_t | size (void) const |
size_t | capacity (void) const |
size_t | offset (void) const |
std::string | as_string (bool normalize_ws=false, bool trim_left=false, bool trim_right=false) const |
void | to_string (std::string &str, bool normalize_ws=false, bool trim_left=false, bool trim_right=false) const |
Public Member Functions inherited from mootio::mistream | |
mistream (void) | |
virtual | ~mistream (void) |
virtual ByteCount | getline (std::string &s, const std::string &delim="\") |
Public Member Functions inherited from mootio::mstream | |
mstream (const std::string &myname="") | |
virtual | ~mstream (void) |
operator bool (void) | |
virtual std::string | errmsg (void) |
virtual bool | reopen (void) |
virtual bool | close (void) |
Public Attributes | |
const char * | cb_rdata |
underlying character data buffer More... | |
size_t | cb_offset |
current read offset position in buffer More... | |
size_t | cb_used |
used length of buffer (in bytes) More... | |
Public Attributes inherited from mootio::mstream | |
std::string | name |
symbolic name of this stream More... | |
This class provides an API for in-memory input which does not resort to C++ sstream : this is a Good Thing, because:
|
inline |
Constructor from a user-specified buffer Read operations will be performed on the buffer specified. User is responsible for freeing memory associated with data
passed to this constructor.
|
inline |
Copy constructor
|
inlinevirtual |
Destructor
|
inline |
Clear buffer
Referenced by release(), and mootio::mcbuffer::release().
|
inline |
Free locally allocated data buffer, if any. Implicitly calls clear()
References clear().
Referenced by mootio::mcbuffer::~mcbuffer().
|
inline |
Asignment to a different data buffer
References data().
|
inlinevirtual |
Check for buffer validity
Reimplemented from mootio::mstream.
|
inlinevirtual |
Check for end-of-buffer (only meaningful for read operations)
Reimplemented from mootio::mstream.
References cb_used.
|
inlinevirtual |
Read up to n
bytes of data into buf
, returns number of bytes actually read.
Reimplemented from mootio::mistream.
|
inlinevirtual |
Read a single byte of data
Reimplemented from mootio::mistream.
|
inline |
Get pointer to current read buffer (whole thing)
References cb_rdata.
Referenced by assign(), moot::TokenWriterNative::sentence2string(), and moot::TokenWriterNative::token2string().
|
inline |
Get current used size of data buffer
References cb_used.
Referenced by mootio::mcbuffer::mcbuffer(), moot::TokenWriterNative::sentence2string(), and moot::TokenWriterNative::token2string().
|
inline |
Get current allocated size of data buffer
References cb_used.
|
inline |
Get current read-offset of data buffer
References cb_offset.
|
inline |
Return the unread portion of the buffer as a new STL string.
normalize_ws | Whether to normalize whitespace (replace all whitespace substrings with a single space). |
trim_left | whether to trim all leading whitespace |
trim_right | whether to trim all trailing whitespace |
References to_string().
|
inline |
Append the unread portion of the buffer to an existing STL string.
str | destination string |
normalize_ws | Whether to normalize whitespace (replace all whitespace substrings with a single space). |
trim_left | whether to trim all leading whitespace |
trim_right | whether to trim all trailing whitespace |
References moot::moot_normalize_ws().
Referenced by as_string().
const char* mootio::micbuffer::cb_rdata |
size_t mootio::micbuffer::cb_offset |
size_t mootio::micbuffer::cb_used |
Referenced by mootio::mcbuffer::assign(), capacity(), mootio::mcbuffer::clear(), moot::mootExpatParser::ContextBuffer::ContextBuffer(), eof(), mootio::mcbuffer::flush(), mootio::mcbuffer::mcbuffer(), mootio::mcbuffer::putbyte(), read(), mootio::mcbuffer::reserve(), moot::TokenReaderExpat::save_context_data(), size(), mootio::mcbuffer::vprintf(), and mootio::mcbuffer::write().