CMake/Source/cmWhileCommand.h

111 lines
3.0 KiB
C
Raw Normal View History

2009-10-02 01:21:28 +04:00
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
2005-01-21 17:38:04 +03:00
2009-10-02 01:21:28 +04:00
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
2005-01-21 17:38:04 +03:00
2009-10-02 01:21:28 +04:00
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
2005-01-21 17:38:04 +03:00
#ifndef cmWhileCommand_h
#define cmWhileCommand_h
#include "cmCommand.h"
#include "cmFunctionBlocker.h"
#include "cmListFileCache.h"
/** \class cmWhileFunctionBlocker
* \brief subclass of function blocker
*
*
*/
class cmWhileFunctionBlocker : public cmFunctionBlocker
{
public:
cmWhileFunctionBlocker() {this->Depth=0;}
2005-01-21 17:38:04 +03:00
virtual ~cmWhileFunctionBlocker() {}
virtual bool IsFunctionBlocked(const cmListFileFunction& lff,
cmMakefile &mf,
cmExecutionStatus &);
2005-01-21 17:38:04 +03:00
virtual bool ShouldRemove(const cmListFileFunction& lff, cmMakefile &mf);
2006-03-15 19:02:08 +03:00
std::vector<cmListFileArgument> Args;
std::vector<cmListFileFunction> Functions;
2006-05-18 21:50:01 +04:00
private:
int Depth;
2005-01-21 17:38:04 +03:00
};
/** \class cmWhileCommand
* \brief starts a while loop
*
* cmWhileCommand starts a while loop
*/
class cmWhileCommand : public cmCommand
{
public:
/**
* This is a virtual constructor for the command.
*/
virtual cmCommand* Clone()
{
return new cmWhileCommand;
}
/**
* This overrides the default InvokeInitialPass implementation.
* It records the arguments before expansion.
*/
virtual bool InvokeInitialPass(const std::vector<cmListFileArgument>& args,
cmExecutionStatus &);
2005-01-21 17:38:04 +03:00
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
virtual bool InitialPass(std::vector<std::string> const&,
cmExecutionStatus &) { return false; }
2005-01-21 17:38:04 +03:00
/**
* This determines if the command is invoked when in script mode.
*/
virtual bool IsScriptable() { return true; }
/**
* The name of the command as specified in CMakeList.txt.
*/
virtual const char* GetName() { return "while";}
2005-01-21 17:38:04 +03:00
/**
* Succinct documentation.
*/
virtual const char* GetTerseDocumentation()
{
return "Evaluate a group of commands while a condition is true";
}
/**
* More documentation.
*/
virtual const char* GetFullDocumentation()
{
return
" while(condition)\n"
2005-01-21 17:38:04 +03:00
" COMMAND1(ARGS ...)\n"
" COMMAND2(ARGS ...)\n"
" ...\n"
" endwhile(condition)\n"
"All commands between while and the matching endwhile are recorded "
"without being invoked. Once the endwhile is evaluated, the "
2005-01-21 17:38:04 +03:00
"recorded list of commands is invoked as long as the condition "
2008-01-10 06:09:19 +03:00
"is true. The condition is evaluated using the same logic as the "
"if command.";
2005-01-21 17:38:04 +03:00
}
cmTypeMacro(cmWhileCommand, cmCommand);
};
#endif