ObjFW
Loading...
Searching...
No Matches
OFValue.h
1/*
2 * Copyright (c) 2008-2024 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
18OF_ASSUME_NONNULL_BEGIN
19
29@property (readonly, nonatomic) const char *objCType;
30
36@property (readonly, nonatomic) void *pointerValue;
37
43@property (readonly, nonatomic) id nonretainedObjectValue;
44
50@property (readonly, nonatomic) OFRange rangeValue;
51
57@property (readonly, nonatomic) OFPoint pointValue;
58
64@property (readonly, nonatomic) OFSize sizeValue;
65
71@property (readonly, nonatomic) OFRect rectValue;
72
78@property (readonly, nonatomic) OFVector3D vector3DValue;
79
85@property (readonly, nonatomic) OFVector4D vector4DValue;
86
95+ (instancetype)valueWithBytes: (const void *)bytes
96 objCType: (const char *)objCType;
97
106+ (instancetype)valueWithPointer: (const void *)pointer;
107
118+ (instancetype)valueWithNonretainedObject: (id)object;
119
126+ (instancetype)valueWithRange: (OFRange)range;
127
134+ (instancetype)valueWithPoint: (OFPoint)point;
135
142+ (instancetype)valueWithSize: (OFSize)size;
143
151+ (instancetype)valueWithRect: (OFRect)rect;
152
160+ (instancetype)valueWithVector3D: (OFVector3D)vector3D;
161
169+ (instancetype)valueWithVector4D: (OFVector4D)vector4D;
170
179- (instancetype)initWithBytes: (const void *)bytes
180 objCType: (const char *)objCType OF_DESIGNATED_INITIALIZER;
181
182- (instancetype)init OF_UNAVAILABLE;
183
191- (void)getValue: (void *)value size: (size_t)size;
192@end
193
194OF_ASSUME_NONNULL_END
195
196#if !defined(NSINTEGER_DEFINED) && !__has_feature(modules)
197/* Required for array literals to work */
198@compatibility_alias NSValue OFValue;
199#endif
The root class for all other classes inside ObjFW.
Definition OFObject.h:688
instancetype init()
Initializes an already allocated object.
Definition OFObject.m:586
A class for storing arbitrary values in an object.
Definition OFValue.h:25
OFRect rectValue
The value as an OFRect.
Definition OFValue.h:71
OFVector3D vector3DValue
The value as an OFVector3D.
Definition OFValue.h:78
OFRange rangeValue
The value as an OFRange.
Definition OFValue.h:50
const char * objCType
The ObjC type encoding of the value.
Definition OFValue.h:29
void * pointerValue
The value as a pointer to void.
Definition OFValue.h:36
OFVector4D vector4DValue
The value as an OFVector4D.
Definition OFValue.h:85
id nonretainedObjectValue
The value as a non-retained object.
Definition OFValue.h:43
OFSize sizeValue
The value as an OFSize.
Definition OFValue.h:64
OFPoint pointValue
The value as an OFPoint.
Definition OFValue.h:57
A protocol for the creation of copies.
Definition OFObject.h:1346
A point in 2D space.
Definition OFObject.h:157
A range.
Definition OFObject.h:106
A rectangle.
Definition OFObject.h:249
A size.
Definition OFObject.h:203
A vector in 3D space.
Definition OFObject.h:300
A vector in 4D space.
Definition OFObject.h:352