ctkCmdLineModuleResult.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 <QDebug>
  17. struct ctkCmdLineModuleResultPrivate : public QSharedData
  18. {
  19. QString Parameter;
  20. QVariant Value;
  21. };
  22. ctkCmdLineModuleResult::ctkCmdLineModuleResult()
  23. : d(new ctkCmdLineModuleResultPrivate)
  24. {}
  25. ctkCmdLineModuleResult::~ctkCmdLineModuleResult()
  26. {
  27. }
  28. ctkCmdLineModuleResult::ctkCmdLineModuleResult(const ctkCmdLineModuleResult &other)
  29. : d(other.d)
  30. {
  31. }
  32. ctkCmdLineModuleResult::ctkCmdLineModuleResult(const QString& parameter, const QVariant& value)
  33. : d(new ctkCmdLineModuleResultPrivate)
  34. {
  35. d->Parameter = parameter;
  36. d->Value = value;
  37. }
  38. bool ctkCmdLineModuleResult::operator==(const ctkCmdLineModuleResult& other) const
  39. {
  40. return d->Parameter == other.d->Parameter && d->Value == other.d->Value;
  41. }
  42. QString ctkCmdLineModuleResult::parameter() const
  43. {
  44. return d->Parameter;
  45. }
  46. QVariant ctkCmdLineModuleResult::value() const
  47. {
  48. return d->Value;
  49. }
  50. QDebug operator<<(QDebug debug, const ctkCmdLineModuleResult& result)
  51. {
  52. debug.nospace() << result.parameter() << "=" << result.value();
  53. return debug;
  54. }
  55. ctkCmdLineModuleResult &ctkCmdLineModuleResult::operator =(const ctkCmdLineModuleResult &other)
  56. {
  57. d->Parameter = other.d->Parameter;
  58. d->Value = other.d->Value;
  59. return *this;
  60. }