Objectively 1.0.0
Ultra-lightweight object oriented framework for GNU C.
|
Classes describe the state and behavior of an Objectively type. More...
Go to the source code of this file.
Data Structures | |
struct | Class |
The runtime representation of a Class. More... | |
struct | ClassDef |
ClassDefs are passed to _initialize via an archetype to initialize a Class. More... | |
Macros | |
#define | alloc(type) ((type *) _alloc(_##type())) |
Allocate and initialize and instance of type . More... | |
#define | cast(type, obj) ((type *) _cast(_##type(), (const ident) obj)) |
Safely cast obj to type . More... | |
#define | classnameof(obj) classof(obj)->def.name |
Resolve the Class name of the given Object instance. More... | |
#define | classof(obj) ((Object *) obj)->clazz |
Resolve the Class of an Object instance. More... | |
#define | interfaceof(type, clazz) ((type##Interface *) (clazz)->interface) |
Resolve the typed interface of a Class. More... | |
#define | obj |
#define | super(type, obj, method, ...) interfaceof(type, _Class()->def.superclass)->method(cast(type, obj), ## __VA_ARGS__) |
#define | type |
Functions | |
OBJECTIVELY_EXPORT ident | _alloc (Class *clazz) |
Instantiate a type through the given Class. More... | |
OBJECTIVELY_EXPORT ident | _cast (Class *clazz, const ident obj) |
Perform a type-checking cast. More... | |
OBJECTIVELY_EXPORT Class * | _initialize (const ClassDef *clazz) |
Initializes the given Class. More... | |
OBJECTIVELY_EXPORT Class * | classForName (const char *name) |
OBJECTIVELY_EXPORT ident | release (ident obj) |
Atomically decrement the given Object's reference count. If the resulting reference count is 0 , the Object is deallocated. More... | |
OBJECTIVELY_EXPORT ident | retain (ident obj) |
Atomically increment the given Object's reference count. More... | |
Variables | |
OBJECTIVELY_EXPORT size_t | _pageSize |
The page size, in bytes, of the target host. More... | |
Classes describe the state and behavior of an Objectively type.
Definition in file Class.h.
#define obj |
#define super | ( | type, | |
obj, | |||
method, | |||
... | |||
) | interfaceof(type, _Class()->def.superclass)->method(cast(type, obj), ## __VA_ARGS__) |
#define type |
OBJECTIVELY_EXPORT ident _alloc | ( | Class * | clazz | ) |
Instantiate a type through the given Class.
Definition at line 128 of file Class.c.
OBJECTIVELY_EXPORT ident _cast | ( | Class * | clazz, |
const ident | obj | ||
) |
OBJECTIVELY_EXPORT Class * _initialize | ( | const ClassDef * | clazz | ) |
Initializes the given Class.
clazz | The Class descriptor. |
Definition at line 91 of file Class.c.
OBJECTIVELY_EXPORT Class * classForName | ( | const char * | name | ) |
Definition at line 165 of file Class.c.
OBJECTIVELY_EXPORT ident release | ( | ident | obj | ) |
Atomically decrement the given Object's reference count. If the resulting reference count is 0
, the Object is deallocated.
NULL
. Definition at line 196 of file Class.c.
OBJECTIVELY_EXPORT ident retain | ( | ident | obj | ) |
OBJECTIVELY_EXPORT size_t _pageSize |