Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Output Class Reference

#include <elm/io/Output.h>

+ Inheritance diagram for Output:

Public Member Functions

 Output (void)
 
 Output (OutStream &stream)
 
OutStreamstream (void) const
 
void setStream (OutStream &stream)
 
void flush (void)
 
void print (bool value)
 
void print (char chr)
 
void print (double value)
 
void print (void *value)
 
void print (const char *str)
 
void print (const CString str)
 
void print (const String &str)
 
void print (const IntFormat &fmt)
 
void print (const FloatFormat &fmt)
 
void print (const StringFormat &fmt)
 
void format (CString fmt,...)
 
void format (CString fmt, VarArg &args)
 
bool supportsANSI ()
 
void print (t::int32 value)
 
void print (t::uint32 value)
 
void print (t::int64 value)
 
void print (t::uint64 value)
 

Detailed Description

Class providing formatted output.

Beside a set of print() functions, this class also supports a collection of format configuration classes:

Below is an example of the use of these classes:

void *p;
cout << "pointer = " << io::fmt(t::uint64(p)).right().pad('0').width(32) << io::endl;

Additionally, this class provides simple facilities to output to a file and to manage release of created streams.

Constructor & Destructor Documentation

◆ Output() [1/2]

Output ( void  )

Build a formatted output on the standard output.

◆ Output() [2/2]

Output ( OutStream stream)

Build a formatted output on the given stream.

Member Function Documentation

◆ flush()

void flush ( void  )

Flush the underlying stream.

Exceptions
IOExceptionIf there is a stream error.

References OutStream::flush(), and OutStream::lastErrorMessage().

Referenced by Saver::close(), VarExpander::expand(), Serializer::flush(), and elm::trace().

◆ format() [1/2]

void format ( CString  fmt,
VarArg args 
)

Print a formatted string a-la C prinf().

Parameters
fmtFormat string.
argsOther arguments.

References VarArg::args(), elm::io::fmt(), and OutStream::write().

◆ format() [2/2]

void format ( CString  fmt,
  ... 
)

Print a formatted string a-la C prinf().

Parameters
fmtFormat string.
...Other arguments.

References elm::io::fmt().

◆ print() [1/14]

void print ( bool  value)

Print a boolean value, 'true' or 'false'.

Parameters
valueValue to write.

Referenced by Output::print().

◆ print() [2/14]

void print ( char  chr)

Print a character.

Parameters
chrCharacter to print.

References OutStream::lastErrorMessage(), and OutStream::write().

◆ print() [3/14]

void print ( const char *  str)
inline

References Output::print(), and elm::str().

Referenced by Output::print().

◆ print() [4/14]

void print ( const CString  str)

Print a C string.

Parameters
strC string to print.

References String::chars(), OutStream::lastErrorMessage(), String::length(), elm::str(), and OutStream::write().

◆ print() [5/14]

◆ print() [6/14]

◆ print() [7/14]

void print ( const String str)

Print a string.

Parameters
strString to print.

References String::chars(), OutStream::lastErrorMessage(), String::length(), elm::str(), and OutStream::write().

◆ print() [8/14]

void print ( const StringFormat fmt)

Print a formatted string.

Parameters
fmtFormat to print.

References IntFormat::_align, IntFormat::_pad, IntFormat::_width, elm::io::CENTER, elm::io::fmt(), elm::io::LEFT, and elm::io::RIGHT.

◆ print() [9/14]

void print ( double  value)

Print a double value.

Parameters
valueDouble value to print.

References OutStream::lastErrorMessage(), and OutStream::write().

◆ print() [10/14]

void print ( t::int32  value)

Print an integer.

Parameters
valueInteger to print.
Deprecated:

References OutStream::lastErrorMessage(), elm::io::p(), and OutStream::write().

◆ print() [11/14]

void print ( t::int64  value)

Print a long long integer.

Parameters
valueLong long integer to print.
Deprecated:

References OutStream::lastErrorMessage(), elm::io::p(), and OutStream::write().

◆ print() [12/14]

void print ( t::uint32  value)

Print an unsigned integer.

Parameters
valueInteger to print.
Deprecated:

References OutStream::lastErrorMessage(), elm::io::p(), and OutStream::write().

◆ print() [13/14]

void print ( t::uint64  value)

Print an unsigned long long integer.

Parameters
valueInteger to print.
Deprecated:

References OutStream::lastErrorMessage(), elm::io::p(), and OutStream::write().

◆ print() [14/14]

void print ( void value)

Print a pointer.

Parameters
valuePointer value.

References OutStream::lastErrorMessage(), elm::io::p(), Output::print(), and OutStream::write().

◆ setStream()

void setStream ( OutStream stream)

Change the output stream of the current output object.

Parameters
streamNew stream to use.

References Output::stream().

Referenced by FileOutput::FileOutput(), Saver::Saver(), and Serializer::setOutputStream().

◆ stream()

OutStream & stream ( void  ) const
inline

Get the stream used by the output.

Returns
Output stream.

Referenced by Output::setStream(), and Serializer::writeRaw().

◆ supportsANSI()

bool supportsANSI ( )

Test if the current stream supports ANSI codes.

Returns
True if the current stream supports ANSI codes, false else.

References OutStream::supportsANSI().


The documentation for this class was generated from the following files:
elm::io::p
Printable< T, M > p(const T &data, const M &man)
Definition: Output.h:302
elm::cout
io::Output cout
elm::io::IntFormat::width
IntFormat & width(int w)
Definition: Output.h:86
elm::t::uint64
unsigned long uint64
Definition: arch.h:33
elm::io::endl
const EOL endl
Definition: io_Output.cpp:880
elm::io::fmt
IntFormat fmt(t::int8 i)
Definition: Output.h:271
elm::io::IntFormat::pad
IntFormat & pad(char p)
Definition: Output.h:94
elm::io::IntFormat::right
IntFormat & right(void)
Definition: Output.h:90