Bond 0.9
C++ Bond Runtime Library API Documentation
Loading...
Searching...
No Matches
Bond::OutputStreamAdaptor Class Reference

A wrapper around an OutputStream that adds formatted output operations used within the Bond Standard Library. More...

#include <bond/io/outputstreamadaptor.h>

Public Member Functions

 OutputStreamAdaptor (OutputStream *stream)
 Constructs an OutputStreamAdaptor object with no formatting flags, a precision of DEFAULT_PRECISION and a field width of 0.
OutputStream * GetStream () const
 Returns the wrapped OutputStream.
void Close ()
 Closes the wrapped OutputStream and detaches from it, after which GetStream returns null. Does nothing if there is no wrapped OutputStream.
void Print (const char *str)
 Prints a null-terminated string to the wrapped OutputStream.
void Print (bool value)
 Prints a boolean value to the wrapped OutputStream.
void Print (char value)
 Prints a character value to the wrapped OutputStream.
void Print (int32_t value)
 Prints a signed 32-bit integer value to the wrapped OutputStream.
void Print (uint32_t value)
 Prints an unsigned 32-bit integer value to the wrapped OutputStream.
void Print (int64_t value)
 Prints a signed 64-bit integer value to the wrapped OutputStream.
void Print (uint64_t value)
 Prints an unsigned 64-bit integer value to the wrapped OutputStream.
void Print (double value)
 Prints a floating-point value to the wrapped OutputStream.
int GetFlags () const
 Returns the current formatting flags.
void SetFlags (int flags)
 Sets the specified formatting flags.
void UnsetFlags (int flags)
 Unsets the specified formatting flags.
void ClearFlags ()
 Clears all formatting flags.
int GetPrecision () const
 Returns the current floating-point precision.
void SetPrecision (int precision)
 Sets the floating-point precision.
int GetWidth () const
 Returns the current field width.
void SetWidth (int width)
 Sets the field width.

Static Public Attributes

static const int DEFAULT_PRECISION = 6
 The floating-point precision of a newly constructed OutputStreamAdaptor.

Detailed Description

A wrapper around an OutputStream that adds formatted output operations used within the Bond Standard Library.

The output functions must only be called while the adaptor wraps a stream.

Constructor & Destructor Documentation

◆ OutputStreamAdaptor()

Bond::OutputStreamAdaptor::OutputStreamAdaptor ( OutputStream * stream)
inlineexplicit

Constructs an OutputStreamAdaptor object with no formatting flags, a precision of DEFAULT_PRECISION and a field width of 0.

Parameters
streamThe stream to which formatted output is written, or null. The stream is not owned by the adaptor.

Member Function Documentation

◆ ClearFlags()

void Bond::OutputStreamAdaptor::ClearFlags ( )
inline

Clears all formatting flags.

This clears any bitfield values previously set from the IO::Flags enum.

◆ Close()

void Bond::OutputStreamAdaptor::Close ( )

Closes the wrapped OutputStream and detaches from it, after which GetStream returns null. Does nothing if there is no wrapped OutputStream.

◆ GetFlags()

int Bond::OutputStreamAdaptor::GetFlags ( ) const
inline

Returns the current formatting flags.

The flags are bitfields defined by the IO::Flags enum.

◆ GetPrecision()

int Bond::OutputStreamAdaptor::GetPrecision ( ) const
inline

Returns the current floating-point precision.

◆ GetStream()

OutputStream * Bond::OutputStreamAdaptor::GetStream ( ) const
inline

Returns the wrapped OutputStream.

◆ GetWidth()

int Bond::OutputStreamAdaptor::GetWidth ( ) const
inline

Returns the current field width.

◆ Print() [1/8]

void Bond::OutputStreamAdaptor::Print ( bool value)

Prints a boolean value to the wrapped OutputStream.

Parameters
valueThe value to print.

◆ Print() [2/8]

void Bond::OutputStreamAdaptor::Print ( char value)

Prints a character value to the wrapped OutputStream.

Parameters
valueThe value to print.

◆ Print() [3/8]

void Bond::OutputStreamAdaptor::Print ( const char * str)

Prints a null-terminated string to the wrapped OutputStream.

Parameters
strThe string to print.

◆ Print() [4/8]

void Bond::OutputStreamAdaptor::Print ( double value)

Prints a floating-point value to the wrapped OutputStream.

Parameters
valueThe value to print.

◆ Print() [5/8]

void Bond::OutputStreamAdaptor::Print ( int32_t value)

Prints a signed 32-bit integer value to the wrapped OutputStream.

Parameters
valueThe value to print.

◆ Print() [6/8]

void Bond::OutputStreamAdaptor::Print ( int64_t value)

Prints a signed 64-bit integer value to the wrapped OutputStream.

Parameters
valueThe value to print.

◆ Print() [7/8]

void Bond::OutputStreamAdaptor::Print ( uint32_t value)

Prints an unsigned 32-bit integer value to the wrapped OutputStream.

Parameters
valueThe value to print.

◆ Print() [8/8]

void Bond::OutputStreamAdaptor::Print ( uint64_t value)

Prints an unsigned 64-bit integer value to the wrapped OutputStream.

Parameters
valueThe value to print.

◆ SetFlags()

void Bond::OutputStreamAdaptor::SetFlags ( int flags)
inline

Sets the specified formatting flags.

The flags are bitfields defined by the IO::Flags enum.

Parameters
flagsThe flags to set.

◆ SetPrecision()

void Bond::OutputStreamAdaptor::SetPrecision ( int precision)
inline

Sets the floating-point precision.

Parameters
precisionThe precision to set.

◆ SetWidth()

void Bond::OutputStreamAdaptor::SetWidth ( int width)
inline

Sets the field width.

Parameters
widthThe width to set.

◆ UnsetFlags()

void Bond::OutputStreamAdaptor::UnsetFlags ( int flags)
inline

Unsets the specified formatting flags.

The flags are bitfields defined by the IO::Flags enum.

Parameters
flagsThe flags to unset.

Member Data Documentation

◆ DEFAULT_PRECISION

const int Bond::OutputStreamAdaptor::DEFAULT_PRECISION = 6
static

The floating-point precision of a newly constructed OutputStreamAdaptor.


The documentation for this class was generated from the following file:
  • include/bond/io/outputstreamadaptor.h