LLGL 0.05 Beta
Loading...
Searching...
No Matches
Trap.h File Reference
#include <LLGL/Export.h>

Namespaces

namespace  LLGL

Macros

#define LLGL_THROW_RUNTIME_ERROR(...)
 Shortcut to throw a runtime error exception.
#define LLGL_THROW_OUT_OF_RANGE(...)
 Shortcut to throw an out of range exception.
#define LLGL_THROW_BAD_CAST(...)
 Shortcut to throw a bad cast exception.
#define LLGL_THROW_INVALID_ARGUMENT(...)
 Shortcut to throw an invalid argument exception.
#define LLGL_VERIFY_EXT(EXCEPTION, CONDITION)
 Helper macro to trap execution when the condition fails.
#define LLGL_VERIFY(CONDITION)
 Shortcut for LLGL_VERIFY_EXT(RuntimeError, CONDITION).

Enumerations

enum class  LLGL::Exception { LLGL::RuntimeError , LLGL::OutOfRange , LLGL::BadCast , LLGL::InvalidArgument }
 Enumeration of all exception classes Trap() can throw. More...

Functions

LLGL_EXPORT void LLGL::Trap (Exception exception, const char *origin, const char *format,...)
 Primary function to trap execution from an unrecoverable state.

Macro Definition Documentation

◆ LLGL_THROW_BAD_CAST

#define LLGL_THROW_BAD_CAST ( ...)
Value:
LLGL::Trap(LLGL::Exception::BadCast, __FUNCTION__, __VA_ARGS__)
LLGL_EXPORT void Trap(Exception exception, const char *origin, const char *format,...)
Primary function to trap execution from an unrecoverable state.
@ BadCast
Refers to std::bad_cast.
Definition Trap.h:65

Shortcut to throw a bad cast exception.

◆ LLGL_THROW_INVALID_ARGUMENT

#define LLGL_THROW_INVALID_ARGUMENT ( ...)
Value:
LLGL::Trap(LLGL::Exception::InvalidArgument, __FUNCTION__, __VA_ARGS__)
@ InvalidArgument
Refers to std::invalid_argument.
Definition Trap.h:68

Shortcut to throw an invalid argument exception.

◆ LLGL_THROW_OUT_OF_RANGE

#define LLGL_THROW_OUT_OF_RANGE ( ...)
Value:
LLGL::Trap(LLGL::Exception::OutOfRange, __FUNCTION__, __VA_ARGS__)
@ OutOfRange
Refers to std::out_of_range.
Definition Trap.h:62

Shortcut to throw an out of range exception.

◆ LLGL_THROW_RUNTIME_ERROR

#define LLGL_THROW_RUNTIME_ERROR ( ...)
Value:
LLGL::Trap(LLGL::Exception::RuntimeError, __FUNCTION__, __VA_ARGS__)
@ RuntimeError
Refers to std::runtime_error.
Definition Trap.h:59

Shortcut to throw a runtime error exception.

◆ LLGL_VERIFY

#define LLGL_VERIFY ( CONDITION)
Value:
LLGL_VERIFY_EXT(RuntimeError, CONDITION)
#define LLGL_VERIFY_EXT(EXCEPTION, CONDITION)
Helper macro to trap execution when the condition fails.
Definition Trap.h:36

Shortcut for LLGL_VERIFY_EXT(RuntimeError, CONDITION).

◆ LLGL_VERIFY_EXT

#define LLGL_VERIFY_EXT ( EXCEPTION,
CONDITION )
Value:
if (!(CONDITION)) \
{ \
LLGL::Trap(LLGL::Exception::EXCEPTION, __FUNCTION__, "assertion failed: %s", #CONDITION); \
}

Helper macro to trap execution when the condition fails.

Remarks
LLGL only throws exceptions if it was built with LLGL_ENABLE_EXCEPTIONS.
See also
LLGL::Trap