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:

Public Member Functions

 StringOutputStream ()
 
std::string toString () const
 
void reset ()
 
void write (const Bytes &b) override
 Write a block of bytes to the stream. More...
 
void close () override
 Terminate the stream. More...
 
bool isOk () const override
 Check if the stream is ok or in an error state. More...
 
const std::string & str () const
 
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 write (const yarp::os::Bytes &b)=0
 Write a block of bytes to the stream. More...
 
- 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 ()
 

Detailed Description

An OutputStream that produces a string.

Handy for testing purposes.

Definition at line 24 of file StringOutputStream.h.

Constructor & Destructor Documentation

◆ StringOutputStream()

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

Definition at line 29 of file StringOutputStream.h.

Member Function Documentation

◆ close()

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

Terminate the stream.

Implements yarp::os::OutputStream.

Definition at line 49 of file StringOutputStream.h.

◆ isOk()

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 53 of file StringOutputStream.h.

◆ reset()

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

Definition at line 38 of file StringOutputStream.h.

◆ str()

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

Definition at line 58 of file StringOutputStream.h.

◆ toString()

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

Definition at line 33 of file StringOutputStream.h.

◆ write() [1/4]

void yarp::os::OutputStream::write

Write a single byte to the stream.

By default, this calls write(const Bytes& b) to do its work.

Parameters
chthe byte to write

Definition at line 38 of file OutputStream.cpp.

◆ write() [2/4]

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.

Definition at line 43 of file StringOutputStream.h.

◆ write() [3/4]

void yarp::os::OutputStream::write

Write a block of bytes to the stream.

By default, this calls write(const Bytes& b) to do its work.

Parameters
bthe bytes to write
offsetan offset within the block to start at
lenthe number of bytes to write

Definition at line 48 of file OutputStream.cpp.

◆ write() [4/4]

virtual void yarp::os::OutputStream::write

Write a block of bytes to the stream.

Parameters
bthe bytes to write

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