LayoutExceptionConstants.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef LAYOUTEXCEPTIONCONSTANTS_H
  2. #define LAYOUTEXCEPTIONCONSTANTS_H
  3. // XXX this cause trouble
  4. // Macro to show LAYOUT_ASSERT in debug build and throw exceptions in release builds.
  5. #ifdef QT_DEBUG
  6. #define LAYOUT_ASSERT(CONDITION, EXCEPTION) Q_ASSERT(CONDITION)
  7. #else
  8. #define LAYOUT_ASSERT(CONDITION, EXCEPTION) Q_ASSERT(CONDITION)
  9. //#define LAYOUT_ASSERT(CONDITION, EXCEPTION)
  10. // if(false == (CONDITION))
  11. // {
  12. // throw EXCEPTION;
  13. // }
  14. #endif
  15. // Exception Error codes constants
  16. #define EXCEPTION_ERROR_CODE_START 1
  17. #define EXCEPTION_ERROR_CODE_START_OFFSET 100 /*!< 100 exception subtypes for each type of exception */
  18. #define EXCEPTION_ERROR_CODE_END_OFFSET 99 /*!< Defines the upper bound offset for each exception type */
  19. // LAYOUTException constants
  20. #define LAYOUTEXCEPTION_INVALID_PARAMETER_MESSAGE QObject::tr("Invalid %1 parameter '%2'.")
  21. #define LAYOUTEXCEPTION_EMPTY_CONTAINER_FOUND_MESSAGE QObject::tr("empty container found '%1'")
  22. #define LAYOUTEXCEPTION_INVALID_TYPE_MESSAGE QObject::tr("Invalid type specified '%1'.")
  23. #define LAYOUTEXCEPTION_DUPLICATE_ID_FOUND_MESSAGE QObject::tr("Duplicate id '%1' found for graph entity'%2'.")
  24. #define LAYOUTEXCEPTION_INVALID_ATTRIBUTE_VALUE_MESAAGE QObject::tr("Invalid '%1' attribute for graph entity '%2'.")
  25. #define LAYOUTEXCEPTION_MANDATORY_ATTRIBUTE_MISSING_MESSAGE QObject::tr("Missing mandatory attribute for entity '%1'.")
  26. #define LAYOUTEXCEPTION_REQUIRED_PARAMETER_NOT_SET_MESSAGE QObject::tr("Required parameter not set '%1'")
  27. #define LAYOUTEXCEPTION_NOT_FOUND_IN_CONTAINER_MESSAGE QObject::tr("'%1' not found in container '%2'")
  28. #define LAYOUTEXCEPTION_INVALID_VALUE_MESSAGE QObject::tr("Invalid parameter '%1' value provided for '%2'.")
  29. #define LAYOUTEXCEPTION_INVALID_OPERATION_MESSAGE QObject::tr("Invalid operation '%1' in '%2'.")
  30. #define LAYOUTEXCEPTION_INCONSISTENT_DATASTRUCTURE_MESSAGE QObject::tr("Inconsistent datastructure '%1' '%2'.")
  31. #define LAYOUTEXCEPTION_INVALID_GRAPH_TYPE_MESSAGE QObject::tr("Graph '%1' is '%2'.")
  32. #define LAYOUTEXCEPTION_UNKNOWN_EXCEPTION_MESSAGE QObject::tr("Unknown exception FROM LayoutException.")
  33. // FileIOException Message Constants
  34. #define FILEIOEXCEPTION_DIRECTORY_NOT_FOUND_EXCEPTION_MESSAGE QObject::tr("Could not find a directory with name '%1'.")
  35. #define FILEIOEXCEPTION_FILENOTFOUND_EXCEPTION_MESSAGE QObject::tr("Could not find a file with name '%1'.")
  36. #define FILEIOEXCEPTION_UNSUPPORTEDFILETYPE_EXCEPTION_MESSAGE QObject::tr("Unsupported file '%1'.")
  37. #define FILEIOEXCEPTION_UNSUPPORTEDFILEFORMAT_EXCEPTION_MESSAGE QObject::tr("Unsupported format for file '%1'.")
  38. #define FILEIOEXCEPTION_UNKNOWN_EXCEPTION_MESSAGE QObject::tr("Unknown file IO exception.")
  39. #define FILEIOEXCEPTION_FILEREADOPERATIONERROR_ERRROR_MESSAGE QObject::tr("Could not open or read the file %1.")
  40. #define FILEIOEXCEPTION_INVALIDFILENAME_MESSAGE QObject::tr("Invalid filename specified '%1'.")
  41. #define FILEIOEXCEPTION_INVALIDFILEFORMAT_EXCEPTION_MESSAGE QObject::tr("Invalid file format '%1'.")
  42. #define FILEIOEXCEPTION_INVALIDFILEOPERATION_EXCEPTION_MESSAGE QObject::tr("Not a %1 file: '%2'.")
  43. // MemoryException Message Constants
  44. #define MEMORYEXCEPTION_NULL_POINTER_EXCEPTION_MESSAGE QObject::tr("Null pointer exception occurred for '%1'.")
  45. #define MEMORYEXCEPTION_UNKNOWNEXCEPTION_MESSAGE QObject::tr("Unknown memory exception occurred.")
  46. #endif // LAYOUTEXCEPTIONCONSTANTS_H