Struct ConfigValue

Struct Documentation

struct ConfigValue

Structure containing a configuration value with complete metadata.

This structure encapsulates a single configuration setting with all associated metadata needed for proper management, validation, and documentation. It tracks both the current value and the original default, along with descriptive information for help systems and configuration file generation.

Lifecycle

  1. Created with default value and metadata during initialization

  2. Updated from configuration file during loading (user_set = true)

  3. Potentially overridden by command-line arguments

  4. Accessed throughout application lifecycle via type-safe getters

Metadata Usage

  • description: Used in help output and configuration file generation

  • category: Used for organizing settings in help and validation

  • user_set: Tracks whether user has explicitly set this value

  • default_value: Preserved for reset operations and help display

Public Functions

inline ConfigValue()

Default constructor creating an empty configuration value.

Creates an uninitialized configuration value. Should only be used in contexts where the value will be immediately assigned proper metadata.

inline ConfigValue(const std::string &def_val, const std::string &desc, const std::string &cat)

Constructor with full metadata specification.

Creates a fully initialized configuration value with metadata. The current value is initially set to the default value.

Parameters:
  • def_val – Default value for this configuration setting

  • desc – Human-readable description for help and documentation

  • cat – Category name for organization (should match ConfigCategory)

Public Members

std::string value

Current value of the configuration setting.

std::string default_value

Original default value for reset/comparison.

std::string description

Human-readable description for help systems.

std::string category

Category name for organization and validation.

bool user_set

Whether user has explicitly set this value.