YARP
Yet Another Robot Platform
yarp::os::StringOutputStream Class Reference

An OutputStream that produces a string. More...

#include <yarp/os/StringOutputStream.h>

+ Inheritance diagram for yarp::os::StringOutputStream:

Detailed Description

An OutputStream that produces a string.

Handy for testing purposes.

Definition at line 26 of file StringOutputStream.h.

Public Member Functions

 StringOutputStream ()
 
std::string toString () const
 
void reset ()
 
virtual void write (const Bytes &b) override
 Write a block of bytes to the stream. More...
 
virtual void close () override
 Terminate the stream. More...
 
virtual bool isOk () const override
 Check if the stream is ok or in an error state. More...
 
const std::string & str () const
 
- Public Member Functions inherited from yarp::os::OutputStream
virtual ~OutputStream ()
 Destructor. More...
 
virtual void write (char ch)
 Write a single byte to the stream. More...
 
virtual void write (const Bytes &b, int offset, int len)
 Write a block of bytes to the stream. More...
 
virtual void flush ()
 Make sure all pending write operations are finished. More...
 
virtual void writeLine (const char *data, int len)
 Write some text followed by a line feed. More...
 
virtual bool setWriteTimeout (double timeout)
 Set activity timeout. More...
 
virtual bool setTypeOfService (int tos)
 
virtual int getTypeOfService ()
 

Private Attributes

std::string data
 

Constructor & Destructor Documentation

◆ StringOutputStream()

yarp::os::StringOutputStream::StringOutputStream ( )
inline

Definition at line 30 of file StringOutputStream.h.

Member Function Documentation

◆ close()

virtual void yarp::os::StringOutputStream::close ( )
inlineoverridevirtual

Terminate the stream.

Implements yarp::os::OutputStream.

Definition at line 45 of file StringOutputStream.h.

◆ isOk()

virtual bool yarp::os::StringOutputStream::isOk ( ) const
inlineoverridevirtual

Check if the stream is ok or in an error state.

Returns
true iff the stream is ok

Implements yarp::os::OutputStream.

Definition at line 48 of file StringOutputStream.h.

◆ reset()

void yarp::os::StringOutputStream::reset ( )
inline

Definition at line 36 of file StringOutputStream.h.

◆ str()

const std::string& yarp::os::StringOutputStream::str ( ) const
inline

Definition at line 52 of file StringOutputStream.h.

◆ toString()

std::string yarp::os::StringOutputStream::toString ( ) const
inline

Definition at line 32 of file StringOutputStream.h.

◆ write()

virtual void yarp::os::StringOutputStream::write ( const Bytes b)
inlineoverridevirtual

Write a block of bytes to the stream.

Parameters
bthe bytes to write

Implements yarp::os::OutputStream.

Reimplemented in yarp::os::impl::FakeTwoWayStream::ActiveStringOutputStream.

Definition at line 40 of file StringOutputStream.h.

Member Data Documentation

◆ data

std::string yarp::os::StringOutputStream::data
private

Definition at line 55 of file StringOutputStream.h.


The documentation for this class was generated from the following file: