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

A configuration variable that can be set from different layers (default value, environment variable, command line argument, runtime get()/set()). More...

#include <layered_config_variable.h>

Public Member Functions

constexpr T get () const noexcept
 Get variable value. If the variable is not set in any layer or has invalid value, the default value will be returned. More...
 
constexpr void set (T value) noexcept
 Set variable value at runtime. It will override value from all other layers. More...
 

Detailed Description

template<class T>
class qx::layered_config_variable< T >

A configuration variable that can be set from different layers (default value, environment variable, command line argument, runtime get()/set()).

Supposed to be created using layered_config_variable_builder and stored as a global variable or constant (in case you don't want to change it at runtime).

Template Parameters
T- variable type
Author
Khrapov
Date
17.05.2026

Definition at line 31 of file layered_config_variable.h.

Member Function Documentation

◆ get()

template<class T >
constexpr T qx::layered_config_variable< T >::get
constexprnoexcept

Get variable value. If the variable is not set in any layer or has invalid value, the default value will be returned.

Return values
-variable value

Definition at line 14 of file layered_config_variable.inl.

◆ set()

template<class T >
constexpr void qx::layered_config_variable< T >::set ( value)
constexprnoexcept

Set variable value at runtime. It will override value from all other layers.

Parameters
value- variable value

Definition at line 21 of file layered_config_variable.inl.


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