cmPropertyMap.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmPropertyMap_h
  4. #define cmPropertyMap_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <string>
  7. #include <unordered_map>
  8. #include <utility>
  9. #include <vector>
  10. #include "cmProperty.h"
  11. /** \class cmPropertyMap
  12. * \brief String property map.
  13. */
  14. class cmPropertyMap
  15. {
  16. public:
  17. // -- General
  18. //! Clear property list
  19. void Clear();
  20. // -- Properties
  21. //! Set the property value
  22. void SetProperty(const std::string& name, const char* value);
  23. //! Append to the property value
  24. void AppendProperty(const std::string& name, const std::string& value,
  25. bool asString = false);
  26. //! Get the property value
  27. cmProp GetPropertyValue(const std::string& name) const;
  28. //! Remove the property @a name from the map
  29. void RemoveProperty(const std::string& name);
  30. // -- Lists
  31. //! Get a sorted list of property keys
  32. std::vector<std::string> GetKeys() const;
  33. //! Get a sorted by key list of property key,value pairs
  34. std::vector<std::pair<std::string, std::string>> GetList() const;
  35. private:
  36. std::unordered_map<std::string, std::string> Map_;
  37. };
  38. #endif