#include <swcdb/core/config/Properties.h>
Public Member Functions | |
SWC_CAN_INLINE | Properties () noexcept |
Properties (Properties &&)=delete | |
Properties (const Properties &)=delete | |
Properties & | operator= (Properties &&)=delete |
Properties & | operator= (const Properties &)=delete |
SWC_CAN_INLINE | ~Properties () noexcept |
void | reset () noexcept |
void | load_from (const Config::Parser::Options &opts, bool only_guarded=false) |
void | load (const std::string &fname, const Config::ParserConfig &filedesc, const Config::ParserConfig &cmddesc, bool allow_unregistered=false, bool only_guarded=false) |
void | reload (const std::string &fname, const Config::ParserConfig &filedesc, const Config::ParserConfig &cmddesc) |
void | alias (const char *primary, const char *secondary) |
void | set (const char *name, Property::Value::Ptr p) |
bool SWC_PURE_FUNC | has (const char *name) const noexcept |
bool | defaulted (const char *name) const |
std::string | to_string (const char *name) const |
void | get_names (Strings &names) const |
void | remove (const char *name) |
Property::Value::Ptr | get_ptr (const char *name, bool null_ok=false) const |
template<typename T > | |
SWC_SHOULD_NOT_INLINE T * | get (const char *name) const |
std::string | get_str (const char *name) const |
std::string | get_str (const char *name, const std::string &v) const |
Strings | get_strs (const char *name) const |
bool | get_bool (const char *name) const |
bool | get_bool (const char *name, bool v) const |
bool | get_gbool (const char *name) const |
int32_t | get_enum (const char *name) const |
int32_t | get_genum (const char *name) const |
uint8_t | get_i8 (const char *name) const |
uint16_t | get_i16 (const char *name) const |
uint16_t | get_i16 (const char *name, uint16_t v) const |
int32_t | get_i32 (const char *name) const |
int32_t | get_i32 (const char *name, int32_t v) const |
int64_t | get_i64 (const char *name) const |
void | print (std::ostream &out, bool include_default=false) const |
Public Attributes | |
Core::MutexSptd | mutex |
Private Types | |
typedef std::map< std::string, Property::Value::Ptr > | Map |
typedef std::map< std::string, std::string > | AliasMap |
Private Attributes | |
Map | m_map |
AliasMap | m_alias_map |
Definition at line 19 of file Properties.h.
|
private |
Definition at line 22 of file Properties.h.
|
private |
Definition at line 21 of file Properties.h.
|
inlinenoexcept |
Definition at line 29 of file Properties.h.
|
delete |
|
delete |
|
inlinenoexcept |
Definition at line 37 of file Properties.h.
References reset().
void SWC::Config::Properties::alias | ( | const char * | primary, |
const char * | secondary | ||
) |
Definition at line 64 of file Properties.cc.
References m_alias_map.
bool SWC::Config::Properties::defaulted | ( | const char * | name | ) | const |
Definition at line 94 of file Properties.cc.
References get_ptr(), and SWC::Config::Property::Value::is_default().
Referenced by SWC::Config::Settings::init_process().
|
inline |
Definition at line 73 of file Properties.h.
References get_ptr().
|
inline |
Definition at line 89 of file Properties.h.
Referenced by get_bool(), and SWC::Config::Settings::init().
|
inline |
Definition at line 93 of file Properties.h.
References get_bool(), and has().
|
inline |
Definition at line 101 of file Properties.h.
|
inline |
Definition at line 97 of file Properties.h.
Referenced by SWC::Config::Settings::init_process().
|
inline |
Definition at line 105 of file Properties.h.
|
inline |
Definition at line 113 of file Properties.h.
Referenced by get_i16(), and SWC::Config::Settings::init_process().
|
inline |
Definition at line 117 of file Properties.h.
References get_i16(), and has().
|
inline |
Definition at line 121 of file Properties.h.
Referenced by get_i32().
|
inline |
Definition at line 125 of file Properties.h.
References get_i32(), and has().
|
inline |
Definition at line 129 of file Properties.h.
|
inline |
Definition at line 109 of file Properties.h.
void SWC::Config::Properties::get_names | ( | Strings & | names | ) | const |
Definition at line 102 of file Properties.cc.
References m_map, SWC::Core::Vector< T, SizeT, GROW_SZ >::push_back(), and SWC::Core::Vector< T, SizeT, GROW_SZ >::reserve().
SWC_SHOULD_NOT_INLINE Property::Value::Ptr SWC::Config::Properties::get_ptr | ( | const char * | name, |
bool | null_ok = false |
||
) | const |
Definition at line 119 of file Properties.cc.
References SWC::Error::CONFIG_GET_ERROR, m_alias_map, m_map, SWC::Condition::str_eq(), and SWC_THROWF.
Referenced by defaulted(), get(), set(), and to_string().
|
inline |
Definition at line 77 of file Properties.h.
Referenced by SWC::Comm::ConfigSSL::ConfigSSL(), get_str(), SWC::Config::init_post_cmd_args(), SWC::Config::Settings::init_process(), SWC::Config::Settings::load_files_by(), SWC::Config::Settings::parse_args(), SWC::Config::Settings::parse_file(), and SWC::Comm::server::SerializedServer::SerializedServer().
|
inline |
Definition at line 81 of file Properties.h.
References get_str(), and has().
|
inline |
Definition at line 85 of file Properties.h.
Referenced by SWC::Comm::ConfigSSL::ConfigSSL(), SWC::client::Mngr::Groups::Groups(), and SWC::Comm::server::SerializedServer::SerializedServer().
|
noexcept |
Definition at line 82 of file Properties.cc.
References SWC::Condition::str_eq().
Referenced by SWC::Comm::ConfigSSL::ConfigSSL(), get_bool(), get_i16(), get_i32(), get_str(), SWC::Config::Settings::init(), SWC::Config::Settings::init_process(), SWC::Config::Settings::load_files_by(), load_from(), SWC::Config::Settings::parse_args(), and SWC::Comm::server::SerializedServer::SerializedServer().
SWC_SHOULD_NOT_INLINE void SWC::Config::Properties::load | ( | const std::string & | fname, |
const Config::ParserConfig & | filedesc, | ||
const Config::ParserConfig & | cmddesc, | ||
bool | allow_unregistered = false , |
||
bool | only_guarded = false |
||
) |
Definition at line 32 of file Properties.cc.
References SWC::Config::ParserConfig::add(), SWC::Config::Parser::config, SWC::Config::Parser::get_options(), load_from(), and SWC::Config::Parser::parse_filedata().
Referenced by SWC::Config::Settings::load_files_by(), SWC::Config::Settings::parse_file(), and reload().
SWC_SHOULD_NOT_INLINE void SWC::Config::Properties::load_from | ( | const Config::Parser::Options & | opts, |
bool | only_guarded = false |
||
) |
Definition at line 20 of file Properties.cc.
References has(), SWC::Config::Parser::Options::map, and set().
Referenced by load(), SWC::Config::Settings::parse_args(), and SWC::Config::Settings::parse_file().
|
delete |
|
delete |
void SWC::Config::Properties::print | ( | std::ostream & | out, |
bool | include_default = false |
||
) | const |
Definition at line 140 of file Properties.cc.
References m_map.
SWC_SHOULD_NOT_INLINE void SWC::Config::Properties::reload | ( | const std::string & | fname, |
const Config::ParserConfig & | filedesc, | ||
const Config::ParserConfig & | cmddesc | ||
) |
Definition at line 50 of file Properties.cc.
References load(), SWC::LOG_WARN, SWC_CURRENT_EXCEPTION, SWC_LOG_OSTREAM, and SWC_LOG_OUT.
Referenced by SWC::Config::Settings::check_dynamic_files().
void SWC::Config::Properties::remove | ( | const char * | name | ) |
Definition at line 108 of file Properties.cc.
References m_map, and SWC::Condition::str_eq().
|
noexcept |
Definition at line 13 of file Properties.cc.
References m_map.
Referenced by ~Properties().
SWC_SHOULD_NOT_INLINE void SWC::Config::Properties::set | ( | const char * | name, |
Property::Value::Ptr | p | ||
) |
Definition at line 70 of file Properties.cc.
References get_ptr(), SWC::Config::Property::Value::is_default(), m_map, and SWC::Config::Property::Value::make_new().
Referenced by load_from().
std::string SWC::Config::Properties::to_string | ( | const char * | name | ) | const |
Definition at line 98 of file Properties.cc.
References get_ptr(), and SWC::Config::Property::Value::to_string().
|
private |
Definition at line 139 of file Properties.h.
|
private |
Definition at line 138 of file Properties.h.
Referenced by get_names(), get_ptr(), print(), remove(), reset(), and set().
Core::MutexSptd SWC::Config::Properties::mutex |
Definition at line 26 of file Properties.h.
Referenced by SWC::Config::Settings::check_dynamic_files(), and SWC::Config::Settings::load_files_by().