LayoutFileIOException.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. #ifndef LAYOUTFILEIOEXCEPTION_H
  2. #define LAYOUTFILEIOEXCEPTION_H
  3. #include <GraphLayoutLibrary_global.h>
  4. #include <LayoutException/LayoutException.h>
  5. #include <LayoutException/LayoutExceptionConstants.h>
  6. /**
  7. * @brief The LayoutFileIOException class
  8. *
  9. * The class defines layout file IO exception enums. Inherites LayoutException.
  10. */
  11. class GRAPHLAYOUTLIBRARYSHARED_EXPORT LayoutFileIOException : public LayoutException
  12. {
  13. private:
  14. QString m_sFileName; /*!< File name */
  15. QString m_sExpectedFileType; /*!< Expected File name */
  16. LayoutExceptionEnum::FileIOExceptionSubTypes m_enExceptionSubType; /*!< stores the subtype of FileIOException */
  17. // Private Helper Functions
  18. /** @name Helper
  19. * The methods under this section are helper functions of FileIOException.
  20. */
  21. //@{
  22. /**
  23. Constructs the error message string for the specified exception sub type.
  24. @pre none
  25. @param none
  26. @return string containing error message specific to the exception subtype.
  27. @throw none
  28. */
  29. QString constructMessageForExceptionSubType();
  30. //@}
  31. protected:
  32. public:
  33. //Creator
  34. /** @name Creators
  35. * The methods under this section are responsible for constructing or
  36. * destructing an instance of type FileIOException.
  37. */
  38. //@{
  39. /**
  40. Constructs new object of type LayoutFileIOException.
  41. @pre none
  42. @param none
  43. @return none
  44. @throw none
  45. */
  46. LayoutFileIOException();
  47. /**
  48. Constructs new object of FileIOException using specified parameters.
  49. @pre none
  50. @param sFunctionName
  51. name of the function at which the exception has occurred.
  52. @param enExceptionSubType
  53. valid value of FileIOExceptionSubTypes enum.
  54. @param sFileName
  55. name of the file for which FileIOException is thrown.
  56. @param sExpectedFileType
  57. Expected file type for the operartion.
  58. @throw none
  59. */
  60. LayoutFileIOException(QString sFunctionName, LayoutExceptionEnum::FileIOExceptionSubTypes enExceptionSubType, QString sFileName, QString sExpectedFileType ="");
  61. /**
  62. Destroys object of type LayoutFileIOException.
  63. @throw exception
  64. */
  65. ~LayoutFileIOException() throw();
  66. //@}
  67. //Queries
  68. /** @name Queries
  69. * The methods under this section are responsible for querying
  70. * an instance of type FileIOException.
  71. */
  72. //@{
  73. /**
  74. Gets the file name for which exception is occurred.
  75. @pre none
  76. @param none
  77. @return string containing file name.
  78. @throw none
  79. */
  80. QString getFileName();
  81. /**
  82. This function returns the error code associated with the exception.
  83. @pre none
  84. @param none
  85. @return the error code associated with the exception.
  86. @throw none
  87. */
  88. int getErrorCode();
  89. /**
  90. This function returns the subtype of the exception.
  91. @pre none
  92. @param none
  93. @return FileIOExceptionSubTypes
  94. @throw none
  95. */
  96. LayoutExceptionEnum::FileIOExceptionSubTypes getExceptionSubType();
  97. //@}
  98. };
  99. #endif // LAYOUTFILEIOEXCEPTION_H