|
CX Framework
Cross-platform C utility framework
|
Data Structures | |
| struct | ObjIface |
Macros | |
| #define | objIfTmplName(iface) iface##_tmpl |
| #define | objIfImport(iface) extern iface objIfTmplName(iface) |
| #define | objIfCheck(iface) |
| #define | objIfBase(iface) ((ObjIface*)((iface)->_implements, (iface)->_parent, (iface)->_size, (iface))) |
Typedefs | |
| typedef struct ObjIface | ObjIface |
Interfaces define contracts that classes implement. An interface is a list of function pointers representing methods that fulfill a specific contract. Interfaces support inheritance, allowing child interfaces to extend parent interfaces.
The ObjIface structure serves dual purposes depending on context:
Template Form - The publicly declared master copy of an interface:
Implementation Form - A statically scoped instance used during class definition:
Example from a .cxh file:
This generates a template Printable_tmpl and implementation structures automatically.
| #define objIfBase | ( | iface | ) | ((ObjIface*)((iface)->_implements, (iface)->_parent, (iface)->_size, (iface))) |
ObjIface *objIfBase(InterfaceType *iface)
Cast an interface pointer to base ObjIface type
| iface | Pointer to any interface structure |
Definition at line 94 of file objiface.h.
| #define objIfCheck | ( | iface | ) |
void objIfCheck(InterfaceType *iface)
Compile-time check that a pointer is to a valid interface structure
| iface | Pointer to interface structure to validate |
Definition at line 82 of file objiface.h.
| #define objIfImport | ( | iface | ) | extern iface objIfTmplName(iface) |
Import an external interface template declaration
| iface | Interface type name |
Definition at line 75 of file objiface.h.
| #define objIfTmplName | ( | iface | ) | iface##_tmpl |
Construct interface template name from interface type name
| iface | Interface type name (e.g., Printable) |
Definition at line 69 of file objiface.h.
Core interface structure
This structure has different interpretations based on context. See the Interfaces overview for detailed explanation of template vs implementation forms.
Definition at line 48 of file objiface.h.