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 program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License version 3.0 only,
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13 * version 3.0 for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * version 3.0 along with this program. If not, see
17 * <https://www.gnu.org/licenses/>.
18 */
19
20#import "OFObject.h"
21
22OF_ASSUME_NONNULL_BEGIN
23
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) OFRange rangeValue;
55
61@property (readonly, nonatomic) OFPoint pointValue;
62
68@property (readonly, nonatomic) OFSize sizeValue;
69
75@property (readonly, nonatomic) OFRect rectValue;
76
82@property (readonly, nonatomic) OFVector3D vector3DValue;
83
89@property (readonly, nonatomic) OFVector4D vector4DValue;
90
99+ (instancetype)valueWithBytes: (const void *)bytes
100 objCType: (const char *)objCType;
101
110+ (instancetype)valueWithPointer: (const void *)pointer;
111
122+ (instancetype)valueWithNonretainedObject: (id)object;
123
130+ (instancetype)valueWithRange: (OFRange)range;
131
138+ (instancetype)valueWithPoint: (OFPoint)point;
139
146+ (instancetype)valueWithSize: (OFSize)size;
147
155+ (instancetype)valueWithRect: (OFRect)rect;
156
164+ (instancetype)valueWithVector3D: (OFVector3D)vector3D;
165
173+ (instancetype)valueWithVector4D: (OFVector4D)vector4D;
174
183- (instancetype)initWithBytes: (const void *)bytes
184 objCType: (const char *)objCType OF_DESIGNATED_INITIALIZER;
185
186- (instancetype)init OF_UNAVAILABLE;
187
195- (void)getValue: (void *)value size: (size_t)size;
196@end
197
198OF_ASSUME_NONNULL_END
199
200#if !defined(NSINTEGER_DEFINED) && !__has_feature(modules)
201/* Required for array literals to work */
202@compatibility_alias NSValue OFValue;
203#endif
The root class for all other classes inside ObjFW.
Definition OFObject.h:692
instancetype init()
Initializes an already allocated object.
Definition OFObject.m:696
A class for storing arbitrary values in an object.
Definition OFValue.h:29
OFRect rectValue
The value as an OFRect.
Definition OFValue.h:75
OFVector3D vector3DValue
The value as an OFVector3D.
Definition OFValue.h:82
OFRange rangeValue
The value as an OFRange.
Definition OFValue.h:54
const char * objCType
The ObjC type encoding of the value.
Definition OFValue.h:33
void * pointerValue
The value as a pointer to void.
Definition OFValue.h:40
OFVector4D vector4DValue
The value as an OFVector4D.
Definition OFValue.h:89
id nonretainedObjectValue
The value as a non-retained object.
Definition OFValue.h:47
OFSize sizeValue
The value as an OFSize.
Definition OFValue.h:68
OFPoint pointValue
The value as an OFPoint.
Definition OFValue.h:61
A protocol for the creation of copies.
Definition OFObject.h:1350
A point in 2D space.
Definition OFObject.h:161
A range.
Definition OFObject.h:110
A rectangle.
Definition OFObject.h:253
A size.
Definition OFObject.h:207
A vector in 3D space.
Definition OFObject.h:304
A vector in 4D space.
Definition OFObject.h:356