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