Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmWhileCommand.h
blobc96d5479dc9587da936340a849da7e9fe86f56e8
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmWhileCommand.h,v $
5 Language: C++
6 Date: $Date: 2009-01-21 14:48:20 $
7 Version: $Revision: 1.11 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmWhileCommand_h
18 #define cmWhileCommand_h
20 #include "cmCommand.h"
21 #include "cmFunctionBlocker.h"
22 #include "cmListFileCache.h"
24 /** \class cmWhileFunctionBlocker
25 * \brief subclass of function blocker
29 class cmWhileFunctionBlocker : public cmFunctionBlocker
31 public:
32 cmWhileFunctionBlocker() {this->Depth=0;}
33 virtual ~cmWhileFunctionBlocker() {}
34 virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
35 cmMakefile &mf,
36 cmExecutionStatus &);
37 virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf);
39 std::vector<cmListFileArgument> Args;
40 std::vector<cmListFileFunction> Functions;
41 private:
42 int Depth;
45 /** \class cmWhileCommand
46 * \brief starts a while loop
48 * cmWhileCommand starts a while loop
50 class cmWhileCommand : public cmCommand
52 public:
53 /**
54 * This is a virtual constructor for the command.
56 virtual cmCommand* Clone()
58 return new cmWhileCommand;
61 /**
62 * This overrides the default InvokeInitialPass implementation.
63 * It records the arguments before expansion.
65 virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
66 cmExecutionStatus &);
68 /**
69 * This is called when the command is first encountered in
70 * the CMakeLists.txt file.
72 virtual bool InitialPass(std::vector<std::string> const&,
73 cmExecutionStatus &) { return false; }
75 /**
76 * This determines if the command is invoked when in script mode.
78 virtual bool IsScriptable() { return true; }
80 /**
81 * The name of the command as specified in CMakeList.txt.
83 virtual const char* GetName() { return "while";}
85 /**
86 * Succinct documentation.
88 virtual const char* GetTerseDocumentation()
90 return "Evaluate a group of commands while a condition is true";
93 /**
94 * More documentation.
96 virtual const char* GetFullDocumentation()
98 return
99 " while(condition)\n"
100 " COMMAND1(ARGS ...)\n"
101 " COMMAND2(ARGS ...)\n"
102 " ...\n"
103 " endwhile(condition)\n"
104 "All commands between while and the matching endwhile are recorded "
105 "without being invoked. Once the endwhile is evaluated, the "
106 "recorded list of commands is invoked as long as the condition "
107 "is true. The condition is evaluated using the same logic as the "
108 "if command.";
111 cmTypeMacro(cmWhileCommand, cmCommand);
115 #endif