packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmMathCommand.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmMathCommand_h
13 #define cmMathCommand_h
14
15 #include "cmCommand.h"
16
17 /// Mathematical expressions: math(EXPR ...) command.
18 class cmMathCommand : public cmCommand
19 {
20 public:
21   /**
22    * This is a virtual constructor for the command.
23    */
24   virtual cmCommand* Clone()
25     {
26     return new cmMathCommand;
27     }
28
29   /**
30    * This is called when the command is first encountered in
31    * the CMakeLists.txt file.
32    */
33   virtual bool InitialPass(std::vector<std::string> const& args,
34                            cmExecutionStatus &status);
35
36   /**
37    * This determines if the command is invoked when in script mode.
38    */
39   virtual bool IsScriptable() const { return true; }
40
41   /**
42    * The name of the command as specified in CMakeList.txt.
43    */
44   virtual const char* GetName() const { return "math";}
45
46   /**
47    * Succinct documentation.
48    */
49   virtual const char* GetTerseDocumentation() const
50     {
51     return "Mathematical expressions.";
52     }
53
54   /**
55    * More documentation.
56    */
57   virtual const char* GetFullDocumentation() const
58     {
59     return
60       "  math(EXPR <output variable> <math expression>)\n"
61       "EXPR evaluates mathematical expression and returns result in the "
62       "output variable. Example mathematical expression is "
63       "'5 * ( 10 + 13 )'.  Supported operators are "
64       "+ - * / % | & ^ ~ << >> * / %.  They have the same meaning "
65       " as they do in C code.";
66     }
67
68   cmTypeMacro(cmMathCommand, cmCommand);
69 protected:
70
71   bool HandleExprCommand(std::vector<std::string> const& args);
72 };
73
74
75 #endif
76