cmFunctionBlocker.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmFunctionBlocker_h
  4. #define cmFunctionBlocker_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <vector>
  7. #include "cm_string_view.hxx"
  8. #include "cmListFileCache.h"
  9. class cmExecutionStatus;
  10. class cmMakefile;
  11. class cmFunctionBlocker
  12. {
  13. public:
  14. /**
  15. * should a function be blocked
  16. */
  17. bool IsFunctionBlocked(cmListFileFunction const& lff,
  18. cmExecutionStatus& status);
  19. virtual ~cmFunctionBlocker() = default;
  20. /** Set/Get the context in which this blocker is created. */
  21. void SetStartingContext(cmListFileContext const& lfc)
  22. {
  23. this->StartingContext = lfc;
  24. }
  25. cmListFileContext const& GetStartingContext() const
  26. {
  27. return this->StartingContext;
  28. }
  29. private:
  30. virtual cm::string_view StartCommandName() const = 0;
  31. virtual cm::string_view EndCommandName() const = 0;
  32. virtual bool ArgumentsMatch(cmListFileFunction const& lff,
  33. cmMakefile& mf) const = 0;
  34. virtual bool Replay(std::vector<cmListFileFunction> functions,
  35. cmExecutionStatus& status) = 0;
  36. private:
  37. cmListFileContext StartingContext;
  38. std::vector<cmListFileFunction> Functions;
  39. unsigned int ScopeDepth = 1;
  40. };
  41. #endif