Steppable 0.0.1
A CAS project written from scratch in C++
|
The namespace containing utility functions for the Steppable library. More...
Namespaces | |
namespace | colors |
A namespace containing functions to set the text color in an output stream. | |
namespace | colorsBg |
A namespace containing functions to set the background color in an output stream. | |
namespace | formats |
A namespace containing functions to set the text format in an output stream. | |
Classes | |
class | ProgramArgs |
This class is used by the program to parse command-line arguments. The class uses regular expressions to match and parse the command-line arguments. It supports switches, positional arguments, and keyword arguments. More... | |
struct | setw |
struct | StringLiteral |
String literal workaround for templates. More... | |
class | Utf8CodePage |
A class that sets the console output code page to UTF-8 and enables VT mode. More... | |
Typedefs | |
using | PosArgs = std::vector<std::string> |
This is the type of the positional arguments. It is equivalent to a vector of string_views. | |
Functions | |
bool | isTerminal (const std::ostream &stream) |
Check if the output stream is a terminal. | |
std::ostream & | reset (std::ostream &stream) |
Reset the text color and format to the default values. | |
std::filesystem::path | getHomeDirectory () |
std::filesystem::path | getConfDirectory () |
const std::regex | KEYWORD_ARG_REGEX (R"(^-([a-zA-Z]*):(-?[0-9]+)$)") |
This is the correct format of a keyword argument. | |
const std::regex | SWITCH_REGEX (R"(^([-+])([a-zA-Z]*)$)") |
This is the correct format of a switch. | |
void | programSafeExit (const int status) |
Exit the program safely. | |
std::tm | localtime_xp (std::time_t *timer) |
template<typename NumberT> | |
void | checkDecimalArg (const NumberT *decimal) |
Checks whether the decimal number is correctly specified. | |
The namespace containing utility functions for the Steppable library.
Namespace for internal functions.
using steppable::__internals::utils::PosArgs = std::vector<std::string> |
This is the type of the positional arguments. It is equivalent to a vector of string_views.
void steppable::__internals::utils::checkDecimalArg | ( | const NumberT * | decimal | ) |
Checks whether the decimal number is correctly specified.
Compares the argument decimal
to MAX_DECIMALS
. If too much decimals are requested, prints an error and quits the program.
NumberT | Type of the number. |
decimal | A pointer to the number of decimals. |
std::filesystem::path steppable::__internals::utils::getConfDirectory | ( | ) |
std::filesystem::path steppable::__internals::utils::getHomeDirectory | ( | ) |
bool steppable::__internals::utils::isTerminal | ( | const std::ostream & | stream | ) |
Check if the output stream is a terminal.
This function checks if the given output stream is associated with a terminal.
[in] | stream | The output stream to check. |
const std::regex steppable::__internals::utils::KEYWORD_ARG_REGEX | ( | R"(^-([a-zA-Z]*):(-?[0-9]+)$)" | ) |
This is the correct format of a keyword argument.
|
inline |
|
inline |
Exit the program safely.
This function exits the program safely with the given status code. On Windows, it uses std::quick_exit, and on macOS, it uses exit, because std::quick_exit is not implemented on macOS.
[in] | status | The status code to exit with |
std::ostream & steppable::__internals::utils::reset | ( | std::ostream & | stream | ) |
Reset the text color and format to the default values.
This function resets the text color and format to the default values.
[in] | stream | The output stream to reset. |
const std::regex steppable::__internals::utils::SWITCH_REGEX | ( | R"(^([-+])([a-zA-Z]*)$)" | ) |
This is the correct format of a switch.