cmWhileCommand.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 cmWhileCommand_h
  4. #define cmWhileCommand_h
  5. #include "cmConfigure.h"
  6. #include <string>
  7. #include <vector>
  8. #include "cmCommand.h"
  9. #include "cmFunctionBlocker.h"
  10. #include "cmListFileCache.h"
  11. class cmExecutionStatus;
  12. class cmMakefile;
  13. class cmWhileFunctionBlocker : public cmFunctionBlocker
  14. {
  15. public:
  16. cmWhileFunctionBlocker(cmMakefile* mf);
  17. ~cmWhileFunctionBlocker() CM_OVERRIDE;
  18. bool IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile& mf,
  19. cmExecutionStatus&) CM_OVERRIDE;
  20. bool ShouldRemove(const cmListFileFunction& lff, cmMakefile& mf) CM_OVERRIDE;
  21. std::vector<cmListFileArgument> Args;
  22. std::vector<cmListFileFunction> Functions;
  23. private:
  24. cmMakefile* Makefile;
  25. int Depth;
  26. };
  27. /// \brief Starts a while loop
  28. class cmWhileCommand : public cmCommand
  29. {
  30. public:
  31. /**
  32. * This is a virtual constructor for the command.
  33. */
  34. cmCommand* Clone() CM_OVERRIDE { return new cmWhileCommand; }
  35. /**
  36. * This overrides the default InvokeInitialPass implementation.
  37. * It records the arguments before expansion.
  38. */
  39. bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
  40. cmExecutionStatus&) CM_OVERRIDE;
  41. /**
  42. * This is called when the command is first encountered in
  43. * the CMakeLists.txt file.
  44. */
  45. bool InitialPass(std::vector<std::string> const&,
  46. cmExecutionStatus&) CM_OVERRIDE
  47. {
  48. return false;
  49. }
  50. /**
  51. * The name of the command as specified in CMakeList.txt.
  52. */
  53. std::string GetName() const CM_OVERRIDE { return "while"; }
  54. };
  55. #endif