From: "Yury G. Kudryashov" <urkud.ur...@gmail.com> This class contains nothing but name (already stored in cmPropertyMap key) and value (string). --- Source/cmProperty.cxx | 40 ---------------------------------------- Source/cmProperty.h | 24 ++---------------------- Source/cmPropertyDefinition.h | 1 + Source/cmPropertyMap.cxx | 28 ++++++++-------------------- Source/cmPropertyMap.h | 5 ++--- Source/cmTestGenerator.cxx | 2 +- 6 files changed, 14 insertions(+), 86 deletions(-)
diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx index 3b37cf3..e69de29 100644 --- a/Source/cmProperty.cxx +++ b/Source/cmProperty.cxx @@ -1,40 +0,0 @@ -/*============================================================================ - CMake - Cross Platform Makefile Generator - Copyright 2000-2009 Kitware, Inc., Insight Software Consortium - - Distributed under the OSI-approved BSD License (the "License"); - see accompanying file Copyright.txt for details. - - This software is distributed WITHOUT ANY WARRANTY; without even the - implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the License for more information. -============================================================================*/ -#include "cmProperty.h" -#include "cmSystemTools.h" - -void cmProperty::Set(const char *name, const char *value) -{ - this->Name = name; - this->Value = value; - this->ValueHasBeenSet = true; -} - -void cmProperty::Append(const char *name, const char *value, bool asString) -{ - this->Name = name; - if(!this->Value.empty() && *value && !asString) - { - this->Value += ";"; - } - this->Value += value; - this->ValueHasBeenSet = true; -} - -const char *cmProperty::GetValue() const -{ - if (this->ValueHasBeenSet) - { - return this->Value.c_str(); - } - return 0; -} diff --git a/Source/cmProperty.h b/Source/cmProperty.h index e0fcd63..a2b3219 100644 --- a/Source/cmProperty.h +++ b/Source/cmProperty.h @@ -12,30 +12,10 @@ #ifndef cmProperty_h #define cmProperty_h -#include "cmStandardIncludes.h" - -class cmProperty +namespace cmProperty { -public: enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL, CACHE, TEST, VARIABLE, CACHED_VARIABLE }; - - // set this property - void Set(const char *name, const char *value); - - // append to this property - void Append(const char *name, const char *value, bool asString = false); - - // get the value - const char *GetValue() const; - - // construct with the value not set - cmProperty() { this->ValueHasBeenSet = false; }; - -protected: - std::string Name; - std::string Value; - bool ValueHasBeenSet; -}; +} #endif diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h index f68db87..898e13b 100644 --- a/Source/cmPropertyDefinition.h +++ b/Source/cmPropertyDefinition.h @@ -13,6 +13,7 @@ #define cmPropertyDefinition_h #include "cmProperty.h" +#include "cmStandardIncludes.h" class cmPropertyDefinition { diff --git a/Source/cmPropertyMap.cxx b/Source/cmPropertyMap.cxx index a4d0bf3..74bbec6 100644 --- a/Source/cmPropertyMap.cxx +++ b/Source/cmPropertyMap.cxx @@ -13,21 +13,6 @@ #include "cmSystemTools.h" #include "cmake.h" -cmProperty *cmPropertyMap::GetOrCreateProperty(const char *name) -{ - cmPropertyMap::iterator it = this->find(name); - cmProperty *prop; - if (it == this->end()) - { - prop = &(*this)[name]; - } - else - { - prop = &(it->second); - } - return prop; -} - void cmPropertyMap::SetProperty(const char *name, const char *value, cmProperty::ScopeType scope) { @@ -54,8 +39,7 @@ void cmPropertyMap::SetProperty(const char *name, const char *value, (void)scope; #endif - cmProperty *prop = this->GetOrCreateProperty(name); - prop->Set(name,value); + (*this)[name] = value; } void cmPropertyMap::AppendProperty(const char* name, const char* value, @@ -80,8 +64,12 @@ void cmPropertyMap::AppendProperty(const char* name, const char* value, (void)scope; #endif - cmProperty *prop = this->GetOrCreateProperty(name); - prop->Append(name,value,asString); + cmStdString &old = (*this)[name]; + if(!old.empty() && !asString) + { + old += ";"; + } + old += value; } const char *cmPropertyMap @@ -118,6 +106,6 @@ const char *cmPropertyMap } return 0; } - return it->second.GetValue(); + return it->second.c_str(); } diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index 94275e2..add5aad 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -13,14 +13,13 @@ #define cmPropertyMap_h #include "cmProperty.h" +#include "cmStandardIncludes.h" class cmake; -class cmPropertyMap : public std::map<cmStdString,cmProperty> +class cmPropertyMap : public std::map<cmStdString,cmStdString> { public: - cmProperty *GetOrCreateProperty(const char *name); - void SetProperty(const char *name, const char *value, cmProperty::ScopeType scope); diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index e0892b2..45e3cd2 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -57,7 +57,7 @@ void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, for ( pit = mpit->begin(); pit != mpit->end(); ++ pit ) { fout << " " << pit->first - << " " << lg->EscapeForCMake(pit->second.GetValue()); + << " " << lg->EscapeForCMake(pit->second.c_str()); } fout << ")" << std::endl; } -- 1.7.8 -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers