mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2024-11-03 04:17:20 -05:00
Feature: Added igloo_RO_GET_TYPE_BY_SYMBOL() which returns a type pointer by the type's name
This commit is contained in:
parent
d123abab8c
commit
233a333883
@ -230,22 +230,24 @@ int igloo_ro_new__return_zero(igloo_ro_t self, const igloo_ro_type_t *type, va_l
|
||||
/* ---[ END PRIVATE ]--- */
|
||||
|
||||
igloo_ro_t igloo_RO_TO_TYPE_raw(igloo_ro_t object, const igloo_ro_type_t *type);
|
||||
#define igloo_RO_GET_TYPE_BY_SYMBOL(x) (igloo_ro__type__ ## x)
|
||||
|
||||
#ifdef IGLOO_CTC_HAVE_TYPE_ATTRIBUTE_TRANSPARENT_UNION
|
||||
#define igloo_RO__GETBASE(x) (((igloo_ro_t)(x)).subtype__igloo_ro_base_t)
|
||||
#define igloo_RO_NULL ((igloo_ro_t)(igloo_ro_base_t*)NULL)
|
||||
#define igloo_RO_IS_NULL(x) (igloo_RO__GETBASE((x)) == NULL)
|
||||
#define igloo_RO_TO_TYPE(x,type) (((igloo_ro_t)igloo_RO_TO_TYPE_raw((x), (igloo_ro__type__ ## type))).subtype__ ## type)
|
||||
#define igloo_RO_TO_TYPE(x,type) (((igloo_ro_t)igloo_RO_TO_TYPE_raw((x), igloo_RO_GET_TYPE_BY_SYMBOL(type))).subtype__ ## type)
|
||||
#else
|
||||
#define igloo_RO__GETBASE(x) ((igloo_ro_base_t*)(x))
|
||||
#define igloo_RO_NULL NULL
|
||||
#define igloo_RO_IS_NULL(x) ((x) == NULL)
|
||||
#define igloo_RO_TO_TYPE(x,type) ((type*)igloo_RO_TO_TYPE_raw((x), (igloo_ro__type__ ## type)))
|
||||
#define igloo_RO_TO_TYPE(x,type) ((type*)igloo_RO_TO_TYPE_raw((x), igloo_RO_GET_TYPE_BY_SYMBOL(type)))
|
||||
#endif
|
||||
|
||||
#define igloo_RO_GET_TYPE(x) (igloo_RO__GETBASE((x)) == NULL ? NULL : igloo_RO__GETBASE((x))->type)
|
||||
#define igloo_RO_GET_TYPENAME(x) (igloo_RO_GET_TYPE((x)) == NULL ? NULL : igloo_RO_GET_TYPE((x))->type_name)
|
||||
int igloo_RO_IS_VALID_raw(igloo_ro_t object, const igloo_ro_type_t *type);
|
||||
#define igloo_RO_IS_VALID(x,type) igloo_RO_IS_VALID_raw((x), (igloo_ro__type__ ## type))
|
||||
#define igloo_RO_IS_VALID(x,type) igloo_RO_IS_VALID_raw((x), igloo_RO_GET_TYPE_BY_SYMBOL(type))
|
||||
int igloo_RO_HAS_TYPE_raw(igloo_ro_t object, const igloo_ro_type_t *type);
|
||||
#define igloo_RO_HAS_TYPE(x,type) igloo_RO_HAS_TYPE_raw((x), (type))
|
||||
|
||||
@ -256,11 +258,11 @@ int igloo_RO_HAS_TYPE_raw(igloo_ro_t object, const igloo_ro_type_t *
|
||||
*/
|
||||
|
||||
igloo_ro_t igloo_ro_new__raw(const igloo_ro_type_t *type, const char *name, igloo_ro_t associated);
|
||||
#define igloo_ro_new_raw(type, name, associated) igloo_RO_TO_TYPE(igloo_ro_new__raw((igloo_ro__type__ ## type), (name), (associated)), type)
|
||||
#define igloo_ro_new_raw(type, name, associated) igloo_RO_TO_TYPE(igloo_ro_new__raw(igloo_RO_GET_TYPE_BY_SYMBOL(type), (name), (associated)), type)
|
||||
|
||||
igloo_ro_t igloo_ro_new__simple(const igloo_ro_type_t *type, const char *name, igloo_ro_t associated, ...);
|
||||
#define igloo_ro_new(type, ...) igloo_RO_TO_TYPE(igloo_ro_new__simple((igloo_ro__type__ ## type), NULL, igloo_RO_NULL, ## __VA_ARGS__), type)
|
||||
#define igloo_ro_new_ext(type, name, associated, ...) igloo_RO_TO_TYPE(igloo_ro_new__simple((igloo_ro__type__ ## type), (name), (associated), ## __VA_ARGS__), type)
|
||||
#define igloo_ro_new(type, ...) igloo_RO_TO_TYPE(igloo_ro_new__simple(igloo_RO_GET_TYPE_BY_SYMBOL(type), NULL, igloo_RO_NULL, ## __VA_ARGS__), type)
|
||||
#define igloo_ro_new_ext(type, name, associated, ...) igloo_RO_TO_TYPE(igloo_ro_new__simple(igloo_RO_GET_TYPE_BY_SYMBOL(type), (name), (associated), ## __VA_ARGS__), type)
|
||||
|
||||
/* This increases the reference counter of the object */
|
||||
int igloo_ro_ref(igloo_ro_t self);
|
||||
|
Loading…
Reference in New Issue
Block a user