Objectively base types.
More...
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/types.h>
Go to the source code of this file.
|
struct | Range |
| A location and length into contiguous collections. More...
|
|
|
#define | clamp(val, min, max) |
|
#define | lengthof(array) (sizeof(array) / sizeof((array)[0])) |
|
#define | max(a, b) ({ typeof (a) _a = (a); typeof (b) _b = (b); _a > _b ? _a : _b; }) |
|
#define | min(a, b) ({ typeof (a) _a = (a); typeof (b) _b = (b); _a < _b ? _a : _b; }) |
|
#define | OBJECTIVELY_EXPORT extern |
|
Objectively base types.
Definition in file Types.h.
◆ clamp
#define clamp |
( |
|
val, |
|
|
|
min, |
|
|
|
max |
|
) |
| |
Value: ({ \
typeof(val) _val = (val); typeof(
min) _min = (
min); typeof(
max) _max = (
max); \
_max < _min ? \
_val < _max ? _max : _val > _min ? _min : _val \
: \
_val < _min ? _min : _val > _max ? _max : _val; \
})
- Returns
- The value, clamped to the bounds.
Definition at line 132 of file Types.h.
◆ lengthof
- Returns
- The length of an array.
Definition at line 145 of file Types.h.
◆ max
#define max |
( |
|
a, |
|
|
|
b |
|
) |
| ({ typeof (a) _a = (a); typeof (b) _b = (b); _a > _b ? _a : _b; }) |
- Returns
- The maximum of the two values.
Definition at line 152 of file Types.h.
◆ min
#define min |
( |
|
a, |
|
|
|
b |
|
) |
| ({ typeof (a) _a = (a); typeof (b) _b = (b); _a < _b ? _a : _b; }) |
- Returns
- The minimum of the two values.
Definition at line 159 of file Types.h.
◆ OBJECTIVELY_EXPORT
#define OBJECTIVELY_EXPORT extern |
◆ BiConsumer
typedef void(* BiConsumer) (ident data1, ident data2) |
The BiConsumer function type.
- Parameters
-
data1 | The first argument. |
data2 | The second argument. |
Definition at line 95 of file Types.h.
◆ Comparator
The Comparator function type for ordering Objects.
- Parameters
-
- Returns
- The Order of
obj1
relative to obj2
.
Definition at line 82 of file Types.h.
◆ Consumer
The Consumer function type.
- Parameters
-
Definition at line 88 of file Types.h.
◆ Functor
The Functor function type for transforming Objects.
- Parameters
-
obj | The Object to transform. |
data | User data. |
- Returns
- The transformation result.
Definition at line 103 of file Types.h.
◆ ident
The identity type, similar to Objective-C id
.
Definition at line 49 of file Types.h.
◆ Predicate
The Predicate function type for filtering Objects.
- Parameters
-
obj | The Object to test. |
data | User data. |
- Returns
- True if
obj
satisfies the predicate, false otherwise.
Definition at line 111 of file Types.h.
◆ Producer
The Producer function type.
- Parameters
-
- Returns
- The product.
Definition at line 118 of file Types.h.
◆ Reducer
The Reducer function type for reducing collections.
- Parameters
-
obj | The Object to reduce. |
accumulator | The accumulator. |
data | User data. |
- Returns
- The reduction result.
Definition at line 127 of file Types.h.
◆ Order
Comparison constants.
Enumerator |
---|
OrderAscending | |
OrderSame | |
OrderDescending | |
Definition at line 70 of file Types.h.
70 {
Order
Comparison constants.