/src/CMake/Source/cmGenExContext.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 <cstddef> |
6 | | #include <string> |
7 | | #include <utility> |
8 | | #include <vector> |
9 | | |
10 | | #include <cm/optional> |
11 | | |
12 | | #include "cmPolicies.h" |
13 | | |
14 | | class cmLocalGenerator; |
15 | | |
16 | | namespace cm { |
17 | | namespace GenEx { |
18 | | |
19 | | struct Context final |
20 | | { |
21 | | Context(cmLocalGenerator const* lg, std::string config, |
22 | | std::string language = std::string()); |
23 | | |
24 | | cmLocalGenerator const* LG; |
25 | | std::string Config; |
26 | | std::string Language; |
27 | | |
28 | | void SetCMP0189(cmPolicies::PolicyStatus cmp0189); |
29 | | cmPolicies::PolicyStatus GetCMP0189() const; |
30 | | |
31 | | void SetBoundOperands(std::vector<std::string> operands); |
32 | | void SetBoundOperand(std::string value); |
33 | | std::size_t BoundOperandCount() const; |
34 | | bool HasBoundOperand(std::size_t index = 0) const; |
35 | | std::string const& GetBoundOperand(std::size_t index = 0) const; |
36 | | |
37 | | private: |
38 | | cm::optional<cmPolicies::PolicyStatus> CMP0189; |
39 | | std::vector<std::string> BoundOperands; |
40 | | }; |
41 | | |
42 | | inline void Context::SetBoundOperands(std::vector<std::string> operands) |
43 | 0 | { |
44 | 0 | this->BoundOperands = std::move(operands); |
45 | 0 | } |
46 | | inline void Context::SetBoundOperand(std::string value) |
47 | 0 | { |
48 | 0 | this->SetBoundOperands({ std::move(value) }); |
49 | 0 | } |
50 | | inline std::size_t Context::BoundOperandCount() const |
51 | 0 | { |
52 | 0 | return this->BoundOperands.size(); |
53 | 0 | } |
54 | | inline bool Context::HasBoundOperand(std::size_t index) const |
55 | 0 | { |
56 | 0 | return index < this->BoundOperandCount(); |
57 | 0 | } |
58 | | inline std::string const& Context::GetBoundOperand(std::size_t index) const |
59 | 0 | { |
60 | 0 | return this->BoundOperands[index]; |
61 | 0 | } |
62 | | } |
63 | | } |