[cmake-developers] Remove cmProperty class
The cmProperty class is used only in cmPropertyMap, and it seems easier to implement this logic in cmPropertyMap. -- 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
[cmake-developers] [PATCH 1/2] Drop cmProperty class
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::mapcmStdString,cmProperty +class cmPropertyMap : public std::mapcmStdString,cmStdString { public: - cmProperty *GetOrCreateProperty(const char *name); - void SetProperty(const char *name, const char *value, cmProperty::ScopeType scope);
[cmake-developers] [PATCH 2/2] Remove cmProperty.{h,cxx}
From: Yury G. Kudryashov urkud.ur...@gmail.com After previous commit cmProperty.h contained only one enum. Move it to cmPropertyMap.h. --- Source/CMakeLists.txt |2 -- Source/cmDocumentation.h |2 +- Source/cmProperty.h | 21 - Source/cmPropertyDefinition.h |2 +- Source/cmPropertyMap.h|7 ++- bootstrap |1 - 6 files changed, 8 insertions(+), 27 deletions(-) delete mode 100644 Source/cmProperty.cxx delete mode 100644 Source/cmProperty.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 0c420b9..e8404ff 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -225,8 +225,6 @@ SET(SRCS cmPolicies.cxx cmProcessTools.cxx cmProcessTools.h - cmProperty.cxx - cmProperty.h cmPropertyDefinition.cxx cmPropertyDefinition.h cmPropertyDefinitionMap.cxx diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 11bef16..0bf3669 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -13,7 +13,7 @@ #define _cmDocumentation_h #include cmStandardIncludes.h -#include cmProperty.h +#include cmPropertyMap.h #include cmDocumentationFormatter.h #include cmDocumentationFormatterHTML.h #include cmDocumentationFormatterDocbook.h diff --git a/Source/cmProperty.cxx b/Source/cmProperty.cxx deleted file mode 100644 index e69de29..000 diff --git a/Source/cmProperty.h b/Source/cmProperty.h deleted file mode 100644 index a2b3219..000 --- a/Source/cmProperty.h +++ /dev/null @@ -1,21 +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. -*/ -#ifndef cmProperty_h -#define cmProperty_h - -namespace cmProperty -{ - enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL, CACHE, - TEST, VARIABLE, CACHED_VARIABLE }; -} - -#endif diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h index 898e13b..e1c2648 100644 --- a/Source/cmPropertyDefinition.h +++ b/Source/cmPropertyDefinition.h @@ -12,7 +12,7 @@ #ifndef cmPropertyDefinition_h #define cmPropertyDefinition_h -#include cmProperty.h +#include cmPropertyMap.h #include cmStandardIncludes.h class cmPropertyDefinition diff --git a/Source/cmPropertyMap.h b/Source/cmPropertyMap.h index add5aad..9759a27 100644 --- a/Source/cmPropertyMap.h +++ b/Source/cmPropertyMap.h @@ -12,11 +12,16 @@ #ifndef cmPropertyMap_h #define cmPropertyMap_h -#include cmProperty.h #include cmStandardIncludes.h class cmake; +namespace cmProperty +{ + enum ScopeType { TARGET, SOURCE_FILE, DIRECTORY, GLOBAL, CACHE, + TEST, VARIABLE, CACHED_VARIABLE }; +} + class cmPropertyMap : public std::mapcmStdString,cmStdString { public: diff --git a/bootstrap b/bootstrap index f5eacbd..327f6c8 100755 --- a/bootstrap +++ b/bootstrap @@ -188,7 +188,6 @@ CMAKE_CXX_SOURCES=\ cmDocumentationFormatter \ cmDocumentationFormatterText \ cmPolicies \ - cmProperty \ cmPropertyMap \ cmPropertyDefinition \ cmPropertyDefinitionMap \ -- 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
[cmake-developers] [PATCH 1/2] cmPropertyDefinition::IsChained is const
From: Yury G. Kudryashov urkud.ur...@gmail.com --- Source/cmPropertyDefinition.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h index f68db87..58d1472 100644 --- a/Source/cmPropertyDefinition.h +++ b/Source/cmPropertyDefinition.h @@ -31,7 +31,7 @@ public: cmPropertyDefinition() { this-Chained = false; }; // is it chained? - bool IsChained() {return this-Chained; }; + bool IsChained() const { return this-Chained; }; // Get the section if any const std::string GetDocumentationSection() const { -- 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
Re: [cmake-developers] [PATCH 1/2] cmPropertyDefinition::IsChained is const
Yury G. Kudryashov wrote: From: Yury G. Kudryashov urkud.ur...@gmail.com Mailman says that the next patch is too big. The compressed version is attached. -- Yury G. Kudryashov, mailto: ur...@mccme.ru 0002-Add-const-qualifier-to-some-cmCommand-members.patch.xz Description: application/xz -- 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
[cmake-developers] [PATCH] Drop if(...) check because condition is always true
From: Yury G. Kudryashov urkud.ur...@gmail.com GetLocation returns std::string::c_str() which is never NULL --- Source/cmLocalGenerator.cxx |8 ++-- 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index ffbeb48..ea48dd1 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1903,12 +1903,8 @@ bool cmLocalGenerator::GetRealDependency(const char* inName, case cmTarget::MODULE_LIBRARY: case cmTarget::UNKNOWN_LIBRARY: { -// Get the location of the target's output file and depend on it. -if(const char* location = target-GetLocation(config)) - { - dep = location; - return true; - } +dep = target-GetLocation(config); +return true; } break; case cmTarget::UTILITY: -- 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