cmFunctionBlocker.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmFunctionBlocker_h
  11. #define cmFunctionBlocker_h
  12. #include "cmStandardIncludes.h"
  13. #include "cmExecutionStatus.h"
  14. #include "cmListFileCache.h"
  15. class cmMakefile;
  16. /** \class cmFunctionBlocker
  17. * \brief A class that defines an interface for blocking cmake functions
  18. *
  19. * This is the superclass for any classes that need to block a cmake function
  20. */
  21. class cmFunctionBlocker
  22. {
  23. public:
  24. /**
  25. * should a function be blocked
  26. */
  27. virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
  28. cmMakefile&mf,
  29. cmExecutionStatus &status) = 0;
  30. /**
  31. * should this function blocker be removed, useful when one function adds a
  32. * blocker and another must remove it
  33. */
  34. virtual bool ShouldRemove(const cmListFileFunction&,
  35. cmMakefile&) {return false;}
  36. virtual ~cmFunctionBlocker() {}
  37. /** Set/Get the context in which this blocker is created. */
  38. void SetStartingContext(cmListFileContext const& lfc)
  39. { this->StartingContext = lfc; }
  40. cmListFileContext const& GetStartingContext()
  41. { return this->StartingContext; }
  42. private:
  43. cmListFileContext StartingContext;
  44. };
  45. #endif