Objectively
Ultra-lightweight object oriented framework for GNU 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
Classclazz
 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.
 
Nullnull (void)
 
- Methods inherited from Object
Class_Object (void)
 The Object archetype.
 
Objectcopy (const Object *self)
 Creates a shallow copy of this Object.
 
void dealloc (Object *self)
 Frees all resources held by this Object.
 
Stringdescription (const Object *self)
 
int hash (const Object *self)
 
Objectinit (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
 The interface.
 
- Protected Attributes inherited from Object
ObjectInterface * interface
 The interface.
 

Property Details

◆ interface

NullInterface* Null::interface
protected

The interface.

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 .interfaceOffset = offsetof(Null, interface),
93 .interfaceSize = sizeof(NullInterface),
96 });
97 });
98
99 return clazz;
100}
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:86
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:95
The Null sentinel.
Definition Null.h:42
NullInterface * interface
The interface.
Definition Null.h:53
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:176
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: