librtti/include/rtti/utils.h
Rongsong Shen c8c1749347 Import source to librtti
Summary:

- Import initial source

Test Plan:
NA
2026-01-29 17:23:07 +08:00

30 lines
1.9 KiB
C

#if !defined(_RTTI_UTILS_H_)
#define _RTTI_UTILS_H_ 1
#define RTTI_GET_METHOD(result, obj, intf, method) \
do { \
typeinfo_t* type_ = NULL; \
meta_obj_t* obj_ = NULL; \
\
(result) = NULL; \
\
if ((obj) == NULL) { \
break; \
} \
\
obj_ = DATA_TO_OBJ(obj); \
\
type_ = obj_->type; \
if (type_ == NULL) { \
break; \
} \
\
if (type_->interfaces.intf == NULL) { \
break; \
} \
\
(result) = type_->interfaces.intf->method; \
} while (0)
#endif