summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2021-06-21 11:34:58 +0300
committerTor Lillqvist <tml@iki.fi>2021-06-21 12:43:17 +0300
commit1a2b29d3d555efb4c93d96ec910b3ac36703e1de (patch)
tree59ab04df4cf67526123a0be3f9ba080778e86152 /common
parentRe-factor Trace Event stuff for improved functionality and thread safety (diff)
downloadonline-1a2b29d3d555efb4c93d96ec910b3ac36703e1de.tar.gz
online-1a2b29d3d555efb4c93d96ec910b3ac36703e1de.zip
Add function to check if config has been initialized
Signed-off-by: Tor Lillqvist <tml@collabora.com> Change-Id: Ieadcb9ad6d34bb6cf789d29896889601baf88a33
Diffstat (limited to 'common')
-rw-r--r--common/ConfigUtil.cpp7
-rw-r--r--common/ConfigUtil.hpp5
2 files changed, 10 insertions, 2 deletions
diff --git a/common/ConfigUtil.cpp b/common/ConfigUtil.cpp
index 69a4b608a9..69be2bf3c5 100644
--- a/common/ConfigUtil.cpp
+++ b/common/ConfigUtil.cpp
@@ -35,6 +35,11 @@ void initialize(const std::string& xml)
initialize(XmlConfig);
}
+bool isInitialized()
+{
+ return Config;
+}
+
std::string getString(const std::string& key, const std::string& def)
{
assert(Config && "Config is not initialized.");
@@ -55,4 +60,4 @@ bool isSslEnabled()
return false;
#endif
}
-} // namespace config \ No newline at end of file
+} // namespace config
diff --git a/common/ConfigUtil.hpp b/common/ConfigUtil.hpp
index 44e7663441..54c393505f 100644
--- a/common/ConfigUtil.hpp
+++ b/common/ConfigUtil.hpp
@@ -30,6 +30,9 @@ void initialize(const std::string& xml);
/// Initialize the config given a pointer to a long-lived pointer.
void initialize(const Poco::Util::AbstractConfiguration* config);
+/// Check if the config has been initialized
+bool isInitialized();
+
/// Returns the value of an entry as string or @def if it is not found.
std::string getString(const std::string& key, const std::string& def);
@@ -39,4 +42,4 @@ bool getBool(const std::string& key, const bool def);
/// Return true if SSL is enabled in the config and no fuzzing is enabled.
bool isSslEnabled();
-} // namespace config \ No newline at end of file
+} // namespace config