cmMathCommand.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html 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 cmMathCommand_h
  14. #define cmMathCommand_h
  15. #include "cmCommand.h"
  16. /** \class cmMathCommand
  17. * \brief Common string operations
  18. *
  19. */
  20. class cmMathCommand : public cmCommand
  21. {
  22. public:
  23. /**
  24. * This is a virtual constructor for the command.
  25. */
  26. virtual cmCommand* Clone()
  27. {
  28. return new cmMathCommand;
  29. }
  30. /**
  31. * This is called when the command is first encountered in
  32. * the CMakeLists.txt file.
  33. */
  34. virtual bool InitialPass(std::vector<std::string> const& args);
  35. /**
  36. * This determines if the command is invoked when in script mode.
  37. */
  38. virtual bool IsScriptable() { return true; }
  39. /**
  40. * The name of the command as specified in CMakeList.txt.
  41. */
  42. virtual const char* GetName() { return "math";}
  43. /**
  44. * Succinct documentation.
  45. */
  46. virtual const char* GetTerseDocumentation()
  47. {
  48. return "Mathematical expressions.";
  49. }
  50. /**
  51. * More documentation.
  52. */
  53. virtual const char* GetFullDocumentation()
  54. {
  55. return
  56. " math(EXPR <output variable> <math expression>)\n"
  57. "EXPR evaluates mathematical expression and return result in the "
  58. "output variable. Example mathematical expression is "
  59. "'5 * ( 10 + 13 )'. Supported operators are "
  60. "+ - * / % | & ^ ~ << >> * / %. They have the same meaning "
  61. " as they do in c code.";
  62. }
  63. cmTypeMacro(cmMathCommand, cmCommand);
  64. protected:
  65. bool HandleExprCommand(std::vector<std::string> const& args);
  66. };
  67. #endif