Objectively 1.0.0
Ultra-lightweight object oriented framework for GNU C.
Properties | Methods | Protected Attributes
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. More...
 
- Properties inherited from Object
Classclazz
 Every instance of Object begins with a pointer to its Class. More...
 

Methods

Class_Null (void)
 The Null archetype. More...
 
Nullnull (void)
 
- Methods inherited from Object
Class_Object (void)
 The Object archetype. More...
 
Objectcopy (const Object *self)
 Creates a shallow copy of this Object. More...
 
void dealloc (Object *self)
 Frees all resources held by this Object. More...
 
Stringdescription (const Object *self)
 
int hash (const Object *self)
 
Objectinit (Object *self)
 Initializes this Object. More...
 
_Bool isEqual (const Object *self, const Object *other)
 Tests equality of the other Object. More...
 
_Bool isKindOfClass (const Object *self, const Class *clazz)
 Tests for Class hierarchy membership. More...
 

Protected Attributes

NullInterface * interface
 The interface. More...
 
- Protected Attributes inherited from Object
ObjectInterface * interface
 The interface. More...
 

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}
Class * _initialize(const ClassDef *def)
Initializes the given Class.
Definition: Class.c:91
static void destroy(Class *clazz)
Definition: Null.c:74
static void initialize(Class *clazz)
Definition: Null.c:64
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:51
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:159
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: