Bond 0.9
Bond Standard Library API Documentation
Loading...
Searching...
No Matches
Bond::OutputStream Struct Reference

An abstract interface for performing both unformatted and formatted output operations. More...

Public Member Functions

void Close ()
 Flushes any unwritten output and closes the stream.
void Flush ()
 Flushes any unwritten output.
OutputStreamPrintStr (const char *str)
 Writes a string of characters to the output stream. Writing stops at the first null character.
OutputStreamPrintB (bool value)
 Writes a formatted Boolean value to the output stream.
OutputStreamPrintC (char value)
 Writes a single character to the output stream.
OutputStreamPrintI (int value)
 Writes a formatted int to the output stream.
OutputStreamPrintUI (uint value)
 Writes a formatted uint to the output stream.
OutputStreamPrintL (long value)
 Writes a formatted long to the output stream.
OutputStreamPrintUL (ulong value)
 Writes a formatted ulong to the output stream.
OutputStreamPrintF (float value)
 Writes a formatted float to the output stream.
OutputStreamPrintD (double value)
 Writes a formatted double to the output stream.
OutputStreamPut (uchar byte)
 Writes a single unformatted byte to the output stream.
OutputStreamWrite (void *bytes, uint numBytes)
int GetFlags () const
 Returns the stream's current format flags as a bitmask of values from the IO::Flags enum.
OutputStreamSetFlags (int flags)
 Enables the format format flags in the given bitmask of values from the IO::Flags enum if they are not already enabled.
OutputStreamUnsetFlags (int flags)
 Disables the format format flags in the given bitmask of values from the IO::Flags enum if they are not already disabled.
OutputStreamClearFlags (int flags)
 Disables all of the format flags.
int GetPrecision () const
OutputStreamSetPrecision (int flags)
int GetWidth () const
 Returns the current minimum field width.
OutputStreamSetWidth (int flags)
 Assigns the minimum field width.
int GetPosition () const
 Returns the stream's current position measured in bytes.
int GetEndPosition () const
 Returns the position of the stream's end measured in bytes.
void SetPosition (int offset)
 Sets the stream's position relative to its beginning measured in bytes.
void SetPositionFromEnd (int offset)
 Sets the stream's position relative to its end measured in bytes.
void AddOffset (int offset)
 Moves the stream by the specified number of bytes relative to its current position.
bool IsEof () const
 Returns whether the end of the stream has been reached.
bool HasError () const
 Returns whether an error has occurred during an output operation.
void ClearError ()
 Clears the error flag.

Detailed Description

An abstract interface for performing both unformatted and formatted output operations.

Member Function Documentation

◆ AddOffset()

void Bond::OutputStream::AddOffset ( int offset)

Moves the stream by the specified number of bytes relative to its current position.

Parameters
offsetThe number of bytes by which the stream is repositioned.

◆ ClearError()

void Bond::OutputStream::ClearError ( )

Clears the error flag.

◆ ClearFlags()

OutputStream * Bond::OutputStream::ClearFlags ( int flags)

Disables all of the format flags.

The format flags modify how the stream formats output.

Returns
The stream on which this function was called.

◆ Close()

void Bond::OutputStream::Close ( )

Flushes any unwritten output and closes the stream.

◆ Flush()

void Bond::OutputStream::Flush ( )

Flushes any unwritten output.

◆ GetEndPosition()

int Bond::OutputStream::GetEndPosition ( ) const

Returns the position of the stream's end measured in bytes.

◆ GetFlags()

int Bond::OutputStream::GetFlags ( ) const

Returns the stream's current format flags as a bitmask of values from the IO::Flags enum.

The format flags modify how the stream formats output.

◆ GetPosition()

int Bond::OutputStream::GetPosition ( ) const

Returns the stream's current position measured in bytes.

◆ GetPrecision()

int Bond::OutputStream::GetPrecision ( ) const

◆ GetWidth()

int Bond::OutputStream::GetWidth ( ) const

Returns the current minimum field width.

◆ HasError()

bool Bond::OutputStream::HasError ( ) const

Returns whether an error has occurred during an output operation.

◆ IsEof()

bool Bond::OutputStream::IsEof ( ) const

Returns whether the end of the stream has been reached.

◆ PrintB()

OutputStream * Bond::OutputStream::PrintB ( bool value)

Writes a formatted Boolean value to the output stream.

If the IO::BoolAlpha flag is set, the values true and false are written as the strings "true" and "false" respectively, otherwise they are written as the strings "0" and "1".

Parameters
valueThe Boolean value to be written to the stream.
Returns
The stream on which this function was called.

◆ PrintC()

OutputStream * Bond::OutputStream::PrintC ( char value)

Writes a single character to the output stream.

Parameters
valueThe character to be written to the stream.
Returns
The stream on which this function was called.

◆ PrintD()

OutputStream * Bond::OutputStream::PrintD ( double value)

Writes a formatted double to the output stream.

If the IO::Fixed or IO::Scientific flag is set, the number is written in decimal notation or scientific notation respectively. If neither flag is set, the number is written in scientific notation if the exponent is less than -4 or greater than the precision, otherwise the number is written in decimal notation. If the IO::Zero flag is set, the value is zero padded to the left. If the IO::Left flag is set, the value is left-justified instead of right-justified. If the IO::ShowPoint flag is set, a decimal point is always written.

Parameters
valueThe floating-point number to be written to the stream.
Returns
The stream on which this function was called.

◆ PrintF()

OutputStream * Bond::OutputStream::PrintF ( float value)

Writes a formatted float to the output stream.

If the IO::Fixed or IO::Scientific flag is set, the number is written in decimal notation or scientific notation respectively. If neither flag is set, the number is written in scientific notation if the exponent is less than -4 or greater than the precision, otherwise the number is written in decimal notation. If the IO::Zero flag is set, the value is zero padded to the left. If the IO::Left flag is set, the value is left-justified instead of right-justified. If the IO::ShowPoint flag is set, a decimal point is always written.

Parameters
valueThe floating-point number to be written to the stream.
Returns
The stream on which this function was called.

◆ PrintI()

OutputStream * Bond::OutputStream::PrintI ( int value)

Writes a formatted int to the output stream.

If the IO::Hex or IO::Oct flag is set, the integer is written in base 16 or 8 respectively, otherwise it is written in base 10. If the IO::ShowBase flag is set in addition to IO::Hex, the string "0x" is written before the number. If the IO::ShowBase flag is set in addition to IO::Oct, the string "0" is written before the number. If the IO::Zero flag is set, the value is zero padded to the left. If the IO::Left flag is set, the value is left-justified instead of right-justified.

Parameters
valueThe integer to be written to the stream.
Returns
The stream on which this function was called.

◆ PrintL()

OutputStream * Bond::OutputStream::PrintL ( long value)

Writes a formatted long to the output stream.

If the IO::Hex or IO::Oct flag is set, the integer is written in base 16 or 8 respectively, otherwise it is written in base 10. If the IO::ShowBase flag is set in addition to IO::Hex, the string "0x" is written before the number. If the IO::ShowBase flag is set in addition to IO::Oct, the string "0" is written before the number. If the IO::Zero flag is set, the value is zero padded to the left. If the IO::Left flag is set, the value is left-justified instead of right-justified.

Parameters
valueThe integer to be written to the stream.
Returns
The stream on which this function was called.

◆ PrintStr()

OutputStream * Bond::OutputStream::PrintStr ( const char * str)

Writes a string of characters to the output stream. Writing stops at the first null character.

Parameters
strPointer to a string of characters to be written to the stream.
Returns
The stream on which this function was called.

◆ PrintUI()

OutputStream * Bond::OutputStream::PrintUI ( uint value)

Writes a formatted uint to the output stream.

If the IO::Hex or IO::Oct flag is set, the integer is written in base 16 or 8 respectively, otherwise it is written in base 10. If the IO::ShowBase flag is set in addition to IO::Hex, the string "0x" is written before the number. If the IO::ShowBase flag is set in addition to IO::Oct, the string "0" is written before the number. If the IO::Zero flag is set, the value is zero padded to the left. If the IO::Left flag is set, the value is left-justified instead of right-justified.

Parameters
valueThe integer to be written to the stream.
Returns
The stream on which this function was called.

◆ PrintUL()

OutputStream * Bond::OutputStream::PrintUL ( ulong value)

Writes a formatted ulong to the output stream.

If the IO::Hex or IO::Oct flag is set, the integer is written in base 16 or 8 respectively, otherwise it is written in base 10. If the IO::ShowBase flag is set in addition to IO::Hex, the string "0x" is written before the number. If the IO::ShowBase flag is set in addition to IO::Oct, the string "0" is written before the number. If the IO::Zero flag is set, the value is zero padded to the left. If the IO::Left flag is set, the value is left-justified instead of right-justified.

Parameters
valueThe integer to be written to the stream.
Returns
The stream on which this function was called.

◆ Put()

OutputStream * Bond::OutputStream::Put ( uchar byte)

Writes a single unformatted byte to the output stream.

Parameters
byteThe byte to be written to the stream.
Returns
The stream on which this function was called.

◆ SetFlags()

OutputStream * Bond::OutputStream::SetFlags ( int flags)

Enables the format format flags in the given bitmask of values from the IO::Flags enum if they are not already enabled.

All other flags are left untouched. The format flags modify how the stream formats output.

Parameters
flagsThe bitmask of flags from the IO::Flags enum to enable.
Returns
The stream on which this function was called.

◆ SetPosition()

void Bond::OutputStream::SetPosition ( int offset)

Sets the stream's position relative to its beginning measured in bytes.

Parameters
offsetThe number of bytes from the beginning to which the stream is repositioned.

◆ SetPositionFromEnd()

void Bond::OutputStream::SetPositionFromEnd ( int offset)

Sets the stream's position relative to its end measured in bytes.

Parameters
offsetThe number of bytes from the end to which the stream is repositioned.

◆ SetPrecision()

OutputStream * Bond::OutputStream::SetPrecision ( int flags)

◆ SetWidth()

OutputStream * Bond::OutputStream::SetWidth ( int flags)

Assigns the minimum field width.

The minimum field width specifies the minimum number of characters to be written in a formatted output operation. If the number of characters in the written value is less than the field width, it will be padded to the left with spaces, or padded to the right if the IO::Left flag is set.

◆ UnsetFlags()

OutputStream * Bond::OutputStream::UnsetFlags ( int flags)

Disables the format format flags in the given bitmask of values from the IO::Flags enum if they are not already disabled.

All other flags are left untouched. The format flags modify how the stream formats output.

Parameters
flagsThe bitmask of flags from the IO::Flags enum to disable.
Returns
The stream on which this function was called.

◆ Write()

OutputStream * Bond::OutputStream::Write ( void * bytes,
uint numBytes )
Parameters
bytesPointer to the array of bytes to be written to the stream.
numBytesThe number of bytes to be written.
Returns
The stream on which this function was called.

The documentation for this struct was generated from the following file:
  • build/libdoc/io.bond