Objectively
Ultra-lightweight object oriented framework for GNU C.
Loading...
Searching...
No Matches
Boole Struct Reference

#include <Boole.h>

Overview

A wrapper for placing boolean primitives into collections, etc.

Definition at line 41 of file Boole.h.

Inheritance diagram for Boole:
Object

Properties

Object object
 The superclass.
 
bool value
 The backing bool.
 
- 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

Classboole (void)
 The Boole archetype.
 
BooleFalse (void)
 
BooleTrue (void)
 
Boolevalueof (bool value)
 
- 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

BooleInterface * interface
 The interface.
 
- Protected Attributes inherited from Object
ObjectInterface * interface
 The interface.
 

Property Details

◆ interface

BooleInterface* Boole::interface
protected

The interface.

Definition at line 52 of file Boole.h.

◆ object

Object Boole::object

The superclass.

Definition at line 46 of file Boole.h.

◆ value

bool Boole::value

The backing bool.

Definition at line 57 of file Boole.h.

Method Details

◆ boole()

Class * boole ( void  )

The Boole archetype.

Returns
The Boole Class.

◆ False()

Boole * False ( void  )
Returns
The false Boole.

Definition at line 59 of file Boole.c.

59 {
60
61 static Once once;
62
63 do_once(&once, {
64 _False = (Boole *) $((Object *) alloc(Boole), init);
65 _False->value = false;
66 });
67
68 return _False;
69}
static Boole * _False
Definition Boole.c:53
#define alloc(type)
Allocate and initialize and instance of type.
Definition Class.h:176
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
A wrapper for placing boolean primitives into collections, etc.
Definition Boole.h:41
bool value
The backing bool.
Definition Boole.h:57
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

◆ True()

Boole * True ( void  )
Returns
The true Boole.

Definition at line 77 of file Boole.c.

77 {
78
79 static Once once;
80
81 do_once(&once, {
82 _True = (Boole *) $((Object *) alloc(Boole), init);
83 _True->value = true;
84 });
85
86 return _True;
87}
static Boole * _True
Definition Boole.c:71

◆ valueof()

Boole * valueof ( bool  value)
Parameters
valueThe boolean.
Returns
The Boole representation of value.

Definition at line 93 of file Boole.c.

93 {
94 return value ? $$(Boole, True) : $$(Boole, False);
95}
Boole * False(void)
Definition Boole.c:59
Boole * True(void)
Definition Boole.c:77

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