LayoutMemoryException.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include "LayoutMemoryException.h"
  2. LayoutMemoryException::LayoutMemoryException()
  3. {
  4. }
  5. LayoutMemoryException::LayoutMemoryException(QString sFunctionName,
  6. LayoutExceptionEnum::MemoryExceptionSubTypes enExceptionSubType,
  7. QString sObjectName) :
  8. LayoutException(sFunctionName, LayoutExceptionEnum::LAYOUT_MEMORYEXCEPTION)
  9. {
  10. m_sObjectName = sObjectName;
  11. m_enExceptionSubType = enExceptionSubType;
  12. QString sExceptionErrorMessage = constructMessageForExceptionSubType();
  13. this->setErrorMessage(sExceptionErrorMessage);
  14. }
  15. LayoutMemoryException::~LayoutMemoryException() throw()
  16. {
  17. }
  18. QString LayoutMemoryException::getObjectName()
  19. {
  20. return m_sObjectName;
  21. }
  22. int LayoutMemoryException::getErrorCode()
  23. {
  24. return m_enExceptionSubType;
  25. }
  26. QString LayoutMemoryException::constructMessageForExceptionSubType()
  27. {
  28. QString sErrorMessage;
  29. switch(m_enExceptionSubType)
  30. {
  31. case LayoutExceptionEnum::NULL_POINTER_EXCEPTION:
  32. sErrorMessage = MEMORYEXCEPTION_NULL_POINTER_EXCEPTION_MESSAGE;
  33. break;
  34. default:
  35. sErrorMessage = MEMORYEXCEPTION_UNKNOWNEXCEPTION_MESSAGE;
  36. break;
  37. }
  38. //replace '%1' object
  39. sErrorMessage = sErrorMessage.arg(m_sObjectName);
  40. qDebug(sErrorMessage.toStdString().c_str());
  41. return sErrorMessage;
  42. }
  43. LayoutExceptionEnum::MemoryExceptionSubTypes LayoutMemoryException::getExceptionSubType()
  44. {
  45. return m_enExceptionSubType;
  46. }