cmWhileCommand.h 2.2 KB

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