17 #include <unordered_map>
27 cstring_view svEnvName;
28 cstring_view svFullCommandLineName;
29 cstring_view svShortCommandLineName;
31 cstring_view svGroupName;
32 cstring_view svDescription;
33 bool bRequired =
false;
35 std::optional<std::any> (*pStringToT)(cstring_view svData);
36 cstring (*pTToString)(
const std::any& data);
37 cstring_view svTypeName;
69 void set_args(
int argc,
char* argv[]) noexcept;
84 bool parse() noexcept;
93 std::optional<T>
get(cstring_view svRuntimeName)
const noexcept;
103 bool set(cstring_view svRuntimeName, T value) noexcept;
108 void reset() noexcept;
120 cstring_view svRuntimeName,
122 T defaultValue) noexcept;
126 std::span<char* const> m_Args;
128 std::unordered_map<cstring_view, details::layered_config_variable_data> m_VariableData;
129 std::unordered_map<cstring_view, std::any> m_DefaultVariables;
130 std::unordered_map<cstring_view, std::any> m_Variables;
A builder for creating layered_config_variable instances.
A singleton that manages layered configuration variables.
void reset() noexcept
Clear all variables and command line arguments. You should call parse() after that to set variables a...
std::optional< T > get(cstring_view svRuntimeName) const noexcept
Get variable value by runtime name.
void set_app_description(cstring sAppDescription) noexcept
Set app description. It will be shown in help message.
bool parse() noexcept
Parse command line arguments, environment variables, and default values.
bool set(cstring_view svRuntimeName, T value) noexcept
Set variable value by runtime name. Only set if the variable type matches.
bool show_help() const noexcept
Show help message if "--help" or "-h" argument is present in command line arguments.
void set_args(int argc, char *argv[]) noexcept
Set command line arguments.
Inherit the necessary singleton class from this.