1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
8 This software is distributed WITHOUT ANY WARRANTY; without even the
9 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License for more information.
11 ============================================================================*/
12 #include "cmPropertyDefinitionMap.h"
13 #include "cmSystemTools.h"
14 #include "cmDocumentationSection.h"
16 void cmPropertyDefinitionMap
17 ::DefineProperty(const char *name, cmProperty::ScopeType scope,
18 const char *ShortDescription,
19 const char *FullDescription,
20 const char *DocumentationSection,
28 cmPropertyDefinitionMap::iterator it = this->find(name);
29 cmPropertyDefinition *prop;
30 if (it == this->end())
32 prop = &(*this)[name];
33 prop->DefineProperty(name,scope,ShortDescription, FullDescription,
34 DocumentationSection, chain);
38 void cmPropertyDefinitionMap
39 ::GetPropertiesDocumentation(std::map<std::string,
40 cmDocumentationSection *>& v) const
42 for(cmPropertyDefinitionMap::const_iterator j = this->begin();
43 j != this->end(); ++j)
45 // add a section if needed
46 std::string secName = j->second.GetDocumentationSection();
47 // if a section was not specified then use the scope
50 switch (j->second.GetScope())
52 case cmProperty::GLOBAL:
53 secName = "Properties of Global Scope";
55 case cmProperty::TARGET:
56 secName = "Properties on Targets";
58 case cmProperty::SOURCE_FILE:
59 secName = "Properties on Source Files";
61 case cmProperty::DIRECTORY:
62 secName = "Properties on Directories";
64 case cmProperty::TEST:
65 secName = "Properties on Tests";
67 case cmProperty::CACHE:
68 secName = "Properties on Cache Entries";
70 case cmProperty::VARIABLE:
71 secName = "Variables";
73 case cmProperty::CACHED_VARIABLE:
74 secName = "Cached Variables";
77 secName = "Properties of Unknown Scope";
84 cmDocumentationSection(secName.c_str(),
85 cmSystemTools::UpperCase(secName).c_str());
87 cmDocumentationEntry e = j->second.GetDocumentation();
88 if (e.Brief.size() || e.Full.size())
90 v[secName]->Append(e);
95 bool cmPropertyDefinitionMap::IsPropertyDefined(const char *name)
102 cmPropertyDefinitionMap::iterator it = this->find(name);
103 if (it == this->end())
111 bool cmPropertyDefinitionMap::IsPropertyChained(const char *name)
118 cmPropertyDefinitionMap::iterator it = this->find(name);
119 if (it == this->end())
124 return it->second.IsChained();