An InputStream that reads from a string. More...
#include <yarp/os/StringInputStream.h>
Public Member Functions | |
StringInputStream () | |
void | reset () |
void | reset (const std::string &str) |
void | add (const std::string &txt) |
void | add (const Bytes &b) |
yarp::conf::ssize_t | read (Bytes &b) override |
Read a block of data from the stream. More... | |
void | close () override |
Terminate the stream. More... | |
virtual std::string | toString () const |
bool | isOk () const override |
Check if the stream is ok or in an error state. More... | |
virtual int | read () |
Read and return a single byte. More... | |
virtual yarp::conf::ssize_t | read (Bytes &b, size_t offset, yarp::conf::ssize_t len) |
Read a block of data from the stream. More... | |
virtual yarp::conf::ssize_t | read (yarp::os::Bytes &b)=0 |
Read a block of data from the stream. More... | |
Public Member Functions inherited from yarp::os::InputStream | |
InputStream () | |
Constructor. More... | |
virtual | ~InputStream () |
Destructor. More... | |
virtual void | check () |
Perform maintenance actions, if needed. More... | |
virtual yarp::conf::ssize_t | read (Bytes &b, size_t offset, yarp::conf::ssize_t len) |
Read a block of data from the stream. More... | |
virtual yarp::conf::ssize_t | partialRead (yarp::os::Bytes &b) |
Like read, but solicit partial responses. More... | |
virtual void | interrupt () |
Interrupt the stream. More... | |
virtual bool | setReadTimeout (double timeout) |
Set activity timeout. More... | |
std::string | readLine (const char terminal='\n', bool *success=nullptr) |
Read a block of text terminated with a specific marker (or EOF). More... | |
yarp::conf::ssize_t | readFull (Bytes &b) |
Keep reading until buffer is full. More... | |
yarp::conf::ssize_t | readDiscard (size_t len) |
Read and discard a fixed number of bytes. More... | |
virtual bool | setReadEnvelopeCallback (readEnvelopeCallbackType callback, void *data) |
Install a callback that the InputStream will have to call when the envelope is read from a message in carriers that cannot be escaped. More... | |
Additional Inherited Members | |
Public Types inherited from yarp::os::InputStream | |
typedef void(* | readEnvelopeCallbackType) (void *, const yarp::os::Bytes &envelope) |
Callback type for setting the envelope from a message in carriers that cannot be escaped. More... | |
An InputStream that reads from a string.
Handy For testing purposes.
Definition at line 24 of file StringInputStream.h.
|
inline |
Definition at line 29 of file StringInputStream.h.
|
inline |
Definition at line 52 of file StringInputStream.h.
|
inline |
Definition at line 47 of file StringInputStream.h.
|
inlineoverridevirtual |
Terminate the stream.
Implements yarp::os::InputStream.
Definition at line 74 of file StringInputStream.h.
|
inlineoverridevirtual |
Check if the stream is ok or in an error state.
Implements yarp::os::InputStream.
Definition at line 83 of file StringInputStream.h.
|
virtual |
Read and return a single byte.
Should block and wait for data. By default, this calls read(Bytes& b) to do its work.
Reimplemented from yarp::os::InputStream.
Definition at line 54 of file InputStream.cpp.
|
inlineoverridevirtual |
Read a block of data from the stream.
Should block and wait for data.
b[out] | the block of data to read to |
Implements yarp::os::InputStream.
Definition at line 59 of file StringInputStream.h.
|
virtual |
Read a block of data from the stream.
Should block and wait for data. By default, this calls read(Bytes& b) to do its work.
[out] | b | the block of data to read to |
offset | an offset within the block to start at | |
len | the number of bytes to read |
Reimplemented from yarp::os::InputStream.
Definition at line 67 of file InputStream.cpp.
|
virtual |
Read a block of data from the stream.
Should block and wait for data.
b[out] | the block of data to read to |
Reimplemented from yarp::os::InputStream.
|
inline |
Definition at line 35 of file StringInputStream.h.
|
inline |
Definition at line 41 of file StringInputStream.h.
|
inlinevirtual |
Definition at line 78 of file StringInputStream.h.