feat update
Some checks failed
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 48s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Failing after 1m6s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 1m13s
linux-arm-gcc / linux-gcc-armhf (push) Failing after 1m21s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 1m24s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Has been cancelled
Some checks failed
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 48s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (push) Failing after 1m6s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 1m13s
linux-arm-gcc / linux-gcc-armhf (push) Failing after 1m21s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 1m24s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Has been cancelled
This commit is contained in:
parent
8d76becf1c
commit
4f8b6241e0
@ -13,6 +13,13 @@ Config::Config(sled::string_view name, sled::string_view path) : config_name_(na
|
|||||||
config_paths_.emplace_back(sled::to_string(path));
|
config_paths_.emplace_back(sled::to_string(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
Config::ToString() const
|
||||||
|
{
|
||||||
|
toml::value root = toml_;
|
||||||
|
return toml::format(root);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Config::AddConfigFullPath(sled::string_view path)
|
Config::AddConfigFullPath(sled::string_view path)
|
||||||
{
|
{
|
||||||
@ -75,6 +82,14 @@ Config::IsSet(sled::string_view key) const
|
|||||||
return GetNode(key, value);
|
return GetNode(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Config::IsArray(sled::string_view key) const
|
||||||
|
{
|
||||||
|
toml::value value;
|
||||||
|
if (!GetNode(key, value)) { return false; }
|
||||||
|
return value.is_array();
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Config::GetBoolOr(sled::string_view key, const bool &def) const
|
Config::GetBoolOr(sled::string_view key, const bool &def) const
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,8 @@ public:
|
|||||||
Config &operator=(const Config &lhs) = delete;
|
Config &operator=(const Config &lhs) = delete;
|
||||||
Config &operator=(Config &&rhs) noexcept = delete;
|
Config &operator=(Config &&rhs) noexcept = delete;
|
||||||
|
|
||||||
|
sled::string ToString() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* case 1
|
* case 1
|
||||||
* - fullpath = /path/to/config.toml
|
* - fullpath = /path/to/config.toml
|
||||||
@ -36,6 +38,8 @@ public:
|
|||||||
bool ReadInConfig();
|
bool ReadInConfig();
|
||||||
|
|
||||||
bool IsSet(sled::string_view key) const;
|
bool IsSet(sled::string_view key) const;
|
||||||
|
bool IsArray(sled::string_view key) const;
|
||||||
|
|
||||||
bool GetBoolOr(sled::string_view key, const bool &def = false) const;
|
bool GetBoolOr(sled::string_view key, const bool &def = false) const;
|
||||||
int GetIntOr(sled::string_view key, const int &def = 0) const;
|
int GetIntOr(sled::string_view key, const int &def = 0) const;
|
||||||
double GetDoubleOr(sled::string_view key, const double &def = 0.0) const;
|
double GetDoubleOr(sled::string_view key, const double &def = 0.0) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user