Config file representation.
More...
#include <Config.h>
|
| Config (const std::filesystem::path &configPath) |
|
| Config (std::string_view serverConfiguration, std::string_view applicationDirectory) |
| Create config from text.
|
|
| Config (const Config &)=default |
|
| Config (Config &&) noexcept=default |
|
Config & | operator= (const Config &)=default |
|
Config & | operator= (Config &&) noexcept=default |
|
Config & | overrideConfiguration (std::string_view key, const json::utility::jsonObject::variantType &value, bool recursive=true) |
| Override specific config value.
|
|
Config & | overrideConfiguration (std::string_view key, const std::vector< int64_t > &value, bool recursive=true) |
| Override specific config value.
|
|
Config & | overrideConfiguration (std::string_view key, const std::vector< std::string > &value, bool recursive=true) |
| Override specific config value.
|
|
Config & | overrideBasePath (const std::filesystem::path &basePath) |
| Override config file directory.
|
|
const std::string & | getConfigurationString (std::string_view key, bool recursive=true) const |
| Get string from config.
|
|
int64_t | getConfigurationInteger (std::string_view key, bool recursive=true) const |
| Get integer from config.
|
|
bool | getConfigurationBoolean (std::string_view key, bool recursive=true) const |
| Get boolean from config.
|
|
const std::filesystem::path & | getBasePath () const |
| Config file directory.
|
|
std::string | getConfiguration () const |
| Get current config JSON string data.
|
|
std::string_view | getRawConfiguration () const |
| Get raw config JSON string data.
|
|
const json::JSONParser & | operator* () const |
| Actual settings.
|
|
template<ranges::range T> |
Config & | overrideConfigurationArray (string_view key, const T &value, bool recursive) |
|
Config file representation.
Definition at line 14 of file Config.h.
◆ Config() [1/2]
framework::utility::Config::Config |
( |
const std::filesystem::path & | configPath | ) |
|
- Parameters
-
configPath | Path to *.json config file |
◆ Config() [2/2]
framework::utility::Config::Config |
( |
std::string_view | serverConfiguration, |
|
|
std::string_view | applicationDirectory ) |
Create config from text.
- Parameters
-
serverConfiguration | UTF8 encoded configuration |
applicationDirectory | Relative to that path all *.json settings construct their own paths(assets path, templates path, ...) |
- Returns
◆ getBasePath()
const filesystem::path & framework::utility::Config::getBasePath |
( |
| ) |
const |
◆ getConfiguration()
string framework::utility::Config::getConfiguration |
( |
| ) |
const |
Get current config JSON string data.
- Returns
Definition at line 97 of file Config.cpp.
◆ getConfigurationBoolean()
bool framework::utility::Config::getConfigurationBoolean |
( |
std::string_view | key, |
|
|
bool | recursive = true ) const |
Get boolean from config.
- Parameters
-
key | Config key |
recursive | Search recursively |
- Returns
- Config boolean value
Definition at line 87 of file Config.cpp.
◆ getConfigurationInteger()
int64_t framework::utility::Config::getConfigurationInteger |
( |
std::string_view | key, |
|
|
bool | recursive = true ) const |
Get integer from config.
- Parameters
-
key | Config key |
recursive | Search recursively |
- Returns
- Config integer value
Definition at line 82 of file Config.cpp.
◆ getConfigurationString()
const string & framework::utility::Config::getConfigurationString |
( |
std::string_view | key, |
|
|
bool | recursive = true ) const |
Get string from config.
- Parameters
-
key | Config key |
recursive | Search recursively |
- Returns
- Config string value
Definition at line 77 of file Config.cpp.
◆ getRawConfiguration()
string_view framework::utility::Config::getRawConfiguration |
( |
| ) |
const |
Get raw config JSON string data.
- Returns
Definition at line 102 of file Config.cpp.
◆ operator*()
const json::JSONParser & framework::utility::Config::operator* |
( |
| ) |
const |
Actual settings.
- Returns
Definition at line 107 of file Config.cpp.
◆ overrideBasePath()
Config & framework::utility::Config::overrideBasePath |
( |
const std::filesystem::path & | basePath | ) |
|
Override config file directory.
- Parameters
-
- Returns
- Self
Definition at line 65 of file Config.cpp.
◆ overrideConfiguration() [1/3]
Config & framework::utility::Config::overrideConfiguration |
( |
std::string_view | key, |
|
|
const json::utility::jsonObject::variantType & | value, |
|
|
bool | recursive = true ) |
Override specific config value.
- Parameters
-
- Returns
◆ overrideConfiguration() [2/3]
Config & framework::utility::Config::overrideConfiguration |
( |
std::string_view | key, |
|
|
const std::vector< int64_t > & | value, |
|
|
bool | recursive = true ) |
Override specific config value.
- Parameters
-
- Returns
◆ overrideConfiguration() [3/3]
Config & framework::utility::Config::overrideConfiguration |
( |
std::string_view | key, |
|
|
const std::vector< std::string > & | value, |
|
|
bool | recursive = true ) |
Override specific config value.
- Parameters
-
- Returns
◆ overrideConfigurationArray()
template<ranges::range T>
Config & framework::utility::Config::overrideConfigurationArray |
( |
string_view | key, |
|
|
const T & | value, |
|
|
bool | recursive ) |
The documentation for this class was generated from the following files: