ctkConfigurationException.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. #ifndef CTKCONFIGURATIONEXCEPTION_H
  16. #define CTKCONFIGURATIONEXCEPTION_H
  17. #include "ctkException.h"
  18. #include <ctkPluginFrameworkEvent.h>
  19. /**
  20. * \ingroup ConfigAdmin
  21. *
  22. * An exception class to inform the Configuration Admin service
  23. * of problems with configuration data.
  24. */
  25. class CTK_PLUGINFW_EXPORT ctkConfigurationException : public ctkRuntimeException
  26. {
  27. public:
  28. /**
  29. * Create a <code>ctkConfigurationException</code> object.
  30. *
  31. * @param property name of the property that caused the problem,
  32. * <code>null</code> if no specific property was the cause
  33. * @param reason reason for failure
  34. */
  35. ctkConfigurationException(const QString& property, const QString& reason);
  36. /**
  37. * Create a <code>ctkConfigurationException</code> object.
  38. *
  39. * @param property name of the property that caused the problem,
  40. * <code>null</code> if no specific property was the cause
  41. * @param reason reason for failure
  42. * @param cause The cause of this exception.
  43. */
  44. ctkConfigurationException(const QString& property, const QString& reason,
  45. const ctkException& cause);
  46. ctkConfigurationException(const ctkConfigurationException& o);
  47. ctkConfigurationException& operator=(const ctkConfigurationException& o);
  48. ~ctkConfigurationException() throw();
  49. /**
  50. * @see ctkException::name()
  51. */
  52. const char* name() const throw();
  53. /**
  54. * @see ctkException::clone()
  55. */
  56. ctkConfigurationException* clone() const;
  57. /**
  58. * @see ctkException::rethrow()
  59. */
  60. void rethrow() const;
  61. /**
  62. * Return the property name that caused the failure or a null QString.
  63. *
  64. * @return name of property or null if no specific property caused the
  65. * problem
  66. */
  67. QString getProperty() const;
  68. /**
  69. * Return the reason for this exception.
  70. *
  71. * @return reason of the failure
  72. */
  73. QString getReason() const;
  74. private:
  75. QString property;
  76. QString reason;
  77. };
  78. /**
  79. * \ingroup ConfigAdmin
  80. */
  81. CTK_PLUGINFW_EXPORT QDebug operator<<(QDebug dbg, const ctkConfigurationException& exc);
  82. /** @}*/
  83. #endif // CTKCONFIGURATIONEXCEPTION_H