Objectively
Object oriented framework for C.
Loading...
Searching...
No Matches
Null Struct Reference

#include <Null.h>

Overview

The Null sentinel.

Use this Object when you must place NULL into collections.

Definition at line 42 of file Null.h.

Inheritance diagram for Null:
Object

Properties

Object object
 The superclass.
 
- Properties inherited from Object
Class * clazz
 Every instance of Object begins with a pointer to its Class.
 
unsigned int magic
 A header to allow introspection of Object types.
 

Methods

Class * _Null (void)
 The Null archetype.
 
Null * null (void)
 
- Methods inherited from Object
Class * _Object (void)
 The Object archetype.
 
Object * copy (const Object *self)
 Creates a shallow copy of this Object.
 
void dealloc (Object *self)
 Frees all resources held by this Object.
 
String * description (const Object *self)
 
int hash (const Object *self)
 
Object * init (Object *self)
 Initializes this Object.
 
bool isEqual (const Object *self, const Object *other)
 Tests equality of the other Object.
 
bool isKindOfClass (const Object *self, const Class *clazz)
 Tests for Class hierarchy membership.
 

Protected Attributes

NullInterface * interface [0]
 The interface type.
 
- Protected Attributes inherited from Object
ObjectInterface * interface [0]
 The interface type.
 

Property Details

◆ interface

NullInterface* Null::interface[0]
protected

The interface type.

Definition at line 53 of file Null.h.

◆ object

Object Null::object

The superclass.

Definition at line 47 of file Null.h.

Method Details

◆ _Null()

Class * _Null ( void  )

The Null archetype.

Returns
The Null Class.

Definition at line 83 of file Null.c.

83 {
84 static Class *clazz;
85 static Once once;
86
87 do_once(&once, {
88 clazz = _initialize(&(const ClassDef) {
89 .name = "Null",
90 .superclass = _Object(),
91 .instanceSize = sizeof(Null),
92 .interfaceSize = sizeof(NullInterface),
93 .initialize = initialize,
94 .destroy = destroy,
95 });
96 });
97
98 return clazz;
99}
static void initialize(Class *clazz)
Definition Array.c:710
static void destroy(Class *clazz)
Definition Boole.c:102
Class * _initialize(const ClassDef *def)
Initializes the given Class.
Definition Class.c:151
long Once
The Once type.
Definition Once.h:37
#define do_once(once, block)
Executes the given block at most one time.
Definition Once.h:43
ClassDefs are passed to _initialize via an archetype to initialize a Class.
Definition Class.h:41
The runtime representation of a Class.
Definition Class.h:90
The Null sentinel.
Definition Null.h:42
Class * clazz
Every instance of Object begins with a pointer to its Class.
Definition Object.h:55
Class * _Object(void)
The Object archetype.
Definition Object.c:136

◆ null()

Null * null ( void  )
Returns
The Null singleton.

Definition at line 48 of file Null.c.

48 {
49
50 static Once once;
51
52 do_once(&once, {
53 _null = (Null *) $((Object *) alloc(Null), init);
54 });
55
56 return _null;
57}
#define alloc(type)
Allocate and initialize and instance of type.
Definition Class.h:226
static Null * _null
Definition Null.c:42
Object is the root Class of The Objectively Class hierarchy.
Definition Object.h:46
Object * init(Object *self)
Initializes this Object.
Definition Object.c:83

The documentation for this struct was generated from the following files: