CmException.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include "CmException.h"
  2. namespace CamelotFramework
  3. {
  4. Exception::Exception(const char* type, const String& desc, const String& src)
  5. :mLine(0), mTypeName(type), mDescription(desc), mSource(src)
  6. { }
  7. Exception::Exception(const char* type, const String& desc, const String& src, const char* file, long line)
  8. :mLine(line), mTypeName(type), mDescription(desc), mSource(src), mFile(file)
  9. { }
  10. Exception::Exception(const Exception& rhs)
  11. : mLine(rhs.mLine), mTypeName(rhs.mTypeName), mDescription(rhs.mDescription),
  12. mSource(rhs.mSource), mFile(rhs.mFile)
  13. { }
  14. void Exception::operator = (const Exception& rhs)
  15. {
  16. mDescription = rhs.mDescription;
  17. mSource = rhs.mSource;
  18. mFile = rhs.mFile;
  19. mLine = rhs.mLine;
  20. mTypeName = rhs.mTypeName;
  21. }
  22. const String& Exception::getFullDescription(void) const
  23. {
  24. if (mFullDesc.empty())
  25. {
  26. StringStream desc;
  27. desc<< "CAMELOT EXCEPTION(" << mTypeName << "): "
  28. << mDescription
  29. << " in " << mSource;
  30. if(mLine > 0)
  31. {
  32. desc << " at " << mFile << " (line " << mLine << ")";
  33. }
  34. mFullDesc = desc.str();
  35. }
  36. return mFullDesc;
  37. }
  38. }