1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmPropertyDefinitionMap.cxx,v $
6 Date: $Date: 2007-10-23 14:40:49 $
7 Version: $Revision: 1.5 $
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
,
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
55 switch (j
->second
.GetScope())
57 case cmProperty::GLOBAL
:
58 secName
= "Properties of Global Scope";
60 case cmProperty::TARGET
:
61 secName
= "Properties on Targets";
63 case cmProperty::SOURCE_FILE
:
64 secName
= "Properties on Source Files";
66 case cmProperty::DIRECTORY
:
67 secName
= "Properties on Directories";
69 case cmProperty::TEST
:
70 secName
= "Properties on Tests";
72 case cmProperty::VARIABLE
:
73 secName
= "Variables";
75 case cmProperty::CACHED_VARIABLE
:
76 secName
= "Cached Variables";
79 secName
= "Properties of Unknown Scope";
86 cmDocumentationSection(secName
.c_str(),
87 cmSystemTools::UpperCase(secName
).c_str());
89 cmDocumentationEntry e
= j
->second
.GetDocumentation();
90 if (e
.Brief
.size() || e
.Full
.size())
92 v
[secName
]->Append(e
);
97 bool cmPropertyDefinitionMap::IsPropertyDefined(const char *name
)
104 cmPropertyDefinitionMap::iterator it
= this->find(name
);
105 if (it
== this->end())
113 bool cmPropertyDefinitionMap::IsPropertyChained(const char *name
)
120 cmPropertyDefinitionMap::iterator it
= this->find(name
);
121 if (it
== this->end())
126 return it
->second
.IsChained();