cmCTestGenericHandler.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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) { this->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) { this->CTest = ctest; }
  54. cmCTest* GetCTestInstance() { return this->CTest; }
  55. /**
  56. * Construct handler
  57. */
  58. cmCTestGenericHandler();
  59. virtual ~cmCTestGenericHandler();
  60. typedef std::map<cmStdString,cmStdString> t_StringToString;
  61. void SetPersistentOption(const char* op, const char* value);
  62. void SetOption(const char* op, const char* value);
  63. const char* GetOption(const char* op);
  64. void SetCommand(cmCTestCommand* command)
  65. {
  66. this->Command = command;
  67. }
  68. void SetSubmitIndex(int idx) { this->SubmitIndex = idx; }
  69. int GetSubmitIndex() { return this->SubmitIndex; }
  70. protected:
  71. bool StartResultingXML(const char* name, cmGeneratedFileStream& xofs);
  72. bool StartLogFile(const char* name, cmGeneratedFileStream& xofs);
  73. bool HandlerVerbose;
  74. cmCTest *CTest;
  75. t_StringToString Options;
  76. t_StringToString PersistentOptions;
  77. cmCTestCommand* Command;
  78. int SubmitIndex;
  79. };
  80. #endif