Core components of the Consolix framework.
The Components group includes modules that provide functionality such as logging, command-line argument handling, configuration management, logo rendering, and structured execution loops.
Main Components:
- TitleComponent: Manages the console window title across platforms.
- Supports UTF-8 titles by converting them to UTF-16 on Windows.
- On Linux/macOS, uses ANSI escape sequences for setting the title.
- LoggerComponent: Configures and manages logging functionality.
- Uses MultiStream to provide consistent logging across platforms.
- Supports UTF-8 output, with automatic conversion to CP866 on Windows for compatibility with legacy consoles.
- Supports ANSI color codes for enhanced readability.
- Integrates with LogIt (if enabled) for structured and multi-stream logging.
- LogoComponent: Displays the application logo in the console.
- CliComponent: Handles command-line arguments using the cxxopts library.
- ConfigComponent: Loads and manages configuration from JSON files.
- BaseLoopComponent: A base class for loop-based components.
- LoopComponent: A component with customizable execution loops.
Key Features:
- Easy integration of logging and logo rendering.
- Convenient handling of command-line arguments.
- Lightweight JSON configuration management, including support for comments.
- Support for custom execution loops using either a base class or the LoopComponent.
- UTF-8 support for program titles on all platforms:
- Automatically converted to UTF-16 on Windows for proper Unicode rendering.
- Displayed via ANSI escape sequences on Linux/macOS.
- UTF-8 console output:
- Uses MultiStream for consistent handling of log messages.
- On Windows, UTF-8 is automatically converted to CP866 for legacy console compatibility.
- Supports ANSI color sequences for improved readability.
- Integrates with LogIt (if enabled) for structured and multi-stream logging.
Included Headers:
Example Usage:
#define CONSOLIX_USE_LOGIT 1
int main(
int argc,
char* argv[]) {
options.add_options()("debug", "Enable debug mode");
}, argc, argv);
});
}
#define CONSOLIX_STREAM()
Fallback for general logging.
Entry point for including all Consolix components.
std::shared_ptr< Component > add(Args &&... args)
Adds a new component to the application. Creates a new instance of the specified component type and a...
void run()
Runs the application. Processes all components in the application's main loop.