resolve cyclic dependency with zstd
[platform/upstream/cmake.git] / Source / cmPropertyMap.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 <string>
8 #include <unordered_map>
9 #include <utility>
10 #include <vector>
11
12 #include "cmValue.h"
13
14 /** \class cmPropertyMap
15  * \brief String property map.
16  */
17 class cmPropertyMap
18 {
19 public:
20   // -- General
21
22   //! Clear property list
23   void Clear();
24
25   // -- Properties
26
27   //! Set the property value
28   void SetProperty(const std::string& name, const char* value);
29   void SetProperty(const std::string& name, cmValue value);
30   void SetProperty(const std::string& name, const std::string& value)
31   {
32     this->SetProperty(name, cmValue(value));
33   }
34
35   //! Append to the property value
36   void AppendProperty(const std::string& name, const std::string& value,
37                       bool asString = false);
38
39   //! Get the property value
40   cmValue GetPropertyValue(const std::string& name) const;
41
42   //! Remove the property @a name from the map
43   void RemoveProperty(const std::string& name);
44
45   // -- Lists
46
47   //! Get a sorted list of property keys
48   std::vector<std::string> GetKeys() const;
49
50   //! Get a sorted by key list of property key,value pairs
51   std::vector<std::pair<std::string, std::string>> GetList() const;
52
53 private:
54   std::unordered_map<std::string, std::string> Map_;
55 };