16 #ifndef ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_CONFIGURATION_CONFIGURATIONNODE_H_ 17 #define ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_CONFIGURATION_CONFIGURATIONNODE_H_ 28 #include <rapidjson/document.h> 33 namespace configuration {
88 static bool initialize(
const std::vector<std::shared_ptr<std::istream>>& jsonStreams);
102 static std::shared_ptr<ConfigurationNode>
createRoot();
136 bool getInt(
const std::string& key,
int* out =
nullptr,
int defaultValue = 0)
const;
147 bool getUint32(
const std::string& key, uint32_t* out =
nullptr, uint32_t defaultValue = 0)
const;
182 template <
typename InputType,
typename OutputType,
typename DefaultType>
185 OutputType* out = static_cast<std::chrono::seconds>(0),
186 DefaultType defaultValue = std::chrono::seconds(0))
const;
211 operator bool()
const;
224 template <
typename Type>
291 static std::mutex m_mutex;
294 static rapidjson::Document m_document;
300 template <
typename InputType,
typename OutputType,
typename DefaultType>
303 auto result =
getInt(key, &temp);
305 *out = OutputType(result ? InputType(temp) : defaultValue);
310 template <
typename Type>
317 if (key.empty() || !m_object) {
323 auto it = m_object->FindMember(key.c_str());
324 if (m_object->MemberEnd() == it || !(it->value.*isType)()) {
331 *out = (it->value.*getType)();
341 #endif // ALEXA_CLIENT_SDK_AVSCOMMON_UTILS_INCLUDE_AVSCOMMON_UTILS_CONFIGURATION_CONFIGURATIONNODE_H_ Definition: ConfigurationNode.h:71
::std::string string
Definition: gtest-port.h:1097
static ConfigurationNode getRoot()
ConfigurationNode getChildNode(const char *key) const
bool getStringValues(const std::string &key, std::set< std::string > *out=nullptr) const
bool getBool(const std::string &key, bool *out=nullptr, bool defaultValue=false) const
bool getValue(const std::string &key, Type *out, Type defaultValue, bool(rapidjson::Value::*isType)() const, Type(rapidjson::Value::*getType)() const) const
Definition: ConfigurationNode.h:311
bool getString(const std::string &key, std::string *out=nullptr, std::string defaultValue="") const
std::string serialize() const
bool Value(const T &value, M matcher)
Definition: gmock-matchers.h:4347
static void uninitialize()
static std::shared_ptr< ConfigurationNode > createRoot()
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
std::size_t getArraySize() const
bool getUint32(const std::string &key, uint32_t *out=nullptr, uint32_t defaultValue=0) const
ConfigurationNode getArray(const std::string &key) const
bool getDuration(const std::string &key, OutputType *out=static_cast< std::chrono::seconds >(0), DefaultType defaultValue=std::chrono::seconds(0)) const
Definition: ConfigurationNode.h:301
bool getInt(const std::string &key, int *out=nullptr, int defaultValue=0) const
Type
Definition: Type.h:26
static bool initialize(const std::vector< std::shared_ptr< std::istream >> &jsonStreams)
ConfigurationNode operator[](const std::string &key) const
static const std::string key
The database key to be used by the protocol given the METADATA object.
Definition: SharedAVSSettingProtocolTest.cpp:58