qxLib
Public Member Functions | List of all members
qx::layered_config_variable_builder< T > Class Template Reference

A builder for creating layered_config_variable instances. More...

#include <layered_config_variable.h>

Public Member Functions

consteval layered_config_variable_builder (cstring_view svRuntimeName, T defaultValue={}) noexcept
 layered_config_variable_builder object constructor More...
 
consteval layered_config_variable_builder env (cstring_view svEnvName) noexcept
 Add environment variable layer with specified name. More...
 
consteval layered_config_variable_builder command_line (cstring_view svFullName, cstring_view svShortName={}) noexcept
 Add command line argument layer with specified full and short names. Full name should start with "--", short name should start with "-" or be empty. More...
 
consteval layered_config_variable_builder group (cstring_view svGroupName) noexcept
 Set the group name for the variable. More...
 
consteval layered_config_variable_builder description (cstring_view svDescription) noexcept
 Set the description for the variable. More...
 
consteval layered_config_variable_builder required () noexcept
 Mark variable as required. If a required variable is not set in any layer or has invalid value, layered_configs_manager::parse() will log errors and return false.
 
layered_config_variable< T > build () noexcept
 Finalize building layered_config_variable instance and add it to layered_configs_manager. More...
 

Detailed Description

template<class T>
class qx::layered_config_variable_builder< T >

A builder for creating layered_config_variable instances.

Template Parameters
T- variable type
Author
Khrapov
Date
17.05.2026

Definition at line 68 of file layered_config_variable.h.

Constructor & Destructor Documentation

◆ layered_config_variable_builder()

template<class T >
consteval qx::layered_config_variable_builder< T >::layered_config_variable_builder ( cstring_view  svRuntimeName,
defaultValue = {} 
)
noexcept

layered_config_variable_builder object constructor

Parameters
svRuntimeName- runtime name of variable
defaultValue- a value to be used if the variable is not set in any layer or has invalid value

Definition at line 27 of file layered_config_variable.inl.

Member Function Documentation

◆ build()

template<class T >
layered_config_variable< T > qx::layered_config_variable_builder< T >::build
noexcept

Finalize building layered_config_variable instance and add it to layered_configs_manager.

Return values
-built layered_config_variable instance

Definition at line 115 of file layered_config_variable.inl.

◆ command_line()

template<class T >
consteval layered_config_variable_builder< T > qx::layered_config_variable_builder< T >::command_line ( cstring_view  svFullName,
cstring_view  svShortName = {} 
)
noexcept

Add command line argument layer with specified full and short names. Full name should start with "--", short name should start with "-" or be empty.

Parameters
svFullName- full name of command line argument
svShortName- short name of command line argument

Definition at line 76 of file layered_config_variable.inl.

◆ description()

template<class T >
consteval layered_config_variable_builder< T > qx::layered_config_variable_builder< T >::description ( cstring_view  svDescription)
noexcept

Set the description for the variable.

This description will be shown in help messages.

Parameters
svDescription- description of the variable

Definition at line 100 of file layered_config_variable.inl.

◆ env()

template<class T >
consteval layered_config_variable_builder< T > qx::layered_config_variable_builder< T >::env ( cstring_view  svEnvName)
noexcept

Add environment variable layer with specified name.

Parameters
svEnvName- name of environment variable

Definition at line 69 of file layered_config_variable.inl.

◆ group()

template<class T >
consteval layered_config_variable_builder< T > qx::layered_config_variable_builder< T >::group ( cstring_view  svGroupName)
noexcept

Set the group name for the variable.

Variables with the same group name can be displayed together in help messages.

Parameters
svGroupName- group name

Definition at line 92 of file layered_config_variable.inl.


The documentation for this class was generated from the following files: