ctkCmdLineModuleResult.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #include "ctkCmdLineModuleResult.h"
  16. #include <QVariant>
  17. #include <QDebug>
  18. struct ctkCmdLineModuleResultPrivate : public QSharedData
  19. {
  20. QString Parameter;
  21. QVariant Value;
  22. };
  23. ctkCmdLineModuleResult::ctkCmdLineModuleResult()
  24. : d(new ctkCmdLineModuleResultPrivate)
  25. {}
  26. ctkCmdLineModuleResult::~ctkCmdLineModuleResult()
  27. {
  28. }
  29. ctkCmdLineModuleResult::ctkCmdLineModuleResult(const ctkCmdLineModuleResult &other)
  30. : d(other.d)
  31. {
  32. }
  33. ctkCmdLineModuleResult::ctkCmdLineModuleResult(const QString& parameter, const QVariant& value)
  34. : d(new ctkCmdLineModuleResultPrivate)
  35. {
  36. d->Parameter = parameter;
  37. d->Value = value;
  38. }
  39. bool ctkCmdLineModuleResult::operator==(const ctkCmdLineModuleResult& other) const
  40. {
  41. return d->Parameter == other.d->Parameter && d->Value == other.d->Value;
  42. }
  43. QString ctkCmdLineModuleResult::parameter() const
  44. {
  45. return d->Parameter;
  46. }
  47. QVariant ctkCmdLineModuleResult::value() const
  48. {
  49. return d->Value;
  50. }
  51. QDebug operator<<(QDebug debug, const ctkCmdLineModuleResult& result)
  52. {
  53. debug.nospace() << result.parameter() << "=" << result.value();
  54. return debug;
  55. }
  56. ctkCmdLineModuleResult &ctkCmdLineModuleResult::operator =(const ctkCmdLineModuleResult &other)
  57. {
  58. d->Parameter = other.d->Parameter;
  59. d->Value = other.d->Value;
  60. return *this;
  61. }