ctkConfigurationException.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 "ctkRuntimeException.h"
  18. /**
  19. * An exception class to inform the Configuration Admin service
  20. * of problems with configuration data.
  21. */
  22. class Q_DECL_EXPORT ctkConfigurationException : public ctkRuntimeException
  23. {
  24. public:
  25. /**
  26. * Create a <code>ctkConfigurationException</code> object.
  27. *
  28. * @param property name of the property that caused the problem,
  29. * <code>null</code> if no specific property was the cause
  30. * @param reason reason for failure
  31. * @param cause The cause of this exception.
  32. */
  33. ctkConfigurationException(const QString& property, const QString& reason,
  34. const std::exception* cause = 0);
  35. ctkConfigurationException(const ctkConfigurationException& o);
  36. ctkConfigurationException& operator=(const ctkConfigurationException& o);
  37. ~ctkConfigurationException() throw() { }
  38. /**
  39. * Return the property name that caused the failure or a null QString.
  40. *
  41. * @return name of property or null if no specific property caused the
  42. * problem
  43. */
  44. QString getProperty() const;
  45. /**
  46. * Return the reason for this exception.
  47. *
  48. * @return reason of the failure
  49. */
  50. QString getReason() const;
  51. private:
  52. QString property;
  53. QString reason;
  54. };
  55. CTK_PLUGINFW_EXPORT QDebug operator<<(QDebug dbg, const ctkConfigurationException& exc);
  56. #endif // CTKCONFIGURATIONEXCEPTION_H