ObjFW
OFMutableSet.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 "OFSet.h"
17 
18 OF_ASSUME_NONNULL_BEGIN
19 
28 @interface OFMutableSet OF_GENERIC(ObjectType): OFSet OF_GENERIC(ObjectType)
29 #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
30 # define ObjectType id
31 #endif
39 + (instancetype)setWithCapacity: (size_t)capacity;
40 
48 - (instancetype)initWithCapacity: (size_t)capacity;
49 
55 - (void)addObject: (ObjectType)object;
56 
62 - (void)removeObject: (ObjectType)object;
63 
69 - (void)minusSet: (OFSet OF_GENERIC(ObjectType) *)set;
70 
77 - (void)intersectSet: (OFSet OF_GENERIC(ObjectType) *)set;
78 
84 - (void)unionSet: (OFSet OF_GENERIC(ObjectType) *)set;
85 
89 - (void)removeAllObjects;
90 
94 - (void)makeImmutable;
95 #if !defined(OF_HAVE_GENERICS) && !defined(DOXYGEN)
96 # undef ObjectType
97 #endif
98 @end
99 
100 OF_ASSUME_NONNULL_END
An abstract class for a mutable unordered set of unique objects.
Definition: OFMutableSet.h:29
void removeAllObjects()
Removes all objects from the set.
Definition: OFMutableSet.m:197
void makeImmutable()
Converts the mutable set to an immutable set.
Definition: OFMutableSet.m:208
An abstract class for an unordered set of unique objects.
Definition: OFSet.h:66