resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmPropertyDefinition.h
1 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2    file Copyright.txt or https://cmake.org/licensing for details.  */
3 #pragma once
4
5 #include "cmConfigure.h" // IWYU pragma: keep
6
7 #include <map>
8 #include <string>
9 #include <utility>
10
11 #include "cmProperty.h"
12
13 /** \class cmPropertyDefinition
14  * \brief Property meta-information
15  *
16  * This class contains the following meta-information about property:
17  * - Various documentation strings;
18  * - If the property is chained.
19  */
20 class cmPropertyDefinition
21 {
22 public:
23   /// Constructor
24   cmPropertyDefinition(std::string shortDescription,
25                        std::string fullDescription, bool chained,
26                        std::string initializeFromVariable);
27
28   /// Is the property chained?
29   bool IsChained() const { return this->Chained; }
30
31   /// Get the documentation (short version)
32   const std::string& GetShortDescription() const
33   {
34     return this->ShortDescription;
35   }
36
37   /// Get the documentation (full version)
38   const std::string& GetFullDescription() const
39   {
40     return this->FullDescription;
41   }
42
43   /// Get the variable the property is initialized from
44   const std::string& GetInitializeFromVariable() const
45   {
46     return this->InitializeFromVariable;
47   }
48
49 private:
50   std::string ShortDescription;
51   std::string FullDescription;
52   bool Chained;
53   std::string InitializeFromVariable;
54 };
55
56 /** \class cmPropertyDefinitionMap
57  * \brief Map property name and scope to their definition
58  */
59 class cmPropertyDefinitionMap
60 {
61 public:
62   // define the property
63   void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
64                       const std::string& ShortDescription,
65                       const std::string& FullDescription, bool chain,
66                       const std::string& initializeFromVariable);
67
68   // get the property definition if present, otherwise nullptr
69   cmPropertyDefinition const* GetPropertyDefinition(
70     const std::string& name, cmProperty::ScopeType scope) const;
71
72   using KeyType = std::pair<std::string, cmProperty::ScopeType>;
73   const std::map<KeyType, cmPropertyDefinition>& GetMap() const
74   {
75     return this->Map_;
76   }
77
78 private:
79   std::map<KeyType, cmPropertyDefinition> Map_;
80 };