#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "Hash.h"
#include "Value.h"
 
Go to the source code of this file.
◆ _Class
◆ _Value()
Definition at line 136 of file Value.c.
  136                    {
  139 
  142            .name = "Value",
  144            .instanceSize = 
sizeof(
Value),
 
  145            .interfaceOffset = offsetof(
Value, interface),
 
  146            .interfaceSize = sizeof(ValueInterface),
  148        });
  149    });
  150 
  151    return clazz;
  152}
Class * _initialize(const ClassDef *def)
Initializes the given Class.
 
static void initialize(Class *clazz)
 
#define do_once(once, block)
Executes the given block at most one time.
 
ClassDefs are passed to _initialize via an archetype to initialize a Class.
 
The runtime representation of a Class.
 
Class * _Object(void)
The Object archetype.
 
Values provide Object encapsulation for C types.
 
 
 
 
◆ dealloc()
  
  
      
        
          | static void dealloc  | 
          ( | 
          Object *  | 
          self | ) | 
           | 
         
       
   | 
  
static   | 
  
 
- See also
 - Object::dealloc(Object *) 
 
Definition at line 38 of file Value.c.
   38                                  {
   39 
   41 
   42    if (this->destructor) {
   43        this->destructor(this->value);
   44    }
   45 
   47}
#define super(type, obj, method,...)
 
Object is the root Class of The Objectively Class hierarchy.
 
void dealloc(Object *self)
Frees all resources held by this Object.
 
 
 
 
◆ hash()
  
  
      
        
          | static int hash  | 
          ( | 
          const Object *  | 
          self | ) | 
           | 
         
       
   | 
  
static   | 
  
 
 
◆ initialize()
  
  
      
        
          | static void initialize  | 
          ( | 
          Class *  | 
          clazz | ) | 
           | 
         
       
   | 
  
static   | 
  
 
- See also
 - Class::initialize(Class *) 
 
Definition at line 122 of file Value.c.
  122                                     {
  123 
  127 
  130}
ident interface
The interface of the Class.
 
Data * initWithBytes(Data *self, const uint8_t *bytes, size_t length)
Initializes this Data by copying length of bytes.
 
Number * initWithValue(Number *self, double value)
Initializes this Number with the specified value.
 
_Bool isEqual(const Object *self, const Object *other)
Tests equality of the other Object.
 
int hash(const Object *self)
 
 
 
 
◆ initWithBytes()
  
  
      
        
          | static Value * initWithBytes  | 
          ( | 
          Value *  | 
          self,  | 
         
        
           | 
           | 
          const uint8_t *  | 
          bytes,  | 
         
        
           | 
           | 
          size_t  | 
          length  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
Definition at line 87 of file Value.c.
   87                                                                              {
   88 
   90    if (self) {
   91        if (bytes) {
   92            self->
value = calloc(1, length);
 
   94 
   95            memcpy(self->
value, bytes, length);
 
   97        }
   98    }
   99 
  100    return self;
  101}
Condition * init(Condition *self)
Initializes this Condition.
 
ValueDestructor destructor
An optional destructor that, if set, is called on dealloc.
 
ident value
The backing value.
 
 
 
 
◆ initWithValue()
Definition at line 107 of file Value.c.
  107                                                      {
  108 
  110    if (self) {
  112    }
  113 
  114    return self;
  115}
 
 
 
◆ isEqual()
  
  
      
        
          | static _Bool isEqual  | 
          ( | 
          const Object *  | 
          self,  | 
         
        
           | 
           | 
          const Object *  | 
          other  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
static   | 
  
 
- See also
 - Object::isEqual(const Object *, const Object *) 
 
Definition at line 64 of file Value.c.
   64                                                              {
   65 
   67        return true;
   68    }
   69 
   71 
   74 
   75        return this->value == that->
value;
 
   76    }
   77 
   78    return false;
   79}
_Bool isKindOfClass(const Object *self, const Class *clazz)
Tests for Class hierarchy membership.
 
Class * _Value(void)
The Value archetype.