summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-04-29 15:11:46 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-04-29 15:11:46 (GMT)
commit036e449c665ce3abe8c11b32c1f73ee9b8a68300 (patch)
tree80303c4bfcba528c96d5794a740acb62e6243188
parent5373e1731a828c5d96af66c4ab87f36d558f3051 (diff)
parenta3358faca1aba179ce6670460f259ab247b44cd4 (diff)
downloadCMake-036e449c665ce3abe8c11b32c1f73ee9b8a68300.zip
CMake-036e449c665ce3abe8c11b32c1f73ee9b8a68300.tar.gz
CMake-036e449c665ce3abe8c11b32c1f73ee9b8a68300.tar.bz2
Merge topic 'clean-up-cmDefinitions'
a3358fac cmDefinitions: Inline SetInternal method. 23370344 cmDefinitions: Remove unused Set return value. b9f4dd39 cmDefinitions: Remove unused method.
-rw-r--r--Source/cmDefinitions.cxx35
-rw-r--r--Source/cmDefinitions.h6
2 files changed, 11 insertions, 30 deletions
diff --git a/Source/cmDefinitions.cxx b/Source/cmDefinitions.cxx
index fe32dd5..abb46b3 100644
--- a/Source/cmDefinitions.cxx
+++ b/Source/cmDefinitions.cxx
@@ -21,13 +21,6 @@ cmDefinitions::cmDefinitions(cmDefinitions* parent)
}
//----------------------------------------------------------------------------
-void cmDefinitions::Reset(cmDefinitions* parent)
-{
- this->Up = parent;
- this->Map.clear();
-}
-
-//----------------------------------------------------------------------------
cmDefinitions::Def const&
cmDefinitions::GetInternal(const std::string& key)
{
@@ -46,37 +39,29 @@ cmDefinitions::GetInternal(const std::string& key)
}
//----------------------------------------------------------------------------
-cmDefinitions::Def const&
-cmDefinitions::SetInternal(const std::string& key, Def const& def)
+const char* cmDefinitions::Get(const std::string& key)
+{
+ Def const& def = this->GetInternal(key);
+ return def.Exists? def.c_str() : 0;
+}
+
+//----------------------------------------------------------------------------
+void cmDefinitions::Set(const std::string& key, const char* value)
{
+ Def def(value);
if(this->Up || def.Exists)
{
// In lower scopes we store keys, defined or not.
- return (this->Map[key] = def);
+ this->Map[key] = def;
}
else
{
// In the top-most scope we need not store undefined keys.
this->Map.erase(key);
- return this->NoDef;
}
}
//----------------------------------------------------------------------------
-const char* cmDefinitions::Get(const std::string& key)
-{
- Def const& def = this->GetInternal(key);
- return def.Exists? def.c_str() : 0;
-}
-
-//----------------------------------------------------------------------------
-const char* cmDefinitions::Set(const std::string& key, const char* value)
-{
- Def const& def = this->SetInternal(key, Def(value));
- return def.Exists? def.c_str() : 0;
-}
-
-//----------------------------------------------------------------------------
std::set<std::string> cmDefinitions::LocalKeys() const
{
std::set<std::string> keys;
diff --git a/Source/cmDefinitions.h b/Source/cmDefinitions.h
index a2f053f..83cd0d9 100644
--- a/Source/cmDefinitions.h
+++ b/Source/cmDefinitions.h
@@ -30,9 +30,6 @@ public:
/** Construct with the given parent scope. */
cmDefinitions(cmDefinitions* parent = 0);
- /** Reset object as if newly constructed. */
- void Reset(cmDefinitions* parent = 0);
-
/** Returns the parent scope, if any. */
cmDefinitions* GetParent() const { return this->Up; }
@@ -41,7 +38,7 @@ public:
const char* Get(const std::string& key);
/** Set (or unset if null) a value associated with a key. */
- const char* Set(const std::string& key, const char* value);
+ void Set(const std::string& key, const char* value);
/** Get the set of all local keys. */
std::set<std::string> LocalKeys() const;
@@ -81,7 +78,6 @@ private:
// Internal query and update methods.
Def const& GetInternal(const std::string& key);
- Def const& SetInternal(const std::string& key, Def const& def);
// Implementation of Closure() method.
struct ClosureTag {};