cmake/Source/cmFunctionBlocker.h

51 lines
1.3 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
2020-02-01 23:06:01 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
#include <vector>
#include <cm/string_view>
#include "cmListFileCache.h"
2017-04-14 19:02:05 +02:00
class cmExecutionStatus;
class cmMakefile;
class cmFunctionBlocker
{
public:
/**
* should a function be blocked
*/
2020-02-01 23:06:01 +01:00
bool IsFunctionBlocked(cmListFileFunction const& lff,
cmExecutionStatus& status);
2019-11-11 23:01:05 +01:00
virtual ~cmFunctionBlocker() = default;
/** Set/Get the context in which this blocker is created. */
void SetStartingContext(cmListFileContext const& lfc)
2016-07-09 11:21:54 +02:00
{
this->StartingContext = lfc;
}
2016-03-13 13:35:51 +01:00
cmListFileContext const& GetStartingContext() const
2016-07-09 11:21:54 +02:00
{
return this->StartingContext;
}
2020-02-01 23:06:01 +01:00
private:
virtual cm::string_view StartCommandName() const = 0;
virtual cm::string_view EndCommandName() const = 0;
virtual bool ArgumentsMatch(cmListFileFunction const& lff,
cmMakefile& mf) const = 0;
virtual bool Replay(std::vector<cmListFileFunction> functions,
cmExecutionStatus& status) = 0;
cmListFileContext StartingContext;
2020-02-01 23:06:01 +01:00
std::vector<cmListFileFunction> Functions;
unsigned int ScopeDepth = 1;
};