BsException.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //__________________________ Banshee Project - A modern game development toolkit _________________________________//
  2. //_____________________________________ www.banshee-project.com __________________________________________________//
  3. //________________________ Copyright (c) 2014 Marko Pintera. All rights reserved. ________________________________//
  4. #include "BsException.h"
  5. namespace BansheeEngine
  6. {
  7. Exception::Exception(const char* type, const String& desc, const String& src)
  8. :mLine(0), mTypeName(type), mDescription(desc), mSource(src)
  9. { }
  10. Exception::Exception(const char* type, const String& desc, const String& src, const char* file, long line)
  11. :mLine(line), mTypeName(type), mDescription(desc), mSource(src), mFile(file)
  12. { }
  13. Exception::Exception(const Exception& rhs)
  14. : mLine(rhs.mLine), mTypeName(rhs.mTypeName), mDescription(rhs.mDescription),
  15. mSource(rhs.mSource), mFile(rhs.mFile)
  16. { }
  17. void Exception::operator = (const Exception& rhs)
  18. {
  19. mDescription = rhs.mDescription;
  20. mSource = rhs.mSource;
  21. mFile = rhs.mFile;
  22. mLine = rhs.mLine;
  23. mTypeName = rhs.mTypeName;
  24. }
  25. const String& Exception::getFullDescription(void) const
  26. {
  27. if (mFullDesc.empty())
  28. {
  29. StringStream desc;
  30. desc<< "BANSHEE EXCEPTION(" << mTypeName << "): "
  31. << mDescription
  32. << " in " << mSource;
  33. if(mLine > 0)
  34. {
  35. desc << " at " << mFile << " (line " << mLine << ")";
  36. }
  37. mFullDesc = desc.str();
  38. }
  39. return mFullDesc;
  40. }
  41. }