Tinker9 70bd052 (Thu Nov 9 12:11:35 2023 -0800)
Loading...
Searching...
No Matches
Functions

Functions

template<class Arg , class Invalid >
void tinker::ioReadStream (Arg &arg, std::string prompt, Arg auto_fill, Invalid &&invalid, std::istream &istream=std::cin)
 Tests the validity of arg. If invalid, read ONE value from an std::istream object. arg will not change until the reading successfully exits. More...
 
template<class T >
void tinker::ioRewindStream (T &stream)
 Rewind a stream object. More...
 
template<class Arg >
int tinker::ioReadString (Arg &arg, const char *str, size_t len)
 Reads ONE value from a string and save to arg. arg will not change until the reading successfully exits. More...
 
int tinker::ioReadString (std::string &arg, const char *str, size_t len)
 Reads ONE value from a string and save to arg. arg will not change until the reading successfully exits. More...
 
template<class Arg , size_t Len>
int tinker::ioReadString (Arg &arg, const char(&src)[Len])
 Reads ONE value from a string and save to arg. arg will not change until the reading successfully exits. More...
 

Detailed Description

Function Documentation

◆ ioReadStream()

template<class Arg , class Invalid >
void tinker::ioReadStream ( Arg &  arg,
std::string  prompt,
Arg  auto_fill,
Invalid &&  invalid,
std::istream &  istream = std::cin 
)

Tests the validity of arg. If invalid, read ONE value from an std::istream object. arg will not change until the reading successfully exits.

Parameters
[out]argVariable to store the value read from input.
[in]promptHelp message to be sent to stdout.
[in]auto_fillDefault value to be assigned to arg.
[in]invalidFunction that returns true if arg is invalid or false if valid.
[in]istreamAn std::istream object; use std::cin by default.

◆ ioReadString() [1/3]

template<class Arg >
int tinker::ioReadString ( Arg &  arg,
const char *  str,
size_t  len 
)

Reads ONE value from a string and save to arg. arg will not change until the reading successfully exits.

Returns
Error code: non-zero if any error occurs; otherwise zero.

◆ ioReadString() [2/3]

template<class Arg , size_t Len>
int tinker::ioReadString ( Arg &  arg,
const char(&)  src[Len] 
)

Reads ONE value from a string and save to arg. arg will not change until the reading successfully exits.

Returns
Error code: non-zero if any error occurs; otherwise zero.

◆ ioReadString() [3/3]

int tinker::ioReadString ( std::string &  arg,
const char *  str,
size_t  len 
)
inline

Reads ONE value from a string and save to arg. arg will not change until the reading successfully exits.

Returns
Error code: non-zero if any error occurs; otherwise zero.

◆ ioRewindStream()

template<class T >
void tinker::ioRewindStream ( T &  stream)

Rewind a stream object.