Evo C++ Library v0.5.1
Public Types | Static Public Member Functions | Public Attributes | List of all members
ConsoleNotMT Struct Reference

#include <evo/io.h>

Detailed Description

Single threaded console I/O.

Public Types

typedef PipeOut::Format Format
 Stream output formatter with state. More...
 
typedef StreamExtMT< PipeIn, MutexInertInT
 Input type. More...
 
typedef MutexInert::Lock Lock
 Mutex lock type. More...
 
typedef StreamExtMT< PipeOut, MutexInertOutT
 Output type. More...
 

Static Public Member Functions

static ConsoleNotMTget ()
 Get console instance to use. More...
 

Public Attributes

OutT err
 Write to console, error output. More...
 
InT in
 Read console input. More...
 
OutT out
 Write to console, normal output. More...
 

Member Typedef Documentation

◆ Format

Stream output formatter with state.

  • This is associated with a Stream object and supports stateful (i.e. sticky) output formatting with "<<" operator on this object
  • Formatting attributes include:
    • Aligned fields for formatting text "columns"
    • Integer base, prefix, and padding (in addition to field padding)
    • Floating point precision and padding (in additon to field padding)
    • String to use for "null" values (null char*, String, Int, etc)
  • Note: Single character (char) and Newline (NL) values are not formatted as fields (i.e. not padded) since they're usually delimiters
  • See: Stream Formatting
Examples

Example using File:

#include <evo/io.h>
using namespace evo;
int main() {
File file("file.txt", oWRITE_NEW);
// Use a temporary formatter to write line: 7B,1C8
File::Format(file) << fHEX << 123 << ',' << 456 << NL;
// Create a formatter and use to write line: 001,002
out << FmtSetInt(fDEC, 3) << 1 << ',' << 2 << NL;
return 0;
}

Example using Console (stdout):

#include <evo/io.h>
using namespace evo;
int main() {
Console& c = con();
// Use a temporary formatter to write line: 7B,1C8
Console::Format(c.out) << fHEX << 123 << ',' << 456 << NL;
// Create a formatter and use to write line: 001,002
out << FmtSetInt(fDEC, 3) << 1 << ',' << 2 << NL;
return 0;
}

For more examples see: Stream Formatting

◆ InT

Input type.

◆ Lock

Mutex lock type.

◆ OutT

Output type.

Member Function Documentation

◆ get()

static ConsoleNotMT& get ( )
inlinestatic

Get console instance to use.

Returns
Console instance

Member Data Documentation

◆ err

OutT err

Write to console, error output.

◆ in

InT in

Read console input.

◆ out

OutT out

Write to console, normal output.


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