/* * Author: Patrick-Christopher Mattulat * Company: Lynar Studios * E-Mail: webmaster@lynarstudios.com * Created: 2023-02-07 * Changed: 2023-05-24 * * */ #include #include using ls::std::core::ExceptionMessage; using std::move; using std::string; ExceptionMessage::ExceptionMessage(string _message) : message(::move(_message)) {} ExceptionMessage::~ExceptionMessage() = default; char *ExceptionMessage::toCharacterPointer() { 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; }