diff --git a/Config.cpp b/Config.cpp index d1bf7b64..00350608 100644 --- a/Config.cpp +++ b/Config.cpp @@ -223,6 +223,15 @@ namespace config { void Finalize() { notify(m_Options); - }; + } + + bool IsDefault(const char *name) { + if (!m_Options.count(name)) + throw "try to check non-existent option"; + + if (m_Options[name].defaulted()) + return true; + return false; + } } // namespace config } // namespace i2p diff --git a/Config.h b/Config.h index 51a12d70..07d7ccb7 100644 --- a/Config.h +++ b/Config.h @@ -94,6 +94,13 @@ namespace config { notify(m_Options); return true; } + + /** + * @brief Check is value explicitly given or default + * @param name Name of checked parameter + * @return true if value set to default, false othervise + */ + bool IsDefault(const char *name); } }