Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmPropertyDefinitionMap.cxx
blob25005097291a81c291744af731a3329647662b18
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmPropertyDefinitionMap.cxx,v $
5 Language: C++
6 <<<<<<< cmPropertyDefinitionMap.cxx
7 Date: $Date: 2007/10/23 14:40:49 $
8 Version: $Revision: 1.5 $
9 =======
10 Date: $Date: 2009-03-10 15:10:42 $
11 Version: $Revision: 1.6 $
12 >>>>>>> 1.6
14 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
15 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
17 This software is distributed WITHOUT ANY WARRANTY; without even
18 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 PURPOSE. See the above copyright notices for more information.
21 =========================================================================*/
22 #include "cmPropertyDefinitionMap.h"
23 #include "cmSystemTools.h"
24 #include "cmDocumentationSection.h"
26 void cmPropertyDefinitionMap
27 ::DefineProperty(const char *name, cmProperty::ScopeType scope,
28 const char *ShortDescription,
29 const char *FullDescription,
30 const char *DocumentationSection,
31 bool chain)
33 if (!name)
35 return;
38 cmPropertyDefinitionMap::iterator it = this->find(name);
39 cmPropertyDefinition *prop;
40 if (it == this->end())
42 prop = &(*this)[name];
43 prop->DefineProperty(name,scope,ShortDescription, FullDescription,
44 DocumentationSection, chain);
48 void cmPropertyDefinitionMap
49 ::GetPropertiesDocumentation(std::map<std::string,
50 cmDocumentationSection *>& v) const
52 for(cmPropertyDefinitionMap::const_iterator j = this->begin();
53 j != this->end(); ++j)
55 // add a section if needed
56 std::string secName = j->second.GetDocumentationSection();
57 // if a section was not specified then use the scope
58 if (!secName.size())
60 switch (j->second.GetScope())
62 case cmProperty::GLOBAL:
63 secName = "Properties of Global Scope";
64 break;
65 case cmProperty::TARGET:
66 secName = "Properties on Targets";
67 break;
68 case cmProperty::SOURCE_FILE:
69 secName = "Properties on Source Files";
70 break;
71 case cmProperty::DIRECTORY:
72 secName = "Properties on Directories";
73 break;
74 case cmProperty::TEST:
75 secName = "Properties on Tests";
76 break;
77 case cmProperty::CACHE:
78 secName = "Properties on Cache Entries";
79 break;
80 case cmProperty::VARIABLE:
81 secName = "Variables";
82 break;
83 case cmProperty::CACHED_VARIABLE:
84 secName = "Cached Variables";
85 break;
86 default:
87 secName = "Properties of Unknown Scope";
88 break;
91 if (!v[secName])
93 v[secName] = new
94 cmDocumentationSection(secName.c_str(),
95 cmSystemTools::UpperCase(secName).c_str());
97 cmDocumentationEntry e = j->second.GetDocumentation();
98 if (e.Brief.size() || e.Full.size())
100 v[secName]->Append(e);
105 bool cmPropertyDefinitionMap::IsPropertyDefined(const char *name)
107 if (!name)
109 return false;
112 cmPropertyDefinitionMap::iterator it = this->find(name);
113 if (it == this->end())
115 return false;
118 return true;
121 bool cmPropertyDefinitionMap::IsPropertyChained(const char *name)
123 if (!name)
125 return false;
128 cmPropertyDefinitionMap::iterator it = this->find(name);
129 if (it == this->end())
131 return false;
134 return it->second.IsChained();