LayoutException.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. #ifndef LAYOUTEXCEPTION_H
  2. #define LAYOUTEXCEPTION_H
  3. #include <GraphLayoutLibrary_global.h>
  4. #include <LayoutException/LayoutExceptionEnum.h>
  5. #include <QString>
  6. #include <QObject>
  7. #include <stdexcept>
  8. #include <boost/exception/exception.hpp>
  9. /**
  10. * @brief The LayoutException class
  11. *
  12. * The class defines layout related exceptions. Inherited fron standard exceptions and Boost exceptions.
  13. */
  14. class GRAPHLAYOUTLIBRARYSHARED_EXPORT LayoutException : std::exception, boost::exception
  15. {
  16. private:
  17. LayoutExceptionEnum :: LayoutExceptionTypes m_enExceptionType; /*!< Exception Type */
  18. QString m_sErrorMessage; /*!< Error Message */
  19. QString m_sExceptionFunctionName; /*!< Function where exception occured */
  20. LayoutExceptionEnum :: LayoutExceptionSubTypes m_enExceptionSubType;
  21. /** stores the id(VertexDescriptor, EdgeDescriptor, SubGraph) for the entity */
  22. QString m_sEntityId;
  23. QString m_sEntityType;
  24. QString m_sEntityValue;
  25. /** stores the attribute name and value */
  26. QString m_sAttributeName;
  27. QString m_sAttributeValue;
  28. // Private Helper Functions
  29. /** @name Helper
  30. * The methods under this section are helper functions of LayoutException.
  31. */
  32. /**
  33. Constructs the error message string for the specified exception sub type.
  34. @pre none
  35. @param none
  36. @return string containing error message specific to the exception subtype.
  37. @throw none
  38. */
  39. QString constructMessageForExceptionSubType();
  40. protected:
  41. //Modifiers
  42. /** @name Modifiers
  43. * The methods under this section are responsible for modifying
  44. * an instance of type LayoutException.
  45. */
  46. //@{
  47. /**
  48. Sets Current exception in member variable
  49. @pre none
  50. @param LayoutExceptionEnum
  51. layout exception enum
  52. @return none
  53. @throw none
  54. */
  55. void setExceptionType(LayoutExceptionEnum::LayoutExceptionTypes enExceptionType);
  56. /**
  57. Sets Current error message in member variable
  58. @pre none
  59. @param sErrorMessage
  60. Error message
  61. @return none
  62. @throw none
  63. */
  64. void setErrorMessage(QString sErrorMessage);
  65. //@}
  66. public:
  67. //Creator
  68. /** @name Creators
  69. * The methods under this section are responsible for constructing or
  70. * destructing an instance of type LayoutException.
  71. */
  72. //@{
  73. /**
  74. Constructs new object of type LayoutException.
  75. @pre none
  76. @param none
  77. @return none
  78. @throw none
  79. */
  80. LayoutException();
  81. /**
  82. Constructs new object of type LayoutException.
  83. @pre none
  84. @param sFunctionName
  85. Name of function which threw exception
  86. @param enExceptionType
  87. Type of exception. Enum of type LayoutExceptionTypes. default : LAYOUTEXCEPTION
  88. @return none
  89. @throw none
  90. */
  91. LayoutException(QString sFunctionName, LayoutExceptionEnum::LayoutExceptionTypes enExceptionType = LayoutExceptionEnum::LAYOUTEXCEPTION);
  92. /**
  93. Constructs new object of type LayoutException.
  94. @pre none
  95. @param sFunctionName
  96. Name of function which threw exception
  97. @param enLayoutExceptionSubType
  98. Subtype of exception. Enum of type LayoutExceptionSubTypes.
  99. @return none
  100. @throw none
  101. */
  102. LayoutException(QString sFunctionName, LayoutExceptionEnum::LayoutExceptionSubTypes enLayoutExceptionSubType);
  103. /**
  104. Constructs new object of type LayoutException.
  105. @pre none
  106. @param sFunctionName
  107. Name of function which threw exception
  108. @param enLayoutExceptionSubType
  109. Subtype of exception. Enum of type LayoutExceptionSubTypes.
  110. @param sEntityValue
  111. String
  112. @param sEntityType
  113. String
  114. @return none
  115. @throw none
  116. */
  117. LayoutException(QString sFunctionName,
  118. LayoutExceptionEnum::LayoutExceptionSubTypes enLayoutExceptionSubType,
  119. QString sEntityValue,
  120. QString sEntityType = "");
  121. /**
  122. Constructs new object of type LayoutException.
  123. @pre none
  124. @param sFunctionName
  125. Name of function which threw exception
  126. @param enLayoutExceptionSubType
  127. Subtype of exception. Enum of type LayoutExceptionSubTypes.
  128. @param sEntityValue
  129. String
  130. @param sEntityType
  131. String
  132. @param sAttributeName
  133. String
  134. @param sAttributeValue
  135. String
  136. @return none
  137. @throw none
  138. */
  139. LayoutException(QString sFunctionName,
  140. LayoutExceptionEnum::LayoutExceptionSubTypes enLayoutExceptionSubType,
  141. QString sEntityValue,
  142. QString sEntityType,
  143. QString sAttributeName,
  144. QString sAttributeValue);
  145. /**
  146. Destroys object of type LayoutException.
  147. @throw exception
  148. */
  149. ~LayoutException() throw();
  150. //@}
  151. //Queries
  152. /** @name Queries
  153. * The methods under this section are responsible for querying
  154. * an instance of type LayoutException.
  155. */
  156. //@{
  157. /**
  158. This function returns the type of the exception.
  159. @pre none
  160. @param none
  161. @return the type of the exception.
  162. @throw none
  163. */
  164. virtual unsigned int getExceptionType();
  165. /**
  166. This function returns the error message associated with the exception.
  167. @pre none
  168. @param none
  169. @return the error message associated with the exception.
  170. @throw none
  171. */
  172. QString getErrorMessage();
  173. /**
  174. This function returns the name of the function which has thrown the exception.
  175. @pre none
  176. @param none
  177. @return the name of the function which has thrown the exception.
  178. @throw none
  179. */
  180. QString getExceptionFunctionName();
  181. /**
  182. This function returns the error code associated with the exception.
  183. @pre none
  184. @param none
  185. @return the error code associated with the exception.
  186. @throw none
  187. */
  188. virtual int getErrorCode();
  189. /**
  190. This function returns the string containing entity value
  191. @pre none
  192. @param none
  193. @return the string containing entity value associated with the exception.
  194. @throw none
  195. */
  196. QString getEntityValue();
  197. /**
  198. This function returns the string containing type of the entity associated with the exception.
  199. @pre none
  200. @param none
  201. @return the string containing entity value associated with the exception.
  202. @throw none
  203. */
  204. QString getEntityType();
  205. /**
  206. This function returns enum Layout Exception SubType associated with the exception.
  207. @pre none
  208. @param none
  209. @return enum Layout Exception SubType associated with the exception.
  210. @throw none
  211. */
  212. LayoutExceptionEnum::LayoutExceptionSubTypes getExceptionSubType();
  213. //@}
  214. //Modifiers
  215. /** @name Modifiers
  216. * The methods under this section are responsible for modifying
  217. * an instance of type LayoutException.
  218. */
  219. //@{
  220. void setExceptionFunctionName(QString sFunctionName);
  221. //@}
  222. };
  223. #endif // LAYOUTEXCEPTION_H