Evo C++ Library v0.5.1
|
#include <evo/io.h>
Input stream for reading from pipe.
Public Types | |
typedef IoFile ::ExceptionInT | ExceptionInT |
Stream input exception type More... | |
typedef IoFile ::Handle | Handle |
Low-level handle type (OS dependent) More... | |
typedef ulong | Size |
Data size type (ulong) More... | |
typedef StreamIn< IoFile > | This |
This stream type. More... | |
Public Member Functions | |
PipeIn (bool exceptions=1) | |
Constructor. More... | |
void | attach (Handle handle, bool owned=true) |
Attach existing input stream. More... | |
RawBuffer & | bufread () |
Advanced: Access primary read buffer. More... | |
bool | close () |
Close stream. More... | |
Handle | detach () |
Detach current stream. 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... | |
Handle | handle () const |
Get stream handle for low-level calls. More... | |
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... | |
ulong | readbin (void *buf, ulong size) |
Read binary input from stream. More... | |
bool | readline (String &str, ulong maxlen=0) |
Read text line input from stream. More... | |
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 Member Functions | |
void | init () |
Initialize and reset buffers for a new stream. More... | |
Protected Attributes | |
IoReader | bufrd_ |
Buffered reader. More... | |
IoFile | device_ |
I/O handle. More... | |
Error | error_ |
Last error code. More... | |
bool | excep_ |
Whether to throw exceptions. More... | |
bool | owned_ |
Whether handle is owned (to be closed here) More... | |
|
inherited |
Stream input exception type
|
inherited |
Data size type (ulong)
|
inline |
Constructor.
exceptions | Whether to enable exceptions on error, default set by Evo config: EVO_EXCEPTIONS |
|
inlineinherited |
Attach existing input stream.
handle | Handle to attach, must be valid |
owned | Whether to take ownership and close handle, false detaches on close() |
|
inlineinherited |
Advanced: Access primary read buffer.
|
inlineinherited |
Close stream.
|
inlineinherited |
Detach current stream.
|
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 >.
|
inlineinherited |
Get stream handle for low-level calls.
|
inlineprotectedinherited |
Initialize and reset buffers for a new stream.
|
inlinevirtualinherited |
|
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 from IoBase.
|
inlinevirtualinherited |
Read text line input from stream.
str | String to store line (cleared first) [out] |
maxlen | Maximum line length, 0 for no limit |
Reimplemented from StreamBase.
|
inlinevirtualinherited |
Read text input from stream.
buf | Buffer to store data read |
size | Size in bytes to read from file (must be positive) |
Reimplemented from StreamBase.
|
inlinevirtualinherited |
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 >.
|
inlinevirtualinherited |
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 >.
|
inlinevirtualinherited |
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 >.
|
inlinevirtualinherited |
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 >.
|
inlinevirtualinherited |
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 >.
|
inlinevirtualinherited |
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 |
Buffered reader.
|
protectedinherited |
I/O handle.
|
protectedinherited |
Last error code.
|
protectedinherited |
Whether to throw exceptions.
|
protectedinherited |
Whether handle is owned (to be closed here)