![]() |
ezEngine Release 25.08
|
An ezResult with an additional message for the reason of failure. More...
#include <Status.h>
Public Member Functions | |
ezStatus (const char *szError) | |
Sets the status to EZ_FAILURE and stores the error message. | |
ezStatus (ezStringView sError) | |
Sets the status to EZ_FAILURE and stores the error message. | |
EZ_ALWAYS_INLINE | ezStatus (ezResult r) |
Sets the status, but doesn't store a message string. | |
EZ_ALWAYS_INLINE | ezStatus (ezResultEnum r) |
Sets the status, but doesn't store a message string. | |
ezStatus (const ezFormatString &fmt) | |
Sets the status to EZ_FAILURE and stores the error message. Can be used with ezFmt(). | |
ezResult | GetResult () const |
EZ_ALWAYS_INLINE bool | Succeeded () const |
EZ_ALWAYS_INLINE bool | Failed () const |
EZ_ALWAYS_INLINE void | IgnoreResult () |
Used to silence compiler warnings, when success or failure doesn't matter. | |
bool | LogFailure (ezLogInterface *pLog=nullptr) const |
If the state is EZ_FAILURE, the message is written to the given log (or the currently active thread-local log). | |
void | AssertSuccess (const char *szMsg=nullptr) const |
Asserts that the function succeeded. In case of failure, the program will terminate. | |
const ezString & | GetMessageString () const |
An ezResult with an additional message for the reason of failure.
void ezStatus::AssertSuccess | ( | const char * | szMsg = nullptr | ) | const |
Asserts that the function succeeded. In case of failure, the program will terminate.
If szMsg is given, this will be the assert message. Additionally m_sMessage will be included as a detailed message.
bool ezStatus::LogFailure | ( | ezLogInterface * | pLog = nullptr | ) | const |
If the state is EZ_FAILURE, the message is written to the given log (or the currently active thread-local log).
The return value is the same as 'Failed()' but isn't marked as [[nodiscard]], ie returns true, if a failure happened, so can be used in a conditional.