ExceptionMessage.cpp 794 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-07
  6. * Changed: 2023-02-23
  7. *
  8. * */
  9. #include <cstring>
  10. #include <ls-std/core/exception/ExceptionMessage.hpp>
  11. using ls::std::core::ExceptionMessage;
  12. using std::move;
  13. using std::string;
  14. ExceptionMessage::ExceptionMessage(string _message) : message(::move(_message))
  15. {}
  16. ExceptionMessage::~ExceptionMessage() = default;
  17. char *ExceptionMessage::toCharacterPointer()
  18. {
  19. char *rawPointerMessage{};
  20. if (!this->message.empty())
  21. {
  22. rawPointerMessage = new char[this->message.size() + 1];
  23. strcpy(rawPointerMessage, this->message.c_str());
  24. rawPointerMessage[this->message.size()] = '\0';
  25. }
  26. return rawPointerMessage;
  27. }