ObjFW
OFTriple.h
1 /*
2  * Copyright (c) 2008-2023 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 OFTriple OF_GENERIC(FirstType, SecondType, ThirdType):
27 #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
28 # define FirstType id
29 # define SecondType id
30 # define ThirdType id
31 #endif
32 {
33  FirstType _Nullable _firstObject;
34  SecondType _Nullable _secondObject;
35  ThirdType _Nullable _thirdObject;
36  OF_RESERVE_IVARS(OFTriple, 4)
37 }
38 
42 @property OF_NULLABLE_PROPERTY (readonly, nonatomic, retain)
43  FirstType firstObject;
44 
48 @property OF_NULLABLE_PROPERTY (readonly, nonatomic, retain)
49  SecondType secondObject;
50 
54 @property OF_NULLABLE_PROPERTY (readonly, nonatomic, retain)
55  ThirdType thirdObject;
56 
65 + (instancetype)tripleWithFirstObject: (nullable FirstType)firstObject
66  secondObject: (nullable SecondType)secondObject
67  thirdObject: (nullable ThirdType)thirdObject;
68 
77 - (instancetype)initWithFirstObject: (nullable FirstType)firstObject
78  secondObject: (nullable SecondType)secondObject
79  thirdObject: (nullable ThirdType)thirdObject
80  OF_DESIGNATED_INITIALIZER;
81 #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
82 # undef FirstType
83 # undef SecondType
84 # undef ThirdType
85 #endif
86 @end
87 
88 OF_ASSUME_NONNULL_END
89 
90 #import "OFMutableTriple.h"
The root class for all other classes inside ObjFW.
Definition: OFObject.h:686
A class for storing a triple of three objects.
Definition: OFTriple.h:25
A protocol for the creation of mutable copies.
Definition: OFObject.h:1367
A protocol for the creation of copies.
Definition: OFObject.h:1346