ObjFW
Loading...
Searching...
No Matches
OFTriple.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
29@interface OFTriple OF_GENERIC(FirstType, SecondType, ThirdType):
31#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
32# define FirstType id
33# define SecondType id
34# define ThirdType id
35#endif
36{
37 FirstType _Nullable _firstObject;
38 SecondType _Nullable _secondObject;
39 ThirdType _Nullable _thirdObject;
40 OF_RESERVE_IVARS(OFTriple, 4)
41}
42
46@property OF_NULLABLE_PROPERTY (readonly, nonatomic, retain)
47 FirstType firstObject;
48
52@property OF_NULLABLE_PROPERTY (readonly, nonatomic, retain)
53 SecondType secondObject;
54
58@property OF_NULLABLE_PROPERTY (readonly, nonatomic, retain)
59 ThirdType thirdObject;
60
69+ (instancetype)tripleWithFirstObject: (nullable FirstType)firstObject
70 secondObject: (nullable SecondType)secondObject
71 thirdObject: (nullable ThirdType)thirdObject;
72
81- (instancetype)initWithFirstObject: (nullable FirstType)firstObject
82 secondObject: (nullable SecondType)secondObject
83 thirdObject: (nullable ThirdType)thirdObject
84 OF_DESIGNATED_INITIALIZER;
85#if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
86# undef FirstType
87# undef SecondType
88# undef ThirdType
89#endif
90@end
91
92OF_ASSUME_NONNULL_END
93
94#import "OFMutableTriple.h"
The root class for all other classes inside ObjFW.
Definition OFObject.h:692
A class for storing a triple of three objects.
Definition OFTriple.h:42
A protocol for the creation of copies.
Definition OFObject.h:1350
A protocol for the creation of mutable copies.
Definition OFObject.h:1371