Rapicorn - Experimental UI Toolkit - Source Code
13.07.0
|
Go to the source code of this file.
Classes | |
struct | Rapicorn::UserSource |
< Helper structure to capture the origin of a user message. More... | |
Namespaces | |
namespace | Rapicorn |
The Rapicorn namespace encompasses core utilities and toolkit functionality. | |
namespace | Rapicorn::AnsiColors |
The AnsiColors namespace contains utility functions for colored terminal output. | |
Defines | |
#define | RAPICORN_FLIPPER(key, blurb) |
Create a Rapicorn::FlipperOption object that can be used to query, cache and document feature toggles. | |
#define | RAPICORN_DEBUG_OPTION(key, blurb) |
Create a Rapicorn::DebugOption object that can be used to query, cache and document debugging options. | |
#define | RAPICORN_KEY_DEBUG(key,...) |
Issues a debugging message if $RAPICORN_DEBUG contains the literal "key" or "all". | |
#define | RAPICORN_FATAL(...) |
Abort the program with a fatal error message. | |
#define | RAPICORN_ASSERT(cond) |
Issue an error and abort the program if expression cond evaluates to false. | |
#define | RAPICORN_ASSERT_RETURN(cond,...) |
Issue an assertion warning and return if condition is false. | |
#define | RAPICORN_ASSERT_UNREACHED() |
Assertion used to label unreachable code. | |
#define | RAPICORN_CRITICAL(...) |
Issues a critical message, see also $RAPICORN_DEBUG=fatal-warnings. | |
#define | RAPICORN_CRITICAL_UNLESS(cond) |
Issue a critical warning if condition is false, i.e. | |
#define | RAPICORN_DIAG(...) |
Issues a diagnostic message, e.g. | |
#define | RAPICORN_STARTUP_ASSERT(expr) |
Abort during program startup if condition is false. | |
#define | assert_unreached |
Shorthand for RAPICORN_ASSERT_UNREACHED() if RAPICORN_CONVENIENCE is defined. | |
#define | assert_return |
Shorthand for RAPICORN_ASSERT_RETURN() if RAPICORN_CONVENIENCE is defined. | |
#define | fatal |
Shorthand for RAPICORN_FATAL() if RAPICORN_CONVENIENCE is defined. | |
#define | critical_unless |
Shorthand for RAPICORN_CRITICAL_UNLESS() if RAPICORN_CONVENIENCE is defined. | |
#define | critical |
Shorthand for RAPICORN_CRITICAL() if RAPICORN_CONVENIENCE is defined. | |
#define | STARTUP_ASSERT |
Shorthand for RAPICORN_STARTUP_ASSERT() if RAPICORN_CONVENIENCE is defined. | |
#define | STATIC_ASSERT |
Shorthand for RAPICORN_STATIC_ASSERT() if RAPICORN_CONVENIENCE is defined. | |
Enumerations | |
enum | Rapicorn::AnsiColors::Colors { NONE, Rapicorn::AnsiColors::RESET, BOLD, BOLD_OFF, ITALICS, ITALICS_OFF, UNDERLINE, UNDERLINE_OFF, INVERSE, INVERSE_OFF, STRIKETHROUGH, STRIKETHROUGH_OFF, FG_BLACK, FG_RED, FG_GREEN, FG_YELLOW, FG_BLUE, FG_MAGENTA, FG_CYAN, FG_WHITE, FG_DEFAULT, BG_BLACK, BG_RED, BG_GREEN, BG_YELLOW, BG_BLUE, BG_MAGENTA, BG_CYAN, BG_WHITE, BG_DEFAULT } |
ANSI color symbols. More... | |
Functions | |
template<class... Args> | |
void | Rapicorn::printout (const char *format, const Args &...args) |
template<class... Args> | |
void | Rapicorn::printerr (const char *format, const Args &...args) |
Print a message on stderr (and flush stderr) ala printf(), using the POSIX/C locale. | |
template<class... Args> | |
void | Rapicorn::user_notice (const UserSource &source, const char *format, const Args &...args) |
Issue a notice about user resources, format uses printf-like syntax. | |
template<class... Args> | |
void | Rapicorn::user_warning (const UserSource &source, const char *format, const Args &...args) |
Issue a notice about user resources, format uses printf-like syntax. | |
bool | Rapicorn::envkey_flipper_check (const char *env_var, const char *key, bool with_all_toggle, volatile bool *cachep) |
Check whether a flipper (feature toggle) is enabled. | |
bool | Rapicorn::envkey_debug_check (const char *env_var, const char *key, volatile bool *cachep) |
Check whether to print debugging message. | |
void | Rapicorn::envkey_debug_message (const char *env_var, const char *key, const char *file, const int line, const String &message, volatile bool *cachep) |
Conditionally print debugging message. | |
void | Rapicorn::debug_envvar (const String &name) |
Parse environment variable name for debug configuration. | |
void | Rapicorn::debug_config_add (const String &option) |
Set debug configuration override. | |
void | Rapicorn::debug_config_del (const String &key) |
Unset debug configuration override. | |
String | Rapicorn::debug_config_get (const String &key, const String &default_value) |
Query debug configuration for option key, defaulting to default_value. | |
bool | Rapicorn::debug_config_bool (const String &key, bool default_value) |
Query debug configuration for option key, defaulting to default_value, return boolean. | |
bool | Rapicorn::debug_devel_check () |
Check if debugging features for development versions should be enabled, see also $RAPICORN_DEBUG. | |
void | Rapicorn::rapicorn_debug (const char *key, const char *file, const int line, const String &msg) |
Issue debugging messages according to configuration. | |
bool | Rapicorn::rapicorn_debug_check (const char *key) |
Check if debugging is enabled for key. | |
const char * | Rapicorn::AnsiColors::color_code (Colors acolor) |
Return ASCII code for the specified color. | |
const char * | Rapicorn::AnsiColors::color (Colors acolor) |
Return ASCII code for the specified color if stdout & stderr should be colorized. | |
bool | Rapicorn::AnsiColors::colorize_tty (int fd) |
Check whether the tty fd should use colorization. | |
void | Rapicorn::AnsiColors::color_envkey (const String &env_var, const String &key) |
Configure the environment variable that always/never/automatically allows colorization. |
#define RAPICORN_ASSERT | ( | cond | ) |
Issue an error and abort the program if expression cond evaluates to false.
Before aborting, a bracktrace is printed to aid debugging of the failing assertion.
#define RAPICORN_ASSERT_RETURN | ( | cond, | |
... | |||
) |
Issue an assertion warning and return if condition is false.
Issue an error and return rvalue if expression condition evaluates to false. Returns void if rvalue was not specified. This is normally used as function entry condition.
#define RAPICORN_ASSERT_UNREACHED | ( | ) |
Assertion used to label unreachable code.
Issues an error message, and aborts the program if it is reached at runtime. This is normally used to label code conditions intended to be unreachable.
#define RAPICORN_CRITICAL | ( | ... | ) |
Issues a critical message, see also $RAPICORN_DEBUG=fatal-warnings.
The error message format uses printf-like syntax.
#define RAPICORN_CRITICAL_UNLESS | ( | cond | ) |
Issue a critical warning if condition is false, i.e.
this macro behaves like RAPICORN_CRITICAL() if expression cond evaluates to false. This is normally used as a non-fatal assertion.
#define RAPICORN_DEBUG_OPTION | ( | key, | |
blurb | |||
) |
Create a Rapicorn::DebugOption object that can be used to query, cache and document debugging options.
When converted to bool, it is checked if $RAPICORN_DEBUG enables or disables the debugging option key. Enabling can be achieved by just adding "key" to the colon separated list in the environment variable. Disabling can be achieved by leaving it out. Alternatively, "key=1" and "key=0" are also recognized to enable and disable the option respectively. Settings listed later can be used as overrides. Typical use:
static auto dbg_test_feature = RAPICORN_DEBUG_OPTION ("test-feature", "Switch use of the test-feature during debugging on or off."); if (dbg_test_feature) enable_test_feature();
#define RAPICORN_DIAG | ( | ... | ) |
Issues a diagnostic message, e.g.
indicaintg I/O errors or invalid user input. Diagnostic message are enabled by default for dvelopment versions and can be enabled otherwise with $RAPICORN_DEBUG=devel. The message format uses printf-like syntax.
#define RAPICORN_FATAL | ( | ... | ) |
Abort the program with a fatal error message.
Issues an error message and call abort() to abort the program, see also $RAPICORN_DEBUG. The error message format uses printf-like syntax.
#define RAPICORN_FLIPPER | ( | key, | |
blurb | |||
) |
Create a Rapicorn::FlipperOption object that can be used to query, cache and document feature toggles.
When converted to bool, it is checked if $RAPICORN_FLIPPER enables or disables the flipper key. Enabling can be achieved by just adding "key" to the colon separated list in the environment variable. Disabling can be achieved by leaving it out. Alternatively, "key=1" and "key=0" are also recognized to enable and disable the option respectively. Settings listed later can be used as overrides. Related: $RAPICORN_DEBUG.
#define RAPICORN_KEY_DEBUG | ( | key, | |
... | |||
) |
Issues a debugging message if $RAPICORN_DEBUG contains the literal "key" or "all".
The message format uses printf-like syntax.
#define RAPICORN_STARTUP_ASSERT | ( | expr | ) |
Abort during program startup if condition is false.
This macro expands to executing an assertion via a static constructor during program startup (before main()). In contrast to static_assert(), this macro can execute arbitrary code, e.g. to assert floating point number properties.