cmTest.cxx 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. #include "cmTest.h"
  14. #include "cmSystemTools.h"
  15. cmTest::cmTest()
  16. {
  17. }
  18. cmTest::~cmTest()
  19. {
  20. }
  21. void cmTest::SetName(const char* name)
  22. {
  23. if ( !name )
  24. {
  25. name = "";
  26. }
  27. this->Name = name;
  28. }
  29. void cmTest::SetCommand(const char* command)
  30. {
  31. if ( !command )
  32. {
  33. command = "";
  34. }
  35. this->Command = command;
  36. }
  37. void cmTest::SetArguments(const std::vector<cmStdString>& args)
  38. {
  39. this->Args = args;
  40. }
  41. const char *cmTest::GetProperty(const char* prop) const
  42. {
  43. std::map<cmStdString,cmStdString>::const_iterator i =
  44. this->Properties.find(prop);
  45. if (i != this->Properties.end())
  46. {
  47. return i->second.c_str();
  48. }
  49. return 0;
  50. }
  51. bool cmTest::GetPropertyAsBool(const char* prop) const
  52. {
  53. std::map<cmStdString,cmStdString>::const_iterator i =
  54. this->Properties.find(prop);
  55. if (i != this->Properties.end())
  56. {
  57. return cmSystemTools::IsOn(i->second.c_str());
  58. }
  59. return false;
  60. }
  61. void cmTest::SetProperty(const char* prop, const char* value)
  62. {
  63. if (!prop)
  64. {
  65. return;
  66. }
  67. if (!value)
  68. {
  69. value = "NOTFOUND";
  70. }
  71. this->Properties[prop] = value;
  72. }