/src/CMake/Source/cmFunctionBlocker.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 <vector> |
8 | | |
9 | | #include <cm/string_view> |
10 | | |
11 | | #include "cmListFileCache.h" |
12 | | |
13 | | class cmExecutionStatus; |
14 | | class cmMakefile; |
15 | | |
16 | | class cmFunctionBlocker |
17 | | { |
18 | | public: |
19 | | /** |
20 | | * should a function be blocked |
21 | | */ |
22 | | bool IsFunctionBlocked(cmListFileFunction const& lff, |
23 | | cmExecutionStatus& status); |
24 | | |
25 | 0 | virtual ~cmFunctionBlocker() = default; |
26 | | |
27 | | /** Set/Get the context in which this blocker is created. */ |
28 | | void SetStartingContext(cmListFileContext const& lfc) |
29 | 0 | { |
30 | 0 | this->StartingContext = lfc; |
31 | 0 | } |
32 | | cmListFileContext const& GetStartingContext() const |
33 | 0 | { |
34 | 0 | return this->StartingContext; |
35 | 0 | } |
36 | | |
37 | | private: |
38 | | virtual cm::string_view StartCommandName() const = 0; |
39 | | virtual cm::string_view EndCommandName() const = 0; |
40 | | |
41 | 0 | virtual bool EndCommandSupportsArguments() const { return true; } |
42 | | |
43 | | virtual bool ArgumentsMatch(cmListFileFunction const& lff, |
44 | | cmMakefile& mf) const = 0; |
45 | | |
46 | | virtual bool Replay(std::vector<cmListFileFunction> functions, |
47 | | cmExecutionStatus& status) = 0; |
48 | | |
49 | | cmListFileContext StartingContext; |
50 | | std::vector<cmListFileFunction> Functions; |
51 | | unsigned int ScopeDepth = 1; |
52 | | }; |