From c3609239097ff06e826ea3196ee58ad18d4961a0 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 4 Oct 2014 19:10:59 -0400 Subject: [PATCH] Config - Added a :has method to detect settings that have no default value. --- src/Config.cpp | 6 ++++++ src/Config.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/Config.cpp b/src/Config.cpp index 833c1f0e5..1141df61f 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -585,6 +585,12 @@ void Config::clear () std::map ::clear (); } +//////////////////////////////////////////////////////////////////////////////// +const bool Config::has (const std::string& key) +{ + return (*this).find (key) != (*this).end (); +} + //////////////////////////////////////////////////////////////////////////////// // Return the configuration value given the specified key. const std::string Config::get (const std::string& key) diff --git a/src/Config.h b/src/Config.h index de5054465..2899c40d4 100644 --- a/src/Config.h +++ b/src/Config.h @@ -49,6 +49,7 @@ public: void setDefaults (); void clear (); + const bool has (const std::string&); const std::string get (const std::string&); const int getInteger (const std::string&); const double getReal (const std::string&);