12345678910111213141516171819202122232425262728293031323334353637383940 |
- /*
- * Author: Patrick-Christopher Mattulat
- * Company: Lynar Studios
- * E-Mail: webmaster@lynarstudios.com
- * Created: 2023-02-07
- * Changed: 2024-05-31
- *
- * */
- #include <cstring>
- #include <ls-std/core/exception/ExceptionMessage.hpp>
- using ls::std::core::ExceptionMessage;
- using std::move;
- using std::string;
- ExceptionMessage::ExceptionMessage(string _message) : message(::move(_message))
- {}
- ExceptionMessage::~ExceptionMessage() = default;
- char *ExceptionMessage::toCharacterPointer() const
- {
- char *rawPointerMessage{};
- if (!this->message.empty())
- {
- size_t initializationSize = this->message.size() + 1;
- rawPointerMessage = new char[initializationSize];
- #if defined(unix) || defined(__APPLE__)
- strcpy(rawPointerMessage, this->message.c_str());
- #endif
- #ifdef _WIN32
- strcpy_s(rawPointerMessage, initializationSize, this->message.c_str());
- #endif
- rawPointerMessage[this->message.size()] = '\0';
- }
- return rawPointerMessage;
- }
|