cmCTestGenericHandler.h 2.5 KB

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