ctkConfigurationException.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 "ctkConfigurationException.h"
  16. #include <QDebug>
  17. //----------------------------------------------------------------------------
  18. ctkConfigurationException::ctkConfigurationException(const QString& property, const QString& reason)
  19. : ctkRuntimeException(property + " : " + reason),
  20. property(property), reason(reason)
  21. {
  22. }
  23. //----------------------------------------------------------------------------
  24. ctkConfigurationException::ctkConfigurationException(const QString& property, const QString& reason,
  25. const ctkException& cause)
  26. : ctkRuntimeException(property + " : " + reason, cause),
  27. property(property), reason(reason)
  28. {
  29. }
  30. //----------------------------------------------------------------------------
  31. ctkConfigurationException::ctkConfigurationException(const ctkConfigurationException& o)
  32. : ctkRuntimeException(o), property(o.property), reason(o.reason)
  33. {
  34. }
  35. //----------------------------------------------------------------------------
  36. ctkConfigurationException& ctkConfigurationException::operator=(const ctkConfigurationException& o)
  37. {
  38. ctkRuntimeException::operator =(o);
  39. property = o.property;
  40. reason = o.reason;
  41. return *this;
  42. }
  43. //----------------------------------------------------------------------------
  44. ctkConfigurationException::~ctkConfigurationException() throw()
  45. {
  46. }
  47. //----------------------------------------------------------------------------
  48. const char* ctkConfigurationException::name() const throw()
  49. {
  50. return "ctkConfigurationException";
  51. }
  52. //----------------------------------------------------------------------------
  53. ctkConfigurationException* ctkConfigurationException::clone() const
  54. {
  55. return new ctkConfigurationException(*this);
  56. }
  57. //----------------------------------------------------------------------------
  58. void ctkConfigurationException::rethrow() const
  59. {
  60. throw *this;
  61. }
  62. //----------------------------------------------------------------------------
  63. QString ctkConfigurationException::getProperty() const
  64. {
  65. return property;
  66. }
  67. //----------------------------------------------------------------------------
  68. QString ctkConfigurationException::getReason() const
  69. {
  70. return reason;
  71. }
  72. //----------------------------------------------------------------------------
  73. QDebug operator<<(QDebug dbg, const ctkConfigurationException& exc)
  74. {
  75. dbg << "ctkConfigurationException:" << exc.what();
  76. return dbg.maybeSpace();
  77. }