ExceptionMessage.cpp 775 B

123456789101112131415161718192021222324252627282930
  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-07
  7. *
  8. * */
  9. #include <cstring>
  10. #include <ls-std/core/exception/ExceptionMessage.hpp>
  11. ls::std::core::ExceptionMessage::ExceptionMessage(::std::string _message) : message(::std::move(_message))
  12. {}
  13. ls::std::core::ExceptionMessage::~ExceptionMessage() = default;
  14. char *ls::std::core::ExceptionMessage::toCharacterPointer()
  15. {
  16. char *rawPointerMessage{};
  17. if (!this->message.empty())
  18. {
  19. rawPointerMessage = new char[this->message.size() + 1];
  20. strcpy(rawPointerMessage, this->message.c_str());
  21. rawPointerMessage[this->message.size()] = '\0';
  22. }
  23. return rawPointerMessage;
  24. }