1
0

cmPropertyMap.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. #include "cmConfigure.h" // IWYU pragma: keep
  5. #include <string>
  6. #include <unordered_map>
  7. #include <utility>
  8. #include <vector>
  9. #include "cmValue.h"
  10. /** \class cmPropertyMap
  11. * \brief String property map.
  12. */
  13. class cmPropertyMap
  14. {
  15. public:
  16. // -- General
  17. //! Clear property list
  18. void Clear();
  19. // -- Properties
  20. //! Set the property value
  21. void SetProperty(const std::string& name, cmValue value);
  22. void SetProperty(const std::string& name, const std::string& value)
  23. {
  24. this->SetProperty(name, cmValue(value));
  25. }
  26. //! Append to the property value
  27. void AppendProperty(const std::string& name, const std::string& value,
  28. bool asString = false);
  29. //! Get the property value
  30. cmValue GetPropertyValue(const std::string& name) const;
  31. //! Remove the property @a name from the map
  32. void RemoveProperty(const std::string& name);
  33. // -- Lists
  34. //! Get a sorted list of property keys
  35. std::vector<std::string> GetKeys() const;
  36. //! Get a sorted by key list of property key,value pairs
  37. std::vector<std::pair<std::string, std::string>> GetList() const;
  38. private:
  39. std::unordered_map<std::string, std::string> Map_;
  40. };