1
2
3
4
5
6
7
8
9
10
11
|
1
2
3
4
5
6
7
8
9
|
-
-
-
+
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019, 2020
* Jonathan Schleifer <js@nil.im>
* Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
-
+
-
|
@throw e;
}
self = [self initWithCapacity: count];
@try {
for (id object in set)
[_mapTable setObject: (void *)1
[_mapTable setObject: (void *)1 forKey: object];
forKey: object];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
|
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
-
+
-
|
@throw e;
}
self = [self initWithCapacity: count];
@try {
for (id object in array)
[_mapTable setObject: (void *)1
[_mapTable setObject: (void *)1 forKey: object];
forKey: object];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (instancetype)initWithObjects: (id const *)objects
- (instancetype)initWithObjects: (id const *)objects count: (size_t)count
count: (size_t)count
{
self = [self initWithCapacity: count];
@try {
for (size_t i = 0; i < count; i++)
[_mapTable setObject: (void *)1
[_mapTable setObject: (void *)1 forKey: objects[i]];
forKey: objects[i]];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (instancetype)initWithObject: (id)firstObject
- (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments
arguments: (va_list)arguments
{
self = [super init];
@try {
id object;
va_list argumentsCopy;
size_t count;
va_copy(argumentsCopy, arguments);
for (count = 1; va_arg(argumentsCopy, id) != nil; count++);
_mapTable = [[OFMapTable alloc]
initWithKeyFunctions: keyFunctions
objectFunctions: objectFunctions
capacity: count];
[_mapTable setObject: (void *)1
[_mapTable setObject: (void *)1 forKey: firstObject];
forKey: firstObject];
while ((object = va_arg(arguments, id)) != nil)
[_mapTable setObject: (void *)1
[_mapTable setObject: (void *)1 forKey: object];
forKey: object];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
|