ObjFW
Classes | Typedefs | Enumerations | Functions
OFObject.h File Reference
#include "objfw-defs.h"
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <limits.h>
#include "block.h"
#include "macros.h"
#include "once.h"
#import "OFObject+KeyValueCoding.h"
#import "OFObject+Serialization.h"
Include dependency graph for OFObject.h:

Go to the source code of this file.

Classes

struct  of_range_t
 A range. More...
 
struct  of_point_t
 A point. More...
 
struct  of_dimension_t
 A dimension. More...
 
struct  of_rectangle_t
 A rectangle. More...
 
protocol  <OFObject>
 The protocol which all root classes implement. More...
 
class  OFObject
 The root class for all other classes inside ObjFW. More...
 
protocol  <OFCopying>
 A protocol for the creation of copies. More...
 
protocol  <OFMutableCopying>
 A protocol for the creation of mutable copies. More...
 
protocol  <OFComparing>
 A protocol for comparing objects. More...
 

Typedefs

typedef of_comparison_result_t(^ of_comparator_t) (id _Nonnull left, id _Nonnull right)
 A comparator to compare two objects. More...
 
typedef double of_time_interval_t
 A time interval in seconds.
 

Enumerations

enum  of_comparison_result_t { OF_ORDERED_ASCENDING = -1 , OF_ORDERED_SAME = 0 , OF_ORDERED_DESCENDING = 1 }
 A result of a comparison. More...
 
enum  of_byte_order_t { OF_BYTE_ORDER_BIG_ENDIAN , OF_BYTE_ORDER_LITTLE_ENDIAN }
 An enum for storing endianess. More...
 

Functions

void *_Nullable of_alloc (size_t count, size_t size) 1
 Allocates memory for the specified number of items of the specified size. More...
 
void *_Nullable of_alloc_zeroed (size_t count, size_t size) 1
 Allocates memory for the specified number of items of the specified size and initializes it with zeros. More...
 
void *_Nullable of_realloc (void *_Nullable pointer, size_t count, size_t size) 1
 Resizes memory to the specified number of items of the specified size. More...
 

Typedef Documentation

◆ of_comparator_t

typedef of_comparison_result_t(^ of_comparator_t) (id _Nonnull left, id _Nonnull right)

A comparator to compare two objects.

Parameters
leftThe left object
rightThe right object
Returns
The order of the objects

Enumeration Type Documentation

◆ of_byte_order_t

An enum for storing endianess.

Enumerator
OF_BYTE_ORDER_BIG_ENDIAN 

Most significant byte first (big endian)

OF_BYTE_ORDER_LITTLE_ENDIAN 

Least significant byte first (little endian)

◆ of_comparison_result_t

A result of a comparison.

Enumerator
OF_ORDERED_ASCENDING 

The left object is smaller than the right

OF_ORDERED_SAME 

Both objects are equal

OF_ORDERED_DESCENDING 

The left object is bigger than the right

Function Documentation

◆ of_alloc()

void* _Nullable of_alloc ( size_t  count,
size_t  size 
)

Allocates memory for the specified number of items of the specified size.

To free the allocated memory, use free().

Throws OFOutOfMemoryException if allocating failed and OFOutOfRangeException if the requested size exceeds the address space.

Parameters
countThe number of items to allocate
sizeThe size of each item to allocate
Returns
A pointer to the allocated memory. May return NULL if the specified size or count is 0.

◆ of_alloc_zeroed()

void* _Nullable of_alloc_zeroed ( size_t  count,
size_t  size 
)

Allocates memory for the specified number of items of the specified size and initializes it with zeros.

To free the allocated memory, use free().

Throws OFOutOfMemoryException if allocating failed and OFOutOfRangeException if the requested size exceeds the address space.

Parameters
sizeThe size of each item to allocate
countThe number of items to allocate
Returns
A pointer to the allocated memory. May return NULL if the specified size or count is 0.

◆ of_realloc()

void* _Nullable of_realloc ( void *_Nullable  pointer,
size_t  count,
size_t  size 
)

Resizes memory to the specified number of items of the specified size.

To free the allocated memory, use free().

If the pointer is NULL, this is equivalent to allocating memory. If the size or number of items is 0, this is equivalent to freeing memory.

Throws OFOutOfMemoryException if allocating failed and OFOutOfRangeException if the requested size exceeds the address space.

Parameters
pointerA pointer to the already allocated memory
sizeThe size of each item to resize to
countThe number of items to resize to
Returns
A pointer to the resized memory chunk