ObjFW
OFValue.h
1 /*
2  * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFObject.h"
17 
18 OF_ASSUME_NONNULL_BEGIN
19 
25 @interface OFValue: OFObject <OFCopying>
26 {
27  OF_RESERVE_IVARS(OFValue, 4)
28 }
29 
33 @property (readonly, nonatomic) const char *objCType;
34 
40 @property (readonly, nonatomic) void *pointerValue;
41 
47 @property (readonly, nonatomic) id nonretainedObjectValue;
48 
54 @property (readonly, nonatomic) of_range_t rangeValue;
55 
61 @property (readonly, nonatomic) of_point_t pointValue;
62 
68 @property (readonly, nonatomic) of_dimension_t dimensionValue;
69 
75 @property (readonly, nonatomic) of_rectangle_t rectangleValue;
76 
85 + (instancetype)valueWithBytes: (const void *)bytes
86  objCType: (const char *)objCType;
87 
96 + (instancetype)valueWithPointer: (const void *)pointer;
97 
108 + (instancetype)valueWithNonretainedObject: (id)object;
109 
116 + (instancetype)valueWithRange: (of_range_t)range;
117 
124 + (instancetype)valueWithPoint: (of_point_t)point;
125 
133 + (instancetype)valueWithDimension: (of_dimension_t)dimension;
134 
142 + (instancetype)valueWithRectangle: (of_rectangle_t)rectangle;
143 
152 - (instancetype)initWithBytes: (const void *)bytes
153  objCType: (const char *)objCType;
154 
164 - (instancetype)initWithPointer: (const void *)pointer;
165 
176 - (instancetype)initWithNonretainedObject: (id)object;
177 
185 - (instancetype)initWithRange: (of_range_t)range;
186 
194 - (instancetype)initWithPoint: (of_point_t)point;
195 
203 - (instancetype)initWithDimension: (of_dimension_t)dimension;
204 
212 - (instancetype)initWithRectangle: (of_rectangle_t)rectangle;
213 
223 - (void)getValue: (void *)value size: (size_t)size;
224 @end
225 
226 OF_ASSUME_NONNULL_END
227 
228 #if !defined(NSINTEGER_DEFINED) && !__has_feature(modules)
229 /* Required for array literals to work */
230 @compatibility_alias NSValue OFValue;
231 #endif
The root class for all other classes inside ObjFW.
Definition: OFObject.h:520
A class for storing arbitrary values in an object.
Definition: OFValue.h:27
A protocol for the creation of copies.
Definition: OFObject.h:1187
A dimension.
Definition: OFObject.h:192
A point.
Definition: OFObject.h:145
A range.
Definition: OFObject.h:93
A rectangle.
Definition: OFObject.h:239