cmForEachCommand.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*=========================================================================
  2. Program: Insight Segmentation & Registration Toolkit
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Insight Consortium. All rights reserved.
  8. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmForEachCommand_h
  14. #define cmForEachCommand_h
  15. #include "cmStandardIncludes.h"
  16. #include "cmCommand.h"
  17. #include "cmFunctionBlocker.h"
  18. /** \class cmForEachFunctionBlocker
  19. * \brief subclass of function blocker
  20. *
  21. *
  22. */
  23. class cmForEachFunctionBlocker : public cmFunctionBlocker
  24. {
  25. public:
  26. cmForEachFunctionBlocker() {}
  27. virtual ~cmForEachFunctionBlocker() {}
  28. virtual bool IsFunctionBlocked(const char *name,
  29. const std::vector<std::string> &args,
  30. cmMakefile &mf);
  31. virtual bool ShouldRemove(const char *name,
  32. const std::vector<std::string> &args,
  33. cmMakefile &mf);
  34. virtual void ScopeEnded(cmMakefile &mf);
  35. std::vector<std::string> m_Args;
  36. std::vector<std::string> m_Commands;
  37. std::vector<std::vector<std::string> > m_CommandArguments;
  38. };
  39. /** \class cmForEachCommand
  40. * \brief starts an if block
  41. *
  42. * cmForEachCommand starts an if block
  43. */
  44. class cmForEachCommand : public cmCommand
  45. {
  46. public:
  47. /**
  48. * This is a virtual constructor for the command.
  49. */
  50. virtual cmCommand* Clone()
  51. {
  52. return new cmForEachCommand;
  53. }
  54. /**
  55. * This is called when the command is first encountered in
  56. * the CMakeLists.txt file.
  57. */
  58. virtual bool InitialPass(std::vector<std::string> const& args);
  59. /**
  60. * This determines if the command gets propagated down
  61. * to makefiles located in subdirectories.
  62. */
  63. virtual bool IsInherited() {return true;}
  64. /**
  65. * The name of the command as specified in CMakeList.txt.
  66. */
  67. virtual const char* GetName() { return "FOREACH";}
  68. /**
  69. * Succinct documentation.
  70. */
  71. virtual const char* GetTerseDocumentation()
  72. {
  73. return "start a foreach loop";
  74. }
  75. /**
  76. * More documentation.
  77. */
  78. virtual const char* GetFullDocumentation()
  79. {
  80. return
  81. "FOREACH (define arg1 arg2 arg2) Starts a foreach block.";
  82. }
  83. cmTypeMacro(cmForEachCommand, cmCommand);
  84. };
  85. #endif