Overview
Validation macros for checking null or invalid objects. Logs a warning with the function name and argument index when a check fails.
Macros
| Name |
Description |
| CDRYX_CHECK_INVALID |
Check validity of arguments using a custom validation function. Uses this as log context. |
| CDRYX_CHECK_INVALID_STATIC |
Same but with explicit log context object. |
| CDRYX_CHECK_INVALID_OBJECT |
Check UObject validity (nullptr and IsValid). Uses this. |
| CDRYX_CHECK_INVALID_OBJECT_STATIC |
Same with explicit log context. |
// Check that myActor and myComponent are valid UObjects, return nullptr if not
CDRYX_CHECK_INVALID_OBJECT(2408140036, return nullptr, {myActor, myComponent})
// Same but in a static context, providing explicit log context
CDRYX_CHECK_INVALID_OBJECT_STATIC(owner, 2308071929, return nullptr, {clazz})
// Custom validation: check that a float array is not empty
CDRYX_CHECK_INVALID(float*, 2401010001, return, o != nullptr, {myFloatPtr})
Functions
| Name |
Description |
| checkInvalid |
Validate an array of objects using a custom predicate. Logs warning with function name and argument index on failure. Returns true if any invalid. |
| castAndCheck |
Cast an object to type W and log if cast fails. |
// checkInvalid with custom predicate
bool anyInvalid = checkInvalid<UObject*>(this, 2401010000,
{myActor, myComponent},
[](UObject* o) { return IsValid(o); },
true, "MyFunction");
// Cast whatToCast to UMyClass, logs warning if cast fails
UMyClass* result = castAndCheck<UMyClass>(this, 2401010002, whatToCast);