|
MolSim
|
Namespace defining utility functions for handling console output. More...
Functions | |
| static std::string | getCompilerName () |
| Gets the name of the compiler used to build the program executable (or "unknown" if the compiler is not identifiable via macros). | |
| static std::string | getBuildDate () |
| Gets the build date and time of the built executable as a string. | |
| static void | printUsage () |
| Prints a usage string explaining the syntax of the main program. | |
| static void | printHelp () |
| Prints a help string explaining the functionality of the main program. | |
| static int | getPercentage (int x, int y) |
| Gets the percentage as an integer from a fraction x / y. | |
| static void | error (const char *msg, const std::string &opt="", bool usage=true, bool close=true) |
| Prints an error message to stderr with the prefix "ERROR: ", optionally prints the usage string and exits with EXIT_FAILURE. | |
Variables | |
| static std::string_view | filename {"./MolSim"} |
| The filename of the executable (default: "./MolSim"). | |
| static std::unordered_map< char, std::string > | optionNames |
| Mapping from getopt option characters to their full names. | |
Namespace defining utility functions for handling console output.
|
inlinestatic |
Prints an error message to stderr with the prefix "ERROR: ", optionally prints the usage string and exits with EXIT_FAILURE.
This is typically used when the user does something wrong and has a different format to error logs printed with spdlog.
| msg | The message to be printed to stderr. |
| opt | An optional extra string to be appended at the end (default: empty). |
| usage | An optional boolean which defines whether or not the usage string should be printed. |
| close | An optional boolean which defines whether or not the program should completely exit afterwards. |
|
inlinestatic |
Gets the build date and time of the built executable as a string.
|
inlinestatic |
Gets the name of the compiler used to build the program executable (or "unknown" if the compiler is not identifiable via macros).
|
inlinestatic |
Gets the percentage as an integer from a fraction x / y.
| x | The numerator. |
| y | The denominator. If this is 0, 100 is returned. |
|
inlinestatic |
Prints a help string explaining the functionality of the main program.
|
inlinestatic |
Prints a usage string explaining the syntax of the main program.
|
inlinestatic |
The filename of the executable (default: "./MolSim").
|
inlinestatic |
Mapping from getopt option characters to their full names.