2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2006-12-01 18:35:21 +00:00
|
|
|
#ifndef cmPropertyMap_h
|
|
|
|
#define cmPropertyMap_h
|
|
|
|
|
2017-04-11 20:00:21 +00:00
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
2016-08-23 22:29:15 +00:00
|
|
|
|
|
|
|
#include <string>
|
2019-06-03 08:29:12 +00:00
|
|
|
#include <unordered_map>
|
2019-06-02 10:43:16 +00:00
|
|
|
#include <utility>
|
2016-08-23 22:29:15 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2019-06-03 08:29:12 +00:00
|
|
|
/** \class cmPropertyMap
|
|
|
|
* \brief String property map.
|
|
|
|
*/
|
2019-06-02 11:34:31 +00:00
|
|
|
class cmPropertyMap
|
2006-12-01 18:35:21 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-06-02 11:34:31 +00:00
|
|
|
// -- General
|
2019-06-03 07:19:58 +00:00
|
|
|
|
2019-06-02 11:34:31 +00:00
|
|
|
//! Clear property list
|
|
|
|
void Clear();
|
2006-12-01 18:35:21 +00:00
|
|
|
|
2019-06-02 11:34:31 +00:00
|
|
|
// -- Properties
|
2019-06-03 07:19:58 +00:00
|
|
|
|
|
|
|
//! Set the property value
|
2016-05-16 14:34:04 +00:00
|
|
|
void SetProperty(const std::string& name, const char* value);
|
2006-12-01 18:35:21 +00:00
|
|
|
|
2019-06-03 07:19:58 +00:00
|
|
|
//! Append to the property value
|
2020-01-25 15:37:00 +00:00
|
|
|
void AppendProperty(const std::string& name, const std::string& value,
|
2016-05-16 14:34:04 +00:00
|
|
|
bool asString = false);
|
2008-01-17 23:13:55 +00:00
|
|
|
|
2019-06-03 07:19:58 +00:00
|
|
|
//! Get the property value
|
2016-05-16 14:34:04 +00:00
|
|
|
const char* GetPropertyValue(const std::string& name) const;
|
2019-06-02 10:35:33 +00:00
|
|
|
|
2019-06-03 07:19:58 +00:00
|
|
|
//! Remove the property @a name from the map
|
|
|
|
void RemoveProperty(const std::string& name);
|
|
|
|
|
2019-06-02 10:35:33 +00:00
|
|
|
// -- Lists
|
2019-06-03 08:29:12 +00:00
|
|
|
|
2019-06-02 10:35:33 +00:00
|
|
|
//! Get a sorted list of property keys
|
|
|
|
std::vector<std::string> GetKeys() const;
|
2019-06-02 10:43:16 +00:00
|
|
|
|
|
|
|
//! Get a sorted by key list of property key,value pairs
|
|
|
|
std::vector<std::pair<std::string, std::string>> GetList() const;
|
2019-06-02 11:34:31 +00:00
|
|
|
|
|
|
|
private:
|
2019-06-03 08:29:12 +00:00
|
|
|
std::unordered_map<std::string, std::string> Map_;
|
2006-12-01 18:35:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|