diff --git a/include/transport/config.h b/include/transport/config.h index c0ad64e576acfc4d0219a59454b855dbd838164c..4ff5b8fa079f1470b405ebffa8a072a6031d4f66 100644 --- a/include/transport/config.h +++ b/include/transport/config.h @@ -34,6 +34,7 @@ #define CONFIG_BOOL(PTR, KEY) (*PTR)[KEY].as() #define CONFIG_LIST(PTR, KEY) (*PTR)[KEY].as >() #define CONFIG_VECTOR(PTR, KEY) (*PTR)[KEY].as >() +#define CONFIG_HAS_KEY(PTR, KEY) (*PTR).hasKey(KEY) namespace Transport { @@ -60,9 +61,9 @@ class Config { /// the parser using opts parameter. /// \param configfile path to config file /// \param opts extra options which will be recognized by a parser - bool load(const std::string &configfile, boost::program_options::options_description &opts); + bool load(const std::string &configfile, boost::program_options::options_description &opts, const std::string &jid = ""); - bool load(std::istream &ifs, boost::program_options::options_description &opts); + bool load(std::istream &ifs, boost::program_options::options_description &opts, const std::string &jid = ""); bool load(std::istream &ifs); @@ -71,10 +72,14 @@ class Config { /// This function loads only config variables needed by libtransport. /// \see load(const std::string &, boost::program_options::options_description &) /// \param configfile path to config file - bool load(const std::string &configfile); + bool load(const std::string &configfile, const std::string &jid = ""); bool reload(); + bool hasKey(const std::string &key) { + return m_variables.find(key) != m_variables.end(); + } + /// Returns value of variable defined by key. /// For variables in sections you can use "section.variable" key format.