xentara-utils v1.0
Xentara utilities library
xentara::utils::ios Namespace Reference

std::ios related functionality More...

Classes

class  Indent
 Automatic object that indents a stream. More...
 
class  toLocal
 Manipulator for inserting UTF-8 and UTF-16 strings into std::ostreams. More...
 
class  ToLocalTime
 Manipulator for inserting time points into std::ostreams as local time. More...
 

Functions

auto indent (std::ostream &stream) -> std::ostream &
 Manipulator to add the current Indent into a stream. More...
 
auto shiftIn (std::ostream &stream) -> std::ostream &
 Manipulator to increase the indent of a stream. More...
 
auto shiftOut (std::ostream &stream) -> std::ostream &
 Manipulator to decrease the indent of a stream. More...
 
template<typename Char , typename Traits >
auto findWord (std::basic_istream< Char, Traits > &stream) -> std::basic_istream< Char, Traits > &
 Manipulator that finds the next word on the line. More...
 
template<typename Char , typename Traits >
auto skipBlanks (std::basic_istream< Char, Traits > &stream) -> std::basic_istream< Char, Traits > &
 Manipulator that skips blanks. More...
 
template<typename Char , typename Traits >
auto skipWord (std::basic_istream< Char, Traits > &stream) -> std::basic_istream< Char, Traits > &
 Manipulator that skips a word. More...
 
template<typename Char , typename Traits >
auto skipLine (std::basic_istream< Char, Traits > &stream) -> std::basic_istream< Char, Traits > &
 Manipulator that skips the rest of the line. More...
 
template<std::convertible_to< std::basic_string_view< char8_t > > String>
 toLocal (const String &) -> toLocal< char8_t >
 
auto toLocalTime (std::chrono::system_clock::time_point time) -> ToLocalTime
 Creates a manipulator for inserting time points into std::ostreams as local time. More...
 
auto toCompactLocalTime (std::chrono::system_clock::time_point time) -> ToLocalTime
 Creates a manipulator for inserting time points into std::ostreams as local time. More...
 

Detailed Description

std::ios related functionality

This namespace contains manipulators designed to be used with std::istream and/or std::ostream.

Function Documentation

◆ findWord()

template<typename Char , typename Traits >
auto xentara::utils::ios::findWord ( std::basic_istream< Char, Traits > &  stream) -> std::basic_istream<Char, Traits> &

Manipulator that finds the next word on the line.

This manipulator looks for the next word on the line by skipping blanks. It will set the fail bit on the stream if there are no more non-blank characters on the current line.

◆ indent()

auto xentara::utils::ios::indent ( std::ostream stream) -> std::ostream &

Manipulator to add the current Indent into a stream.

◆ shiftIn()

auto xentara::utils::ios::shiftIn ( std::ostream stream) -> std::ostream &

Manipulator to increase the indent of a stream.

◆ shiftOut()

auto xentara::utils::ios::shiftOut ( std::ostream stream) -> std::ostream &

Manipulator to decrease the indent of a stream.

◆ skipBlanks()

template<typename Char , typename Traits >
auto xentara::utils::ios::skipBlanks ( std::basic_istream< Char, Traits > &  stream) -> std::basic_istream<Char, Traits> &

Manipulator that skips blanks.

This manipulator behaves just like std::ws, but does not skip across the end of the line.

◆ skipLine()

template<typename Char , typename Traits >
auto xentara::utils::ios::skipLine ( std::basic_istream< Char, Traits > &  stream) -> std::basic_istream<Char, Traits> &

Manipulator that skips the rest of the line.

◆ skipWord()

template<typename Char , typename Traits >
auto xentara::utils::ios::skipWord ( std::basic_istream< Char, Traits > &  stream) -> std::basic_istream<Char, Traits> &

Manipulator that skips a word.

This manipulator skips the current word by skipping all characters that are not blanks. If no characters are skipped, the fail bit is set.

◆ toCompactLocalTime()

auto xentara::utils::ios::toCompactLocalTime ( std::chrono::system_clock::time_point  time) -> ToLocalTime

Creates a manipulator for inserting time points into std::ostreams as local time.

The returned manipulator only shows as much of seconds and fractions of a second as necessary

Parameters
timeThe time to insert

◆ toLocal()

template<std::convertible_to< std::basic_string_view< char8_t > > String>
xentara::utils::ios::toLocal ( const String &  ) -> toLocal< char8_t >

◆ toLocalTime()

auto xentara::utils::ios::toLocalTime ( std::chrono::system_clock::time_point  time) -> ToLocalTime

Creates a manipulator for inserting time points into std::ostreams as local time.

The returned manipulator always outputs the full time with nanosecond precision

Parameters
timeThe time to insert