[+] AU_THROW_CONST_STRING

This commit is contained in:
Reece Wilson 2022-09-26 15:48:30 +01:00
parent dfeeae4687
commit 86673fbfb6

View File

@ -164,8 +164,35 @@ struct AuStringException : std::exception
};
#endif
struct AuStringOwnedException : AuStringException
{
inline AuStringOwnedException(const char *str) noexcept : AuStringException("")
{
buffer = str;
this->pNullString = buffer.c_str();
}
inline AuStringOwnedException(const std::string &str) noexcept : AuStringException("")
{
buffer = str;
this->pNullString = buffer.c_str();
}
inline AuStringOwnedException(std::string &&str) noexcept : AuStringException("")
{
buffer = std::move(str);
this->pNullString = buffer.c_str();
}
std::string buffer;
};
#if !defined(AU_THROW_CONST_STRING)
#define AU_THROW_CONST_STRING(var) throw AuStringException(var)
#endif
#if !defined(AU_THROW_STRING)
#define AU_THROW_STRING(var) throw AuStringException(var)
#define AU_THROW_STRING(var) throw AuStringOwnedException(var)
#endif
#define AU_ITERATE_ARRAY(index, arry) AuUInt index = 0; index < AuArraySize(arry); index++