|
Monitoring System 0.1.0
System resource monitoring with pluggable collectors and alerting
|
Unified configuration parsing utility. More...
#include <config_parser.h>

Static Public Member Functions | |
| template<typename T > | |
| static T | get (const config_map &config, const std::string &key, const T &default_value) |
| Get a configuration value with type conversion. | |
| template<typename T > | |
| static std::optional< T > | get_optional (const config_map &config, const std::string &key) |
| Get a configuration value as optional. | |
| static bool | has_key (const config_map &config, const std::string &key) |
| Check if a configuration key exists. | |
| template<typename T > | |
| static T | get_clamped (const config_map &config, const std::string &key, const T &default_value, const T &min_value, const T &max_value) |
| Get a configuration value with validation. | |
| template<typename T > | |
| static T | get_enum (const config_map &config, const std::string &key, const T &default_value, const std::unordered_set< T > &allowed_values) |
| Get a configuration value from a set of allowed values. | |
| static std::string | get_matching (const config_map &config, const std::string &key, const std::string &default_value, const std::string &pattern) |
| Get a string configuration value matching a regex pattern. | |
| template<typename T > | |
| static T | get_validated (const config_map &config, const std::string &key, const T &default_value, std::function< bool(const T &)> validator) |
| Get a configuration value with custom validation. | |
| template<typename Duration > | |
| static Duration | get_duration (const config_map &config, const std::string &key, const Duration &default_value) |
| Get a duration value from configuration. | |
| template<typename T > | |
| static std::vector< T > | get_list (const config_map &config, const std::string &key, const std::vector< T > &default_values) |
| Get a list of values from a comma-separated string. | |
Static Private Member Functions | |
| template<typename T > | |
| static T | parse_value (const std::string &str, const T &default_value) |
| Parse a string value to target type with default fallback. | |
| template<typename T > | |
| static std::optional< T > | parse_value_optional (const std::string &str) |
| Parse a string value to target type as optional. | |
| static bool | parse_bool (const std::string &str) |
| Parse boolean value from string. | |
| template<typename T > | |
| static T | parse_integral (const std::string &str) |
| Parse integral value from string. | |
| template<typename T > | |
| static T | parse_floating (const std::string &str) |
| Parse floating-point value from string. | |
| template<typename Duration > | |
| static Duration | parse_duration (const std::string &str, const Duration &default_value) |
| Parse duration string with optional suffix Supported suffixes: ms (milliseconds), s (seconds), m (minutes), h (hours) | |
| template<typename T > | |
| static std::vector< T > | parse_list (const std::string &str, const std::vector< T > &default_values) |
| Parse comma-separated list of values. | |
Unified configuration parsing utility.
Provides type-safe parsing of configuration values with default value support. Handles boolean, integer, floating-point, and string types consistently.
Definition at line 52 of file config_parser.h.
|
inlinestatic |
Get a configuration value with type conversion.
| T | The target type (bool, int, size_t, double, std::string, etc.) |
| config | The configuration map |
| key | The configuration key to look up |
| default_value | The default value if key is not found or parsing fails |
Definition at line 63 of file config_parser.h.
References parse_value().
Referenced by get_clamped(), get_enum(), and get_validated().


|
inlinestatic |
Get a configuration value with validation.
| T | The target type |
| config | The configuration map |
| key | The configuration key to look up |
| default_value | The default value if key is not found |
| min_value | Minimum allowed value |
| max_value | Maximum allowed value |
Definition at line 108 of file config_parser.h.
References get().

|
inlinestatic |
Get a duration value from configuration.
| Duration | The chrono duration type (e.g., std::chrono::milliseconds) |
| config | The configuration map |
| key | The configuration key to look up |
| default_value | The default duration if key is not found |
Supported formats:
Definition at line 197 of file config_parser.h.
References parse_duration().

|
inlinestatic |
Get a configuration value from a set of allowed values.
| T | The target type |
| config | The configuration map |
| key | The configuration key to look up |
| default_value | The default value if key is not found or invalid |
| allowed_values | Set of valid values |
Definition at line 131 of file config_parser.h.
References get().

|
inlinestatic |
Get a list of values from a comma-separated string.
| T | The element type |
| config | The configuration map |
| key | The configuration key to look up |
| default_values | The default list if key is not found |
Definition at line 215 of file config_parser.h.
References parse_list().

|
inlinestatic |
Get a string configuration value matching a regex pattern.
| config | The configuration map |
| key | The configuration key to look up |
| default_value | The default value if key is not found or invalid |
| pattern | The regex pattern to match against |
Definition at line 148 of file config_parser.h.
|
inlinestatic |
Get a configuration value as optional.
| T | The target type |
| config | The configuration map |
| key | The configuration key to look up |
Definition at line 79 of file config_parser.h.
References parse_value_optional().

|
inlinestatic |
Get a configuration value with custom validation.
| T | The target type |
| config | The configuration map |
| key | The configuration key to look up |
| default_value | The default value if key is not found or validation fails |
| validator | A function that returns true if the value is valid |
Definition at line 175 of file config_parser.h.
References get().

|
inlinestatic |
Check if a configuration key exists.
| config | The configuration map |
| key | The configuration key to check |
Definition at line 93 of file config_parser.h.
|
inlinestaticprivate |
Parse boolean value from string.
| str | String to parse ("true", "1", "yes", "on" -> true) |
Definition at line 274 of file config_parser.h.
Referenced by parse_value(), and parse_value_optional().

|
inlinestaticprivate |
Parse duration string with optional suffix Supported suffixes: ms (milliseconds), s (seconds), m (minutes), h (hours)
Definition at line 321 of file config_parser.h.
Referenced by get_duration().

|
inlinestaticprivate |
Parse floating-point value from string.
Definition at line 305 of file config_parser.h.
Referenced by parse_value(), and parse_value_optional().

|
inlinestaticprivate |
Parse integral value from string.
Definition at line 290 of file config_parser.h.
Referenced by parse_value(), and parse_value_optional().

|
inlinestaticprivate |
Parse comma-separated list of values.
Definition at line 372 of file config_parser.h.
References parse_value_optional().
Referenced by get_list().


|
inlinestaticprivate |
Parse a string value to target type with default fallback.
Definition at line 229 of file config_parser.h.
References parse_bool(), parse_floating(), and parse_integral().
Referenced by get().


|
inlinestaticprivate |
Parse a string value to target type as optional.
Definition at line 251 of file config_parser.h.
References parse_bool(), parse_floating(), and parse_integral().
Referenced by get_optional(), and parse_list().

