Evo C++ Library v0.5.1
|
#include <evo/iobase.h>
Base text and binary stream interface.
Public Types | |
typedef ulong | Size |
Data size type (ulong) More... | |
Public Member Functions | |
StreamBase () | |
Constructor. More... | |
virtual | ~StreamBase () |
Destructor. More... | |
Error | error () const |
Get error code from last operation. More... | |
bool | excep () const |
Get whether exceptions are enabled. More... | |
void | excep (bool val) |
Set whether exceptions are enabled. More... | |
virtual bool | flush () |
Flush any pending output in stream write buffer, if buffered. More... | |
virtual bool | isopen () const |
Get whether stream is open. More... | |
operator SafeBoolType () const | |
Safe (explicit) evaluation as bool type. More... | |
bool | operator! () const |
Negation operator checks whether an error was set by a previous operation. More... | |
virtual ulong | readbin (void *buf, ulong size) |
Read binary input from stream. More... | |
virtual bool | readline (String &str, ulong maxlen=0) |
Read text line input from stream. More... | |
virtual ulong | readtext (char *buf, ulong size) |
Read text input from stream. More... | |
virtual char * | write_direct (Size size) |
Get pointer for writing directly to buffer to append data. More... | |
virtual bool | write_direct_finish (Size size) |
Finish writing directly to buffer. More... | |
char * | write_direct_flush (Size &available, Size written_size, Size reserve_size) |
Flush data written directly to buffer and get pointer for appending more. More... | |
char * | write_direct_multi (Size &available, Size reserve_size) |
Get pointer for writing directly to buffer to append data and allow multiple passes for larger sizes. More... | |
virtual ulong | writebin (const void *buf, ulong size) |
Write binary output to stream. More... | |
virtual ulong | writechar (char ch, ulong count=1) |
Write repeat character as text output to stream. More... | |
virtual ulong | writeline (const char *buf, ulong size) |
Write text line output to stream. More... | |
virtual Size | writequoted (const char *buf, Size size, char delim, bool optional=false) |
Write quoted text output to string. More... | |
virtual ulong | writetext (const char *buf, ulong size) |
Write text output to stream. More... | |
Protected Attributes | |
Error | error_ |
Last error code. More... | |
bool | excep_ |
Whether to throw exceptions. More... | |
typedef ulong Size |
Data size type (ulong)
|
inline |
Constructor.
|
inlinevirtual |
Destructor.
|
inlineinherited |
Get error code from last operation.
|
inlineinherited |
Get whether exceptions are enabled.
|
inlineinherited |
Set whether exceptions are enabled.
val | Whether to enable exceptions |
|
inlinevirtualinherited |
Flush any pending output in stream write buffer, if buffered.
Reimplemented in Stream< T >, Stream< IoFile >, Stream< IoSocket >, StreamOut< T >, and StreamOut< IoFile >.
|
inlinevirtualinherited |
Get whether stream is open.
Reimplemented in Stream< T >, Stream< IoFile >, Stream< IoSocket >, StreamOut< T >, StreamOut< IoFile >, StreamIn< T >, and StreamIn< IoFile >.
|
inlineinherited |
Safe (explicit) evaluation as bool type.
|
inlineinherited |
|
inlinevirtualinherited |
Read binary input from stream.
buf | Buffer to store data read |
size | Size to read |
Reimplemented in SocketCast, Stream< T >, Stream< IoFile >, Stream< IoSocket >, StreamIn< T >, and StreamIn< IoFile >.
|
inlinevirtual |
Read text line input from stream.
str | String to store line (cleared first) [out] |
maxlen | Maximum line length, 0 for no limit |
Reimplemented in Stream< T >, Stream< IoFile >, Stream< IoSocket >, StreamIn< T >, and StreamIn< IoFile >.
|
inlinevirtual |
Read text input from stream.
buf | Buffer to store data read |
size | Size in bytes to read from file (must be positive) |
Reimplemented in Stream< T >, Stream< IoFile >, Stream< IoSocket >, StreamIn< T >, and StreamIn< IoFile >.
|
inlinevirtual |
Get pointer for writing directly to buffer to append data.
size | Requred size in bytes to reserve |
Reimplemented in Stream< T >, Stream< IoFile >, Stream< IoSocket >, StreamOut< T >, and StreamOut< IoFile >.
|
inlinevirtual |
Finish writing directly to buffer.
size | Size written in bytes, must not be greater than size passed to write_direct() |
Reimplemented in Stream< T >, Stream< IoFile >, Stream< IoSocket >, StreamOut< T >, and StreamOut< IoFile >.
Flush data written directly to buffer and get pointer for appending more.
reserve_size
is 0 then this does the same as write_direct_finish() and returns a non-NULL but invalid pointer on successavailable | Stores available size reserved in bytes, may be less than reserve_size , 0 if reserve_size was 0 [out] |
written_size | Size written in bytes to flush, must not be greater than available size from previous call to this or write_direct_multi() |
reserve_size | Requred size in bytes to reserve, 0 to finish |
Get pointer for writing directly to buffer to append data and allow multiple passes for larger sizes.
reserve_size
is 0 then this does nothing and returns a non-NULL but invalid pointeravailable | Stores available size reserved in bytes, may be less than reserve_size , 0 if reserve_size was 0 [out] |
reserve_size | Requred size in bytes to reserve |
|
inlinevirtualinherited |
Write binary output to stream.
buf | Data to write |
size | Size to write |
Reimplemented in SocketCast, Stream< T >, Stream< IoFile >, Stream< IoSocket >, StreamOut< T >, and StreamOut< IoFile >.
|
inlinevirtual |
Write repeat character as text output to stream.
ch | Character to write |
count | Character count to write, must be positive |
Reimplemented in Stream< T >, Stream< IoFile >, Stream< IoSocket >, StreamOut< T >, and StreamOut< IoFile >.
|
inlinevirtual |
Write text line output to stream.
buf | Data buffer to write from |
size | Data size to write in bytes, must be positive |
Reimplemented in Stream< T >, Stream< IoFile >, Stream< IoSocket >, StreamOut< T >, and StreamOut< IoFile >.
|
inlinevirtual |
Write quoted text output to string.
buf | Data to quote and write |
size | Data size to write |
delim | Delimiter for next field to escape via quoting |
optional | Whether quoting is optional, true to avoid quoting if possible |
Reimplemented in Stream< T >, Stream< IoFile >, Stream< IoSocket >, StreamOut< T >, and StreamOut< IoFile >.
|
inlinevirtual |
Write text output to stream.
buf | Data to write |
size | Size to write |
Reimplemented in Stream< T >, Stream< IoFile >, Stream< IoSocket >, StreamOut< T >, and StreamOut< IoFile >.
|
protectedinherited |
Last error code.
|
protectedinherited |
Whether to throw exceptions.