cmake/Source/cmPropertyDefinition.h

81 lines
2.2 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2021-09-14 00:13:48 +02:00
#pragma once
2017-07-20 19:35:53 +02:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
2020-08-30 11:54:41 +02:00
#include <map>
2016-10-30 18:24:19 +01:00
#include <string>
2020-08-30 11:54:41 +02:00
#include <utility>
2016-10-30 18:24:19 +01:00
2020-02-01 23:06:01 +01:00
#include "cmProperty.h"
2012-04-19 19:04:21 +03:00
/** \class cmPropertyDefinition
* \brief Property meta-information
*
* This class contains the following meta-information about property:
* - Various documentation strings;
* - If the property is chained.
*/
class cmPropertyDefinition
{
public:
2020-08-30 11:54:41 +02:00
/// Constructor
cmPropertyDefinition(std::string shortDescription,
2022-03-29 21:10:50 +02:00
std::string fullDescription, bool chained,
std::string initializeFromVariable);
2012-04-19 19:04:21 +03:00
/// Is the property chained?
2015-04-27 22:25:09 +02:00
bool IsChained() const { return this->Chained; }
2012-04-19 19:04:21 +03:00
/// Get the documentation (short version)
2016-07-09 11:21:54 +02:00
const std::string& GetShortDescription() const
{
return this->ShortDescription;
}
2012-04-19 19:04:21 +03:00
/// Get the documentation (full version)
2016-07-09 11:21:54 +02:00
const std::string& GetFullDescription() const
{
return this->FullDescription;
}
2012-04-19 19:04:21 +03:00
2022-03-29 21:10:50 +02:00
/// Get the variable the property is initialized from
const std::string& GetInitializeFromVariable() const
{
return this->InitializeFromVariable;
}
2020-08-30 11:54:41 +02:00
private:
std::string ShortDescription;
std::string FullDescription;
bool Chained;
2022-03-29 21:10:50 +02:00
std::string InitializeFromVariable;
};
2020-08-30 11:54:41 +02:00
/** \class cmPropertyDefinitionMap
* \brief Map property name and scope to their definition
*/
class cmPropertyDefinitionMap
{
public:
// define the property
void DefineProperty(const std::string& name, cmProperty::ScopeType scope,
const std::string& ShortDescription,
2022-03-29 21:10:50 +02:00
const std::string& FullDescription, bool chain,
const std::string& initializeFromVariable);
2020-08-30 11:54:41 +02:00
// get the property definition if present, otherwise nullptr
cmPropertyDefinition const* GetPropertyDefinition(
const std::string& name, cmProperty::ScopeType scope) const;
2022-03-29 21:10:50 +02:00
using KeyType = std::pair<std::string, cmProperty::ScopeType>;
const std::map<KeyType, cmPropertyDefinition>& GetMap() const
{
return this->Map_;
}
2020-08-30 11:54:41 +02:00
private:
2022-03-29 21:10:50 +02:00
std::map<KeyType, cmPropertyDefinition> Map_;
2020-08-30 11:54:41 +02:00
};