Coverage Report

Created: 2026-02-09 06:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/CMake/Source/cmPropertyDefinition.h
Line
Count
Source
1
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2
   file LICENSE.rst or https://cmake.org/licensing for details.  */
3
#pragma once
4
5
#include "cmConfigure.h" // IWYU pragma: keep
6
7
#include <map>
8
#include <string>
9
10
#include "cmProperty.h"
11
12
/** \class cmPropertyDefinition
13
 * \brief Property meta-information
14
 *
15
 * This class contains the following meta-information about property:
16
 * - Various documentation strings;
17
 * - If the property is chained.
18
 */
19
class cmPropertyDefinition
20
{
21
public:
22
  /// Constructor
23
  cmPropertyDefinition(std::string shortDescription,
24
                       std::string fullDescription, bool chained,
25
                       std::string initializeFromVariable);
26
27
  /// Is the property chained?
28
0
  bool IsChained() const { return this->Chained; }
29
30
  /// Get the documentation (short version)
31
  std::string const& GetShortDescription() const
32
0
  {
33
0
    return this->ShortDescription;
34
0
  }
35
36
  /// Get the documentation (full version)
37
  std::string const& GetFullDescription() const
38
0
  {
39
0
    return this->FullDescription;
40
0
  }
41
42
  /// Get the variable the property is initialized from
43
  std::string const& GetInitializeFromVariable() const
44
0
  {
45
0
    return this->InitializeFromVariable;
46
0
  }
47
48
private:
49
  std::string ShortDescription;
50
  std::string FullDescription;
51
  bool Chained;
52
  std::string InitializeFromVariable;
53
};
54
55
/** \class cmPropertyDefinitionMap
56
 * \brief Map property name and scope to their definition
57
 */
58
class cmPropertyDefinitionMap
59
{
60
public:
61
  // define the property
62
  void DefineProperty(std::string const& name, cmProperty::ScopeType scope,
63
                      std::string const& ShortDescription,
64
                      std::string const& FullDescription, bool chain,
65
                      std::string const& initializeFromVariable);
66
67
  // get the property definition if present, otherwise nullptr
68
  cmPropertyDefinition const* GetPropertyDefinition(
69
    std::string const& name, cmProperty::ScopeType scope) const;
70
71
  using ScopeMap = std::map<cmProperty::ScopeType, cmPropertyDefinition>;
72
0
  std::map<std::string, ScopeMap> const& GetMap() const { return this->Map_; }
73
74
private:
75
  std::map<std::string, ScopeMap> Map_;
76
};