Evo C++ Library v0.5.1
|
Evo supports extensive stream formatting.
Text streams can be written with formatting using the stream operator (<<).
The following examples write format to stdout, but also apply to any Stream type (File, Socket, PipeOut, etc).
Streams also support explicit formatting to customize the output:
Formatting attributes must be explicitly passed with each value – Stream itself doesn't keep any formatting state.
Formatting types used with operator<<()
:
Streams have a default newline value (see constructor) formatted with NL – default is determined by the stream itself.
Create a Stream::Format object (where Stream is the stream type used) to keep formatting state and make formatting "sticky" through that object, similar to String::Format:
This can also be done as a one-liner using a temporary formatter:
Sticky formatting is useful for applying the same formatting to many fields. You may still use explicit stream formatting (see previous section) to override sticky formatting.
Formatting types for setting attributes with operator<<()
See also: Smart Quoting