summaryrefslogtreecommitdiffstats
path: root/Source/cmPropertyDefinition.h
diff options
context:
space:
mode:
authorTushar Maheshwari <tushar27192@gmail.com>2020-05-13 14:24:03 (GMT)
committerTushar Maheshwari <tushar27192@gmail.com>2020-05-15 13:28:02 (GMT)
commit6728f0fa858c1782e6c619661f32c016d84d1ad6 (patch)
tree5debb1b915705c9cbe1ca397304a76233c9847cb /Source/cmPropertyDefinition.h
parent1cc4bc41916b60e9d52c3a89f6f77b091fbe0d31 (diff)
downloadCMake-6728f0fa858c1782e6c619661f32c016d84d1ad6.zip
CMake-6728f0fa858c1782e6c619661f32c016d84d1ad6.tar.gz
CMake-6728f0fa858c1782e6c619661f32c016d84d1ad6.tar.bz2
cmPropertyDefinitionMap: simplify and shorten
Diffstat (limited to 'Source/cmPropertyDefinition.h')
-rw-r--r--Source/cmPropertyDefinition.h36
1 files changed, 25 insertions, 11 deletions
diff --git a/Source/cmPropertyDefinition.h b/Source/cmPropertyDefinition.h
index d2e4467..f83bc4f 100644
--- a/Source/cmPropertyDefinition.h
+++ b/Source/cmPropertyDefinition.h
@@ -5,7 +5,9 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <map>
#include <string>
+#include <utility>
#include "cmProperty.h"
@@ -13,25 +15,19 @@
* \brief Property meta-information
*
* This class contains the following meta-information about property:
- * - Name;
* - Various documentation strings;
- * - The scope of the property;
* - If the property is chained.
*/
class cmPropertyDefinition
{
public:
/// Constructor
- cmPropertyDefinition(std::string name, cmProperty::ScopeType scope,
- std::string ShortDescription,
- std::string FullDescription, bool chained = false);
+ cmPropertyDefinition(std::string shortDescription,
+ std::string fullDescription, bool chained);
/// Is the property chained?
bool IsChained() const { return this->Chained; }
- /// Get the scope
- cmProperty::ScopeType GetScope() const { return this->Scope; }
-
/// Get the documentation (short version)
const std::string& GetShortDescription() const
{
@@ -44,12 +40,30 @@ public:
return this->FullDescription;
}
-protected:
- std::string Name;
+private:
std::string ShortDescription;
std::string FullDescription;
- cmProperty::ScopeType Scope;
bool Chained;
};
+/** \class cmPropertyDefinitionMap
+ * \brief Map property name and scope to their definition
+ */
+class cmPropertyDefinitionMap
+{
+public:
+ // define the property
+ void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
+ const std::string& ShortDescription,
+ const std::string& FullDescription, bool chain);
+
+ // get the property definition if present, otherwise nullptr
+ cmPropertyDefinition const* GetPropertyDefinition(
+ const std::string& name, cmProperty::ScopeType scope) const;
+
+private:
+ using key_type = std::pair<std::string, cmProperty::ScopeType>;
+ std::map<key_type, cmPropertyDefinition> Map_;
+};
+
#endif