cmCTestGenericHandler.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. 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 cmCTestGenericHandler_h
  14. #define cmCTestGenericHandler_h
  15. #include "cmObject.h"
  16. class cmCTest;
  17. class cmMakefile;
  18. class cmCTestCommand;
  19. /** \class cmCTestGenericHandler
  20. * \brief A superclass of all CTest Handlers
  21. *
  22. */
  23. class cmCTestGenericHandler : public cmObject
  24. {
  25. public:
  26. /**
  27. * If verbose then more informaiton is printed out
  28. */
  29. void SetVerbose(bool val) { m_HandlerVerbose = val; }
  30. /**
  31. * Populate internals from CTest custom scripts
  32. */
  33. virtual void PopulateCustomVectors(cmMakefile *) {}
  34. /**
  35. * Do the actual processing. Subclass has to override it.
  36. * Return < 0 if error.
  37. */
  38. virtual int ProcessHandler() = 0;
  39. /**
  40. * Process command line arguments that are applicable for the handler
  41. */
  42. virtual int ProcessCommandLineArguments(
  43. const std::string& /*currentArg*/, size_t& /*idx*/,
  44. const std::vector<std::string>& /*allArgs*/) { return 1; }
  45. /**
  46. * Initialize handler
  47. */
  48. virtual void Initialize() = 0;
  49. /**
  50. * Set the CTest instance
  51. */
  52. void SetCTestInstance(cmCTest* ctest) { m_CTest = ctest; }
  53. cmCTest* GetCTestInstance() { return m_CTest; }
  54. /**
  55. * Construct handler
  56. */
  57. cmCTestGenericHandler();
  58. virtual ~cmCTestGenericHandler();
  59. typedef std::map<cmStdString,cmStdString> t_StringToString;
  60. void SetOption(const char* op, const char* value);
  61. const char* GetOption(const char* op);
  62. void SetCommand(cmCTestCommand* command)
  63. {
  64. m_Command = command;
  65. }
  66. protected:
  67. bool m_HandlerVerbose;
  68. cmCTest *m_CTest;
  69. t_StringToString m_Options;
  70. cmCTestCommand* m_Command;
  71. };
  72. #endif