Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: third_party/protobuf/objectivec/GPBDictionary.h

Issue 2600753002: Reverts third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 14 matching lines...) Expand all
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 30
31 #import <Foundation/Foundation.h> 31 #import <Foundation/Foundation.h>
32 32
33 #import "GPBRuntimeTypes.h" 33 #import "GPBRuntimeTypes.h"
34 34
35 // Note on naming: for the classes holding numeric values, a more natural 35 // These classes are used for map fields of basic data types. They are used beca use
36 // naming of the method might be things like "-valueForKey:", 36 // they perform better than boxing into NSNumbers in NSDictionaries.
37 // "-setValue:forKey:"; etc. But those selectors are also defined by Key Value 37
38 // Coding (KVC) as categories on NSObject. So "overloading" the selectors with 38 // Note: These are not meant to be subclassed.
39 // other meanings can cause warnings (based on compiler settings), but more
40 // importantly, some of those selector get called as KVC breaks up keypaths.
41 // So if those selectors are used, using KVC will compile cleanly, but could
42 // crash as it invokes those selectors with the wrong types of arguments.
43 39
44 NS_ASSUME_NONNULL_BEGIN 40 NS_ASSUME_NONNULL_BEGIN
45 41
46 //%PDDM-EXPAND DECLARE_DICTIONARIES() 42 //%PDDM-EXPAND DECLARE_DICTIONARIES()
47 // This block of code is generated, do not edit it directly. 43 // This block of code is generated, do not edit it directly.
48 44
49 #pragma mark - UInt32 -> UInt32 45 #pragma mark - UInt32 -> UInt32
50 46
51 /**
52 * Class used for map fields of <uint32_t, uint32_t>
53 * values. This performs better than boxing into NSNumbers in NSDictionaries.
54 *
55 * @note This class is not meant to be subclassed.
56 **/
57 @interface GPBUInt32UInt32Dictionary : NSObject <NSCopying> 47 @interface GPBUInt32UInt32Dictionary : NSObject <NSCopying>
58 48
59 /** Number of entries stored in this dictionary. */ 49 @property(nonatomic, readonly) NSUInteger count;
60 @property(nonatomic, readonly) NSUInteger count; 50
61 51 + (instancetype)dictionary;
62 /** 52 + (instancetype)dictionaryWithValue:(uint32_t)value
63 * @return A newly instanced and empty dictionary. 53 forKey:(uint32_t)key;
64 **/ 54 + (instancetype)dictionaryWithValues:(const uint32_t [])values
65 + (instancetype)dictionary; 55 forKeys:(const uint32_t [])keys
66 56 count:(NSUInteger)count;
67 /**
68 * Creates and initializes a dictionary with the single entry given.
69 *
70 * @param value The value to be placed in the dictionary.
71 * @param key The key under which to store the value.
72 *
73 * @return A newly instanced dictionary with the key and value in it.
74 **/
75 + (instancetype)dictionaryWithUInt32:(uint32_t)value
76 forKey:(uint32_t)key;
77
78 /**
79 * Creates and initializes a dictionary with the entries given.
80 *
81 * @param values The values to be placed in the dictionary.
82 * @param keys The keys under which to store the values.
83 * @param count The number of entries to store in the dictionary.
84 *
85 * @return A newly instanced dictionary with the keys and values in it.
86 **/
87 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
88 forKeys:(const uint32_t [])keys
89 count:(NSUInteger)count;
90
91 /**
92 * Creates and initializes a dictionary with the entries from the given.
93 * dictionary.
94 *
95 * @param dictionary Dictionary containing the entries to add to the dictionary.
96 *
97 * @return A newly instanced dictionary with the entries from the given
98 * dictionary in it.
99 **/
100 + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary ; 57 + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary ;
101 58 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
102 /** 59
103 * Creates and initializes a dictionary with the given capacity. 60 - (instancetype)initWithValues:(const uint32_t [])values
104 * 61 forKeys:(const uint32_t [])keys
105 * @param numItems Capacity needed for the dictionary. 62 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
106 *
107 * @return A newly instanced dictionary with the given capacity.
108 **/
109 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
110
111 /**
112 * Initializes this dictionary, copying the given values and keys.
113 *
114 * @param values The values to be placed in this dictionary.
115 * @param keys The keys under which to store the values.
116 * @param count The number of elements to copy into the dictionary.
117 *
118 * @return A newly initialized dictionary with a copy of the values and keys.
119 **/
120 - (instancetype)initWithUInt32s:(const uint32_t [])values
121 forKeys:(const uint32_t [])keys
122 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
123
124 /**
125 * Initializes this dictionary, copying the entries from the given dictionary.
126 *
127 * @param dictionary Dictionary containing the entries to add to this dictionary .
128 *
129 * @return A newly initialized dictionary with the entries of the given dictiona ry.
130 **/
131 - (instancetype)initWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary; 63 - (instancetype)initWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary;
132 64 - (instancetype)initWithCapacity:(NSUInteger)numItems;
133 /** 65
134 * Initializes this dictionary with the requested capacity. 66 - (BOOL)valueForKey:(uint32_t)key value:(nullable uint32_t *)value;
135 * 67
136 * @param numItems Number of items needed for this dictionary. 68 - (void)enumerateKeysAndValuesUsingBlock:
137 *
138 * @return A newly initialized dictionary with the requested capacity.
139 **/
140 - (instancetype)initWithCapacity:(NSUInteger)numItems;
141
142 /**
143 * Gets the value for the given key.
144 *
145 * @param value Pointer into which the value will be set, if found.
146 * @param key Key under which the value is stored, if present.
147 *
148 * @return YES if the key was found and the value was copied, NO otherwise.
149 **/
150 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint32_t)key;
151
152 /**
153 * Enumerates the keys and values on this dictionary with the given block.
154 *
155 * @param block The block to enumerate with.
156 * **key**: The key for the current entry.
157 * **value**: The value for the current entry
158 * **stop**: A pointer to a boolean that when set stops the enumeration.
159 **/
160 - (void)enumerateKeysAndUInt32sUsingBlock:
161 (void (^)(uint32_t key, uint32_t value, BOOL *stop))block; 69 (void (^)(uint32_t key, uint32_t value, BOOL *stop))block;
162 70
163 /**
164 * Adds the keys and values from another dictionary.
165 *
166 * @param otherDictionary Dictionary containing entries to be added to this
167 * dictionary.
168 **/
169 - (void)addEntriesFromDictionary:(GPBUInt32UInt32Dictionary *)otherDictionary; 71 - (void)addEntriesFromDictionary:(GPBUInt32UInt32Dictionary *)otherDictionary;
170 72
171 /** 73 - (void)setValue:(uint32_t)value forKey:(uint32_t)key;
172 * Sets the value for the given key. 74
173 * 75 - (void)removeValueForKey:(uint32_t)aKey;
174 * @param value The value to set.
175 * @param key The key under which to store the value.
176 **/
177 - (void)setUInt32:(uint32_t)value forKey:(uint32_t)key;
178
179 /**
180 * Removes the entry for the given key.
181 *
182 * @param aKey Key to be removed from this dictionary.
183 **/
184 - (void)removeUInt32ForKey:(uint32_t)aKey;
185
186 /**
187 * Removes all entries in this dictionary.
188 **/
189 - (void)removeAll; 76 - (void)removeAll;
190 77
191 @end 78 @end
192 79
193 #pragma mark - UInt32 -> Int32 80 #pragma mark - UInt32 -> Int32
194 81
195 /**
196 * Class used for map fields of <uint32_t, int32_t>
197 * values. This performs better than boxing into NSNumbers in NSDictionaries.
198 *
199 * @note This class is not meant to be subclassed.
200 **/
201 @interface GPBUInt32Int32Dictionary : NSObject <NSCopying> 82 @interface GPBUInt32Int32Dictionary : NSObject <NSCopying>
202 83
203 /** Number of entries stored in this dictionary. */ 84 @property(nonatomic, readonly) NSUInteger count;
204 @property(nonatomic, readonly) NSUInteger count; 85
205 86 + (instancetype)dictionary;
206 /** 87 + (instancetype)dictionaryWithValue:(int32_t)value
207 * @return A newly instanced and empty dictionary. 88 forKey:(uint32_t)key;
208 **/ 89 + (instancetype)dictionaryWithValues:(const int32_t [])values
209 + (instancetype)dictionary; 90 forKeys:(const uint32_t [])keys
210 91 count:(NSUInteger)count;
211 /**
212 * Creates and initializes a dictionary with the single entry given.
213 *
214 * @param value The value to be placed in the dictionary.
215 * @param key The key under which to store the value.
216 *
217 * @return A newly instanced dictionary with the key and value in it.
218 **/
219 + (instancetype)dictionaryWithInt32:(int32_t)value
220 forKey:(uint32_t)key;
221
222 /**
223 * Creates and initializes a dictionary with the entries given.
224 *
225 * @param values The values to be placed in the dictionary.
226 * @param keys The keys under which to store the values.
227 * @param count The number of entries to store in the dictionary.
228 *
229 * @return A newly instanced dictionary with the keys and values in it.
230 **/
231 + (instancetype)dictionaryWithInt32s:(const int32_t [])values
232 forKeys:(const uint32_t [])keys
233 count:(NSUInteger)count;
234
235 /**
236 * Creates and initializes a dictionary with the entries from the given.
237 * dictionary.
238 *
239 * @param dictionary Dictionary containing the entries to add to the dictionary.
240 *
241 * @return A newly instanced dictionary with the entries from the given
242 * dictionary in it.
243 **/
244 + (instancetype)dictionaryWithDictionary:(GPBUInt32Int32Dictionary *)dictionary; 92 + (instancetype)dictionaryWithDictionary:(GPBUInt32Int32Dictionary *)dictionary;
245 93 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
246 /** 94
247 * Creates and initializes a dictionary with the given capacity. 95 - (instancetype)initWithValues:(const int32_t [])values
248 * 96 forKeys:(const uint32_t [])keys
249 * @param numItems Capacity needed for the dictionary. 97 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
250 *
251 * @return A newly instanced dictionary with the given capacity.
252 **/
253 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
254
255 /**
256 * Initializes this dictionary, copying the given values and keys.
257 *
258 * @param values The values to be placed in this dictionary.
259 * @param keys The keys under which to store the values.
260 * @param count The number of elements to copy into the dictionary.
261 *
262 * @return A newly initialized dictionary with a copy of the values and keys.
263 **/
264 - (instancetype)initWithInt32s:(const int32_t [])values
265 forKeys:(const uint32_t [])keys
266 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
267
268 /**
269 * Initializes this dictionary, copying the entries from the given dictionary.
270 *
271 * @param dictionary Dictionary containing the entries to add to this dictionary .
272 *
273 * @return A newly initialized dictionary with the entries of the given dictiona ry.
274 **/
275 - (instancetype)initWithDictionary:(GPBUInt32Int32Dictionary *)dictionary; 98 - (instancetype)initWithDictionary:(GPBUInt32Int32Dictionary *)dictionary;
276 99 - (instancetype)initWithCapacity:(NSUInteger)numItems;
277 /** 100
278 * Initializes this dictionary with the requested capacity. 101 - (BOOL)valueForKey:(uint32_t)key value:(nullable int32_t *)value;
279 * 102
280 * @param numItems Number of items needed for this dictionary. 103 - (void)enumerateKeysAndValuesUsingBlock:
281 *
282 * @return A newly initialized dictionary with the requested capacity.
283 **/
284 - (instancetype)initWithCapacity:(NSUInteger)numItems;
285
286 /**
287 * Gets the value for the given key.
288 *
289 * @param value Pointer into which the value will be set, if found.
290 * @param key Key under which the value is stored, if present.
291 *
292 * @return YES if the key was found and the value was copied, NO otherwise.
293 **/
294 - (BOOL)getInt32:(nullable int32_t *)value forKey:(uint32_t)key;
295
296 /**
297 * Enumerates the keys and values on this dictionary with the given block.
298 *
299 * @param block The block to enumerate with.
300 * **key**: The key for the current entry.
301 * **value**: The value for the current entry
302 * **stop**: A pointer to a boolean that when set stops the enumeration.
303 **/
304 - (void)enumerateKeysAndInt32sUsingBlock:
305 (void (^)(uint32_t key, int32_t value, BOOL *stop))block; 104 (void (^)(uint32_t key, int32_t value, BOOL *stop))block;
306 105
307 /**
308 * Adds the keys and values from another dictionary.
309 *
310 * @param otherDictionary Dictionary containing entries to be added to this
311 * dictionary.
312 **/
313 - (void)addEntriesFromDictionary:(GPBUInt32Int32Dictionary *)otherDictionary; 106 - (void)addEntriesFromDictionary:(GPBUInt32Int32Dictionary *)otherDictionary;
314 107
315 /** 108 - (void)setValue:(int32_t)value forKey:(uint32_t)key;
316 * Sets the value for the given key. 109
317 * 110 - (void)removeValueForKey:(uint32_t)aKey;
318 * @param value The value to set.
319 * @param key The key under which to store the value.
320 **/
321 - (void)setInt32:(int32_t)value forKey:(uint32_t)key;
322
323 /**
324 * Removes the entry for the given key.
325 *
326 * @param aKey Key to be removed from this dictionary.
327 **/
328 - (void)removeInt32ForKey:(uint32_t)aKey;
329
330 /**
331 * Removes all entries in this dictionary.
332 **/
333 - (void)removeAll; 111 - (void)removeAll;
334 112
335 @end 113 @end
336 114
337 #pragma mark - UInt32 -> UInt64 115 #pragma mark - UInt32 -> UInt64
338 116
339 /**
340 * Class used for map fields of <uint32_t, uint64_t>
341 * values. This performs better than boxing into NSNumbers in NSDictionaries.
342 *
343 * @note This class is not meant to be subclassed.
344 **/
345 @interface GPBUInt32UInt64Dictionary : NSObject <NSCopying> 117 @interface GPBUInt32UInt64Dictionary : NSObject <NSCopying>
346 118
347 /** Number of entries stored in this dictionary. */ 119 @property(nonatomic, readonly) NSUInteger count;
348 @property(nonatomic, readonly) NSUInteger count; 120
349 121 + (instancetype)dictionary;
350 /** 122 + (instancetype)dictionaryWithValue:(uint64_t)value
351 * @return A newly instanced and empty dictionary. 123 forKey:(uint32_t)key;
352 **/ 124 + (instancetype)dictionaryWithValues:(const uint64_t [])values
353 + (instancetype)dictionary; 125 forKeys:(const uint32_t [])keys
354 126 count:(NSUInteger)count;
355 /**
356 * Creates and initializes a dictionary with the single entry given.
357 *
358 * @param value The value to be placed in the dictionary.
359 * @param key The key under which to store the value.
360 *
361 * @return A newly instanced dictionary with the key and value in it.
362 **/
363 + (instancetype)dictionaryWithUInt64:(uint64_t)value
364 forKey:(uint32_t)key;
365
366 /**
367 * Creates and initializes a dictionary with the entries given.
368 *
369 * @param values The values to be placed in the dictionary.
370 * @param keys The keys under which to store the values.
371 * @param count The number of entries to store in the dictionary.
372 *
373 * @return A newly instanced dictionary with the keys and values in it.
374 **/
375 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
376 forKeys:(const uint32_t [])keys
377 count:(NSUInteger)count;
378
379 /**
380 * Creates and initializes a dictionary with the entries from the given.
381 * dictionary.
382 *
383 * @param dictionary Dictionary containing the entries to add to the dictionary.
384 *
385 * @return A newly instanced dictionary with the entries from the given
386 * dictionary in it.
387 **/
388 + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary ; 127 + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary ;
389 128 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
390 /** 129
391 * Creates and initializes a dictionary with the given capacity. 130 - (instancetype)initWithValues:(const uint64_t [])values
392 * 131 forKeys:(const uint32_t [])keys
393 * @param numItems Capacity needed for the dictionary. 132 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
394 *
395 * @return A newly instanced dictionary with the given capacity.
396 **/
397 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
398
399 /**
400 * Initializes this dictionary, copying the given values and keys.
401 *
402 * @param values The values to be placed in this dictionary.
403 * @param keys The keys under which to store the values.
404 * @param count The number of elements to copy into the dictionary.
405 *
406 * @return A newly initialized dictionary with a copy of the values and keys.
407 **/
408 - (instancetype)initWithUInt64s:(const uint64_t [])values
409 forKeys:(const uint32_t [])keys
410 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
411
412 /**
413 * Initializes this dictionary, copying the entries from the given dictionary.
414 *
415 * @param dictionary Dictionary containing the entries to add to this dictionary .
416 *
417 * @return A newly initialized dictionary with the entries of the given dictiona ry.
418 **/
419 - (instancetype)initWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary; 133 - (instancetype)initWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary;
420 134 - (instancetype)initWithCapacity:(NSUInteger)numItems;
421 /** 135
422 * Initializes this dictionary with the requested capacity. 136 - (BOOL)valueForKey:(uint32_t)key value:(nullable uint64_t *)value;
423 * 137
424 * @param numItems Number of items needed for this dictionary. 138 - (void)enumerateKeysAndValuesUsingBlock:
425 *
426 * @return A newly initialized dictionary with the requested capacity.
427 **/
428 - (instancetype)initWithCapacity:(NSUInteger)numItems;
429
430 /**
431 * Gets the value for the given key.
432 *
433 * @param value Pointer into which the value will be set, if found.
434 * @param key Key under which the value is stored, if present.
435 *
436 * @return YES if the key was found and the value was copied, NO otherwise.
437 **/
438 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint32_t)key;
439
440 /**
441 * Enumerates the keys and values on this dictionary with the given block.
442 *
443 * @param block The block to enumerate with.
444 * **key**: The key for the current entry.
445 * **value**: The value for the current entry
446 * **stop**: A pointer to a boolean that when set stops the enumeration.
447 **/
448 - (void)enumerateKeysAndUInt64sUsingBlock:
449 (void (^)(uint32_t key, uint64_t value, BOOL *stop))block; 139 (void (^)(uint32_t key, uint64_t value, BOOL *stop))block;
450 140
451 /**
452 * Adds the keys and values from another dictionary.
453 *
454 * @param otherDictionary Dictionary containing entries to be added to this
455 * dictionary.
456 **/
457 - (void)addEntriesFromDictionary:(GPBUInt32UInt64Dictionary *)otherDictionary; 141 - (void)addEntriesFromDictionary:(GPBUInt32UInt64Dictionary *)otherDictionary;
458 142
459 /** 143 - (void)setValue:(uint64_t)value forKey:(uint32_t)key;
460 * Sets the value for the given key. 144
461 * 145 - (void)removeValueForKey:(uint32_t)aKey;
462 * @param value The value to set.
463 * @param key The key under which to store the value.
464 **/
465 - (void)setUInt64:(uint64_t)value forKey:(uint32_t)key;
466
467 /**
468 * Removes the entry for the given key.
469 *
470 * @param aKey Key to be removed from this dictionary.
471 **/
472 - (void)removeUInt64ForKey:(uint32_t)aKey;
473
474 /**
475 * Removes all entries in this dictionary.
476 **/
477 - (void)removeAll; 146 - (void)removeAll;
478 147
479 @end 148 @end
480 149
481 #pragma mark - UInt32 -> Int64 150 #pragma mark - UInt32 -> Int64
482 151
483 /**
484 * Class used for map fields of <uint32_t, int64_t>
485 * values. This performs better than boxing into NSNumbers in NSDictionaries.
486 *
487 * @note This class is not meant to be subclassed.
488 **/
489 @interface GPBUInt32Int64Dictionary : NSObject <NSCopying> 152 @interface GPBUInt32Int64Dictionary : NSObject <NSCopying>
490 153
491 /** Number of entries stored in this dictionary. */ 154 @property(nonatomic, readonly) NSUInteger count;
492 @property(nonatomic, readonly) NSUInteger count; 155
493 156 + (instancetype)dictionary;
494 /** 157 + (instancetype)dictionaryWithValue:(int64_t)value
495 * @return A newly instanced and empty dictionary. 158 forKey:(uint32_t)key;
496 **/ 159 + (instancetype)dictionaryWithValues:(const int64_t [])values
497 + (instancetype)dictionary; 160 forKeys:(const uint32_t [])keys
498 161 count:(NSUInteger)count;
499 /**
500 * Creates and initializes a dictionary with the single entry given.
501 *
502 * @param value The value to be placed in the dictionary.
503 * @param key The key under which to store the value.
504 *
505 * @return A newly instanced dictionary with the key and value in it.
506 **/
507 + (instancetype)dictionaryWithInt64:(int64_t)value
508 forKey:(uint32_t)key;
509
510 /**
511 * Creates and initializes a dictionary with the entries given.
512 *
513 * @param values The values to be placed in the dictionary.
514 * @param keys The keys under which to store the values.
515 * @param count The number of entries to store in the dictionary.
516 *
517 * @return A newly instanced dictionary with the keys and values in it.
518 **/
519 + (instancetype)dictionaryWithInt64s:(const int64_t [])values
520 forKeys:(const uint32_t [])keys
521 count:(NSUInteger)count;
522
523 /**
524 * Creates and initializes a dictionary with the entries from the given.
525 * dictionary.
526 *
527 * @param dictionary Dictionary containing the entries to add to the dictionary.
528 *
529 * @return A newly instanced dictionary with the entries from the given
530 * dictionary in it.
531 **/
532 + (instancetype)dictionaryWithDictionary:(GPBUInt32Int64Dictionary *)dictionary; 162 + (instancetype)dictionaryWithDictionary:(GPBUInt32Int64Dictionary *)dictionary;
533 163 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
534 /** 164
535 * Creates and initializes a dictionary with the given capacity. 165 - (instancetype)initWithValues:(const int64_t [])values
536 * 166 forKeys:(const uint32_t [])keys
537 * @param numItems Capacity needed for the dictionary. 167 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
538 *
539 * @return A newly instanced dictionary with the given capacity.
540 **/
541 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
542
543 /**
544 * Initializes this dictionary, copying the given values and keys.
545 *
546 * @param values The values to be placed in this dictionary.
547 * @param keys The keys under which to store the values.
548 * @param count The number of elements to copy into the dictionary.
549 *
550 * @return A newly initialized dictionary with a copy of the values and keys.
551 **/
552 - (instancetype)initWithInt64s:(const int64_t [])values
553 forKeys:(const uint32_t [])keys
554 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
555
556 /**
557 * Initializes this dictionary, copying the entries from the given dictionary.
558 *
559 * @param dictionary Dictionary containing the entries to add to this dictionary .
560 *
561 * @return A newly initialized dictionary with the entries of the given dictiona ry.
562 **/
563 - (instancetype)initWithDictionary:(GPBUInt32Int64Dictionary *)dictionary; 168 - (instancetype)initWithDictionary:(GPBUInt32Int64Dictionary *)dictionary;
564 169 - (instancetype)initWithCapacity:(NSUInteger)numItems;
565 /** 170
566 * Initializes this dictionary with the requested capacity. 171 - (BOOL)valueForKey:(uint32_t)key value:(nullable int64_t *)value;
567 * 172
568 * @param numItems Number of items needed for this dictionary. 173 - (void)enumerateKeysAndValuesUsingBlock:
569 *
570 * @return A newly initialized dictionary with the requested capacity.
571 **/
572 - (instancetype)initWithCapacity:(NSUInteger)numItems;
573
574 /**
575 * Gets the value for the given key.
576 *
577 * @param value Pointer into which the value will be set, if found.
578 * @param key Key under which the value is stored, if present.
579 *
580 * @return YES if the key was found and the value was copied, NO otherwise.
581 **/
582 - (BOOL)getInt64:(nullable int64_t *)value forKey:(uint32_t)key;
583
584 /**
585 * Enumerates the keys and values on this dictionary with the given block.
586 *
587 * @param block The block to enumerate with.
588 * **key**: The key for the current entry.
589 * **value**: The value for the current entry
590 * **stop**: A pointer to a boolean that when set stops the enumeration.
591 **/
592 - (void)enumerateKeysAndInt64sUsingBlock:
593 (void (^)(uint32_t key, int64_t value, BOOL *stop))block; 174 (void (^)(uint32_t key, int64_t value, BOOL *stop))block;
594 175
595 /**
596 * Adds the keys and values from another dictionary.
597 *
598 * @param otherDictionary Dictionary containing entries to be added to this
599 * dictionary.
600 **/
601 - (void)addEntriesFromDictionary:(GPBUInt32Int64Dictionary *)otherDictionary; 176 - (void)addEntriesFromDictionary:(GPBUInt32Int64Dictionary *)otherDictionary;
602 177
603 /** 178 - (void)setValue:(int64_t)value forKey:(uint32_t)key;
604 * Sets the value for the given key. 179
605 * 180 - (void)removeValueForKey:(uint32_t)aKey;
606 * @param value The value to set.
607 * @param key The key under which to store the value.
608 **/
609 - (void)setInt64:(int64_t)value forKey:(uint32_t)key;
610
611 /**
612 * Removes the entry for the given key.
613 *
614 * @param aKey Key to be removed from this dictionary.
615 **/
616 - (void)removeInt64ForKey:(uint32_t)aKey;
617
618 /**
619 * Removes all entries in this dictionary.
620 **/
621 - (void)removeAll; 181 - (void)removeAll;
622 182
623 @end 183 @end
624 184
625 #pragma mark - UInt32 -> Bool 185 #pragma mark - UInt32 -> Bool
626 186
627 /**
628 * Class used for map fields of <uint32_t, BOOL>
629 * values. This performs better than boxing into NSNumbers in NSDictionaries.
630 *
631 * @note This class is not meant to be subclassed.
632 **/
633 @interface GPBUInt32BoolDictionary : NSObject <NSCopying> 187 @interface GPBUInt32BoolDictionary : NSObject <NSCopying>
634 188
635 /** Number of entries stored in this dictionary. */ 189 @property(nonatomic, readonly) NSUInteger count;
636 @property(nonatomic, readonly) NSUInteger count; 190
637 191 + (instancetype)dictionary;
638 /** 192 + (instancetype)dictionaryWithValue:(BOOL)value
639 * @return A newly instanced and empty dictionary. 193 forKey:(uint32_t)key;
640 **/ 194 + (instancetype)dictionaryWithValues:(const BOOL [])values
641 + (instancetype)dictionary; 195 forKeys:(const uint32_t [])keys
642 196 count:(NSUInteger)count;
643 /**
644 * Creates and initializes a dictionary with the single entry given.
645 *
646 * @param value The value to be placed in the dictionary.
647 * @param key The key under which to store the value.
648 *
649 * @return A newly instanced dictionary with the key and value in it.
650 **/
651 + (instancetype)dictionaryWithBool:(BOOL)value
652 forKey:(uint32_t)key;
653
654 /**
655 * Creates and initializes a dictionary with the entries given.
656 *
657 * @param values The values to be placed in the dictionary.
658 * @param keys The keys under which to store the values.
659 * @param count The number of entries to store in the dictionary.
660 *
661 * @return A newly instanced dictionary with the keys and values in it.
662 **/
663 + (instancetype)dictionaryWithBools:(const BOOL [])values
664 forKeys:(const uint32_t [])keys
665 count:(NSUInteger)count;
666
667 /**
668 * Creates and initializes a dictionary with the entries from the given.
669 * dictionary.
670 *
671 * @param dictionary Dictionary containing the entries to add to the dictionary.
672 *
673 * @return A newly instanced dictionary with the entries from the given
674 * dictionary in it.
675 **/
676 + (instancetype)dictionaryWithDictionary:(GPBUInt32BoolDictionary *)dictionary; 197 + (instancetype)dictionaryWithDictionary:(GPBUInt32BoolDictionary *)dictionary;
677 198 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
678 /** 199
679 * Creates and initializes a dictionary with the given capacity. 200 - (instancetype)initWithValues:(const BOOL [])values
680 * 201 forKeys:(const uint32_t [])keys
681 * @param numItems Capacity needed for the dictionary. 202 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
682 *
683 * @return A newly instanced dictionary with the given capacity.
684 **/
685 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
686
687 /**
688 * Initializes this dictionary, copying the given values and keys.
689 *
690 * @param values The values to be placed in this dictionary.
691 * @param keys The keys under which to store the values.
692 * @param count The number of elements to copy into the dictionary.
693 *
694 * @return A newly initialized dictionary with a copy of the values and keys.
695 **/
696 - (instancetype)initWithBools:(const BOOL [])values
697 forKeys:(const uint32_t [])keys
698 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
699
700 /**
701 * Initializes this dictionary, copying the entries from the given dictionary.
702 *
703 * @param dictionary Dictionary containing the entries to add to this dictionary .
704 *
705 * @return A newly initialized dictionary with the entries of the given dictiona ry.
706 **/
707 - (instancetype)initWithDictionary:(GPBUInt32BoolDictionary *)dictionary; 203 - (instancetype)initWithDictionary:(GPBUInt32BoolDictionary *)dictionary;
708 204 - (instancetype)initWithCapacity:(NSUInteger)numItems;
709 /** 205
710 * Initializes this dictionary with the requested capacity. 206 - (BOOL)valueForKey:(uint32_t)key value:(nullable BOOL *)value;
711 * 207
712 * @param numItems Number of items needed for this dictionary. 208 - (void)enumerateKeysAndValuesUsingBlock:
713 *
714 * @return A newly initialized dictionary with the requested capacity.
715 **/
716 - (instancetype)initWithCapacity:(NSUInteger)numItems;
717
718 /**
719 * Gets the value for the given key.
720 *
721 * @param value Pointer into which the value will be set, if found.
722 * @param key Key under which the value is stored, if present.
723 *
724 * @return YES if the key was found and the value was copied, NO otherwise.
725 **/
726 - (BOOL)getBool:(nullable BOOL *)value forKey:(uint32_t)key;
727
728 /**
729 * Enumerates the keys and values on this dictionary with the given block.
730 *
731 * @param block The block to enumerate with.
732 * **key**: The key for the current entry.
733 * **value**: The value for the current entry
734 * **stop**: A pointer to a boolean that when set stops the enumeration.
735 **/
736 - (void)enumerateKeysAndBoolsUsingBlock:
737 (void (^)(uint32_t key, BOOL value, BOOL *stop))block; 209 (void (^)(uint32_t key, BOOL value, BOOL *stop))block;
738 210
739 /**
740 * Adds the keys and values from another dictionary.
741 *
742 * @param otherDictionary Dictionary containing entries to be added to this
743 * dictionary.
744 **/
745 - (void)addEntriesFromDictionary:(GPBUInt32BoolDictionary *)otherDictionary; 211 - (void)addEntriesFromDictionary:(GPBUInt32BoolDictionary *)otherDictionary;
746 212
747 /** 213 - (void)setValue:(BOOL)value forKey:(uint32_t)key;
748 * Sets the value for the given key. 214
749 * 215 - (void)removeValueForKey:(uint32_t)aKey;
750 * @param value The value to set.
751 * @param key The key under which to store the value.
752 **/
753 - (void)setBool:(BOOL)value forKey:(uint32_t)key;
754
755 /**
756 * Removes the entry for the given key.
757 *
758 * @param aKey Key to be removed from this dictionary.
759 **/
760 - (void)removeBoolForKey:(uint32_t)aKey;
761
762 /**
763 * Removes all entries in this dictionary.
764 **/
765 - (void)removeAll; 216 - (void)removeAll;
766 217
767 @end 218 @end
768 219
769 #pragma mark - UInt32 -> Float 220 #pragma mark - UInt32 -> Float
770 221
771 /**
772 * Class used for map fields of <uint32_t, float>
773 * values. This performs better than boxing into NSNumbers in NSDictionaries.
774 *
775 * @note This class is not meant to be subclassed.
776 **/
777 @interface GPBUInt32FloatDictionary : NSObject <NSCopying> 222 @interface GPBUInt32FloatDictionary : NSObject <NSCopying>
778 223
779 /** Number of entries stored in this dictionary. */ 224 @property(nonatomic, readonly) NSUInteger count;
780 @property(nonatomic, readonly) NSUInteger count; 225
781 226 + (instancetype)dictionary;
782 /** 227 + (instancetype)dictionaryWithValue:(float)value
783 * @return A newly instanced and empty dictionary. 228 forKey:(uint32_t)key;
784 **/ 229 + (instancetype)dictionaryWithValues:(const float [])values
785 + (instancetype)dictionary; 230 forKeys:(const uint32_t [])keys
786 231 count:(NSUInteger)count;
787 /**
788 * Creates and initializes a dictionary with the single entry given.
789 *
790 * @param value The value to be placed in the dictionary.
791 * @param key The key under which to store the value.
792 *
793 * @return A newly instanced dictionary with the key and value in it.
794 **/
795 + (instancetype)dictionaryWithFloat:(float)value
796 forKey:(uint32_t)key;
797
798 /**
799 * Creates and initializes a dictionary with the entries given.
800 *
801 * @param values The values to be placed in the dictionary.
802 * @param keys The keys under which to store the values.
803 * @param count The number of entries to store in the dictionary.
804 *
805 * @return A newly instanced dictionary with the keys and values in it.
806 **/
807 + (instancetype)dictionaryWithFloats:(const float [])values
808 forKeys:(const uint32_t [])keys
809 count:(NSUInteger)count;
810
811 /**
812 * Creates and initializes a dictionary with the entries from the given.
813 * dictionary.
814 *
815 * @param dictionary Dictionary containing the entries to add to the dictionary.
816 *
817 * @return A newly instanced dictionary with the entries from the given
818 * dictionary in it.
819 **/
820 + (instancetype)dictionaryWithDictionary:(GPBUInt32FloatDictionary *)dictionary; 232 + (instancetype)dictionaryWithDictionary:(GPBUInt32FloatDictionary *)dictionary;
821 233 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
822 /** 234
823 * Creates and initializes a dictionary with the given capacity. 235 - (instancetype)initWithValues:(const float [])values
824 * 236 forKeys:(const uint32_t [])keys
825 * @param numItems Capacity needed for the dictionary. 237 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
826 *
827 * @return A newly instanced dictionary with the given capacity.
828 **/
829 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
830
831 /**
832 * Initializes this dictionary, copying the given values and keys.
833 *
834 * @param values The values to be placed in this dictionary.
835 * @param keys The keys under which to store the values.
836 * @param count The number of elements to copy into the dictionary.
837 *
838 * @return A newly initialized dictionary with a copy of the values and keys.
839 **/
840 - (instancetype)initWithFloats:(const float [])values
841 forKeys:(const uint32_t [])keys
842 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
843
844 /**
845 * Initializes this dictionary, copying the entries from the given dictionary.
846 *
847 * @param dictionary Dictionary containing the entries to add to this dictionary .
848 *
849 * @return A newly initialized dictionary with the entries of the given dictiona ry.
850 **/
851 - (instancetype)initWithDictionary:(GPBUInt32FloatDictionary *)dictionary; 238 - (instancetype)initWithDictionary:(GPBUInt32FloatDictionary *)dictionary;
852 239 - (instancetype)initWithCapacity:(NSUInteger)numItems;
853 /** 240
854 * Initializes this dictionary with the requested capacity. 241 - (BOOL)valueForKey:(uint32_t)key value:(nullable float *)value;
855 * 242
856 * @param numItems Number of items needed for this dictionary. 243 - (void)enumerateKeysAndValuesUsingBlock:
857 *
858 * @return A newly initialized dictionary with the requested capacity.
859 **/
860 - (instancetype)initWithCapacity:(NSUInteger)numItems;
861
862 /**
863 * Gets the value for the given key.
864 *
865 * @param value Pointer into which the value will be set, if found.
866 * @param key Key under which the value is stored, if present.
867 *
868 * @return YES if the key was found and the value was copied, NO otherwise.
869 **/
870 - (BOOL)getFloat:(nullable float *)value forKey:(uint32_t)key;
871
872 /**
873 * Enumerates the keys and values on this dictionary with the given block.
874 *
875 * @param block The block to enumerate with.
876 * **key**: The key for the current entry.
877 * **value**: The value for the current entry
878 * **stop**: A pointer to a boolean that when set stops the enumeration.
879 **/
880 - (void)enumerateKeysAndFloatsUsingBlock:
881 (void (^)(uint32_t key, float value, BOOL *stop))block; 244 (void (^)(uint32_t key, float value, BOOL *stop))block;
882 245
883 /**
884 * Adds the keys and values from another dictionary.
885 *
886 * @param otherDictionary Dictionary containing entries to be added to this
887 * dictionary.
888 **/
889 - (void)addEntriesFromDictionary:(GPBUInt32FloatDictionary *)otherDictionary; 246 - (void)addEntriesFromDictionary:(GPBUInt32FloatDictionary *)otherDictionary;
890 247
891 /** 248 - (void)setValue:(float)value forKey:(uint32_t)key;
892 * Sets the value for the given key. 249
893 * 250 - (void)removeValueForKey:(uint32_t)aKey;
894 * @param value The value to set.
895 * @param key The key under which to store the value.
896 **/
897 - (void)setFloat:(float)value forKey:(uint32_t)key;
898
899 /**
900 * Removes the entry for the given key.
901 *
902 * @param aKey Key to be removed from this dictionary.
903 **/
904 - (void)removeFloatForKey:(uint32_t)aKey;
905
906 /**
907 * Removes all entries in this dictionary.
908 **/
909 - (void)removeAll; 251 - (void)removeAll;
910 252
911 @end 253 @end
912 254
913 #pragma mark - UInt32 -> Double 255 #pragma mark - UInt32 -> Double
914 256
915 /**
916 * Class used for map fields of <uint32_t, double>
917 * values. This performs better than boxing into NSNumbers in NSDictionaries.
918 *
919 * @note This class is not meant to be subclassed.
920 **/
921 @interface GPBUInt32DoubleDictionary : NSObject <NSCopying> 257 @interface GPBUInt32DoubleDictionary : NSObject <NSCopying>
922 258
923 /** Number of entries stored in this dictionary. */ 259 @property(nonatomic, readonly) NSUInteger count;
924 @property(nonatomic, readonly) NSUInteger count; 260
925 261 + (instancetype)dictionary;
926 /** 262 + (instancetype)dictionaryWithValue:(double)value
927 * @return A newly instanced and empty dictionary. 263 forKey:(uint32_t)key;
928 **/ 264 + (instancetype)dictionaryWithValues:(const double [])values
929 + (instancetype)dictionary; 265 forKeys:(const uint32_t [])keys
930 266 count:(NSUInteger)count;
931 /**
932 * Creates and initializes a dictionary with the single entry given.
933 *
934 * @param value The value to be placed in the dictionary.
935 * @param key The key under which to store the value.
936 *
937 * @return A newly instanced dictionary with the key and value in it.
938 **/
939 + (instancetype)dictionaryWithDouble:(double)value
940 forKey:(uint32_t)key;
941
942 /**
943 * Creates and initializes a dictionary with the entries given.
944 *
945 * @param values The values to be placed in the dictionary.
946 * @param keys The keys under which to store the values.
947 * @param count The number of entries to store in the dictionary.
948 *
949 * @return A newly instanced dictionary with the keys and values in it.
950 **/
951 + (instancetype)dictionaryWithDoubles:(const double [])values
952 forKeys:(const uint32_t [])keys
953 count:(NSUInteger)count;
954
955 /**
956 * Creates and initializes a dictionary with the entries from the given.
957 * dictionary.
958 *
959 * @param dictionary Dictionary containing the entries to add to the dictionary.
960 *
961 * @return A newly instanced dictionary with the entries from the given
962 * dictionary in it.
963 **/
964 + (instancetype)dictionaryWithDictionary:(GPBUInt32DoubleDictionary *)dictionary ; 267 + (instancetype)dictionaryWithDictionary:(GPBUInt32DoubleDictionary *)dictionary ;
965 268 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
966 /** 269
967 * Creates and initializes a dictionary with the given capacity. 270 - (instancetype)initWithValues:(const double [])values
968 * 271 forKeys:(const uint32_t [])keys
969 * @param numItems Capacity needed for the dictionary. 272 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
970 *
971 * @return A newly instanced dictionary with the given capacity.
972 **/
973 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
974
975 /**
976 * Initializes this dictionary, copying the given values and keys.
977 *
978 * @param values The values to be placed in this dictionary.
979 * @param keys The keys under which to store the values.
980 * @param count The number of elements to copy into the dictionary.
981 *
982 * @return A newly initialized dictionary with a copy of the values and keys.
983 **/
984 - (instancetype)initWithDoubles:(const double [])values
985 forKeys:(const uint32_t [])keys
986 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
987
988 /**
989 * Initializes this dictionary, copying the entries from the given dictionary.
990 *
991 * @param dictionary Dictionary containing the entries to add to this dictionary .
992 *
993 * @return A newly initialized dictionary with the entries of the given dictiona ry.
994 **/
995 - (instancetype)initWithDictionary:(GPBUInt32DoubleDictionary *)dictionary; 273 - (instancetype)initWithDictionary:(GPBUInt32DoubleDictionary *)dictionary;
996 274 - (instancetype)initWithCapacity:(NSUInteger)numItems;
997 /** 275
998 * Initializes this dictionary with the requested capacity. 276 - (BOOL)valueForKey:(uint32_t)key value:(nullable double *)value;
999 * 277
1000 * @param numItems Number of items needed for this dictionary. 278 - (void)enumerateKeysAndValuesUsingBlock:
1001 *
1002 * @return A newly initialized dictionary with the requested capacity.
1003 **/
1004 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1005
1006 /**
1007 * Gets the value for the given key.
1008 *
1009 * @param value Pointer into which the value will be set, if found.
1010 * @param key Key under which the value is stored, if present.
1011 *
1012 * @return YES if the key was found and the value was copied, NO otherwise.
1013 **/
1014 - (BOOL)getDouble:(nullable double *)value forKey:(uint32_t)key;
1015
1016 /**
1017 * Enumerates the keys and values on this dictionary with the given block.
1018 *
1019 * @param block The block to enumerate with.
1020 * **key**: The key for the current entry.
1021 * **value**: The value for the current entry
1022 * **stop**: A pointer to a boolean that when set stops the enumeration.
1023 **/
1024 - (void)enumerateKeysAndDoublesUsingBlock:
1025 (void (^)(uint32_t key, double value, BOOL *stop))block; 279 (void (^)(uint32_t key, double value, BOOL *stop))block;
1026 280
1027 /**
1028 * Adds the keys and values from another dictionary.
1029 *
1030 * @param otherDictionary Dictionary containing entries to be added to this
1031 * dictionary.
1032 **/
1033 - (void)addEntriesFromDictionary:(GPBUInt32DoubleDictionary *)otherDictionary; 281 - (void)addEntriesFromDictionary:(GPBUInt32DoubleDictionary *)otherDictionary;
1034 282
1035 /** 283 - (void)setValue:(double)value forKey:(uint32_t)key;
1036 * Sets the value for the given key. 284
1037 * 285 - (void)removeValueForKey:(uint32_t)aKey;
1038 * @param value The value to set.
1039 * @param key The key under which to store the value.
1040 **/
1041 - (void)setDouble:(double)value forKey:(uint32_t)key;
1042
1043 /**
1044 * Removes the entry for the given key.
1045 *
1046 * @param aKey Key to be removed from this dictionary.
1047 **/
1048 - (void)removeDoubleForKey:(uint32_t)aKey;
1049
1050 /**
1051 * Removes all entries in this dictionary.
1052 **/
1053 - (void)removeAll; 286 - (void)removeAll;
1054 287
1055 @end 288 @end
1056 289
1057 #pragma mark - UInt32 -> Enum 290 #pragma mark - UInt32 -> Enum
1058 291
1059 /**
1060 * Class used for map fields of <uint32_t, int32_t>
1061 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1062 *
1063 * @note This class is not meant to be subclassed.
1064 **/
1065 @interface GPBUInt32EnumDictionary : NSObject <NSCopying> 292 @interface GPBUInt32EnumDictionary : NSObject <NSCopying>
1066 293
1067 /** Number of entries stored in this dictionary. */ 294 @property(nonatomic, readonly) NSUInteger count;
1068 @property(nonatomic, readonly) NSUInteger count;
1069 /** The validation function to check if the enums are valid. */
1070 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 295 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
1071 296
1072 /** 297 + (instancetype)dictionary;
1073 * @return A newly instanced and empty dictionary.
1074 **/
1075 + (instancetype)dictionary;
1076
1077 /**
1078 * Creates and initializes a dictionary with the given validation function.
1079 *
1080 * @param func The enum validation function for the dictionary.
1081 *
1082 * @return A newly instanced dictionary.
1083 **/
1084 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func; 298 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func;
1085
1086 /**
1087 * Creates and initializes a dictionary with the single entry given.
1088 *
1089 * @param func The enum validation function for the dictionary.
1090 * @param rawValue The raw enum value to be placed in the dictionary.
1091 * @param key The key under which to store the value.
1092 *
1093 * @return A newly instanced dictionary with the key and value in it.
1094 **/
1095 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 299 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
1096 rawValue:(int32_t)rawValue 300 rawValue:(int32_t)rawValue
1097 forKey:(uint32_t)key; 301 forKey:(uint32_t)key;
1098
1099 /**
1100 * Creates and initializes a dictionary with the entries given.
1101 *
1102 * @param func The enum validation function for the dictionary.
1103 * @param values The raw enum values values to be placed in the dictionary.
1104 * @param keys The keys under which to store the values.
1105 * @param count The number of entries to store in the dictionary.
1106 *
1107 * @return A newly instanced dictionary with the keys and values in it.
1108 **/
1109 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 302 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
1110 rawValues:(const int32_t [])values 303 rawValues:(const int32_t [])values
1111 forKeys:(const uint32_t [])keys 304 forKeys:(const uint32_t [])keys
1112 count:(NSUInteger)count; 305 count:(NSUInteger)count;
1113
1114 /**
1115 * Creates and initializes a dictionary with the entries from the given.
1116 * dictionary.
1117 *
1118 * @param dictionary Dictionary containing the entries to add to the dictionary.
1119 *
1120 * @return A newly instanced dictionary with the entries from the given
1121 * dictionary in it.
1122 **/
1123 + (instancetype)dictionaryWithDictionary:(GPBUInt32EnumDictionary *)dictionary; 306 + (instancetype)dictionaryWithDictionary:(GPBUInt32EnumDictionary *)dictionary;
1124
1125 /**
1126 * Creates and initializes a dictionary with the given capacity.
1127 *
1128 * @param func The enum validation function for the dictionary.
1129 * @param numItems Capacity needed for the dictionary.
1130 *
1131 * @return A newly instanced dictionary with the given capacity.
1132 **/
1133 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 307 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
1134 capacity:(NSUInteger)numItems; 308 capacity:(NSUInteger)numItems;
1135 309
1136 /**
1137 * Initializes a dictionary with the given validation function.
1138 *
1139 * @param func The enum validation function for the dictionary.
1140 *
1141 * @return A newly initialized dictionary.
1142 **/
1143 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 310 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
1144
1145 /**
1146 * Initializes a dictionary with the entries given.
1147 *
1148 * @param func The enum validation function for the dictionary.
1149 * @param values The raw enum values values to be placed in the dictionary.
1150 * @param keys The keys under which to store the values.
1151 * @param count The number of entries to store in the dictionary.
1152 *
1153 * @return A newly initialized dictionary with the keys and values in it.
1154 **/
1155 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 311 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1156 rawValues:(const int32_t [])values 312 rawValues:(const int32_t [])values
1157 forKeys:(const uint32_t [])keys 313 forKeys:(const uint32_t [])keys
1158 count:(NSUInteger)count NS_DESIGNATED_INITI ALIZER; 314 count:(NSUInteger)count NS_DESIGNATED_INITI ALIZER;
1159
1160 /**
1161 * Initializes a dictionary with the entries from the given.
1162 * dictionary.
1163 *
1164 * @param dictionary Dictionary containing the entries to add to the dictionary.
1165 *
1166 * @return A newly initialized dictionary with the entries from the given
1167 * dictionary in it.
1168 **/
1169 - (instancetype)initWithDictionary:(GPBUInt32EnumDictionary *)dictionary; 315 - (instancetype)initWithDictionary:(GPBUInt32EnumDictionary *)dictionary;
1170
1171 /**
1172 * Initializes a dictionary with the given capacity.
1173 *
1174 * @param func The enum validation function for the dictionary.
1175 * @param numItems Capacity needed for the dictionary.
1176 *
1177 * @return A newly initialized dictionary with the given capacity.
1178 **/
1179 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 316 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
1180 capacity:(NSUInteger)numItems; 317 capacity:(NSUInteger)numItems;
1181 318
1182 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 319 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
1183 // is not a valid enumerator as defined by validationFunc. If the actual value i s 320 // is not a valid enumerator as defined by validationFunc. If the actual value i s
1184 // desired, use "raw" version of the method. 321 // desired, use "raw" version of the method.
1185 322
1186 /** 323 - (BOOL)valueForKey:(uint32_t)key value:(nullable int32_t *)value;
1187 * Gets the value for the given key.
1188 *
1189 * @param value Pointer into which the value will be set, if found.
1190 * @param key Key under which the value is stored, if present.
1191 *
1192 * @return YES if the key was found and the value was copied, NO otherwise.
1193 **/
1194 - (BOOL)getEnum:(nullable int32_t *)value forKey:(uint32_t)key;
1195 324
1196 /** 325 - (void)enumerateKeysAndValuesUsingBlock:
1197 * Enumerates the keys and values on this dictionary with the given block.
1198 *
1199 * @param block The block to enumerate with.
1200 * **key**: The key for the current entry.
1201 * **value**: The value for the current entry
1202 * **stop**: A pointer to a boolean that when set stops the enumeration.
1203 **/
1204 - (void)enumerateKeysAndEnumsUsingBlock:
1205 (void (^)(uint32_t key, int32_t value, BOOL *stop))block; 326 (void (^)(uint32_t key, int32_t value, BOOL *stop))block;
1206 327
1207 /** 328 // These methods bypass the validationFunc to provide access to values that were not
1208 * Gets the raw enum value for the given key. 329 // known at the time the binary was compiled.
1209 *
1210 * @note This method bypass the validationFunc to enable the access of values th at
1211 * were not known at the time the binary was compiled.
1212 *
1213 * @param rawValue Pointer into which the value will be set, if found.
1214 * @param key Key under which the value is stored, if present.
1215 *
1216 * @return YES if the key was found and the value was copied, NO otherwise.
1217 **/
1218 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint32_t)key;
1219 330
1220 /** 331 - (BOOL)valueForKey:(uint32_t)key rawValue:(nullable int32_t *)rawValue;
1221 * Enumerates the keys and values on this dictionary with the given block. 332
1222 *
1223 * @note This method bypass the validationFunc to enable the access of values th at
1224 * were not known at the time the binary was compiled.
1225 *
1226 * @param block The block to enumerate with.
1227 * **key**: The key for the current entry.
1228 * **rawValue**: The value for the current entry
1229 * **stop**: A pointer to a boolean that when set stops the enumeration.
1230 **/
1231 - (void)enumerateKeysAndRawValuesUsingBlock: 333 - (void)enumerateKeysAndRawValuesUsingBlock:
1232 (void (^)(uint32_t key, int32_t rawValue, BOOL *stop))block; 334 (void (^)(uint32_t key, int32_t rawValue, BOOL *stop))block;
1233 335
1234 /**
1235 * Adds the keys and raw enum values from another dictionary.
1236 *
1237 * @note This method bypass the validationFunc to enable the setting of values t hat
1238 * were not known at the time the binary was compiled.
1239 *
1240 * @param otherDictionary Dictionary containing entries to be added to this
1241 * dictionary.
1242 **/
1243 - (void)addRawEntriesFromDictionary:(GPBUInt32EnumDictionary *)otherDictionary; 336 - (void)addRawEntriesFromDictionary:(GPBUInt32EnumDictionary *)otherDictionary;
1244 337
1245 // If value is not a valid enumerator as defined by validationFunc, these 338 // If value is not a valid enumerator as defined by validationFunc, these
1246 // methods will assert in debug, and will log in release and assign the value 339 // methods will assert in debug, and will log in release and assign the value
1247 // to the default value. Use the rawValue methods below to assign non enumerator 340 // to the default value. Use the rawValue methods below to assign non enumerator
1248 // values. 341 // values.
1249 342
1250 /** 343 - (void)setValue:(int32_t)value forKey:(uint32_t)key;
1251 * Sets the value for the given key. 344
1252 * 345 // This method bypass the validationFunc to provide setting of values that were not
1253 * @param value The value to set. 346 // known at the time the binary was compiled.
1254 * @param key The key under which to store the value.
1255 **/
1256 - (void)setEnum:(int32_t)value forKey:(uint32_t)key;
1257
1258 /**
1259 * Sets the raw enum value for the given key.
1260 *
1261 * @note This method bypass the validationFunc to enable the setting of values t hat
1262 * were not known at the time the binary was compiled.
1263 *
1264 * @param rawValue The raw enum value to set.
1265 * @param key The key under which to store the raw enum value.
1266 **/
1267 - (void)setRawValue:(int32_t)rawValue forKey:(uint32_t)key; 347 - (void)setRawValue:(int32_t)rawValue forKey:(uint32_t)key;
1268 348
1269 /** 349 // No validation applies to these methods.
1270 * Removes the entry for the given key. 350
1271 * 351 - (void)removeValueForKey:(uint32_t)aKey;
1272 * @param aKey Key to be removed from this dictionary.
1273 **/
1274 - (void)removeEnumForKey:(uint32_t)aKey;
1275
1276 /**
1277 * Removes all entries in this dictionary.
1278 **/
1279 - (void)removeAll; 352 - (void)removeAll;
1280 353
1281 @end 354 @end
1282 355
1283 #pragma mark - UInt32 -> Object 356 #pragma mark - UInt32 -> Object
1284 357
1285 /**
1286 * Class used for map fields of <uint32_t, ObjectType>
1287 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1288 *
1289 * @note This class is not meant to be subclassed.
1290 **/
1291 @interface GPBUInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyi ng> 358 @interface GPBUInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyi ng>
1292 359
1293 /** Number of entries stored in this dictionary. */ 360 @property(nonatomic, readonly) NSUInteger count;
1294 @property(nonatomic, readonly) NSUInteger count; 361
1295 362 + (instancetype)dictionary;
1296 /**
1297 * @return A newly instanced and empty dictionary.
1298 **/
1299 + (instancetype)dictionary;
1300
1301 /**
1302 * Creates and initializes a dictionary with the single entry given.
1303 *
1304 * @param object The value to be placed in the dictionary.
1305 * @param key The key under which to store the value.
1306 *
1307 * @return A newly instanced dictionary with the key and value in it.
1308 **/
1309 + (instancetype)dictionaryWithObject:(ObjectType)object 363 + (instancetype)dictionaryWithObject:(ObjectType)object
1310 forKey:(uint32_t)key; 364 forKey:(uint32_t)key;
1311
1312 /**
1313 * Creates and initializes a dictionary with the entries given.
1314 *
1315 * @param objects The values to be placed in the dictionary.
1316 * @param keys The keys under which to store the values.
1317 * @param count The number of entries to store in the dictionary.
1318 *
1319 * @return A newly instanced dictionary with the keys and values in it.
1320 **/
1321 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [] )objects 365 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [] )objects
1322 forKeys:(const uint32_t [])keys 366 forKeys:(const uint32_t [])keys
1323 count:(NSUInteger)count; 367 count:(NSUInteger)count;
1324
1325 /**
1326 * Creates and initializes a dictionary with the entries from the given.
1327 * dictionary.
1328 *
1329 * @param dictionary Dictionary containing the entries to add to the dictionary.
1330 *
1331 * @return A newly instanced dictionary with the entries from the given
1332 * dictionary in it.
1333 **/
1334 + (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary ; 368 + (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary ;
1335 369 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
1336 /** 370
1337 * Creates and initializes a dictionary with the given capacity.
1338 *
1339 * @param numItems Capacity needed for the dictionary.
1340 *
1341 * @return A newly instanced dictionary with the given capacity.
1342 **/
1343 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
1344
1345 /**
1346 * Initializes this dictionary, copying the given values and keys.
1347 *
1348 * @param objects The values to be placed in this dictionary.
1349 * @param keys The keys under which to store the values.
1350 * @param count The number of elements to copy into the dictionary.
1351 *
1352 * @return A newly initialized dictionary with a copy of the values and keys.
1353 **/
1354 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec ts 371 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec ts
1355 forKeys:(const uint32_t [])keys 372 forKeys:(const uint32_t [])keys
1356 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 373 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1357
1358 /**
1359 * Initializes this dictionary, copying the entries from the given dictionary.
1360 *
1361 * @param dictionary Dictionary containing the entries to add to this dictionary .
1362 *
1363 * @return A newly initialized dictionary with the entries of the given dictiona ry.
1364 **/
1365 - (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary; 374 - (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
1366 375 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1367 /** 376
1368 * Initializes this dictionary with the requested capacity.
1369 *
1370 * @param numItems Number of items needed for this dictionary.
1371 *
1372 * @return A newly initialized dictionary with the requested capacity.
1373 **/
1374 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1375
1376 /**
1377 * Fetches the object stored under the given key.
1378 *
1379 * @param key Key under which the value is stored, if present.
1380 *
1381 * @return The object if found, nil otherwise.
1382 **/
1383 - (ObjectType)objectForKey:(uint32_t)key; 377 - (ObjectType)objectForKey:(uint32_t)key;
1384 378
1385 /**
1386 * Enumerates the keys and values on this dictionary with the given block.
1387 *
1388 * @param block The block to enumerate with.
1389 * **key**: The key for the current entry.
1390 * **object**: The value for the current entry
1391 * **stop**: A pointer to a boolean that when set stops the enumeration .
1392 **/
1393 - (void)enumerateKeysAndObjectsUsingBlock: 379 - (void)enumerateKeysAndObjectsUsingBlock:
1394 (void (^)(uint32_t key, ObjectType object, BOOL *stop))block; 380 (void (^)(uint32_t key, ObjectType object, BOOL *stop))block;
1395 381
1396 /**
1397 * Adds the keys and values from another dictionary.
1398 *
1399 * @param otherDictionary Dictionary containing entries to be added to this
1400 * dictionary.
1401 **/
1402 - (void)addEntriesFromDictionary:(GPBUInt32ObjectDictionary *)otherDictionary; 382 - (void)addEntriesFromDictionary:(GPBUInt32ObjectDictionary *)otherDictionary;
1403 383
1404 /**
1405 * Sets the value for the given key.
1406 *
1407 * @param object The value to set.
1408 * @param key The key under which to store the value.
1409 **/
1410 - (void)setObject:(ObjectType)object forKey:(uint32_t)key; 384 - (void)setObject:(ObjectType)object forKey:(uint32_t)key;
1411 385
1412 /**
1413 * Removes the entry for the given key.
1414 *
1415 * @param aKey Key to be removed from this dictionary.
1416 **/
1417 - (void)removeObjectForKey:(uint32_t)aKey; 386 - (void)removeObjectForKey:(uint32_t)aKey;
1418
1419 /**
1420 * Removes all entries in this dictionary.
1421 **/
1422 - (void)removeAll; 387 - (void)removeAll;
1423 388
1424 @end 389 @end
1425 390
1426 #pragma mark - Int32 -> UInt32 391 #pragma mark - Int32 -> UInt32
1427 392
1428 /**
1429 * Class used for map fields of <int32_t, uint32_t>
1430 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1431 *
1432 * @note This class is not meant to be subclassed.
1433 **/
1434 @interface GPBInt32UInt32Dictionary : NSObject <NSCopying> 393 @interface GPBInt32UInt32Dictionary : NSObject <NSCopying>
1435 394
1436 /** Number of entries stored in this dictionary. */ 395 @property(nonatomic, readonly) NSUInteger count;
1437 @property(nonatomic, readonly) NSUInteger count; 396
1438 397 + (instancetype)dictionary;
1439 /** 398 + (instancetype)dictionaryWithValue:(uint32_t)value
1440 * @return A newly instanced and empty dictionary. 399 forKey:(int32_t)key;
1441 **/ 400 + (instancetype)dictionaryWithValues:(const uint32_t [])values
1442 + (instancetype)dictionary; 401 forKeys:(const int32_t [])keys
1443 402 count:(NSUInteger)count;
1444 /**
1445 * Creates and initializes a dictionary with the single entry given.
1446 *
1447 * @param value The value to be placed in the dictionary.
1448 * @param key The key under which to store the value.
1449 *
1450 * @return A newly instanced dictionary with the key and value in it.
1451 **/
1452 + (instancetype)dictionaryWithUInt32:(uint32_t)value
1453 forKey:(int32_t)key;
1454
1455 /**
1456 * Creates and initializes a dictionary with the entries given.
1457 *
1458 * @param values The values to be placed in the dictionary.
1459 * @param keys The keys under which to store the values.
1460 * @param count The number of entries to store in the dictionary.
1461 *
1462 * @return A newly instanced dictionary with the keys and values in it.
1463 **/
1464 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
1465 forKeys:(const int32_t [])keys
1466 count:(NSUInteger)count;
1467
1468 /**
1469 * Creates and initializes a dictionary with the entries from the given.
1470 * dictionary.
1471 *
1472 * @param dictionary Dictionary containing the entries to add to the dictionary.
1473 *
1474 * @return A newly instanced dictionary with the entries from the given
1475 * dictionary in it.
1476 **/
1477 + (instancetype)dictionaryWithDictionary:(GPBInt32UInt32Dictionary *)dictionary; 403 + (instancetype)dictionaryWithDictionary:(GPBInt32UInt32Dictionary *)dictionary;
1478 404 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
1479 /** 405
1480 * Creates and initializes a dictionary with the given capacity. 406 - (instancetype)initWithValues:(const uint32_t [])values
1481 * 407 forKeys:(const int32_t [])keys
1482 * @param numItems Capacity needed for the dictionary. 408 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1483 *
1484 * @return A newly instanced dictionary with the given capacity.
1485 **/
1486 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
1487
1488 /**
1489 * Initializes this dictionary, copying the given values and keys.
1490 *
1491 * @param values The values to be placed in this dictionary.
1492 * @param keys The keys under which to store the values.
1493 * @param count The number of elements to copy into the dictionary.
1494 *
1495 * @return A newly initialized dictionary with a copy of the values and keys.
1496 **/
1497 - (instancetype)initWithUInt32s:(const uint32_t [])values
1498 forKeys:(const int32_t [])keys
1499 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1500
1501 /**
1502 * Initializes this dictionary, copying the entries from the given dictionary.
1503 *
1504 * @param dictionary Dictionary containing the entries to add to this dictionary .
1505 *
1506 * @return A newly initialized dictionary with the entries of the given dictiona ry.
1507 **/
1508 - (instancetype)initWithDictionary:(GPBInt32UInt32Dictionary *)dictionary; 409 - (instancetype)initWithDictionary:(GPBInt32UInt32Dictionary *)dictionary;
1509 410 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1510 /** 411
1511 * Initializes this dictionary with the requested capacity. 412 - (BOOL)valueForKey:(int32_t)key value:(nullable uint32_t *)value;
1512 * 413
1513 * @param numItems Number of items needed for this dictionary. 414 - (void)enumerateKeysAndValuesUsingBlock:
1514 *
1515 * @return A newly initialized dictionary with the requested capacity.
1516 **/
1517 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1518
1519 /**
1520 * Gets the value for the given key.
1521 *
1522 * @param value Pointer into which the value will be set, if found.
1523 * @param key Key under which the value is stored, if present.
1524 *
1525 * @return YES if the key was found and the value was copied, NO otherwise.
1526 **/
1527 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int32_t)key;
1528
1529 /**
1530 * Enumerates the keys and values on this dictionary with the given block.
1531 *
1532 * @param block The block to enumerate with.
1533 * **key**: The key for the current entry.
1534 * **value**: The value for the current entry
1535 * **stop**: A pointer to a boolean that when set stops the enumeration.
1536 **/
1537 - (void)enumerateKeysAndUInt32sUsingBlock:
1538 (void (^)(int32_t key, uint32_t value, BOOL *stop))block; 415 (void (^)(int32_t key, uint32_t value, BOOL *stop))block;
1539 416
1540 /**
1541 * Adds the keys and values from another dictionary.
1542 *
1543 * @param otherDictionary Dictionary containing entries to be added to this
1544 * dictionary.
1545 **/
1546 - (void)addEntriesFromDictionary:(GPBInt32UInt32Dictionary *)otherDictionary; 417 - (void)addEntriesFromDictionary:(GPBInt32UInt32Dictionary *)otherDictionary;
1547 418
1548 /** 419 - (void)setValue:(uint32_t)value forKey:(int32_t)key;
1549 * Sets the value for the given key. 420
1550 * 421 - (void)removeValueForKey:(int32_t)aKey;
1551 * @param value The value to set.
1552 * @param key The key under which to store the value.
1553 **/
1554 - (void)setUInt32:(uint32_t)value forKey:(int32_t)key;
1555
1556 /**
1557 * Removes the entry for the given key.
1558 *
1559 * @param aKey Key to be removed from this dictionary.
1560 **/
1561 - (void)removeUInt32ForKey:(int32_t)aKey;
1562
1563 /**
1564 * Removes all entries in this dictionary.
1565 **/
1566 - (void)removeAll; 422 - (void)removeAll;
1567 423
1568 @end 424 @end
1569 425
1570 #pragma mark - Int32 -> Int32 426 #pragma mark - Int32 -> Int32
1571 427
1572 /**
1573 * Class used for map fields of <int32_t, int32_t>
1574 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1575 *
1576 * @note This class is not meant to be subclassed.
1577 **/
1578 @interface GPBInt32Int32Dictionary : NSObject <NSCopying> 428 @interface GPBInt32Int32Dictionary : NSObject <NSCopying>
1579 429
1580 /** Number of entries stored in this dictionary. */ 430 @property(nonatomic, readonly) NSUInteger count;
1581 @property(nonatomic, readonly) NSUInteger count; 431
1582 432 + (instancetype)dictionary;
1583 /** 433 + (instancetype)dictionaryWithValue:(int32_t)value
1584 * @return A newly instanced and empty dictionary. 434 forKey:(int32_t)key;
1585 **/ 435 + (instancetype)dictionaryWithValues:(const int32_t [])values
1586 + (instancetype)dictionary; 436 forKeys:(const int32_t [])keys
1587 437 count:(NSUInteger)count;
1588 /**
1589 * Creates and initializes a dictionary with the single entry given.
1590 *
1591 * @param value The value to be placed in the dictionary.
1592 * @param key The key under which to store the value.
1593 *
1594 * @return A newly instanced dictionary with the key and value in it.
1595 **/
1596 + (instancetype)dictionaryWithInt32:(int32_t)value
1597 forKey:(int32_t)key;
1598
1599 /**
1600 * Creates and initializes a dictionary with the entries given.
1601 *
1602 * @param values The values to be placed in the dictionary.
1603 * @param keys The keys under which to store the values.
1604 * @param count The number of entries to store in the dictionary.
1605 *
1606 * @return A newly instanced dictionary with the keys and values in it.
1607 **/
1608 + (instancetype)dictionaryWithInt32s:(const int32_t [])values
1609 forKeys:(const int32_t [])keys
1610 count:(NSUInteger)count;
1611
1612 /**
1613 * Creates and initializes a dictionary with the entries from the given.
1614 * dictionary.
1615 *
1616 * @param dictionary Dictionary containing the entries to add to the dictionary.
1617 *
1618 * @return A newly instanced dictionary with the entries from the given
1619 * dictionary in it.
1620 **/
1621 + (instancetype)dictionaryWithDictionary:(GPBInt32Int32Dictionary *)dictionary; 438 + (instancetype)dictionaryWithDictionary:(GPBInt32Int32Dictionary *)dictionary;
1622 439 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
1623 /** 440
1624 * Creates and initializes a dictionary with the given capacity. 441 - (instancetype)initWithValues:(const int32_t [])values
1625 * 442 forKeys:(const int32_t [])keys
1626 * @param numItems Capacity needed for the dictionary. 443 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1627 *
1628 * @return A newly instanced dictionary with the given capacity.
1629 **/
1630 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
1631
1632 /**
1633 * Initializes this dictionary, copying the given values and keys.
1634 *
1635 * @param values The values to be placed in this dictionary.
1636 * @param keys The keys under which to store the values.
1637 * @param count The number of elements to copy into the dictionary.
1638 *
1639 * @return A newly initialized dictionary with a copy of the values and keys.
1640 **/
1641 - (instancetype)initWithInt32s:(const int32_t [])values
1642 forKeys:(const int32_t [])keys
1643 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1644
1645 /**
1646 * Initializes this dictionary, copying the entries from the given dictionary.
1647 *
1648 * @param dictionary Dictionary containing the entries to add to this dictionary .
1649 *
1650 * @return A newly initialized dictionary with the entries of the given dictiona ry.
1651 **/
1652 - (instancetype)initWithDictionary:(GPBInt32Int32Dictionary *)dictionary; 444 - (instancetype)initWithDictionary:(GPBInt32Int32Dictionary *)dictionary;
1653 445 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1654 /** 446
1655 * Initializes this dictionary with the requested capacity. 447 - (BOOL)valueForKey:(int32_t)key value:(nullable int32_t *)value;
1656 * 448
1657 * @param numItems Number of items needed for this dictionary. 449 - (void)enumerateKeysAndValuesUsingBlock:
1658 *
1659 * @return A newly initialized dictionary with the requested capacity.
1660 **/
1661 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1662
1663 /**
1664 * Gets the value for the given key.
1665 *
1666 * @param value Pointer into which the value will be set, if found.
1667 * @param key Key under which the value is stored, if present.
1668 *
1669 * @return YES if the key was found and the value was copied, NO otherwise.
1670 **/
1671 - (BOOL)getInt32:(nullable int32_t *)value forKey:(int32_t)key;
1672
1673 /**
1674 * Enumerates the keys and values on this dictionary with the given block.
1675 *
1676 * @param block The block to enumerate with.
1677 * **key**: The key for the current entry.
1678 * **value**: The value for the current entry
1679 * **stop**: A pointer to a boolean that when set stops the enumeration.
1680 **/
1681 - (void)enumerateKeysAndInt32sUsingBlock:
1682 (void (^)(int32_t key, int32_t value, BOOL *stop))block; 450 (void (^)(int32_t key, int32_t value, BOOL *stop))block;
1683 451
1684 /**
1685 * Adds the keys and values from another dictionary.
1686 *
1687 * @param otherDictionary Dictionary containing entries to be added to this
1688 * dictionary.
1689 **/
1690 - (void)addEntriesFromDictionary:(GPBInt32Int32Dictionary *)otherDictionary; 452 - (void)addEntriesFromDictionary:(GPBInt32Int32Dictionary *)otherDictionary;
1691 453
1692 /** 454 - (void)setValue:(int32_t)value forKey:(int32_t)key;
1693 * Sets the value for the given key. 455
1694 * 456 - (void)removeValueForKey:(int32_t)aKey;
1695 * @param value The value to set.
1696 * @param key The key under which to store the value.
1697 **/
1698 - (void)setInt32:(int32_t)value forKey:(int32_t)key;
1699
1700 /**
1701 * Removes the entry for the given key.
1702 *
1703 * @param aKey Key to be removed from this dictionary.
1704 **/
1705 - (void)removeInt32ForKey:(int32_t)aKey;
1706
1707 /**
1708 * Removes all entries in this dictionary.
1709 **/
1710 - (void)removeAll; 457 - (void)removeAll;
1711 458
1712 @end 459 @end
1713 460
1714 #pragma mark - Int32 -> UInt64 461 #pragma mark - Int32 -> UInt64
1715 462
1716 /**
1717 * Class used for map fields of <int32_t, uint64_t>
1718 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1719 *
1720 * @note This class is not meant to be subclassed.
1721 **/
1722 @interface GPBInt32UInt64Dictionary : NSObject <NSCopying> 463 @interface GPBInt32UInt64Dictionary : NSObject <NSCopying>
1723 464
1724 /** Number of entries stored in this dictionary. */ 465 @property(nonatomic, readonly) NSUInteger count;
1725 @property(nonatomic, readonly) NSUInteger count; 466
1726 467 + (instancetype)dictionary;
1727 /** 468 + (instancetype)dictionaryWithValue:(uint64_t)value
1728 * @return A newly instanced and empty dictionary. 469 forKey:(int32_t)key;
1729 **/ 470 + (instancetype)dictionaryWithValues:(const uint64_t [])values
1730 + (instancetype)dictionary; 471 forKeys:(const int32_t [])keys
1731 472 count:(NSUInteger)count;
1732 /**
1733 * Creates and initializes a dictionary with the single entry given.
1734 *
1735 * @param value The value to be placed in the dictionary.
1736 * @param key The key under which to store the value.
1737 *
1738 * @return A newly instanced dictionary with the key and value in it.
1739 **/
1740 + (instancetype)dictionaryWithUInt64:(uint64_t)value
1741 forKey:(int32_t)key;
1742
1743 /**
1744 * Creates and initializes a dictionary with the entries given.
1745 *
1746 * @param values The values to be placed in the dictionary.
1747 * @param keys The keys under which to store the values.
1748 * @param count The number of entries to store in the dictionary.
1749 *
1750 * @return A newly instanced dictionary with the keys and values in it.
1751 **/
1752 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
1753 forKeys:(const int32_t [])keys
1754 count:(NSUInteger)count;
1755
1756 /**
1757 * Creates and initializes a dictionary with the entries from the given.
1758 * dictionary.
1759 *
1760 * @param dictionary Dictionary containing the entries to add to the dictionary.
1761 *
1762 * @return A newly instanced dictionary with the entries from the given
1763 * dictionary in it.
1764 **/
1765 + (instancetype)dictionaryWithDictionary:(GPBInt32UInt64Dictionary *)dictionary; 473 + (instancetype)dictionaryWithDictionary:(GPBInt32UInt64Dictionary *)dictionary;
1766 474 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
1767 /** 475
1768 * Creates and initializes a dictionary with the given capacity. 476 - (instancetype)initWithValues:(const uint64_t [])values
1769 * 477 forKeys:(const int32_t [])keys
1770 * @param numItems Capacity needed for the dictionary. 478 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1771 *
1772 * @return A newly instanced dictionary with the given capacity.
1773 **/
1774 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
1775
1776 /**
1777 * Initializes this dictionary, copying the given values and keys.
1778 *
1779 * @param values The values to be placed in this dictionary.
1780 * @param keys The keys under which to store the values.
1781 * @param count The number of elements to copy into the dictionary.
1782 *
1783 * @return A newly initialized dictionary with a copy of the values and keys.
1784 **/
1785 - (instancetype)initWithUInt64s:(const uint64_t [])values
1786 forKeys:(const int32_t [])keys
1787 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1788
1789 /**
1790 * Initializes this dictionary, copying the entries from the given dictionary.
1791 *
1792 * @param dictionary Dictionary containing the entries to add to this dictionary .
1793 *
1794 * @return A newly initialized dictionary with the entries of the given dictiona ry.
1795 **/
1796 - (instancetype)initWithDictionary:(GPBInt32UInt64Dictionary *)dictionary; 479 - (instancetype)initWithDictionary:(GPBInt32UInt64Dictionary *)dictionary;
1797 480 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1798 /** 481
1799 * Initializes this dictionary with the requested capacity. 482 - (BOOL)valueForKey:(int32_t)key value:(nullable uint64_t *)value;
1800 * 483
1801 * @param numItems Number of items needed for this dictionary. 484 - (void)enumerateKeysAndValuesUsingBlock:
1802 *
1803 * @return A newly initialized dictionary with the requested capacity.
1804 **/
1805 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1806
1807 /**
1808 * Gets the value for the given key.
1809 *
1810 * @param value Pointer into which the value will be set, if found.
1811 * @param key Key under which the value is stored, if present.
1812 *
1813 * @return YES if the key was found and the value was copied, NO otherwise.
1814 **/
1815 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int32_t)key;
1816
1817 /**
1818 * Enumerates the keys and values on this dictionary with the given block.
1819 *
1820 * @param block The block to enumerate with.
1821 * **key**: The key for the current entry.
1822 * **value**: The value for the current entry
1823 * **stop**: A pointer to a boolean that when set stops the enumeration.
1824 **/
1825 - (void)enumerateKeysAndUInt64sUsingBlock:
1826 (void (^)(int32_t key, uint64_t value, BOOL *stop))block; 485 (void (^)(int32_t key, uint64_t value, BOOL *stop))block;
1827 486
1828 /**
1829 * Adds the keys and values from another dictionary.
1830 *
1831 * @param otherDictionary Dictionary containing entries to be added to this
1832 * dictionary.
1833 **/
1834 - (void)addEntriesFromDictionary:(GPBInt32UInt64Dictionary *)otherDictionary; 487 - (void)addEntriesFromDictionary:(GPBInt32UInt64Dictionary *)otherDictionary;
1835 488
1836 /** 489 - (void)setValue:(uint64_t)value forKey:(int32_t)key;
1837 * Sets the value for the given key. 490
1838 * 491 - (void)removeValueForKey:(int32_t)aKey;
1839 * @param value The value to set.
1840 * @param key The key under which to store the value.
1841 **/
1842 - (void)setUInt64:(uint64_t)value forKey:(int32_t)key;
1843
1844 /**
1845 * Removes the entry for the given key.
1846 *
1847 * @param aKey Key to be removed from this dictionary.
1848 **/
1849 - (void)removeUInt64ForKey:(int32_t)aKey;
1850
1851 /**
1852 * Removes all entries in this dictionary.
1853 **/
1854 - (void)removeAll; 492 - (void)removeAll;
1855 493
1856 @end 494 @end
1857 495
1858 #pragma mark - Int32 -> Int64 496 #pragma mark - Int32 -> Int64
1859 497
1860 /**
1861 * Class used for map fields of <int32_t, int64_t>
1862 * values. This performs better than boxing into NSNumbers in NSDictionaries.
1863 *
1864 * @note This class is not meant to be subclassed.
1865 **/
1866 @interface GPBInt32Int64Dictionary : NSObject <NSCopying> 498 @interface GPBInt32Int64Dictionary : NSObject <NSCopying>
1867 499
1868 /** Number of entries stored in this dictionary. */ 500 @property(nonatomic, readonly) NSUInteger count;
1869 @property(nonatomic, readonly) NSUInteger count; 501
1870 502 + (instancetype)dictionary;
1871 /** 503 + (instancetype)dictionaryWithValue:(int64_t)value
1872 * @return A newly instanced and empty dictionary. 504 forKey:(int32_t)key;
1873 **/ 505 + (instancetype)dictionaryWithValues:(const int64_t [])values
1874 + (instancetype)dictionary; 506 forKeys:(const int32_t [])keys
1875 507 count:(NSUInteger)count;
1876 /**
1877 * Creates and initializes a dictionary with the single entry given.
1878 *
1879 * @param value The value to be placed in the dictionary.
1880 * @param key The key under which to store the value.
1881 *
1882 * @return A newly instanced dictionary with the key and value in it.
1883 **/
1884 + (instancetype)dictionaryWithInt64:(int64_t)value
1885 forKey:(int32_t)key;
1886
1887 /**
1888 * Creates and initializes a dictionary with the entries given.
1889 *
1890 * @param values The values to be placed in the dictionary.
1891 * @param keys The keys under which to store the values.
1892 * @param count The number of entries to store in the dictionary.
1893 *
1894 * @return A newly instanced dictionary with the keys and values in it.
1895 **/
1896 + (instancetype)dictionaryWithInt64s:(const int64_t [])values
1897 forKeys:(const int32_t [])keys
1898 count:(NSUInteger)count;
1899
1900 /**
1901 * Creates and initializes a dictionary with the entries from the given.
1902 * dictionary.
1903 *
1904 * @param dictionary Dictionary containing the entries to add to the dictionary.
1905 *
1906 * @return A newly instanced dictionary with the entries from the given
1907 * dictionary in it.
1908 **/
1909 + (instancetype)dictionaryWithDictionary:(GPBInt32Int64Dictionary *)dictionary; 508 + (instancetype)dictionaryWithDictionary:(GPBInt32Int64Dictionary *)dictionary;
1910 509 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
1911 /** 510
1912 * Creates and initializes a dictionary with the given capacity. 511 - (instancetype)initWithValues:(const int64_t [])values
1913 * 512 forKeys:(const int32_t [])keys
1914 * @param numItems Capacity needed for the dictionary. 513 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1915 *
1916 * @return A newly instanced dictionary with the given capacity.
1917 **/
1918 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
1919
1920 /**
1921 * Initializes this dictionary, copying the given values and keys.
1922 *
1923 * @param values The values to be placed in this dictionary.
1924 * @param keys The keys under which to store the values.
1925 * @param count The number of elements to copy into the dictionary.
1926 *
1927 * @return A newly initialized dictionary with a copy of the values and keys.
1928 **/
1929 - (instancetype)initWithInt64s:(const int64_t [])values
1930 forKeys:(const int32_t [])keys
1931 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
1932
1933 /**
1934 * Initializes this dictionary, copying the entries from the given dictionary.
1935 *
1936 * @param dictionary Dictionary containing the entries to add to this dictionary .
1937 *
1938 * @return A newly initialized dictionary with the entries of the given dictiona ry.
1939 **/
1940 - (instancetype)initWithDictionary:(GPBInt32Int64Dictionary *)dictionary; 514 - (instancetype)initWithDictionary:(GPBInt32Int64Dictionary *)dictionary;
1941 515 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1942 /** 516
1943 * Initializes this dictionary with the requested capacity. 517 - (BOOL)valueForKey:(int32_t)key value:(nullable int64_t *)value;
1944 * 518
1945 * @param numItems Number of items needed for this dictionary. 519 - (void)enumerateKeysAndValuesUsingBlock:
1946 *
1947 * @return A newly initialized dictionary with the requested capacity.
1948 **/
1949 - (instancetype)initWithCapacity:(NSUInteger)numItems;
1950
1951 /**
1952 * Gets the value for the given key.
1953 *
1954 * @param value Pointer into which the value will be set, if found.
1955 * @param key Key under which the value is stored, if present.
1956 *
1957 * @return YES if the key was found and the value was copied, NO otherwise.
1958 **/
1959 - (BOOL)getInt64:(nullable int64_t *)value forKey:(int32_t)key;
1960
1961 /**
1962 * Enumerates the keys and values on this dictionary with the given block.
1963 *
1964 * @param block The block to enumerate with.
1965 * **key**: The key for the current entry.
1966 * **value**: The value for the current entry
1967 * **stop**: A pointer to a boolean that when set stops the enumeration.
1968 **/
1969 - (void)enumerateKeysAndInt64sUsingBlock:
1970 (void (^)(int32_t key, int64_t value, BOOL *stop))block; 520 (void (^)(int32_t key, int64_t value, BOOL *stop))block;
1971 521
1972 /**
1973 * Adds the keys and values from another dictionary.
1974 *
1975 * @param otherDictionary Dictionary containing entries to be added to this
1976 * dictionary.
1977 **/
1978 - (void)addEntriesFromDictionary:(GPBInt32Int64Dictionary *)otherDictionary; 522 - (void)addEntriesFromDictionary:(GPBInt32Int64Dictionary *)otherDictionary;
1979 523
1980 /** 524 - (void)setValue:(int64_t)value forKey:(int32_t)key;
1981 * Sets the value for the given key. 525
1982 * 526 - (void)removeValueForKey:(int32_t)aKey;
1983 * @param value The value to set.
1984 * @param key The key under which to store the value.
1985 **/
1986 - (void)setInt64:(int64_t)value forKey:(int32_t)key;
1987
1988 /**
1989 * Removes the entry for the given key.
1990 *
1991 * @param aKey Key to be removed from this dictionary.
1992 **/
1993 - (void)removeInt64ForKey:(int32_t)aKey;
1994
1995 /**
1996 * Removes all entries in this dictionary.
1997 **/
1998 - (void)removeAll; 527 - (void)removeAll;
1999 528
2000 @end 529 @end
2001 530
2002 #pragma mark - Int32 -> Bool 531 #pragma mark - Int32 -> Bool
2003 532
2004 /**
2005 * Class used for map fields of <int32_t, BOOL>
2006 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2007 *
2008 * @note This class is not meant to be subclassed.
2009 **/
2010 @interface GPBInt32BoolDictionary : NSObject <NSCopying> 533 @interface GPBInt32BoolDictionary : NSObject <NSCopying>
2011 534
2012 /** Number of entries stored in this dictionary. */ 535 @property(nonatomic, readonly) NSUInteger count;
2013 @property(nonatomic, readonly) NSUInteger count; 536
2014 537 + (instancetype)dictionary;
2015 /** 538 + (instancetype)dictionaryWithValue:(BOOL)value
2016 * @return A newly instanced and empty dictionary. 539 forKey:(int32_t)key;
2017 **/ 540 + (instancetype)dictionaryWithValues:(const BOOL [])values
2018 + (instancetype)dictionary; 541 forKeys:(const int32_t [])keys
2019 542 count:(NSUInteger)count;
2020 /**
2021 * Creates and initializes a dictionary with the single entry given.
2022 *
2023 * @param value The value to be placed in the dictionary.
2024 * @param key The key under which to store the value.
2025 *
2026 * @return A newly instanced dictionary with the key and value in it.
2027 **/
2028 + (instancetype)dictionaryWithBool:(BOOL)value
2029 forKey:(int32_t)key;
2030
2031 /**
2032 * Creates and initializes a dictionary with the entries given.
2033 *
2034 * @param values The values to be placed in the dictionary.
2035 * @param keys The keys under which to store the values.
2036 * @param count The number of entries to store in the dictionary.
2037 *
2038 * @return A newly instanced dictionary with the keys and values in it.
2039 **/
2040 + (instancetype)dictionaryWithBools:(const BOOL [])values
2041 forKeys:(const int32_t [])keys
2042 count:(NSUInteger)count;
2043
2044 /**
2045 * Creates and initializes a dictionary with the entries from the given.
2046 * dictionary.
2047 *
2048 * @param dictionary Dictionary containing the entries to add to the dictionary.
2049 *
2050 * @return A newly instanced dictionary with the entries from the given
2051 * dictionary in it.
2052 **/
2053 + (instancetype)dictionaryWithDictionary:(GPBInt32BoolDictionary *)dictionary; 543 + (instancetype)dictionaryWithDictionary:(GPBInt32BoolDictionary *)dictionary;
2054 544 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
2055 /** 545
2056 * Creates and initializes a dictionary with the given capacity. 546 - (instancetype)initWithValues:(const BOOL [])values
2057 * 547 forKeys:(const int32_t [])keys
2058 * @param numItems Capacity needed for the dictionary. 548 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2059 *
2060 * @return A newly instanced dictionary with the given capacity.
2061 **/
2062 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
2063
2064 /**
2065 * Initializes this dictionary, copying the given values and keys.
2066 *
2067 * @param values The values to be placed in this dictionary.
2068 * @param keys The keys under which to store the values.
2069 * @param count The number of elements to copy into the dictionary.
2070 *
2071 * @return A newly initialized dictionary with a copy of the values and keys.
2072 **/
2073 - (instancetype)initWithBools:(const BOOL [])values
2074 forKeys:(const int32_t [])keys
2075 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2076
2077 /**
2078 * Initializes this dictionary, copying the entries from the given dictionary.
2079 *
2080 * @param dictionary Dictionary containing the entries to add to this dictionary .
2081 *
2082 * @return A newly initialized dictionary with the entries of the given dictiona ry.
2083 **/
2084 - (instancetype)initWithDictionary:(GPBInt32BoolDictionary *)dictionary; 549 - (instancetype)initWithDictionary:(GPBInt32BoolDictionary *)dictionary;
2085 550 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2086 /** 551
2087 * Initializes this dictionary with the requested capacity. 552 - (BOOL)valueForKey:(int32_t)key value:(nullable BOOL *)value;
2088 * 553
2089 * @param numItems Number of items needed for this dictionary. 554 - (void)enumerateKeysAndValuesUsingBlock:
2090 *
2091 * @return A newly initialized dictionary with the requested capacity.
2092 **/
2093 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2094
2095 /**
2096 * Gets the value for the given key.
2097 *
2098 * @param value Pointer into which the value will be set, if found.
2099 * @param key Key under which the value is stored, if present.
2100 *
2101 * @return YES if the key was found and the value was copied, NO otherwise.
2102 **/
2103 - (BOOL)getBool:(nullable BOOL *)value forKey:(int32_t)key;
2104
2105 /**
2106 * Enumerates the keys and values on this dictionary with the given block.
2107 *
2108 * @param block The block to enumerate with.
2109 * **key**: The key for the current entry.
2110 * **value**: The value for the current entry
2111 * **stop**: A pointer to a boolean that when set stops the enumeration.
2112 **/
2113 - (void)enumerateKeysAndBoolsUsingBlock:
2114 (void (^)(int32_t key, BOOL value, BOOL *stop))block; 555 (void (^)(int32_t key, BOOL value, BOOL *stop))block;
2115 556
2116 /**
2117 * Adds the keys and values from another dictionary.
2118 *
2119 * @param otherDictionary Dictionary containing entries to be added to this
2120 * dictionary.
2121 **/
2122 - (void)addEntriesFromDictionary:(GPBInt32BoolDictionary *)otherDictionary; 557 - (void)addEntriesFromDictionary:(GPBInt32BoolDictionary *)otherDictionary;
2123 558
2124 /** 559 - (void)setValue:(BOOL)value forKey:(int32_t)key;
2125 * Sets the value for the given key. 560
2126 * 561 - (void)removeValueForKey:(int32_t)aKey;
2127 * @param value The value to set.
2128 * @param key The key under which to store the value.
2129 **/
2130 - (void)setBool:(BOOL)value forKey:(int32_t)key;
2131
2132 /**
2133 * Removes the entry for the given key.
2134 *
2135 * @param aKey Key to be removed from this dictionary.
2136 **/
2137 - (void)removeBoolForKey:(int32_t)aKey;
2138
2139 /**
2140 * Removes all entries in this dictionary.
2141 **/
2142 - (void)removeAll; 562 - (void)removeAll;
2143 563
2144 @end 564 @end
2145 565
2146 #pragma mark - Int32 -> Float 566 #pragma mark - Int32 -> Float
2147 567
2148 /**
2149 * Class used for map fields of <int32_t, float>
2150 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2151 *
2152 * @note This class is not meant to be subclassed.
2153 **/
2154 @interface GPBInt32FloatDictionary : NSObject <NSCopying> 568 @interface GPBInt32FloatDictionary : NSObject <NSCopying>
2155 569
2156 /** Number of entries stored in this dictionary. */ 570 @property(nonatomic, readonly) NSUInteger count;
2157 @property(nonatomic, readonly) NSUInteger count; 571
2158 572 + (instancetype)dictionary;
2159 /** 573 + (instancetype)dictionaryWithValue:(float)value
2160 * @return A newly instanced and empty dictionary. 574 forKey:(int32_t)key;
2161 **/ 575 + (instancetype)dictionaryWithValues:(const float [])values
2162 + (instancetype)dictionary; 576 forKeys:(const int32_t [])keys
2163 577 count:(NSUInteger)count;
2164 /**
2165 * Creates and initializes a dictionary with the single entry given.
2166 *
2167 * @param value The value to be placed in the dictionary.
2168 * @param key The key under which to store the value.
2169 *
2170 * @return A newly instanced dictionary with the key and value in it.
2171 **/
2172 + (instancetype)dictionaryWithFloat:(float)value
2173 forKey:(int32_t)key;
2174
2175 /**
2176 * Creates and initializes a dictionary with the entries given.
2177 *
2178 * @param values The values to be placed in the dictionary.
2179 * @param keys The keys under which to store the values.
2180 * @param count The number of entries to store in the dictionary.
2181 *
2182 * @return A newly instanced dictionary with the keys and values in it.
2183 **/
2184 + (instancetype)dictionaryWithFloats:(const float [])values
2185 forKeys:(const int32_t [])keys
2186 count:(NSUInteger)count;
2187
2188 /**
2189 * Creates and initializes a dictionary with the entries from the given.
2190 * dictionary.
2191 *
2192 * @param dictionary Dictionary containing the entries to add to the dictionary.
2193 *
2194 * @return A newly instanced dictionary with the entries from the given
2195 * dictionary in it.
2196 **/
2197 + (instancetype)dictionaryWithDictionary:(GPBInt32FloatDictionary *)dictionary; 578 + (instancetype)dictionaryWithDictionary:(GPBInt32FloatDictionary *)dictionary;
2198 579 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
2199 /** 580
2200 * Creates and initializes a dictionary with the given capacity. 581 - (instancetype)initWithValues:(const float [])values
2201 * 582 forKeys:(const int32_t [])keys
2202 * @param numItems Capacity needed for the dictionary. 583 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2203 *
2204 * @return A newly instanced dictionary with the given capacity.
2205 **/
2206 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
2207
2208 /**
2209 * Initializes this dictionary, copying the given values and keys.
2210 *
2211 * @param values The values to be placed in this dictionary.
2212 * @param keys The keys under which to store the values.
2213 * @param count The number of elements to copy into the dictionary.
2214 *
2215 * @return A newly initialized dictionary with a copy of the values and keys.
2216 **/
2217 - (instancetype)initWithFloats:(const float [])values
2218 forKeys:(const int32_t [])keys
2219 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2220
2221 /**
2222 * Initializes this dictionary, copying the entries from the given dictionary.
2223 *
2224 * @param dictionary Dictionary containing the entries to add to this dictionary .
2225 *
2226 * @return A newly initialized dictionary with the entries of the given dictiona ry.
2227 **/
2228 - (instancetype)initWithDictionary:(GPBInt32FloatDictionary *)dictionary; 584 - (instancetype)initWithDictionary:(GPBInt32FloatDictionary *)dictionary;
2229 585 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2230 /** 586
2231 * Initializes this dictionary with the requested capacity. 587 - (BOOL)valueForKey:(int32_t)key value:(nullable float *)value;
2232 * 588
2233 * @param numItems Number of items needed for this dictionary. 589 - (void)enumerateKeysAndValuesUsingBlock:
2234 *
2235 * @return A newly initialized dictionary with the requested capacity.
2236 **/
2237 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2238
2239 /**
2240 * Gets the value for the given key.
2241 *
2242 * @param value Pointer into which the value will be set, if found.
2243 * @param key Key under which the value is stored, if present.
2244 *
2245 * @return YES if the key was found and the value was copied, NO otherwise.
2246 **/
2247 - (BOOL)getFloat:(nullable float *)value forKey:(int32_t)key;
2248
2249 /**
2250 * Enumerates the keys and values on this dictionary with the given block.
2251 *
2252 * @param block The block to enumerate with.
2253 * **key**: The key for the current entry.
2254 * **value**: The value for the current entry
2255 * **stop**: A pointer to a boolean that when set stops the enumeration.
2256 **/
2257 - (void)enumerateKeysAndFloatsUsingBlock:
2258 (void (^)(int32_t key, float value, BOOL *stop))block; 590 (void (^)(int32_t key, float value, BOOL *stop))block;
2259 591
2260 /**
2261 * Adds the keys and values from another dictionary.
2262 *
2263 * @param otherDictionary Dictionary containing entries to be added to this
2264 * dictionary.
2265 **/
2266 - (void)addEntriesFromDictionary:(GPBInt32FloatDictionary *)otherDictionary; 592 - (void)addEntriesFromDictionary:(GPBInt32FloatDictionary *)otherDictionary;
2267 593
2268 /** 594 - (void)setValue:(float)value forKey:(int32_t)key;
2269 * Sets the value for the given key. 595
2270 * 596 - (void)removeValueForKey:(int32_t)aKey;
2271 * @param value The value to set.
2272 * @param key The key under which to store the value.
2273 **/
2274 - (void)setFloat:(float)value forKey:(int32_t)key;
2275
2276 /**
2277 * Removes the entry for the given key.
2278 *
2279 * @param aKey Key to be removed from this dictionary.
2280 **/
2281 - (void)removeFloatForKey:(int32_t)aKey;
2282
2283 /**
2284 * Removes all entries in this dictionary.
2285 **/
2286 - (void)removeAll; 597 - (void)removeAll;
2287 598
2288 @end 599 @end
2289 600
2290 #pragma mark - Int32 -> Double 601 #pragma mark - Int32 -> Double
2291 602
2292 /**
2293 * Class used for map fields of <int32_t, double>
2294 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2295 *
2296 * @note This class is not meant to be subclassed.
2297 **/
2298 @interface GPBInt32DoubleDictionary : NSObject <NSCopying> 603 @interface GPBInt32DoubleDictionary : NSObject <NSCopying>
2299 604
2300 /** Number of entries stored in this dictionary. */ 605 @property(nonatomic, readonly) NSUInteger count;
2301 @property(nonatomic, readonly) NSUInteger count; 606
2302 607 + (instancetype)dictionary;
2303 /** 608 + (instancetype)dictionaryWithValue:(double)value
2304 * @return A newly instanced and empty dictionary. 609 forKey:(int32_t)key;
2305 **/ 610 + (instancetype)dictionaryWithValues:(const double [])values
2306 + (instancetype)dictionary; 611 forKeys:(const int32_t [])keys
2307 612 count:(NSUInteger)count;
2308 /**
2309 * Creates and initializes a dictionary with the single entry given.
2310 *
2311 * @param value The value to be placed in the dictionary.
2312 * @param key The key under which to store the value.
2313 *
2314 * @return A newly instanced dictionary with the key and value in it.
2315 **/
2316 + (instancetype)dictionaryWithDouble:(double)value
2317 forKey:(int32_t)key;
2318
2319 /**
2320 * Creates and initializes a dictionary with the entries given.
2321 *
2322 * @param values The values to be placed in the dictionary.
2323 * @param keys The keys under which to store the values.
2324 * @param count The number of entries to store in the dictionary.
2325 *
2326 * @return A newly instanced dictionary with the keys and values in it.
2327 **/
2328 + (instancetype)dictionaryWithDoubles:(const double [])values
2329 forKeys:(const int32_t [])keys
2330 count:(NSUInteger)count;
2331
2332 /**
2333 * Creates and initializes a dictionary with the entries from the given.
2334 * dictionary.
2335 *
2336 * @param dictionary Dictionary containing the entries to add to the dictionary.
2337 *
2338 * @return A newly instanced dictionary with the entries from the given
2339 * dictionary in it.
2340 **/
2341 + (instancetype)dictionaryWithDictionary:(GPBInt32DoubleDictionary *)dictionary; 613 + (instancetype)dictionaryWithDictionary:(GPBInt32DoubleDictionary *)dictionary;
2342 614 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
2343 /** 615
2344 * Creates and initializes a dictionary with the given capacity. 616 - (instancetype)initWithValues:(const double [])values
2345 * 617 forKeys:(const int32_t [])keys
2346 * @param numItems Capacity needed for the dictionary. 618 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2347 *
2348 * @return A newly instanced dictionary with the given capacity.
2349 **/
2350 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
2351
2352 /**
2353 * Initializes this dictionary, copying the given values and keys.
2354 *
2355 * @param values The values to be placed in this dictionary.
2356 * @param keys The keys under which to store the values.
2357 * @param count The number of elements to copy into the dictionary.
2358 *
2359 * @return A newly initialized dictionary with a copy of the values and keys.
2360 **/
2361 - (instancetype)initWithDoubles:(const double [])values
2362 forKeys:(const int32_t [])keys
2363 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2364
2365 /**
2366 * Initializes this dictionary, copying the entries from the given dictionary.
2367 *
2368 * @param dictionary Dictionary containing the entries to add to this dictionary .
2369 *
2370 * @return A newly initialized dictionary with the entries of the given dictiona ry.
2371 **/
2372 - (instancetype)initWithDictionary:(GPBInt32DoubleDictionary *)dictionary; 619 - (instancetype)initWithDictionary:(GPBInt32DoubleDictionary *)dictionary;
2373 620 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2374 /** 621
2375 * Initializes this dictionary with the requested capacity. 622 - (BOOL)valueForKey:(int32_t)key value:(nullable double *)value;
2376 * 623
2377 * @param numItems Number of items needed for this dictionary. 624 - (void)enumerateKeysAndValuesUsingBlock:
2378 *
2379 * @return A newly initialized dictionary with the requested capacity.
2380 **/
2381 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2382
2383 /**
2384 * Gets the value for the given key.
2385 *
2386 * @param value Pointer into which the value will be set, if found.
2387 * @param key Key under which the value is stored, if present.
2388 *
2389 * @return YES if the key was found and the value was copied, NO otherwise.
2390 **/
2391 - (BOOL)getDouble:(nullable double *)value forKey:(int32_t)key;
2392
2393 /**
2394 * Enumerates the keys and values on this dictionary with the given block.
2395 *
2396 * @param block The block to enumerate with.
2397 * **key**: The key for the current entry.
2398 * **value**: The value for the current entry
2399 * **stop**: A pointer to a boolean that when set stops the enumeration.
2400 **/
2401 - (void)enumerateKeysAndDoublesUsingBlock:
2402 (void (^)(int32_t key, double value, BOOL *stop))block; 625 (void (^)(int32_t key, double value, BOOL *stop))block;
2403 626
2404 /**
2405 * Adds the keys and values from another dictionary.
2406 *
2407 * @param otherDictionary Dictionary containing entries to be added to this
2408 * dictionary.
2409 **/
2410 - (void)addEntriesFromDictionary:(GPBInt32DoubleDictionary *)otherDictionary; 627 - (void)addEntriesFromDictionary:(GPBInt32DoubleDictionary *)otherDictionary;
2411 628
2412 /** 629 - (void)setValue:(double)value forKey:(int32_t)key;
2413 * Sets the value for the given key. 630
2414 * 631 - (void)removeValueForKey:(int32_t)aKey;
2415 * @param value The value to set.
2416 * @param key The key under which to store the value.
2417 **/
2418 - (void)setDouble:(double)value forKey:(int32_t)key;
2419
2420 /**
2421 * Removes the entry for the given key.
2422 *
2423 * @param aKey Key to be removed from this dictionary.
2424 **/
2425 - (void)removeDoubleForKey:(int32_t)aKey;
2426
2427 /**
2428 * Removes all entries in this dictionary.
2429 **/
2430 - (void)removeAll; 632 - (void)removeAll;
2431 633
2432 @end 634 @end
2433 635
2434 #pragma mark - Int32 -> Enum 636 #pragma mark - Int32 -> Enum
2435 637
2436 /**
2437 * Class used for map fields of <int32_t, int32_t>
2438 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2439 *
2440 * @note This class is not meant to be subclassed.
2441 **/
2442 @interface GPBInt32EnumDictionary : NSObject <NSCopying> 638 @interface GPBInt32EnumDictionary : NSObject <NSCopying>
2443 639
2444 /** Number of entries stored in this dictionary. */ 640 @property(nonatomic, readonly) NSUInteger count;
2445 @property(nonatomic, readonly) NSUInteger count;
2446 /** The validation function to check if the enums are valid. */
2447 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 641 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
2448 642
2449 /** 643 + (instancetype)dictionary;
2450 * @return A newly instanced and empty dictionary.
2451 **/
2452 + (instancetype)dictionary;
2453
2454 /**
2455 * Creates and initializes a dictionary with the given validation function.
2456 *
2457 * @param func The enum validation function for the dictionary.
2458 *
2459 * @return A newly instanced dictionary.
2460 **/
2461 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func; 644 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func;
2462
2463 /**
2464 * Creates and initializes a dictionary with the single entry given.
2465 *
2466 * @param func The enum validation function for the dictionary.
2467 * @param rawValue The raw enum value to be placed in the dictionary.
2468 * @param key The key under which to store the value.
2469 *
2470 * @return A newly instanced dictionary with the key and value in it.
2471 **/
2472 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 645 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
2473 rawValue:(int32_t)rawValue 646 rawValue:(int32_t)rawValue
2474 forKey:(int32_t)key; 647 forKey:(int32_t)key;
2475
2476 /**
2477 * Creates and initializes a dictionary with the entries given.
2478 *
2479 * @param func The enum validation function for the dictionary.
2480 * @param values The raw enum values values to be placed in the dictionary.
2481 * @param keys The keys under which to store the values.
2482 * @param count The number of entries to store in the dictionary.
2483 *
2484 * @return A newly instanced dictionary with the keys and values in it.
2485 **/
2486 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 648 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
2487 rawValues:(const int32_t [])values 649 rawValues:(const int32_t [])values
2488 forKeys:(const int32_t [])keys 650 forKeys:(const int32_t [])keys
2489 count:(NSUInteger)count; 651 count:(NSUInteger)count;
2490
2491 /**
2492 * Creates and initializes a dictionary with the entries from the given.
2493 * dictionary.
2494 *
2495 * @param dictionary Dictionary containing the entries to add to the dictionary.
2496 *
2497 * @return A newly instanced dictionary with the entries from the given
2498 * dictionary in it.
2499 **/
2500 + (instancetype)dictionaryWithDictionary:(GPBInt32EnumDictionary *)dictionary; 652 + (instancetype)dictionaryWithDictionary:(GPBInt32EnumDictionary *)dictionary;
2501
2502 /**
2503 * Creates and initializes a dictionary with the given capacity.
2504 *
2505 * @param func The enum validation function for the dictionary.
2506 * @param numItems Capacity needed for the dictionary.
2507 *
2508 * @return A newly instanced dictionary with the given capacity.
2509 **/
2510 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 653 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
2511 capacity:(NSUInteger)numItems; 654 capacity:(NSUInteger)numItems;
2512 655
2513 /**
2514 * Initializes a dictionary with the given validation function.
2515 *
2516 * @param func The enum validation function for the dictionary.
2517 *
2518 * @return A newly initialized dictionary.
2519 **/
2520 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 656 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
2521
2522 /**
2523 * Initializes a dictionary with the entries given.
2524 *
2525 * @param func The enum validation function for the dictionary.
2526 * @param values The raw enum values values to be placed in the dictionary.
2527 * @param keys The keys under which to store the values.
2528 * @param count The number of entries to store in the dictionary.
2529 *
2530 * @return A newly initialized dictionary with the keys and values in it.
2531 **/
2532 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 657 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
2533 rawValues:(const int32_t [])values 658 rawValues:(const int32_t [])values
2534 forKeys:(const int32_t [])keys 659 forKeys:(const int32_t [])keys
2535 count:(NSUInteger)count NS_DESIGNATED_INITI ALIZER; 660 count:(NSUInteger)count NS_DESIGNATED_INITI ALIZER;
2536
2537 /**
2538 * Initializes a dictionary with the entries from the given.
2539 * dictionary.
2540 *
2541 * @param dictionary Dictionary containing the entries to add to the dictionary.
2542 *
2543 * @return A newly initialized dictionary with the entries from the given
2544 * dictionary in it.
2545 **/
2546 - (instancetype)initWithDictionary:(GPBInt32EnumDictionary *)dictionary; 661 - (instancetype)initWithDictionary:(GPBInt32EnumDictionary *)dictionary;
2547
2548 /**
2549 * Initializes a dictionary with the given capacity.
2550 *
2551 * @param func The enum validation function for the dictionary.
2552 * @param numItems Capacity needed for the dictionary.
2553 *
2554 * @return A newly initialized dictionary with the given capacity.
2555 **/
2556 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 662 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
2557 capacity:(NSUInteger)numItems; 663 capacity:(NSUInteger)numItems;
2558 664
2559 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 665 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
2560 // is not a valid enumerator as defined by validationFunc. If the actual value i s 666 // is not a valid enumerator as defined by validationFunc. If the actual value i s
2561 // desired, use "raw" version of the method. 667 // desired, use "raw" version of the method.
2562 668
2563 /** 669 - (BOOL)valueForKey:(int32_t)key value:(nullable int32_t *)value;
2564 * Gets the value for the given key.
2565 *
2566 * @param value Pointer into which the value will be set, if found.
2567 * @param key Key under which the value is stored, if present.
2568 *
2569 * @return YES if the key was found and the value was copied, NO otherwise.
2570 **/
2571 - (BOOL)getEnum:(nullable int32_t *)value forKey:(int32_t)key;
2572 670
2573 /** 671 - (void)enumerateKeysAndValuesUsingBlock:
2574 * Enumerates the keys and values on this dictionary with the given block.
2575 *
2576 * @param block The block to enumerate with.
2577 * **key**: The key for the current entry.
2578 * **value**: The value for the current entry
2579 * **stop**: A pointer to a boolean that when set stops the enumeration.
2580 **/
2581 - (void)enumerateKeysAndEnumsUsingBlock:
2582 (void (^)(int32_t key, int32_t value, BOOL *stop))block; 672 (void (^)(int32_t key, int32_t value, BOOL *stop))block;
2583 673
2584 /** 674 // These methods bypass the validationFunc to provide access to values that were not
2585 * Gets the raw enum value for the given key. 675 // known at the time the binary was compiled.
2586 *
2587 * @note This method bypass the validationFunc to enable the access of values th at
2588 * were not known at the time the binary was compiled.
2589 *
2590 * @param rawValue Pointer into which the value will be set, if found.
2591 * @param key Key under which the value is stored, if present.
2592 *
2593 * @return YES if the key was found and the value was copied, NO otherwise.
2594 **/
2595 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int32_t)key;
2596 676
2597 /** 677 - (BOOL)valueForKey:(int32_t)key rawValue:(nullable int32_t *)rawValue;
2598 * Enumerates the keys and values on this dictionary with the given block. 678
2599 *
2600 * @note This method bypass the validationFunc to enable the access of values th at
2601 * were not known at the time the binary was compiled.
2602 *
2603 * @param block The block to enumerate with.
2604 * **key**: The key for the current entry.
2605 * **rawValue**: The value for the current entry
2606 * **stop**: A pointer to a boolean that when set stops the enumeration.
2607 **/
2608 - (void)enumerateKeysAndRawValuesUsingBlock: 679 - (void)enumerateKeysAndRawValuesUsingBlock:
2609 (void (^)(int32_t key, int32_t rawValue, BOOL *stop))block; 680 (void (^)(int32_t key, int32_t rawValue, BOOL *stop))block;
2610 681
2611 /**
2612 * Adds the keys and raw enum values from another dictionary.
2613 *
2614 * @note This method bypass the validationFunc to enable the setting of values t hat
2615 * were not known at the time the binary was compiled.
2616 *
2617 * @param otherDictionary Dictionary containing entries to be added to this
2618 * dictionary.
2619 **/
2620 - (void)addRawEntriesFromDictionary:(GPBInt32EnumDictionary *)otherDictionary; 682 - (void)addRawEntriesFromDictionary:(GPBInt32EnumDictionary *)otherDictionary;
2621 683
2622 // If value is not a valid enumerator as defined by validationFunc, these 684 // If value is not a valid enumerator as defined by validationFunc, these
2623 // methods will assert in debug, and will log in release and assign the value 685 // methods will assert in debug, and will log in release and assign the value
2624 // to the default value. Use the rawValue methods below to assign non enumerator 686 // to the default value. Use the rawValue methods below to assign non enumerator
2625 // values. 687 // values.
2626 688
2627 /** 689 - (void)setValue:(int32_t)value forKey:(int32_t)key;
2628 * Sets the value for the given key. 690
2629 * 691 // This method bypass the validationFunc to provide setting of values that were not
2630 * @param value The value to set. 692 // known at the time the binary was compiled.
2631 * @param key The key under which to store the value.
2632 **/
2633 - (void)setEnum:(int32_t)value forKey:(int32_t)key;
2634
2635 /**
2636 * Sets the raw enum value for the given key.
2637 *
2638 * @note This method bypass the validationFunc to enable the setting of values t hat
2639 * were not known at the time the binary was compiled.
2640 *
2641 * @param rawValue The raw enum value to set.
2642 * @param key The key under which to store the raw enum value.
2643 **/
2644 - (void)setRawValue:(int32_t)rawValue forKey:(int32_t)key; 693 - (void)setRawValue:(int32_t)rawValue forKey:(int32_t)key;
2645 694
2646 /** 695 // No validation applies to these methods.
2647 * Removes the entry for the given key. 696
2648 * 697 - (void)removeValueForKey:(int32_t)aKey;
2649 * @param aKey Key to be removed from this dictionary.
2650 **/
2651 - (void)removeEnumForKey:(int32_t)aKey;
2652
2653 /**
2654 * Removes all entries in this dictionary.
2655 **/
2656 - (void)removeAll; 698 - (void)removeAll;
2657 699
2658 @end 700 @end
2659 701
2660 #pragma mark - Int32 -> Object 702 #pragma mark - Int32 -> Object
2661 703
2662 /**
2663 * Class used for map fields of <int32_t, ObjectType>
2664 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2665 *
2666 * @note This class is not meant to be subclassed.
2667 **/
2668 @interface GPBInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyin g> 704 @interface GPBInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyin g>
2669 705
2670 /** Number of entries stored in this dictionary. */ 706 @property(nonatomic, readonly) NSUInteger count;
2671 @property(nonatomic, readonly) NSUInteger count; 707
2672 708 + (instancetype)dictionary;
2673 /**
2674 * @return A newly instanced and empty dictionary.
2675 **/
2676 + (instancetype)dictionary;
2677
2678 /**
2679 * Creates and initializes a dictionary with the single entry given.
2680 *
2681 * @param object The value to be placed in the dictionary.
2682 * @param key The key under which to store the value.
2683 *
2684 * @return A newly instanced dictionary with the key and value in it.
2685 **/
2686 + (instancetype)dictionaryWithObject:(ObjectType)object 709 + (instancetype)dictionaryWithObject:(ObjectType)object
2687 forKey:(int32_t)key; 710 forKey:(int32_t)key;
2688
2689 /**
2690 * Creates and initializes a dictionary with the entries given.
2691 *
2692 * @param objects The values to be placed in the dictionary.
2693 * @param keys The keys under which to store the values.
2694 * @param count The number of entries to store in the dictionary.
2695 *
2696 * @return A newly instanced dictionary with the keys and values in it.
2697 **/
2698 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [] )objects 711 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [] )objects
2699 forKeys:(const int32_t [])keys 712 forKeys:(const int32_t [])keys
2700 count:(NSUInteger)count; 713 count:(NSUInteger)count;
2701
2702 /**
2703 * Creates and initializes a dictionary with the entries from the given.
2704 * dictionary.
2705 *
2706 * @param dictionary Dictionary containing the entries to add to the dictionary.
2707 *
2708 * @return A newly instanced dictionary with the entries from the given
2709 * dictionary in it.
2710 **/
2711 + (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary; 714 + (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
2712 715 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
2713 /** 716
2714 * Creates and initializes a dictionary with the given capacity.
2715 *
2716 * @param numItems Capacity needed for the dictionary.
2717 *
2718 * @return A newly instanced dictionary with the given capacity.
2719 **/
2720 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
2721
2722 /**
2723 * Initializes this dictionary, copying the given values and keys.
2724 *
2725 * @param objects The values to be placed in this dictionary.
2726 * @param keys The keys under which to store the values.
2727 * @param count The number of elements to copy into the dictionary.
2728 *
2729 * @return A newly initialized dictionary with a copy of the values and keys.
2730 **/
2731 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec ts 717 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec ts
2732 forKeys:(const int32_t [])keys 718 forKeys:(const int32_t [])keys
2733 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 719 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2734
2735 /**
2736 * Initializes this dictionary, copying the entries from the given dictionary.
2737 *
2738 * @param dictionary Dictionary containing the entries to add to this dictionary .
2739 *
2740 * @return A newly initialized dictionary with the entries of the given dictiona ry.
2741 **/
2742 - (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary; 720 - (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
2743 721 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2744 /** 722
2745 * Initializes this dictionary with the requested capacity.
2746 *
2747 * @param numItems Number of items needed for this dictionary.
2748 *
2749 * @return A newly initialized dictionary with the requested capacity.
2750 **/
2751 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2752
2753 /**
2754 * Fetches the object stored under the given key.
2755 *
2756 * @param key Key under which the value is stored, if present.
2757 *
2758 * @return The object if found, nil otherwise.
2759 **/
2760 - (ObjectType)objectForKey:(int32_t)key; 723 - (ObjectType)objectForKey:(int32_t)key;
2761 724
2762 /**
2763 * Enumerates the keys and values on this dictionary with the given block.
2764 *
2765 * @param block The block to enumerate with.
2766 * **key**: The key for the current entry.
2767 * **object**: The value for the current entry
2768 * **stop**: A pointer to a boolean that when set stops the enumeration .
2769 **/
2770 - (void)enumerateKeysAndObjectsUsingBlock: 725 - (void)enumerateKeysAndObjectsUsingBlock:
2771 (void (^)(int32_t key, ObjectType object, BOOL *stop))block; 726 (void (^)(int32_t key, ObjectType object, BOOL *stop))block;
2772 727
2773 /**
2774 * Adds the keys and values from another dictionary.
2775 *
2776 * @param otherDictionary Dictionary containing entries to be added to this
2777 * dictionary.
2778 **/
2779 - (void)addEntriesFromDictionary:(GPBInt32ObjectDictionary *)otherDictionary; 728 - (void)addEntriesFromDictionary:(GPBInt32ObjectDictionary *)otherDictionary;
2780 729
2781 /**
2782 * Sets the value for the given key.
2783 *
2784 * @param object The value to set.
2785 * @param key The key under which to store the value.
2786 **/
2787 - (void)setObject:(ObjectType)object forKey:(int32_t)key; 730 - (void)setObject:(ObjectType)object forKey:(int32_t)key;
2788 731
2789 /**
2790 * Removes the entry for the given key.
2791 *
2792 * @param aKey Key to be removed from this dictionary.
2793 **/
2794 - (void)removeObjectForKey:(int32_t)aKey; 732 - (void)removeObjectForKey:(int32_t)aKey;
2795
2796 /**
2797 * Removes all entries in this dictionary.
2798 **/
2799 - (void)removeAll; 733 - (void)removeAll;
2800 734
2801 @end 735 @end
2802 736
2803 #pragma mark - UInt64 -> UInt32 737 #pragma mark - UInt64 -> UInt32
2804 738
2805 /**
2806 * Class used for map fields of <uint64_t, uint32_t>
2807 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2808 *
2809 * @note This class is not meant to be subclassed.
2810 **/
2811 @interface GPBUInt64UInt32Dictionary : NSObject <NSCopying> 739 @interface GPBUInt64UInt32Dictionary : NSObject <NSCopying>
2812 740
2813 /** Number of entries stored in this dictionary. */ 741 @property(nonatomic, readonly) NSUInteger count;
2814 @property(nonatomic, readonly) NSUInteger count; 742
2815 743 + (instancetype)dictionary;
2816 /** 744 + (instancetype)dictionaryWithValue:(uint32_t)value
2817 * @return A newly instanced and empty dictionary. 745 forKey:(uint64_t)key;
2818 **/ 746 + (instancetype)dictionaryWithValues:(const uint32_t [])values
2819 + (instancetype)dictionary; 747 forKeys:(const uint64_t [])keys
2820 748 count:(NSUInteger)count;
2821 /**
2822 * Creates and initializes a dictionary with the single entry given.
2823 *
2824 * @param value The value to be placed in the dictionary.
2825 * @param key The key under which to store the value.
2826 *
2827 * @return A newly instanced dictionary with the key and value in it.
2828 **/
2829 + (instancetype)dictionaryWithUInt32:(uint32_t)value
2830 forKey:(uint64_t)key;
2831
2832 /**
2833 * Creates and initializes a dictionary with the entries given.
2834 *
2835 * @param values The values to be placed in the dictionary.
2836 * @param keys The keys under which to store the values.
2837 * @param count The number of entries to store in the dictionary.
2838 *
2839 * @return A newly instanced dictionary with the keys and values in it.
2840 **/
2841 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
2842 forKeys:(const uint64_t [])keys
2843 count:(NSUInteger)count;
2844
2845 /**
2846 * Creates and initializes a dictionary with the entries from the given.
2847 * dictionary.
2848 *
2849 * @param dictionary Dictionary containing the entries to add to the dictionary.
2850 *
2851 * @return A newly instanced dictionary with the entries from the given
2852 * dictionary in it.
2853 **/
2854 + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary ; 749 + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary ;
2855 750 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
2856 /** 751
2857 * Creates and initializes a dictionary with the given capacity. 752 - (instancetype)initWithValues:(const uint32_t [])values
2858 * 753 forKeys:(const uint64_t [])keys
2859 * @param numItems Capacity needed for the dictionary. 754 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2860 *
2861 * @return A newly instanced dictionary with the given capacity.
2862 **/
2863 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
2864
2865 /**
2866 * Initializes this dictionary, copying the given values and keys.
2867 *
2868 * @param values The values to be placed in this dictionary.
2869 * @param keys The keys under which to store the values.
2870 * @param count The number of elements to copy into the dictionary.
2871 *
2872 * @return A newly initialized dictionary with a copy of the values and keys.
2873 **/
2874 - (instancetype)initWithUInt32s:(const uint32_t [])values
2875 forKeys:(const uint64_t [])keys
2876 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
2877
2878 /**
2879 * Initializes this dictionary, copying the entries from the given dictionary.
2880 *
2881 * @param dictionary Dictionary containing the entries to add to this dictionary .
2882 *
2883 * @return A newly initialized dictionary with the entries of the given dictiona ry.
2884 **/
2885 - (instancetype)initWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary; 755 - (instancetype)initWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary;
2886 756 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2887 /** 757
2888 * Initializes this dictionary with the requested capacity. 758 - (BOOL)valueForKey:(uint64_t)key value:(nullable uint32_t *)value;
2889 * 759
2890 * @param numItems Number of items needed for this dictionary. 760 - (void)enumerateKeysAndValuesUsingBlock:
2891 *
2892 * @return A newly initialized dictionary with the requested capacity.
2893 **/
2894 - (instancetype)initWithCapacity:(NSUInteger)numItems;
2895
2896 /**
2897 * Gets the value for the given key.
2898 *
2899 * @param value Pointer into which the value will be set, if found.
2900 * @param key Key under which the value is stored, if present.
2901 *
2902 * @return YES if the key was found and the value was copied, NO otherwise.
2903 **/
2904 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint64_t)key;
2905
2906 /**
2907 * Enumerates the keys and values on this dictionary with the given block.
2908 *
2909 * @param block The block to enumerate with.
2910 * **key**: The key for the current entry.
2911 * **value**: The value for the current entry
2912 * **stop**: A pointer to a boolean that when set stops the enumeration.
2913 **/
2914 - (void)enumerateKeysAndUInt32sUsingBlock:
2915 (void (^)(uint64_t key, uint32_t value, BOOL *stop))block; 761 (void (^)(uint64_t key, uint32_t value, BOOL *stop))block;
2916 762
2917 /**
2918 * Adds the keys and values from another dictionary.
2919 *
2920 * @param otherDictionary Dictionary containing entries to be added to this
2921 * dictionary.
2922 **/
2923 - (void)addEntriesFromDictionary:(GPBUInt64UInt32Dictionary *)otherDictionary; 763 - (void)addEntriesFromDictionary:(GPBUInt64UInt32Dictionary *)otherDictionary;
2924 764
2925 /** 765 - (void)setValue:(uint32_t)value forKey:(uint64_t)key;
2926 * Sets the value for the given key. 766
2927 * 767 - (void)removeValueForKey:(uint64_t)aKey;
2928 * @param value The value to set.
2929 * @param key The key under which to store the value.
2930 **/
2931 - (void)setUInt32:(uint32_t)value forKey:(uint64_t)key;
2932
2933 /**
2934 * Removes the entry for the given key.
2935 *
2936 * @param aKey Key to be removed from this dictionary.
2937 **/
2938 - (void)removeUInt32ForKey:(uint64_t)aKey;
2939
2940 /**
2941 * Removes all entries in this dictionary.
2942 **/
2943 - (void)removeAll; 768 - (void)removeAll;
2944 769
2945 @end 770 @end
2946 771
2947 #pragma mark - UInt64 -> Int32 772 #pragma mark - UInt64 -> Int32
2948 773
2949 /**
2950 * Class used for map fields of <uint64_t, int32_t>
2951 * values. This performs better than boxing into NSNumbers in NSDictionaries.
2952 *
2953 * @note This class is not meant to be subclassed.
2954 **/
2955 @interface GPBUInt64Int32Dictionary : NSObject <NSCopying> 774 @interface GPBUInt64Int32Dictionary : NSObject <NSCopying>
2956 775
2957 /** Number of entries stored in this dictionary. */ 776 @property(nonatomic, readonly) NSUInteger count;
2958 @property(nonatomic, readonly) NSUInteger count; 777
2959 778 + (instancetype)dictionary;
2960 /** 779 + (instancetype)dictionaryWithValue:(int32_t)value
2961 * @return A newly instanced and empty dictionary. 780 forKey:(uint64_t)key;
2962 **/ 781 + (instancetype)dictionaryWithValues:(const int32_t [])values
2963 + (instancetype)dictionary; 782 forKeys:(const uint64_t [])keys
2964 783 count:(NSUInteger)count;
2965 /**
2966 * Creates and initializes a dictionary with the single entry given.
2967 *
2968 * @param value The value to be placed in the dictionary.
2969 * @param key The key under which to store the value.
2970 *
2971 * @return A newly instanced dictionary with the key and value in it.
2972 **/
2973 + (instancetype)dictionaryWithInt32:(int32_t)value
2974 forKey:(uint64_t)key;
2975
2976 /**
2977 * Creates and initializes a dictionary with the entries given.
2978 *
2979 * @param values The values to be placed in the dictionary.
2980 * @param keys The keys under which to store the values.
2981 * @param count The number of entries to store in the dictionary.
2982 *
2983 * @return A newly instanced dictionary with the keys and values in it.
2984 **/
2985 + (instancetype)dictionaryWithInt32s:(const int32_t [])values
2986 forKeys:(const uint64_t [])keys
2987 count:(NSUInteger)count;
2988
2989 /**
2990 * Creates and initializes a dictionary with the entries from the given.
2991 * dictionary.
2992 *
2993 * @param dictionary Dictionary containing the entries to add to the dictionary.
2994 *
2995 * @return A newly instanced dictionary with the entries from the given
2996 * dictionary in it.
2997 **/
2998 + (instancetype)dictionaryWithDictionary:(GPBUInt64Int32Dictionary *)dictionary; 784 + (instancetype)dictionaryWithDictionary:(GPBUInt64Int32Dictionary *)dictionary;
2999 785 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
3000 /** 786
3001 * Creates and initializes a dictionary with the given capacity. 787 - (instancetype)initWithValues:(const int32_t [])values
3002 * 788 forKeys:(const uint64_t [])keys
3003 * @param numItems Capacity needed for the dictionary. 789 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3004 *
3005 * @return A newly instanced dictionary with the given capacity.
3006 **/
3007 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
3008
3009 /**
3010 * Initializes this dictionary, copying the given values and keys.
3011 *
3012 * @param values The values to be placed in this dictionary.
3013 * @param keys The keys under which to store the values.
3014 * @param count The number of elements to copy into the dictionary.
3015 *
3016 * @return A newly initialized dictionary with a copy of the values and keys.
3017 **/
3018 - (instancetype)initWithInt32s:(const int32_t [])values
3019 forKeys:(const uint64_t [])keys
3020 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3021
3022 /**
3023 * Initializes this dictionary, copying the entries from the given dictionary.
3024 *
3025 * @param dictionary Dictionary containing the entries to add to this dictionary .
3026 *
3027 * @return A newly initialized dictionary with the entries of the given dictiona ry.
3028 **/
3029 - (instancetype)initWithDictionary:(GPBUInt64Int32Dictionary *)dictionary; 790 - (instancetype)initWithDictionary:(GPBUInt64Int32Dictionary *)dictionary;
3030 791 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3031 /** 792
3032 * Initializes this dictionary with the requested capacity. 793 - (BOOL)valueForKey:(uint64_t)key value:(nullable int32_t *)value;
3033 * 794
3034 * @param numItems Number of items needed for this dictionary. 795 - (void)enumerateKeysAndValuesUsingBlock:
3035 *
3036 * @return A newly initialized dictionary with the requested capacity.
3037 **/
3038 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3039
3040 /**
3041 * Gets the value for the given key.
3042 *
3043 * @param value Pointer into which the value will be set, if found.
3044 * @param key Key under which the value is stored, if present.
3045 *
3046 * @return YES if the key was found and the value was copied, NO otherwise.
3047 **/
3048 - (BOOL)getInt32:(nullable int32_t *)value forKey:(uint64_t)key;
3049
3050 /**
3051 * Enumerates the keys and values on this dictionary with the given block.
3052 *
3053 * @param block The block to enumerate with.
3054 * **key**: The key for the current entry.
3055 * **value**: The value for the current entry
3056 * **stop**: A pointer to a boolean that when set stops the enumeration.
3057 **/
3058 - (void)enumerateKeysAndInt32sUsingBlock:
3059 (void (^)(uint64_t key, int32_t value, BOOL *stop))block; 796 (void (^)(uint64_t key, int32_t value, BOOL *stop))block;
3060 797
3061 /**
3062 * Adds the keys and values from another dictionary.
3063 *
3064 * @param otherDictionary Dictionary containing entries to be added to this
3065 * dictionary.
3066 **/
3067 - (void)addEntriesFromDictionary:(GPBUInt64Int32Dictionary *)otherDictionary; 798 - (void)addEntriesFromDictionary:(GPBUInt64Int32Dictionary *)otherDictionary;
3068 799
3069 /** 800 - (void)setValue:(int32_t)value forKey:(uint64_t)key;
3070 * Sets the value for the given key. 801
3071 * 802 - (void)removeValueForKey:(uint64_t)aKey;
3072 * @param value The value to set.
3073 * @param key The key under which to store the value.
3074 **/
3075 - (void)setInt32:(int32_t)value forKey:(uint64_t)key;
3076
3077 /**
3078 * Removes the entry for the given key.
3079 *
3080 * @param aKey Key to be removed from this dictionary.
3081 **/
3082 - (void)removeInt32ForKey:(uint64_t)aKey;
3083
3084 /**
3085 * Removes all entries in this dictionary.
3086 **/
3087 - (void)removeAll; 803 - (void)removeAll;
3088 804
3089 @end 805 @end
3090 806
3091 #pragma mark - UInt64 -> UInt64 807 #pragma mark - UInt64 -> UInt64
3092 808
3093 /**
3094 * Class used for map fields of <uint64_t, uint64_t>
3095 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3096 *
3097 * @note This class is not meant to be subclassed.
3098 **/
3099 @interface GPBUInt64UInt64Dictionary : NSObject <NSCopying> 809 @interface GPBUInt64UInt64Dictionary : NSObject <NSCopying>
3100 810
3101 /** Number of entries stored in this dictionary. */ 811 @property(nonatomic, readonly) NSUInteger count;
3102 @property(nonatomic, readonly) NSUInteger count; 812
3103 813 + (instancetype)dictionary;
3104 /** 814 + (instancetype)dictionaryWithValue:(uint64_t)value
3105 * @return A newly instanced and empty dictionary. 815 forKey:(uint64_t)key;
3106 **/ 816 + (instancetype)dictionaryWithValues:(const uint64_t [])values
3107 + (instancetype)dictionary; 817 forKeys:(const uint64_t [])keys
3108 818 count:(NSUInteger)count;
3109 /**
3110 * Creates and initializes a dictionary with the single entry given.
3111 *
3112 * @param value The value to be placed in the dictionary.
3113 * @param key The key under which to store the value.
3114 *
3115 * @return A newly instanced dictionary with the key and value in it.
3116 **/
3117 + (instancetype)dictionaryWithUInt64:(uint64_t)value
3118 forKey:(uint64_t)key;
3119
3120 /**
3121 * Creates and initializes a dictionary with the entries given.
3122 *
3123 * @param values The values to be placed in the dictionary.
3124 * @param keys The keys under which to store the values.
3125 * @param count The number of entries to store in the dictionary.
3126 *
3127 * @return A newly instanced dictionary with the keys and values in it.
3128 **/
3129 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
3130 forKeys:(const uint64_t [])keys
3131 count:(NSUInteger)count;
3132
3133 /**
3134 * Creates and initializes a dictionary with the entries from the given.
3135 * dictionary.
3136 *
3137 * @param dictionary Dictionary containing the entries to add to the dictionary.
3138 *
3139 * @return A newly instanced dictionary with the entries from the given
3140 * dictionary in it.
3141 **/
3142 + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary ; 819 + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary ;
3143 820 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
3144 /** 821
3145 * Creates and initializes a dictionary with the given capacity. 822 - (instancetype)initWithValues:(const uint64_t [])values
3146 * 823 forKeys:(const uint64_t [])keys
3147 * @param numItems Capacity needed for the dictionary. 824 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3148 *
3149 * @return A newly instanced dictionary with the given capacity.
3150 **/
3151 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
3152
3153 /**
3154 * Initializes this dictionary, copying the given values and keys.
3155 *
3156 * @param values The values to be placed in this dictionary.
3157 * @param keys The keys under which to store the values.
3158 * @param count The number of elements to copy into the dictionary.
3159 *
3160 * @return A newly initialized dictionary with a copy of the values and keys.
3161 **/
3162 - (instancetype)initWithUInt64s:(const uint64_t [])values
3163 forKeys:(const uint64_t [])keys
3164 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3165
3166 /**
3167 * Initializes this dictionary, copying the entries from the given dictionary.
3168 *
3169 * @param dictionary Dictionary containing the entries to add to this dictionary .
3170 *
3171 * @return A newly initialized dictionary with the entries of the given dictiona ry.
3172 **/
3173 - (instancetype)initWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary; 825 - (instancetype)initWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary;
3174 826 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3175 /** 827
3176 * Initializes this dictionary with the requested capacity. 828 - (BOOL)valueForKey:(uint64_t)key value:(nullable uint64_t *)value;
3177 * 829
3178 * @param numItems Number of items needed for this dictionary. 830 - (void)enumerateKeysAndValuesUsingBlock:
3179 *
3180 * @return A newly initialized dictionary with the requested capacity.
3181 **/
3182 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3183
3184 /**
3185 * Gets the value for the given key.
3186 *
3187 * @param value Pointer into which the value will be set, if found.
3188 * @param key Key under which the value is stored, if present.
3189 *
3190 * @return YES if the key was found and the value was copied, NO otherwise.
3191 **/
3192 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint64_t)key;
3193
3194 /**
3195 * Enumerates the keys and values on this dictionary with the given block.
3196 *
3197 * @param block The block to enumerate with.
3198 * **key**: The key for the current entry.
3199 * **value**: The value for the current entry
3200 * **stop**: A pointer to a boolean that when set stops the enumeration.
3201 **/
3202 - (void)enumerateKeysAndUInt64sUsingBlock:
3203 (void (^)(uint64_t key, uint64_t value, BOOL *stop))block; 831 (void (^)(uint64_t key, uint64_t value, BOOL *stop))block;
3204 832
3205 /**
3206 * Adds the keys and values from another dictionary.
3207 *
3208 * @param otherDictionary Dictionary containing entries to be added to this
3209 * dictionary.
3210 **/
3211 - (void)addEntriesFromDictionary:(GPBUInt64UInt64Dictionary *)otherDictionary; 833 - (void)addEntriesFromDictionary:(GPBUInt64UInt64Dictionary *)otherDictionary;
3212 834
3213 /** 835 - (void)setValue:(uint64_t)value forKey:(uint64_t)key;
3214 * Sets the value for the given key. 836
3215 * 837 - (void)removeValueForKey:(uint64_t)aKey;
3216 * @param value The value to set.
3217 * @param key The key under which to store the value.
3218 **/
3219 - (void)setUInt64:(uint64_t)value forKey:(uint64_t)key;
3220
3221 /**
3222 * Removes the entry for the given key.
3223 *
3224 * @param aKey Key to be removed from this dictionary.
3225 **/
3226 - (void)removeUInt64ForKey:(uint64_t)aKey;
3227
3228 /**
3229 * Removes all entries in this dictionary.
3230 **/
3231 - (void)removeAll; 838 - (void)removeAll;
3232 839
3233 @end 840 @end
3234 841
3235 #pragma mark - UInt64 -> Int64 842 #pragma mark - UInt64 -> Int64
3236 843
3237 /**
3238 * Class used for map fields of <uint64_t, int64_t>
3239 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3240 *
3241 * @note This class is not meant to be subclassed.
3242 **/
3243 @interface GPBUInt64Int64Dictionary : NSObject <NSCopying> 844 @interface GPBUInt64Int64Dictionary : NSObject <NSCopying>
3244 845
3245 /** Number of entries stored in this dictionary. */ 846 @property(nonatomic, readonly) NSUInteger count;
3246 @property(nonatomic, readonly) NSUInteger count; 847
3247 848 + (instancetype)dictionary;
3248 /** 849 + (instancetype)dictionaryWithValue:(int64_t)value
3249 * @return A newly instanced and empty dictionary. 850 forKey:(uint64_t)key;
3250 **/ 851 + (instancetype)dictionaryWithValues:(const int64_t [])values
3251 + (instancetype)dictionary; 852 forKeys:(const uint64_t [])keys
3252 853 count:(NSUInteger)count;
3253 /**
3254 * Creates and initializes a dictionary with the single entry given.
3255 *
3256 * @param value The value to be placed in the dictionary.
3257 * @param key The key under which to store the value.
3258 *
3259 * @return A newly instanced dictionary with the key and value in it.
3260 **/
3261 + (instancetype)dictionaryWithInt64:(int64_t)value
3262 forKey:(uint64_t)key;
3263
3264 /**
3265 * Creates and initializes a dictionary with the entries given.
3266 *
3267 * @param values The values to be placed in the dictionary.
3268 * @param keys The keys under which to store the values.
3269 * @param count The number of entries to store in the dictionary.
3270 *
3271 * @return A newly instanced dictionary with the keys and values in it.
3272 **/
3273 + (instancetype)dictionaryWithInt64s:(const int64_t [])values
3274 forKeys:(const uint64_t [])keys
3275 count:(NSUInteger)count;
3276
3277 /**
3278 * Creates and initializes a dictionary with the entries from the given.
3279 * dictionary.
3280 *
3281 * @param dictionary Dictionary containing the entries to add to the dictionary.
3282 *
3283 * @return A newly instanced dictionary with the entries from the given
3284 * dictionary in it.
3285 **/
3286 + (instancetype)dictionaryWithDictionary:(GPBUInt64Int64Dictionary *)dictionary; 854 + (instancetype)dictionaryWithDictionary:(GPBUInt64Int64Dictionary *)dictionary;
3287 855 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
3288 /** 856
3289 * Creates and initializes a dictionary with the given capacity. 857 - (instancetype)initWithValues:(const int64_t [])values
3290 * 858 forKeys:(const uint64_t [])keys
3291 * @param numItems Capacity needed for the dictionary. 859 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3292 *
3293 * @return A newly instanced dictionary with the given capacity.
3294 **/
3295 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
3296
3297 /**
3298 * Initializes this dictionary, copying the given values and keys.
3299 *
3300 * @param values The values to be placed in this dictionary.
3301 * @param keys The keys under which to store the values.
3302 * @param count The number of elements to copy into the dictionary.
3303 *
3304 * @return A newly initialized dictionary with a copy of the values and keys.
3305 **/
3306 - (instancetype)initWithInt64s:(const int64_t [])values
3307 forKeys:(const uint64_t [])keys
3308 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3309
3310 /**
3311 * Initializes this dictionary, copying the entries from the given dictionary.
3312 *
3313 * @param dictionary Dictionary containing the entries to add to this dictionary .
3314 *
3315 * @return A newly initialized dictionary with the entries of the given dictiona ry.
3316 **/
3317 - (instancetype)initWithDictionary:(GPBUInt64Int64Dictionary *)dictionary; 860 - (instancetype)initWithDictionary:(GPBUInt64Int64Dictionary *)dictionary;
3318 861 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3319 /** 862
3320 * Initializes this dictionary with the requested capacity. 863 - (BOOL)valueForKey:(uint64_t)key value:(nullable int64_t *)value;
3321 * 864
3322 * @param numItems Number of items needed for this dictionary. 865 - (void)enumerateKeysAndValuesUsingBlock:
3323 *
3324 * @return A newly initialized dictionary with the requested capacity.
3325 **/
3326 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3327
3328 /**
3329 * Gets the value for the given key.
3330 *
3331 * @param value Pointer into which the value will be set, if found.
3332 * @param key Key under which the value is stored, if present.
3333 *
3334 * @return YES if the key was found and the value was copied, NO otherwise.
3335 **/
3336 - (BOOL)getInt64:(nullable int64_t *)value forKey:(uint64_t)key;
3337
3338 /**
3339 * Enumerates the keys and values on this dictionary with the given block.
3340 *
3341 * @param block The block to enumerate with.
3342 * **key**: The key for the current entry.
3343 * **value**: The value for the current entry
3344 * **stop**: A pointer to a boolean that when set stops the enumeration.
3345 **/
3346 - (void)enumerateKeysAndInt64sUsingBlock:
3347 (void (^)(uint64_t key, int64_t value, BOOL *stop))block; 866 (void (^)(uint64_t key, int64_t value, BOOL *stop))block;
3348 867
3349 /**
3350 * Adds the keys and values from another dictionary.
3351 *
3352 * @param otherDictionary Dictionary containing entries to be added to this
3353 * dictionary.
3354 **/
3355 - (void)addEntriesFromDictionary:(GPBUInt64Int64Dictionary *)otherDictionary; 868 - (void)addEntriesFromDictionary:(GPBUInt64Int64Dictionary *)otherDictionary;
3356 869
3357 /** 870 - (void)setValue:(int64_t)value forKey:(uint64_t)key;
3358 * Sets the value for the given key. 871
3359 * 872 - (void)removeValueForKey:(uint64_t)aKey;
3360 * @param value The value to set.
3361 * @param key The key under which to store the value.
3362 **/
3363 - (void)setInt64:(int64_t)value forKey:(uint64_t)key;
3364
3365 /**
3366 * Removes the entry for the given key.
3367 *
3368 * @param aKey Key to be removed from this dictionary.
3369 **/
3370 - (void)removeInt64ForKey:(uint64_t)aKey;
3371
3372 /**
3373 * Removes all entries in this dictionary.
3374 **/
3375 - (void)removeAll; 873 - (void)removeAll;
3376 874
3377 @end 875 @end
3378 876
3379 #pragma mark - UInt64 -> Bool 877 #pragma mark - UInt64 -> Bool
3380 878
3381 /**
3382 * Class used for map fields of <uint64_t, BOOL>
3383 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3384 *
3385 * @note This class is not meant to be subclassed.
3386 **/
3387 @interface GPBUInt64BoolDictionary : NSObject <NSCopying> 879 @interface GPBUInt64BoolDictionary : NSObject <NSCopying>
3388 880
3389 /** Number of entries stored in this dictionary. */ 881 @property(nonatomic, readonly) NSUInteger count;
3390 @property(nonatomic, readonly) NSUInteger count; 882
3391 883 + (instancetype)dictionary;
3392 /** 884 + (instancetype)dictionaryWithValue:(BOOL)value
3393 * @return A newly instanced and empty dictionary. 885 forKey:(uint64_t)key;
3394 **/ 886 + (instancetype)dictionaryWithValues:(const BOOL [])values
3395 + (instancetype)dictionary; 887 forKeys:(const uint64_t [])keys
3396 888 count:(NSUInteger)count;
3397 /**
3398 * Creates and initializes a dictionary with the single entry given.
3399 *
3400 * @param value The value to be placed in the dictionary.
3401 * @param key The key under which to store the value.
3402 *
3403 * @return A newly instanced dictionary with the key and value in it.
3404 **/
3405 + (instancetype)dictionaryWithBool:(BOOL)value
3406 forKey:(uint64_t)key;
3407
3408 /**
3409 * Creates and initializes a dictionary with the entries given.
3410 *
3411 * @param values The values to be placed in the dictionary.
3412 * @param keys The keys under which to store the values.
3413 * @param count The number of entries to store in the dictionary.
3414 *
3415 * @return A newly instanced dictionary with the keys and values in it.
3416 **/
3417 + (instancetype)dictionaryWithBools:(const BOOL [])values
3418 forKeys:(const uint64_t [])keys
3419 count:(NSUInteger)count;
3420
3421 /**
3422 * Creates and initializes a dictionary with the entries from the given.
3423 * dictionary.
3424 *
3425 * @param dictionary Dictionary containing the entries to add to the dictionary.
3426 *
3427 * @return A newly instanced dictionary with the entries from the given
3428 * dictionary in it.
3429 **/
3430 + (instancetype)dictionaryWithDictionary:(GPBUInt64BoolDictionary *)dictionary; 889 + (instancetype)dictionaryWithDictionary:(GPBUInt64BoolDictionary *)dictionary;
3431 890 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
3432 /** 891
3433 * Creates and initializes a dictionary with the given capacity. 892 - (instancetype)initWithValues:(const BOOL [])values
3434 * 893 forKeys:(const uint64_t [])keys
3435 * @param numItems Capacity needed for the dictionary. 894 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3436 *
3437 * @return A newly instanced dictionary with the given capacity.
3438 **/
3439 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
3440
3441 /**
3442 * Initializes this dictionary, copying the given values and keys.
3443 *
3444 * @param values The values to be placed in this dictionary.
3445 * @param keys The keys under which to store the values.
3446 * @param count The number of elements to copy into the dictionary.
3447 *
3448 * @return A newly initialized dictionary with a copy of the values and keys.
3449 **/
3450 - (instancetype)initWithBools:(const BOOL [])values
3451 forKeys:(const uint64_t [])keys
3452 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3453
3454 /**
3455 * Initializes this dictionary, copying the entries from the given dictionary.
3456 *
3457 * @param dictionary Dictionary containing the entries to add to this dictionary .
3458 *
3459 * @return A newly initialized dictionary with the entries of the given dictiona ry.
3460 **/
3461 - (instancetype)initWithDictionary:(GPBUInt64BoolDictionary *)dictionary; 895 - (instancetype)initWithDictionary:(GPBUInt64BoolDictionary *)dictionary;
3462 896 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3463 /** 897
3464 * Initializes this dictionary with the requested capacity. 898 - (BOOL)valueForKey:(uint64_t)key value:(nullable BOOL *)value;
3465 * 899
3466 * @param numItems Number of items needed for this dictionary. 900 - (void)enumerateKeysAndValuesUsingBlock:
3467 *
3468 * @return A newly initialized dictionary with the requested capacity.
3469 **/
3470 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3471
3472 /**
3473 * Gets the value for the given key.
3474 *
3475 * @param value Pointer into which the value will be set, if found.
3476 * @param key Key under which the value is stored, if present.
3477 *
3478 * @return YES if the key was found and the value was copied, NO otherwise.
3479 **/
3480 - (BOOL)getBool:(nullable BOOL *)value forKey:(uint64_t)key;
3481
3482 /**
3483 * Enumerates the keys and values on this dictionary with the given block.
3484 *
3485 * @param block The block to enumerate with.
3486 * **key**: The key for the current entry.
3487 * **value**: The value for the current entry
3488 * **stop**: A pointer to a boolean that when set stops the enumeration.
3489 **/
3490 - (void)enumerateKeysAndBoolsUsingBlock:
3491 (void (^)(uint64_t key, BOOL value, BOOL *stop))block; 901 (void (^)(uint64_t key, BOOL value, BOOL *stop))block;
3492 902
3493 /**
3494 * Adds the keys and values from another dictionary.
3495 *
3496 * @param otherDictionary Dictionary containing entries to be added to this
3497 * dictionary.
3498 **/
3499 - (void)addEntriesFromDictionary:(GPBUInt64BoolDictionary *)otherDictionary; 903 - (void)addEntriesFromDictionary:(GPBUInt64BoolDictionary *)otherDictionary;
3500 904
3501 /** 905 - (void)setValue:(BOOL)value forKey:(uint64_t)key;
3502 * Sets the value for the given key. 906
3503 * 907 - (void)removeValueForKey:(uint64_t)aKey;
3504 * @param value The value to set.
3505 * @param key The key under which to store the value.
3506 **/
3507 - (void)setBool:(BOOL)value forKey:(uint64_t)key;
3508
3509 /**
3510 * Removes the entry for the given key.
3511 *
3512 * @param aKey Key to be removed from this dictionary.
3513 **/
3514 - (void)removeBoolForKey:(uint64_t)aKey;
3515
3516 /**
3517 * Removes all entries in this dictionary.
3518 **/
3519 - (void)removeAll; 908 - (void)removeAll;
3520 909
3521 @end 910 @end
3522 911
3523 #pragma mark - UInt64 -> Float 912 #pragma mark - UInt64 -> Float
3524 913
3525 /**
3526 * Class used for map fields of <uint64_t, float>
3527 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3528 *
3529 * @note This class is not meant to be subclassed.
3530 **/
3531 @interface GPBUInt64FloatDictionary : NSObject <NSCopying> 914 @interface GPBUInt64FloatDictionary : NSObject <NSCopying>
3532 915
3533 /** Number of entries stored in this dictionary. */ 916 @property(nonatomic, readonly) NSUInteger count;
3534 @property(nonatomic, readonly) NSUInteger count; 917
3535 918 + (instancetype)dictionary;
3536 /** 919 + (instancetype)dictionaryWithValue:(float)value
3537 * @return A newly instanced and empty dictionary. 920 forKey:(uint64_t)key;
3538 **/ 921 + (instancetype)dictionaryWithValues:(const float [])values
3539 + (instancetype)dictionary; 922 forKeys:(const uint64_t [])keys
3540 923 count:(NSUInteger)count;
3541 /**
3542 * Creates and initializes a dictionary with the single entry given.
3543 *
3544 * @param value The value to be placed in the dictionary.
3545 * @param key The key under which to store the value.
3546 *
3547 * @return A newly instanced dictionary with the key and value in it.
3548 **/
3549 + (instancetype)dictionaryWithFloat:(float)value
3550 forKey:(uint64_t)key;
3551
3552 /**
3553 * Creates and initializes a dictionary with the entries given.
3554 *
3555 * @param values The values to be placed in the dictionary.
3556 * @param keys The keys under which to store the values.
3557 * @param count The number of entries to store in the dictionary.
3558 *
3559 * @return A newly instanced dictionary with the keys and values in it.
3560 **/
3561 + (instancetype)dictionaryWithFloats:(const float [])values
3562 forKeys:(const uint64_t [])keys
3563 count:(NSUInteger)count;
3564
3565 /**
3566 * Creates and initializes a dictionary with the entries from the given.
3567 * dictionary.
3568 *
3569 * @param dictionary Dictionary containing the entries to add to the dictionary.
3570 *
3571 * @return A newly instanced dictionary with the entries from the given
3572 * dictionary in it.
3573 **/
3574 + (instancetype)dictionaryWithDictionary:(GPBUInt64FloatDictionary *)dictionary; 924 + (instancetype)dictionaryWithDictionary:(GPBUInt64FloatDictionary *)dictionary;
3575 925 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
3576 /** 926
3577 * Creates and initializes a dictionary with the given capacity. 927 - (instancetype)initWithValues:(const float [])values
3578 * 928 forKeys:(const uint64_t [])keys
3579 * @param numItems Capacity needed for the dictionary. 929 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3580 *
3581 * @return A newly instanced dictionary with the given capacity.
3582 **/
3583 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
3584
3585 /**
3586 * Initializes this dictionary, copying the given values and keys.
3587 *
3588 * @param values The values to be placed in this dictionary.
3589 * @param keys The keys under which to store the values.
3590 * @param count The number of elements to copy into the dictionary.
3591 *
3592 * @return A newly initialized dictionary with a copy of the values and keys.
3593 **/
3594 - (instancetype)initWithFloats:(const float [])values
3595 forKeys:(const uint64_t [])keys
3596 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3597
3598 /**
3599 * Initializes this dictionary, copying the entries from the given dictionary.
3600 *
3601 * @param dictionary Dictionary containing the entries to add to this dictionary .
3602 *
3603 * @return A newly initialized dictionary with the entries of the given dictiona ry.
3604 **/
3605 - (instancetype)initWithDictionary:(GPBUInt64FloatDictionary *)dictionary; 930 - (instancetype)initWithDictionary:(GPBUInt64FloatDictionary *)dictionary;
3606 931 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3607 /** 932
3608 * Initializes this dictionary with the requested capacity. 933 - (BOOL)valueForKey:(uint64_t)key value:(nullable float *)value;
3609 * 934
3610 * @param numItems Number of items needed for this dictionary. 935 - (void)enumerateKeysAndValuesUsingBlock:
3611 *
3612 * @return A newly initialized dictionary with the requested capacity.
3613 **/
3614 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3615
3616 /**
3617 * Gets the value for the given key.
3618 *
3619 * @param value Pointer into which the value will be set, if found.
3620 * @param key Key under which the value is stored, if present.
3621 *
3622 * @return YES if the key was found and the value was copied, NO otherwise.
3623 **/
3624 - (BOOL)getFloat:(nullable float *)value forKey:(uint64_t)key;
3625
3626 /**
3627 * Enumerates the keys and values on this dictionary with the given block.
3628 *
3629 * @param block The block to enumerate with.
3630 * **key**: The key for the current entry.
3631 * **value**: The value for the current entry
3632 * **stop**: A pointer to a boolean that when set stops the enumeration.
3633 **/
3634 - (void)enumerateKeysAndFloatsUsingBlock:
3635 (void (^)(uint64_t key, float value, BOOL *stop))block; 936 (void (^)(uint64_t key, float value, BOOL *stop))block;
3636 937
3637 /**
3638 * Adds the keys and values from another dictionary.
3639 *
3640 * @param otherDictionary Dictionary containing entries to be added to this
3641 * dictionary.
3642 **/
3643 - (void)addEntriesFromDictionary:(GPBUInt64FloatDictionary *)otherDictionary; 938 - (void)addEntriesFromDictionary:(GPBUInt64FloatDictionary *)otherDictionary;
3644 939
3645 /** 940 - (void)setValue:(float)value forKey:(uint64_t)key;
3646 * Sets the value for the given key. 941
3647 * 942 - (void)removeValueForKey:(uint64_t)aKey;
3648 * @param value The value to set.
3649 * @param key The key under which to store the value.
3650 **/
3651 - (void)setFloat:(float)value forKey:(uint64_t)key;
3652
3653 /**
3654 * Removes the entry for the given key.
3655 *
3656 * @param aKey Key to be removed from this dictionary.
3657 **/
3658 - (void)removeFloatForKey:(uint64_t)aKey;
3659
3660 /**
3661 * Removes all entries in this dictionary.
3662 **/
3663 - (void)removeAll; 943 - (void)removeAll;
3664 944
3665 @end 945 @end
3666 946
3667 #pragma mark - UInt64 -> Double 947 #pragma mark - UInt64 -> Double
3668 948
3669 /**
3670 * Class used for map fields of <uint64_t, double>
3671 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3672 *
3673 * @note This class is not meant to be subclassed.
3674 **/
3675 @interface GPBUInt64DoubleDictionary : NSObject <NSCopying> 949 @interface GPBUInt64DoubleDictionary : NSObject <NSCopying>
3676 950
3677 /** Number of entries stored in this dictionary. */ 951 @property(nonatomic, readonly) NSUInteger count;
3678 @property(nonatomic, readonly) NSUInteger count; 952
3679 953 + (instancetype)dictionary;
3680 /** 954 + (instancetype)dictionaryWithValue:(double)value
3681 * @return A newly instanced and empty dictionary. 955 forKey:(uint64_t)key;
3682 **/ 956 + (instancetype)dictionaryWithValues:(const double [])values
3683 + (instancetype)dictionary; 957 forKeys:(const uint64_t [])keys
3684 958 count:(NSUInteger)count;
3685 /**
3686 * Creates and initializes a dictionary with the single entry given.
3687 *
3688 * @param value The value to be placed in the dictionary.
3689 * @param key The key under which to store the value.
3690 *
3691 * @return A newly instanced dictionary with the key and value in it.
3692 **/
3693 + (instancetype)dictionaryWithDouble:(double)value
3694 forKey:(uint64_t)key;
3695
3696 /**
3697 * Creates and initializes a dictionary with the entries given.
3698 *
3699 * @param values The values to be placed in the dictionary.
3700 * @param keys The keys under which to store the values.
3701 * @param count The number of entries to store in the dictionary.
3702 *
3703 * @return A newly instanced dictionary with the keys and values in it.
3704 **/
3705 + (instancetype)dictionaryWithDoubles:(const double [])values
3706 forKeys:(const uint64_t [])keys
3707 count:(NSUInteger)count;
3708
3709 /**
3710 * Creates and initializes a dictionary with the entries from the given.
3711 * dictionary.
3712 *
3713 * @param dictionary Dictionary containing the entries to add to the dictionary.
3714 *
3715 * @return A newly instanced dictionary with the entries from the given
3716 * dictionary in it.
3717 **/
3718 + (instancetype)dictionaryWithDictionary:(GPBUInt64DoubleDictionary *)dictionary ; 959 + (instancetype)dictionaryWithDictionary:(GPBUInt64DoubleDictionary *)dictionary ;
3719 960 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
3720 /** 961
3721 * Creates and initializes a dictionary with the given capacity. 962 - (instancetype)initWithValues:(const double [])values
3722 * 963 forKeys:(const uint64_t [])keys
3723 * @param numItems Capacity needed for the dictionary. 964 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3724 *
3725 * @return A newly instanced dictionary with the given capacity.
3726 **/
3727 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
3728
3729 /**
3730 * Initializes this dictionary, copying the given values and keys.
3731 *
3732 * @param values The values to be placed in this dictionary.
3733 * @param keys The keys under which to store the values.
3734 * @param count The number of elements to copy into the dictionary.
3735 *
3736 * @return A newly initialized dictionary with a copy of the values and keys.
3737 **/
3738 - (instancetype)initWithDoubles:(const double [])values
3739 forKeys:(const uint64_t [])keys
3740 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
3741
3742 /**
3743 * Initializes this dictionary, copying the entries from the given dictionary.
3744 *
3745 * @param dictionary Dictionary containing the entries to add to this dictionary .
3746 *
3747 * @return A newly initialized dictionary with the entries of the given dictiona ry.
3748 **/
3749 - (instancetype)initWithDictionary:(GPBUInt64DoubleDictionary *)dictionary; 965 - (instancetype)initWithDictionary:(GPBUInt64DoubleDictionary *)dictionary;
3750 966 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3751 /** 967
3752 * Initializes this dictionary with the requested capacity. 968 - (BOOL)valueForKey:(uint64_t)key value:(nullable double *)value;
3753 * 969
3754 * @param numItems Number of items needed for this dictionary. 970 - (void)enumerateKeysAndValuesUsingBlock:
3755 *
3756 * @return A newly initialized dictionary with the requested capacity.
3757 **/
3758 - (instancetype)initWithCapacity:(NSUInteger)numItems;
3759
3760 /**
3761 * Gets the value for the given key.
3762 *
3763 * @param value Pointer into which the value will be set, if found.
3764 * @param key Key under which the value is stored, if present.
3765 *
3766 * @return YES if the key was found and the value was copied, NO otherwise.
3767 **/
3768 - (BOOL)getDouble:(nullable double *)value forKey:(uint64_t)key;
3769
3770 /**
3771 * Enumerates the keys and values on this dictionary with the given block.
3772 *
3773 * @param block The block to enumerate with.
3774 * **key**: The key for the current entry.
3775 * **value**: The value for the current entry
3776 * **stop**: A pointer to a boolean that when set stops the enumeration.
3777 **/
3778 - (void)enumerateKeysAndDoublesUsingBlock:
3779 (void (^)(uint64_t key, double value, BOOL *stop))block; 971 (void (^)(uint64_t key, double value, BOOL *stop))block;
3780 972
3781 /**
3782 * Adds the keys and values from another dictionary.
3783 *
3784 * @param otherDictionary Dictionary containing entries to be added to this
3785 * dictionary.
3786 **/
3787 - (void)addEntriesFromDictionary:(GPBUInt64DoubleDictionary *)otherDictionary; 973 - (void)addEntriesFromDictionary:(GPBUInt64DoubleDictionary *)otherDictionary;
3788 974
3789 /** 975 - (void)setValue:(double)value forKey:(uint64_t)key;
3790 * Sets the value for the given key. 976
3791 * 977 - (void)removeValueForKey:(uint64_t)aKey;
3792 * @param value The value to set.
3793 * @param key The key under which to store the value.
3794 **/
3795 - (void)setDouble:(double)value forKey:(uint64_t)key;
3796
3797 /**
3798 * Removes the entry for the given key.
3799 *
3800 * @param aKey Key to be removed from this dictionary.
3801 **/
3802 - (void)removeDoubleForKey:(uint64_t)aKey;
3803
3804 /**
3805 * Removes all entries in this dictionary.
3806 **/
3807 - (void)removeAll; 978 - (void)removeAll;
3808 979
3809 @end 980 @end
3810 981
3811 #pragma mark - UInt64 -> Enum 982 #pragma mark - UInt64 -> Enum
3812 983
3813 /**
3814 * Class used for map fields of <uint64_t, int32_t>
3815 * values. This performs better than boxing into NSNumbers in NSDictionaries.
3816 *
3817 * @note This class is not meant to be subclassed.
3818 **/
3819 @interface GPBUInt64EnumDictionary : NSObject <NSCopying> 984 @interface GPBUInt64EnumDictionary : NSObject <NSCopying>
3820 985
3821 /** Number of entries stored in this dictionary. */ 986 @property(nonatomic, readonly) NSUInteger count;
3822 @property(nonatomic, readonly) NSUInteger count;
3823 /** The validation function to check if the enums are valid. */
3824 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 987 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
3825 988
3826 /** 989 + (instancetype)dictionary;
3827 * @return A newly instanced and empty dictionary.
3828 **/
3829 + (instancetype)dictionary;
3830
3831 /**
3832 * Creates and initializes a dictionary with the given validation function.
3833 *
3834 * @param func The enum validation function for the dictionary.
3835 *
3836 * @return A newly instanced dictionary.
3837 **/
3838 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func; 990 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func;
3839
3840 /**
3841 * Creates and initializes a dictionary with the single entry given.
3842 *
3843 * @param func The enum validation function for the dictionary.
3844 * @param rawValue The raw enum value to be placed in the dictionary.
3845 * @param key The key under which to store the value.
3846 *
3847 * @return A newly instanced dictionary with the key and value in it.
3848 **/
3849 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 991 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
3850 rawValue:(int32_t)rawValue 992 rawValue:(int32_t)rawValue
3851 forKey:(uint64_t)key; 993 forKey:(uint64_t)key;
3852
3853 /**
3854 * Creates and initializes a dictionary with the entries given.
3855 *
3856 * @param func The enum validation function for the dictionary.
3857 * @param values The raw enum values values to be placed in the dictionary.
3858 * @param keys The keys under which to store the values.
3859 * @param count The number of entries to store in the dictionary.
3860 *
3861 * @return A newly instanced dictionary with the keys and values in it.
3862 **/
3863 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 994 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
3864 rawValues:(const int32_t [])values 995 rawValues:(const int32_t [])values
3865 forKeys:(const uint64_t [])keys 996 forKeys:(const uint64_t [])keys
3866 count:(NSUInteger)count; 997 count:(NSUInteger)count;
3867
3868 /**
3869 * Creates and initializes a dictionary with the entries from the given.
3870 * dictionary.
3871 *
3872 * @param dictionary Dictionary containing the entries to add to the dictionary.
3873 *
3874 * @return A newly instanced dictionary with the entries from the given
3875 * dictionary in it.
3876 **/
3877 + (instancetype)dictionaryWithDictionary:(GPBUInt64EnumDictionary *)dictionary; 998 + (instancetype)dictionaryWithDictionary:(GPBUInt64EnumDictionary *)dictionary;
3878
3879 /**
3880 * Creates and initializes a dictionary with the given capacity.
3881 *
3882 * @param func The enum validation function for the dictionary.
3883 * @param numItems Capacity needed for the dictionary.
3884 *
3885 * @return A newly instanced dictionary with the given capacity.
3886 **/
3887 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 999 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
3888 capacity:(NSUInteger)numItems; 1000 capacity:(NSUInteger)numItems;
3889 1001
3890 /**
3891 * Initializes a dictionary with the given validation function.
3892 *
3893 * @param func The enum validation function for the dictionary.
3894 *
3895 * @return A newly initialized dictionary.
3896 **/
3897 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 1002 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
3898
3899 /**
3900 * Initializes a dictionary with the entries given.
3901 *
3902 * @param func The enum validation function for the dictionary.
3903 * @param values The raw enum values values to be placed in the dictionary.
3904 * @param keys The keys under which to store the values.
3905 * @param count The number of entries to store in the dictionary.
3906 *
3907 * @return A newly initialized dictionary with the keys and values in it.
3908 **/
3909 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1003 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
3910 rawValues:(const int32_t [])values 1004 rawValues:(const int32_t [])values
3911 forKeys:(const uint64_t [])keys 1005 forKeys:(const uint64_t [])keys
3912 count:(NSUInteger)count NS_DESIGNATED_INITI ALIZER; 1006 count:(NSUInteger)count NS_DESIGNATED_INITI ALIZER;
3913
3914 /**
3915 * Initializes a dictionary with the entries from the given.
3916 * dictionary.
3917 *
3918 * @param dictionary Dictionary containing the entries to add to the dictionary.
3919 *
3920 * @return A newly initialized dictionary with the entries from the given
3921 * dictionary in it.
3922 **/
3923 - (instancetype)initWithDictionary:(GPBUInt64EnumDictionary *)dictionary; 1007 - (instancetype)initWithDictionary:(GPBUInt64EnumDictionary *)dictionary;
3924
3925 /**
3926 * Initializes a dictionary with the given capacity.
3927 *
3928 * @param func The enum validation function for the dictionary.
3929 * @param numItems Capacity needed for the dictionary.
3930 *
3931 * @return A newly initialized dictionary with the given capacity.
3932 **/
3933 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1008 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
3934 capacity:(NSUInteger)numItems; 1009 capacity:(NSUInteger)numItems;
3935 1010
3936 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 1011 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
3937 // is not a valid enumerator as defined by validationFunc. If the actual value i s 1012 // is not a valid enumerator as defined by validationFunc. If the actual value i s
3938 // desired, use "raw" version of the method. 1013 // desired, use "raw" version of the method.
3939 1014
3940 /** 1015 - (BOOL)valueForKey:(uint64_t)key value:(nullable int32_t *)value;
3941 * Gets the value for the given key.
3942 *
3943 * @param value Pointer into which the value will be set, if found.
3944 * @param key Key under which the value is stored, if present.
3945 *
3946 * @return YES if the key was found and the value was copied, NO otherwise.
3947 **/
3948 - (BOOL)getEnum:(nullable int32_t *)value forKey:(uint64_t)key;
3949 1016
3950 /** 1017 - (void)enumerateKeysAndValuesUsingBlock:
3951 * Enumerates the keys and values on this dictionary with the given block.
3952 *
3953 * @param block The block to enumerate with.
3954 * **key**: The key for the current entry.
3955 * **value**: The value for the current entry
3956 * **stop**: A pointer to a boolean that when set stops the enumeration.
3957 **/
3958 - (void)enumerateKeysAndEnumsUsingBlock:
3959 (void (^)(uint64_t key, int32_t value, BOOL *stop))block; 1018 (void (^)(uint64_t key, int32_t value, BOOL *stop))block;
3960 1019
3961 /** 1020 // These methods bypass the validationFunc to provide access to values that were not
3962 * Gets the raw enum value for the given key. 1021 // known at the time the binary was compiled.
3963 *
3964 * @note This method bypass the validationFunc to enable the access of values th at
3965 * were not known at the time the binary was compiled.
3966 *
3967 * @param rawValue Pointer into which the value will be set, if found.
3968 * @param key Key under which the value is stored, if present.
3969 *
3970 * @return YES if the key was found and the value was copied, NO otherwise.
3971 **/
3972 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint64_t)key;
3973 1022
3974 /** 1023 - (BOOL)valueForKey:(uint64_t)key rawValue:(nullable int32_t *)rawValue;
3975 * Enumerates the keys and values on this dictionary with the given block. 1024
3976 *
3977 * @note This method bypass the validationFunc to enable the access of values th at
3978 * were not known at the time the binary was compiled.
3979 *
3980 * @param block The block to enumerate with.
3981 * **key**: The key for the current entry.
3982 * **rawValue**: The value for the current entry
3983 * **stop**: A pointer to a boolean that when set stops the enumeration.
3984 **/
3985 - (void)enumerateKeysAndRawValuesUsingBlock: 1025 - (void)enumerateKeysAndRawValuesUsingBlock:
3986 (void (^)(uint64_t key, int32_t rawValue, BOOL *stop))block; 1026 (void (^)(uint64_t key, int32_t rawValue, BOOL *stop))block;
3987 1027
3988 /**
3989 * Adds the keys and raw enum values from another dictionary.
3990 *
3991 * @note This method bypass the validationFunc to enable the setting of values t hat
3992 * were not known at the time the binary was compiled.
3993 *
3994 * @param otherDictionary Dictionary containing entries to be added to this
3995 * dictionary.
3996 **/
3997 - (void)addRawEntriesFromDictionary:(GPBUInt64EnumDictionary *)otherDictionary; 1028 - (void)addRawEntriesFromDictionary:(GPBUInt64EnumDictionary *)otherDictionary;
3998 1029
3999 // If value is not a valid enumerator as defined by validationFunc, these 1030 // If value is not a valid enumerator as defined by validationFunc, these
4000 // methods will assert in debug, and will log in release and assign the value 1031 // methods will assert in debug, and will log in release and assign the value
4001 // to the default value. Use the rawValue methods below to assign non enumerator 1032 // to the default value. Use the rawValue methods below to assign non enumerator
4002 // values. 1033 // values.
4003 1034
4004 /** 1035 - (void)setValue:(int32_t)value forKey:(uint64_t)key;
4005 * Sets the value for the given key. 1036
4006 * 1037 // This method bypass the validationFunc to provide setting of values that were not
4007 * @param value The value to set. 1038 // known at the time the binary was compiled.
4008 * @param key The key under which to store the value.
4009 **/
4010 - (void)setEnum:(int32_t)value forKey:(uint64_t)key;
4011
4012 /**
4013 * Sets the raw enum value for the given key.
4014 *
4015 * @note This method bypass the validationFunc to enable the setting of values t hat
4016 * were not known at the time the binary was compiled.
4017 *
4018 * @param rawValue The raw enum value to set.
4019 * @param key The key under which to store the raw enum value.
4020 **/
4021 - (void)setRawValue:(int32_t)rawValue forKey:(uint64_t)key; 1039 - (void)setRawValue:(int32_t)rawValue forKey:(uint64_t)key;
4022 1040
4023 /** 1041 // No validation applies to these methods.
4024 * Removes the entry for the given key. 1042
4025 * 1043 - (void)removeValueForKey:(uint64_t)aKey;
4026 * @param aKey Key to be removed from this dictionary.
4027 **/
4028 - (void)removeEnumForKey:(uint64_t)aKey;
4029
4030 /**
4031 * Removes all entries in this dictionary.
4032 **/
4033 - (void)removeAll; 1044 - (void)removeAll;
4034 1045
4035 @end 1046 @end
4036 1047
4037 #pragma mark - UInt64 -> Object 1048 #pragma mark - UInt64 -> Object
4038 1049
4039 /**
4040 * Class used for map fields of <uint64_t, ObjectType>
4041 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4042 *
4043 * @note This class is not meant to be subclassed.
4044 **/
4045 @interface GPBUInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyi ng> 1050 @interface GPBUInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyi ng>
4046 1051
4047 /** Number of entries stored in this dictionary. */ 1052 @property(nonatomic, readonly) NSUInteger count;
4048 @property(nonatomic, readonly) NSUInteger count; 1053
4049 1054 + (instancetype)dictionary;
4050 /**
4051 * @return A newly instanced and empty dictionary.
4052 **/
4053 + (instancetype)dictionary;
4054
4055 /**
4056 * Creates and initializes a dictionary with the single entry given.
4057 *
4058 * @param object The value to be placed in the dictionary.
4059 * @param key The key under which to store the value.
4060 *
4061 * @return A newly instanced dictionary with the key and value in it.
4062 **/
4063 + (instancetype)dictionaryWithObject:(ObjectType)object 1055 + (instancetype)dictionaryWithObject:(ObjectType)object
4064 forKey:(uint64_t)key; 1056 forKey:(uint64_t)key;
4065
4066 /**
4067 * Creates and initializes a dictionary with the entries given.
4068 *
4069 * @param objects The values to be placed in the dictionary.
4070 * @param keys The keys under which to store the values.
4071 * @param count The number of entries to store in the dictionary.
4072 *
4073 * @return A newly instanced dictionary with the keys and values in it.
4074 **/
4075 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [] )objects 1057 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [] )objects
4076 forKeys:(const uint64_t [])keys 1058 forKeys:(const uint64_t [])keys
4077 count:(NSUInteger)count; 1059 count:(NSUInteger)count;
4078
4079 /**
4080 * Creates and initializes a dictionary with the entries from the given.
4081 * dictionary.
4082 *
4083 * @param dictionary Dictionary containing the entries to add to the dictionary.
4084 *
4085 * @return A newly instanced dictionary with the entries from the given
4086 * dictionary in it.
4087 **/
4088 + (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary ; 1060 + (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary ;
4089 1061 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4090 /** 1062
4091 * Creates and initializes a dictionary with the given capacity.
4092 *
4093 * @param numItems Capacity needed for the dictionary.
4094 *
4095 * @return A newly instanced dictionary with the given capacity.
4096 **/
4097 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4098
4099 /**
4100 * Initializes this dictionary, copying the given values and keys.
4101 *
4102 * @param objects The values to be placed in this dictionary.
4103 * @param keys The keys under which to store the values.
4104 * @param count The number of elements to copy into the dictionary.
4105 *
4106 * @return A newly initialized dictionary with a copy of the values and keys.
4107 **/
4108 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec ts 1063 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec ts
4109 forKeys:(const uint64_t [])keys 1064 forKeys:(const uint64_t [])keys
4110 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1065 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4111
4112 /**
4113 * Initializes this dictionary, copying the entries from the given dictionary.
4114 *
4115 * @param dictionary Dictionary containing the entries to add to this dictionary .
4116 *
4117 * @return A newly initialized dictionary with the entries of the given dictiona ry.
4118 **/
4119 - (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary; 1066 - (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
4120 1067 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4121 /** 1068
4122 * Initializes this dictionary with the requested capacity.
4123 *
4124 * @param numItems Number of items needed for this dictionary.
4125 *
4126 * @return A newly initialized dictionary with the requested capacity.
4127 **/
4128 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4129
4130 /**
4131 * Fetches the object stored under the given key.
4132 *
4133 * @param key Key under which the value is stored, if present.
4134 *
4135 * @return The object if found, nil otherwise.
4136 **/
4137 - (ObjectType)objectForKey:(uint64_t)key; 1069 - (ObjectType)objectForKey:(uint64_t)key;
4138 1070
4139 /**
4140 * Enumerates the keys and values on this dictionary with the given block.
4141 *
4142 * @param block The block to enumerate with.
4143 * **key**: The key for the current entry.
4144 * **object**: The value for the current entry
4145 * **stop**: A pointer to a boolean that when set stops the enumeration .
4146 **/
4147 - (void)enumerateKeysAndObjectsUsingBlock: 1071 - (void)enumerateKeysAndObjectsUsingBlock:
4148 (void (^)(uint64_t key, ObjectType object, BOOL *stop))block; 1072 (void (^)(uint64_t key, ObjectType object, BOOL *stop))block;
4149 1073
4150 /**
4151 * Adds the keys and values from another dictionary.
4152 *
4153 * @param otherDictionary Dictionary containing entries to be added to this
4154 * dictionary.
4155 **/
4156 - (void)addEntriesFromDictionary:(GPBUInt64ObjectDictionary *)otherDictionary; 1074 - (void)addEntriesFromDictionary:(GPBUInt64ObjectDictionary *)otherDictionary;
4157 1075
4158 /**
4159 * Sets the value for the given key.
4160 *
4161 * @param object The value to set.
4162 * @param key The key under which to store the value.
4163 **/
4164 - (void)setObject:(ObjectType)object forKey:(uint64_t)key; 1076 - (void)setObject:(ObjectType)object forKey:(uint64_t)key;
4165 1077
4166 /**
4167 * Removes the entry for the given key.
4168 *
4169 * @param aKey Key to be removed from this dictionary.
4170 **/
4171 - (void)removeObjectForKey:(uint64_t)aKey; 1078 - (void)removeObjectForKey:(uint64_t)aKey;
4172
4173 /**
4174 * Removes all entries in this dictionary.
4175 **/
4176 - (void)removeAll; 1079 - (void)removeAll;
4177 1080
4178 @end 1081 @end
4179 1082
4180 #pragma mark - Int64 -> UInt32 1083 #pragma mark - Int64 -> UInt32
4181 1084
4182 /**
4183 * Class used for map fields of <int64_t, uint32_t>
4184 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4185 *
4186 * @note This class is not meant to be subclassed.
4187 **/
4188 @interface GPBInt64UInt32Dictionary : NSObject <NSCopying> 1085 @interface GPBInt64UInt32Dictionary : NSObject <NSCopying>
4189 1086
4190 /** Number of entries stored in this dictionary. */ 1087 @property(nonatomic, readonly) NSUInteger count;
4191 @property(nonatomic, readonly) NSUInteger count; 1088
4192 1089 + (instancetype)dictionary;
4193 /** 1090 + (instancetype)dictionaryWithValue:(uint32_t)value
4194 * @return A newly instanced and empty dictionary. 1091 forKey:(int64_t)key;
4195 **/ 1092 + (instancetype)dictionaryWithValues:(const uint32_t [])values
4196 + (instancetype)dictionary; 1093 forKeys:(const int64_t [])keys
4197 1094 count:(NSUInteger)count;
4198 /**
4199 * Creates and initializes a dictionary with the single entry given.
4200 *
4201 * @param value The value to be placed in the dictionary.
4202 * @param key The key under which to store the value.
4203 *
4204 * @return A newly instanced dictionary with the key and value in it.
4205 **/
4206 + (instancetype)dictionaryWithUInt32:(uint32_t)value
4207 forKey:(int64_t)key;
4208
4209 /**
4210 * Creates and initializes a dictionary with the entries given.
4211 *
4212 * @param values The values to be placed in the dictionary.
4213 * @param keys The keys under which to store the values.
4214 * @param count The number of entries to store in the dictionary.
4215 *
4216 * @return A newly instanced dictionary with the keys and values in it.
4217 **/
4218 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
4219 forKeys:(const int64_t [])keys
4220 count:(NSUInteger)count;
4221
4222 /**
4223 * Creates and initializes a dictionary with the entries from the given.
4224 * dictionary.
4225 *
4226 * @param dictionary Dictionary containing the entries to add to the dictionary.
4227 *
4228 * @return A newly instanced dictionary with the entries from the given
4229 * dictionary in it.
4230 **/
4231 + (instancetype)dictionaryWithDictionary:(GPBInt64UInt32Dictionary *)dictionary; 1095 + (instancetype)dictionaryWithDictionary:(GPBInt64UInt32Dictionary *)dictionary;
4232 1096 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4233 /** 1097
4234 * Creates and initializes a dictionary with the given capacity. 1098 - (instancetype)initWithValues:(const uint32_t [])values
4235 * 1099 forKeys:(const int64_t [])keys
4236 * @param numItems Capacity needed for the dictionary. 1100 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4237 *
4238 * @return A newly instanced dictionary with the given capacity.
4239 **/
4240 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4241
4242 /**
4243 * Initializes this dictionary, copying the given values and keys.
4244 *
4245 * @param values The values to be placed in this dictionary.
4246 * @param keys The keys under which to store the values.
4247 * @param count The number of elements to copy into the dictionary.
4248 *
4249 * @return A newly initialized dictionary with a copy of the values and keys.
4250 **/
4251 - (instancetype)initWithUInt32s:(const uint32_t [])values
4252 forKeys:(const int64_t [])keys
4253 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4254
4255 /**
4256 * Initializes this dictionary, copying the entries from the given dictionary.
4257 *
4258 * @param dictionary Dictionary containing the entries to add to this dictionary .
4259 *
4260 * @return A newly initialized dictionary with the entries of the given dictiona ry.
4261 **/
4262 - (instancetype)initWithDictionary:(GPBInt64UInt32Dictionary *)dictionary; 1101 - (instancetype)initWithDictionary:(GPBInt64UInt32Dictionary *)dictionary;
4263 1102 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4264 /** 1103
4265 * Initializes this dictionary with the requested capacity. 1104 - (BOOL)valueForKey:(int64_t)key value:(nullable uint32_t *)value;
4266 * 1105
4267 * @param numItems Number of items needed for this dictionary. 1106 - (void)enumerateKeysAndValuesUsingBlock:
4268 *
4269 * @return A newly initialized dictionary with the requested capacity.
4270 **/
4271 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4272
4273 /**
4274 * Gets the value for the given key.
4275 *
4276 * @param value Pointer into which the value will be set, if found.
4277 * @param key Key under which the value is stored, if present.
4278 *
4279 * @return YES if the key was found and the value was copied, NO otherwise.
4280 **/
4281 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int64_t)key;
4282
4283 /**
4284 * Enumerates the keys and values on this dictionary with the given block.
4285 *
4286 * @param block The block to enumerate with.
4287 * **key**: The key for the current entry.
4288 * **value**: The value for the current entry
4289 * **stop**: A pointer to a boolean that when set stops the enumeration.
4290 **/
4291 - (void)enumerateKeysAndUInt32sUsingBlock:
4292 (void (^)(int64_t key, uint32_t value, BOOL *stop))block; 1107 (void (^)(int64_t key, uint32_t value, BOOL *stop))block;
4293 1108
4294 /**
4295 * Adds the keys and values from another dictionary.
4296 *
4297 * @param otherDictionary Dictionary containing entries to be added to this
4298 * dictionary.
4299 **/
4300 - (void)addEntriesFromDictionary:(GPBInt64UInt32Dictionary *)otherDictionary; 1109 - (void)addEntriesFromDictionary:(GPBInt64UInt32Dictionary *)otherDictionary;
4301 1110
4302 /** 1111 - (void)setValue:(uint32_t)value forKey:(int64_t)key;
4303 * Sets the value for the given key. 1112
4304 * 1113 - (void)removeValueForKey:(int64_t)aKey;
4305 * @param value The value to set.
4306 * @param key The key under which to store the value.
4307 **/
4308 - (void)setUInt32:(uint32_t)value forKey:(int64_t)key;
4309
4310 /**
4311 * Removes the entry for the given key.
4312 *
4313 * @param aKey Key to be removed from this dictionary.
4314 **/
4315 - (void)removeUInt32ForKey:(int64_t)aKey;
4316
4317 /**
4318 * Removes all entries in this dictionary.
4319 **/
4320 - (void)removeAll; 1114 - (void)removeAll;
4321 1115
4322 @end 1116 @end
4323 1117
4324 #pragma mark - Int64 -> Int32 1118 #pragma mark - Int64 -> Int32
4325 1119
4326 /**
4327 * Class used for map fields of <int64_t, int32_t>
4328 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4329 *
4330 * @note This class is not meant to be subclassed.
4331 **/
4332 @interface GPBInt64Int32Dictionary : NSObject <NSCopying> 1120 @interface GPBInt64Int32Dictionary : NSObject <NSCopying>
4333 1121
4334 /** Number of entries stored in this dictionary. */ 1122 @property(nonatomic, readonly) NSUInteger count;
4335 @property(nonatomic, readonly) NSUInteger count; 1123
4336 1124 + (instancetype)dictionary;
4337 /** 1125 + (instancetype)dictionaryWithValue:(int32_t)value
4338 * @return A newly instanced and empty dictionary. 1126 forKey:(int64_t)key;
4339 **/ 1127 + (instancetype)dictionaryWithValues:(const int32_t [])values
4340 + (instancetype)dictionary; 1128 forKeys:(const int64_t [])keys
4341 1129 count:(NSUInteger)count;
4342 /**
4343 * Creates and initializes a dictionary with the single entry given.
4344 *
4345 * @param value The value to be placed in the dictionary.
4346 * @param key The key under which to store the value.
4347 *
4348 * @return A newly instanced dictionary with the key and value in it.
4349 **/
4350 + (instancetype)dictionaryWithInt32:(int32_t)value
4351 forKey:(int64_t)key;
4352
4353 /**
4354 * Creates and initializes a dictionary with the entries given.
4355 *
4356 * @param values The values to be placed in the dictionary.
4357 * @param keys The keys under which to store the values.
4358 * @param count The number of entries to store in the dictionary.
4359 *
4360 * @return A newly instanced dictionary with the keys and values in it.
4361 **/
4362 + (instancetype)dictionaryWithInt32s:(const int32_t [])values
4363 forKeys:(const int64_t [])keys
4364 count:(NSUInteger)count;
4365
4366 /**
4367 * Creates and initializes a dictionary with the entries from the given.
4368 * dictionary.
4369 *
4370 * @param dictionary Dictionary containing the entries to add to the dictionary.
4371 *
4372 * @return A newly instanced dictionary with the entries from the given
4373 * dictionary in it.
4374 **/
4375 + (instancetype)dictionaryWithDictionary:(GPBInt64Int32Dictionary *)dictionary; 1130 + (instancetype)dictionaryWithDictionary:(GPBInt64Int32Dictionary *)dictionary;
4376 1131 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4377 /** 1132
4378 * Creates and initializes a dictionary with the given capacity. 1133 - (instancetype)initWithValues:(const int32_t [])values
4379 * 1134 forKeys:(const int64_t [])keys
4380 * @param numItems Capacity needed for the dictionary. 1135 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4381 *
4382 * @return A newly instanced dictionary with the given capacity.
4383 **/
4384 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4385
4386 /**
4387 * Initializes this dictionary, copying the given values and keys.
4388 *
4389 * @param values The values to be placed in this dictionary.
4390 * @param keys The keys under which to store the values.
4391 * @param count The number of elements to copy into the dictionary.
4392 *
4393 * @return A newly initialized dictionary with a copy of the values and keys.
4394 **/
4395 - (instancetype)initWithInt32s:(const int32_t [])values
4396 forKeys:(const int64_t [])keys
4397 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4398
4399 /**
4400 * Initializes this dictionary, copying the entries from the given dictionary.
4401 *
4402 * @param dictionary Dictionary containing the entries to add to this dictionary .
4403 *
4404 * @return A newly initialized dictionary with the entries of the given dictiona ry.
4405 **/
4406 - (instancetype)initWithDictionary:(GPBInt64Int32Dictionary *)dictionary; 1136 - (instancetype)initWithDictionary:(GPBInt64Int32Dictionary *)dictionary;
4407 1137 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4408 /** 1138
4409 * Initializes this dictionary with the requested capacity. 1139 - (BOOL)valueForKey:(int64_t)key value:(nullable int32_t *)value;
4410 * 1140
4411 * @param numItems Number of items needed for this dictionary. 1141 - (void)enumerateKeysAndValuesUsingBlock:
4412 *
4413 * @return A newly initialized dictionary with the requested capacity.
4414 **/
4415 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4416
4417 /**
4418 * Gets the value for the given key.
4419 *
4420 * @param value Pointer into which the value will be set, if found.
4421 * @param key Key under which the value is stored, if present.
4422 *
4423 * @return YES if the key was found and the value was copied, NO otherwise.
4424 **/
4425 - (BOOL)getInt32:(nullable int32_t *)value forKey:(int64_t)key;
4426
4427 /**
4428 * Enumerates the keys and values on this dictionary with the given block.
4429 *
4430 * @param block The block to enumerate with.
4431 * **key**: The key for the current entry.
4432 * **value**: The value for the current entry
4433 * **stop**: A pointer to a boolean that when set stops the enumeration.
4434 **/
4435 - (void)enumerateKeysAndInt32sUsingBlock:
4436 (void (^)(int64_t key, int32_t value, BOOL *stop))block; 1142 (void (^)(int64_t key, int32_t value, BOOL *stop))block;
4437 1143
4438 /**
4439 * Adds the keys and values from another dictionary.
4440 *
4441 * @param otherDictionary Dictionary containing entries to be added to this
4442 * dictionary.
4443 **/
4444 - (void)addEntriesFromDictionary:(GPBInt64Int32Dictionary *)otherDictionary; 1144 - (void)addEntriesFromDictionary:(GPBInt64Int32Dictionary *)otherDictionary;
4445 1145
4446 /** 1146 - (void)setValue:(int32_t)value forKey:(int64_t)key;
4447 * Sets the value for the given key. 1147
4448 * 1148 - (void)removeValueForKey:(int64_t)aKey;
4449 * @param value The value to set.
4450 * @param key The key under which to store the value.
4451 **/
4452 - (void)setInt32:(int32_t)value forKey:(int64_t)key;
4453
4454 /**
4455 * Removes the entry for the given key.
4456 *
4457 * @param aKey Key to be removed from this dictionary.
4458 **/
4459 - (void)removeInt32ForKey:(int64_t)aKey;
4460
4461 /**
4462 * Removes all entries in this dictionary.
4463 **/
4464 - (void)removeAll; 1149 - (void)removeAll;
4465 1150
4466 @end 1151 @end
4467 1152
4468 #pragma mark - Int64 -> UInt64 1153 #pragma mark - Int64 -> UInt64
4469 1154
4470 /**
4471 * Class used for map fields of <int64_t, uint64_t>
4472 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4473 *
4474 * @note This class is not meant to be subclassed.
4475 **/
4476 @interface GPBInt64UInt64Dictionary : NSObject <NSCopying> 1155 @interface GPBInt64UInt64Dictionary : NSObject <NSCopying>
4477 1156
4478 /** Number of entries stored in this dictionary. */ 1157 @property(nonatomic, readonly) NSUInteger count;
4479 @property(nonatomic, readonly) NSUInteger count; 1158
4480 1159 + (instancetype)dictionary;
4481 /** 1160 + (instancetype)dictionaryWithValue:(uint64_t)value
4482 * @return A newly instanced and empty dictionary. 1161 forKey:(int64_t)key;
4483 **/ 1162 + (instancetype)dictionaryWithValues:(const uint64_t [])values
4484 + (instancetype)dictionary; 1163 forKeys:(const int64_t [])keys
4485 1164 count:(NSUInteger)count;
4486 /**
4487 * Creates and initializes a dictionary with the single entry given.
4488 *
4489 * @param value The value to be placed in the dictionary.
4490 * @param key The key under which to store the value.
4491 *
4492 * @return A newly instanced dictionary with the key and value in it.
4493 **/
4494 + (instancetype)dictionaryWithUInt64:(uint64_t)value
4495 forKey:(int64_t)key;
4496
4497 /**
4498 * Creates and initializes a dictionary with the entries given.
4499 *
4500 * @param values The values to be placed in the dictionary.
4501 * @param keys The keys under which to store the values.
4502 * @param count The number of entries to store in the dictionary.
4503 *
4504 * @return A newly instanced dictionary with the keys and values in it.
4505 **/
4506 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
4507 forKeys:(const int64_t [])keys
4508 count:(NSUInteger)count;
4509
4510 /**
4511 * Creates and initializes a dictionary with the entries from the given.
4512 * dictionary.
4513 *
4514 * @param dictionary Dictionary containing the entries to add to the dictionary.
4515 *
4516 * @return A newly instanced dictionary with the entries from the given
4517 * dictionary in it.
4518 **/
4519 + (instancetype)dictionaryWithDictionary:(GPBInt64UInt64Dictionary *)dictionary; 1165 + (instancetype)dictionaryWithDictionary:(GPBInt64UInt64Dictionary *)dictionary;
4520 1166 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4521 /** 1167
4522 * Creates and initializes a dictionary with the given capacity. 1168 - (instancetype)initWithValues:(const uint64_t [])values
4523 * 1169 forKeys:(const int64_t [])keys
4524 * @param numItems Capacity needed for the dictionary. 1170 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4525 *
4526 * @return A newly instanced dictionary with the given capacity.
4527 **/
4528 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4529
4530 /**
4531 * Initializes this dictionary, copying the given values and keys.
4532 *
4533 * @param values The values to be placed in this dictionary.
4534 * @param keys The keys under which to store the values.
4535 * @param count The number of elements to copy into the dictionary.
4536 *
4537 * @return A newly initialized dictionary with a copy of the values and keys.
4538 **/
4539 - (instancetype)initWithUInt64s:(const uint64_t [])values
4540 forKeys:(const int64_t [])keys
4541 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4542
4543 /**
4544 * Initializes this dictionary, copying the entries from the given dictionary.
4545 *
4546 * @param dictionary Dictionary containing the entries to add to this dictionary .
4547 *
4548 * @return A newly initialized dictionary with the entries of the given dictiona ry.
4549 **/
4550 - (instancetype)initWithDictionary:(GPBInt64UInt64Dictionary *)dictionary; 1171 - (instancetype)initWithDictionary:(GPBInt64UInt64Dictionary *)dictionary;
4551 1172 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4552 /** 1173
4553 * Initializes this dictionary with the requested capacity. 1174 - (BOOL)valueForKey:(int64_t)key value:(nullable uint64_t *)value;
4554 * 1175
4555 * @param numItems Number of items needed for this dictionary. 1176 - (void)enumerateKeysAndValuesUsingBlock:
4556 *
4557 * @return A newly initialized dictionary with the requested capacity.
4558 **/
4559 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4560
4561 /**
4562 * Gets the value for the given key.
4563 *
4564 * @param value Pointer into which the value will be set, if found.
4565 * @param key Key under which the value is stored, if present.
4566 *
4567 * @return YES if the key was found and the value was copied, NO otherwise.
4568 **/
4569 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int64_t)key;
4570
4571 /**
4572 * Enumerates the keys and values on this dictionary with the given block.
4573 *
4574 * @param block The block to enumerate with.
4575 * **key**: The key for the current entry.
4576 * **value**: The value for the current entry
4577 * **stop**: A pointer to a boolean that when set stops the enumeration.
4578 **/
4579 - (void)enumerateKeysAndUInt64sUsingBlock:
4580 (void (^)(int64_t key, uint64_t value, BOOL *stop))block; 1177 (void (^)(int64_t key, uint64_t value, BOOL *stop))block;
4581 1178
4582 /**
4583 * Adds the keys and values from another dictionary.
4584 *
4585 * @param otherDictionary Dictionary containing entries to be added to this
4586 * dictionary.
4587 **/
4588 - (void)addEntriesFromDictionary:(GPBInt64UInt64Dictionary *)otherDictionary; 1179 - (void)addEntriesFromDictionary:(GPBInt64UInt64Dictionary *)otherDictionary;
4589 1180
4590 /** 1181 - (void)setValue:(uint64_t)value forKey:(int64_t)key;
4591 * Sets the value for the given key. 1182
4592 * 1183 - (void)removeValueForKey:(int64_t)aKey;
4593 * @param value The value to set.
4594 * @param key The key under which to store the value.
4595 **/
4596 - (void)setUInt64:(uint64_t)value forKey:(int64_t)key;
4597
4598 /**
4599 * Removes the entry for the given key.
4600 *
4601 * @param aKey Key to be removed from this dictionary.
4602 **/
4603 - (void)removeUInt64ForKey:(int64_t)aKey;
4604
4605 /**
4606 * Removes all entries in this dictionary.
4607 **/
4608 - (void)removeAll; 1184 - (void)removeAll;
4609 1185
4610 @end 1186 @end
4611 1187
4612 #pragma mark - Int64 -> Int64 1188 #pragma mark - Int64 -> Int64
4613 1189
4614 /**
4615 * Class used for map fields of <int64_t, int64_t>
4616 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4617 *
4618 * @note This class is not meant to be subclassed.
4619 **/
4620 @interface GPBInt64Int64Dictionary : NSObject <NSCopying> 1190 @interface GPBInt64Int64Dictionary : NSObject <NSCopying>
4621 1191
4622 /** Number of entries stored in this dictionary. */ 1192 @property(nonatomic, readonly) NSUInteger count;
4623 @property(nonatomic, readonly) NSUInteger count; 1193
4624 1194 + (instancetype)dictionary;
4625 /** 1195 + (instancetype)dictionaryWithValue:(int64_t)value
4626 * @return A newly instanced and empty dictionary. 1196 forKey:(int64_t)key;
4627 **/ 1197 + (instancetype)dictionaryWithValues:(const int64_t [])values
4628 + (instancetype)dictionary; 1198 forKeys:(const int64_t [])keys
4629 1199 count:(NSUInteger)count;
4630 /**
4631 * Creates and initializes a dictionary with the single entry given.
4632 *
4633 * @param value The value to be placed in the dictionary.
4634 * @param key The key under which to store the value.
4635 *
4636 * @return A newly instanced dictionary with the key and value in it.
4637 **/
4638 + (instancetype)dictionaryWithInt64:(int64_t)value
4639 forKey:(int64_t)key;
4640
4641 /**
4642 * Creates and initializes a dictionary with the entries given.
4643 *
4644 * @param values The values to be placed in the dictionary.
4645 * @param keys The keys under which to store the values.
4646 * @param count The number of entries to store in the dictionary.
4647 *
4648 * @return A newly instanced dictionary with the keys and values in it.
4649 **/
4650 + (instancetype)dictionaryWithInt64s:(const int64_t [])values
4651 forKeys:(const int64_t [])keys
4652 count:(NSUInteger)count;
4653
4654 /**
4655 * Creates and initializes a dictionary with the entries from the given.
4656 * dictionary.
4657 *
4658 * @param dictionary Dictionary containing the entries to add to the dictionary.
4659 *
4660 * @return A newly instanced dictionary with the entries from the given
4661 * dictionary in it.
4662 **/
4663 + (instancetype)dictionaryWithDictionary:(GPBInt64Int64Dictionary *)dictionary; 1200 + (instancetype)dictionaryWithDictionary:(GPBInt64Int64Dictionary *)dictionary;
4664 1201 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4665 /** 1202
4666 * Creates and initializes a dictionary with the given capacity. 1203 - (instancetype)initWithValues:(const int64_t [])values
4667 * 1204 forKeys:(const int64_t [])keys
4668 * @param numItems Capacity needed for the dictionary. 1205 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4669 *
4670 * @return A newly instanced dictionary with the given capacity.
4671 **/
4672 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4673
4674 /**
4675 * Initializes this dictionary, copying the given values and keys.
4676 *
4677 * @param values The values to be placed in this dictionary.
4678 * @param keys The keys under which to store the values.
4679 * @param count The number of elements to copy into the dictionary.
4680 *
4681 * @return A newly initialized dictionary with a copy of the values and keys.
4682 **/
4683 - (instancetype)initWithInt64s:(const int64_t [])values
4684 forKeys:(const int64_t [])keys
4685 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4686
4687 /**
4688 * Initializes this dictionary, copying the entries from the given dictionary.
4689 *
4690 * @param dictionary Dictionary containing the entries to add to this dictionary .
4691 *
4692 * @return A newly initialized dictionary with the entries of the given dictiona ry.
4693 **/
4694 - (instancetype)initWithDictionary:(GPBInt64Int64Dictionary *)dictionary; 1206 - (instancetype)initWithDictionary:(GPBInt64Int64Dictionary *)dictionary;
4695 1207 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4696 /** 1208
4697 * Initializes this dictionary with the requested capacity. 1209 - (BOOL)valueForKey:(int64_t)key value:(nullable int64_t *)value;
4698 * 1210
4699 * @param numItems Number of items needed for this dictionary. 1211 - (void)enumerateKeysAndValuesUsingBlock:
4700 *
4701 * @return A newly initialized dictionary with the requested capacity.
4702 **/
4703 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4704
4705 /**
4706 * Gets the value for the given key.
4707 *
4708 * @param value Pointer into which the value will be set, if found.
4709 * @param key Key under which the value is stored, if present.
4710 *
4711 * @return YES if the key was found and the value was copied, NO otherwise.
4712 **/
4713 - (BOOL)getInt64:(nullable int64_t *)value forKey:(int64_t)key;
4714
4715 /**
4716 * Enumerates the keys and values on this dictionary with the given block.
4717 *
4718 * @param block The block to enumerate with.
4719 * **key**: The key for the current entry.
4720 * **value**: The value for the current entry
4721 * **stop**: A pointer to a boolean that when set stops the enumeration.
4722 **/
4723 - (void)enumerateKeysAndInt64sUsingBlock:
4724 (void (^)(int64_t key, int64_t value, BOOL *stop))block; 1212 (void (^)(int64_t key, int64_t value, BOOL *stop))block;
4725 1213
4726 /**
4727 * Adds the keys and values from another dictionary.
4728 *
4729 * @param otherDictionary Dictionary containing entries to be added to this
4730 * dictionary.
4731 **/
4732 - (void)addEntriesFromDictionary:(GPBInt64Int64Dictionary *)otherDictionary; 1214 - (void)addEntriesFromDictionary:(GPBInt64Int64Dictionary *)otherDictionary;
4733 1215
4734 /** 1216 - (void)setValue:(int64_t)value forKey:(int64_t)key;
4735 * Sets the value for the given key. 1217
4736 * 1218 - (void)removeValueForKey:(int64_t)aKey;
4737 * @param value The value to set.
4738 * @param key The key under which to store the value.
4739 **/
4740 - (void)setInt64:(int64_t)value forKey:(int64_t)key;
4741
4742 /**
4743 * Removes the entry for the given key.
4744 *
4745 * @param aKey Key to be removed from this dictionary.
4746 **/
4747 - (void)removeInt64ForKey:(int64_t)aKey;
4748
4749 /**
4750 * Removes all entries in this dictionary.
4751 **/
4752 - (void)removeAll; 1219 - (void)removeAll;
4753 1220
4754 @end 1221 @end
4755 1222
4756 #pragma mark - Int64 -> Bool 1223 #pragma mark - Int64 -> Bool
4757 1224
4758 /**
4759 * Class used for map fields of <int64_t, BOOL>
4760 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4761 *
4762 * @note This class is not meant to be subclassed.
4763 **/
4764 @interface GPBInt64BoolDictionary : NSObject <NSCopying> 1225 @interface GPBInt64BoolDictionary : NSObject <NSCopying>
4765 1226
4766 /** Number of entries stored in this dictionary. */ 1227 @property(nonatomic, readonly) NSUInteger count;
4767 @property(nonatomic, readonly) NSUInteger count; 1228
4768 1229 + (instancetype)dictionary;
4769 /** 1230 + (instancetype)dictionaryWithValue:(BOOL)value
4770 * @return A newly instanced and empty dictionary. 1231 forKey:(int64_t)key;
4771 **/ 1232 + (instancetype)dictionaryWithValues:(const BOOL [])values
4772 + (instancetype)dictionary; 1233 forKeys:(const int64_t [])keys
4773 1234 count:(NSUInteger)count;
4774 /**
4775 * Creates and initializes a dictionary with the single entry given.
4776 *
4777 * @param value The value to be placed in the dictionary.
4778 * @param key The key under which to store the value.
4779 *
4780 * @return A newly instanced dictionary with the key and value in it.
4781 **/
4782 + (instancetype)dictionaryWithBool:(BOOL)value
4783 forKey:(int64_t)key;
4784
4785 /**
4786 * Creates and initializes a dictionary with the entries given.
4787 *
4788 * @param values The values to be placed in the dictionary.
4789 * @param keys The keys under which to store the values.
4790 * @param count The number of entries to store in the dictionary.
4791 *
4792 * @return A newly instanced dictionary with the keys and values in it.
4793 **/
4794 + (instancetype)dictionaryWithBools:(const BOOL [])values
4795 forKeys:(const int64_t [])keys
4796 count:(NSUInteger)count;
4797
4798 /**
4799 * Creates and initializes a dictionary with the entries from the given.
4800 * dictionary.
4801 *
4802 * @param dictionary Dictionary containing the entries to add to the dictionary.
4803 *
4804 * @return A newly instanced dictionary with the entries from the given
4805 * dictionary in it.
4806 **/
4807 + (instancetype)dictionaryWithDictionary:(GPBInt64BoolDictionary *)dictionary; 1235 + (instancetype)dictionaryWithDictionary:(GPBInt64BoolDictionary *)dictionary;
4808 1236 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4809 /** 1237
4810 * Creates and initializes a dictionary with the given capacity. 1238 - (instancetype)initWithValues:(const BOOL [])values
4811 * 1239 forKeys:(const int64_t [])keys
4812 * @param numItems Capacity needed for the dictionary. 1240 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4813 *
4814 * @return A newly instanced dictionary with the given capacity.
4815 **/
4816 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4817
4818 /**
4819 * Initializes this dictionary, copying the given values and keys.
4820 *
4821 * @param values The values to be placed in this dictionary.
4822 * @param keys The keys under which to store the values.
4823 * @param count The number of elements to copy into the dictionary.
4824 *
4825 * @return A newly initialized dictionary with a copy of the values and keys.
4826 **/
4827 - (instancetype)initWithBools:(const BOOL [])values
4828 forKeys:(const int64_t [])keys
4829 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4830
4831 /**
4832 * Initializes this dictionary, copying the entries from the given dictionary.
4833 *
4834 * @param dictionary Dictionary containing the entries to add to this dictionary .
4835 *
4836 * @return A newly initialized dictionary with the entries of the given dictiona ry.
4837 **/
4838 - (instancetype)initWithDictionary:(GPBInt64BoolDictionary *)dictionary; 1241 - (instancetype)initWithDictionary:(GPBInt64BoolDictionary *)dictionary;
4839 1242 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4840 /** 1243
4841 * Initializes this dictionary with the requested capacity. 1244 - (BOOL)valueForKey:(int64_t)key value:(nullable BOOL *)value;
4842 * 1245
4843 * @param numItems Number of items needed for this dictionary. 1246 - (void)enumerateKeysAndValuesUsingBlock:
4844 *
4845 * @return A newly initialized dictionary with the requested capacity.
4846 **/
4847 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4848
4849 /**
4850 * Gets the value for the given key.
4851 *
4852 * @param value Pointer into which the value will be set, if found.
4853 * @param key Key under which the value is stored, if present.
4854 *
4855 * @return YES if the key was found and the value was copied, NO otherwise.
4856 **/
4857 - (BOOL)getBool:(nullable BOOL *)value forKey:(int64_t)key;
4858
4859 /**
4860 * Enumerates the keys and values on this dictionary with the given block.
4861 *
4862 * @param block The block to enumerate with.
4863 * **key**: The key for the current entry.
4864 * **value**: The value for the current entry
4865 * **stop**: A pointer to a boolean that when set stops the enumeration.
4866 **/
4867 - (void)enumerateKeysAndBoolsUsingBlock:
4868 (void (^)(int64_t key, BOOL value, BOOL *stop))block; 1247 (void (^)(int64_t key, BOOL value, BOOL *stop))block;
4869 1248
4870 /**
4871 * Adds the keys and values from another dictionary.
4872 *
4873 * @param otherDictionary Dictionary containing entries to be added to this
4874 * dictionary.
4875 **/
4876 - (void)addEntriesFromDictionary:(GPBInt64BoolDictionary *)otherDictionary; 1249 - (void)addEntriesFromDictionary:(GPBInt64BoolDictionary *)otherDictionary;
4877 1250
4878 /** 1251 - (void)setValue:(BOOL)value forKey:(int64_t)key;
4879 * Sets the value for the given key. 1252
4880 * 1253 - (void)removeValueForKey:(int64_t)aKey;
4881 * @param value The value to set.
4882 * @param key The key under which to store the value.
4883 **/
4884 - (void)setBool:(BOOL)value forKey:(int64_t)key;
4885
4886 /**
4887 * Removes the entry for the given key.
4888 *
4889 * @param aKey Key to be removed from this dictionary.
4890 **/
4891 - (void)removeBoolForKey:(int64_t)aKey;
4892
4893 /**
4894 * Removes all entries in this dictionary.
4895 **/
4896 - (void)removeAll; 1254 - (void)removeAll;
4897 1255
4898 @end 1256 @end
4899 1257
4900 #pragma mark - Int64 -> Float 1258 #pragma mark - Int64 -> Float
4901 1259
4902 /**
4903 * Class used for map fields of <int64_t, float>
4904 * values. This performs better than boxing into NSNumbers in NSDictionaries.
4905 *
4906 * @note This class is not meant to be subclassed.
4907 **/
4908 @interface GPBInt64FloatDictionary : NSObject <NSCopying> 1260 @interface GPBInt64FloatDictionary : NSObject <NSCopying>
4909 1261
4910 /** Number of entries stored in this dictionary. */ 1262 @property(nonatomic, readonly) NSUInteger count;
4911 @property(nonatomic, readonly) NSUInteger count; 1263
4912 1264 + (instancetype)dictionary;
4913 /** 1265 + (instancetype)dictionaryWithValue:(float)value
4914 * @return A newly instanced and empty dictionary. 1266 forKey:(int64_t)key;
4915 **/ 1267 + (instancetype)dictionaryWithValues:(const float [])values
4916 + (instancetype)dictionary; 1268 forKeys:(const int64_t [])keys
4917 1269 count:(NSUInteger)count;
4918 /**
4919 * Creates and initializes a dictionary with the single entry given.
4920 *
4921 * @param value The value to be placed in the dictionary.
4922 * @param key The key under which to store the value.
4923 *
4924 * @return A newly instanced dictionary with the key and value in it.
4925 **/
4926 + (instancetype)dictionaryWithFloat:(float)value
4927 forKey:(int64_t)key;
4928
4929 /**
4930 * Creates and initializes a dictionary with the entries given.
4931 *
4932 * @param values The values to be placed in the dictionary.
4933 * @param keys The keys under which to store the values.
4934 * @param count The number of entries to store in the dictionary.
4935 *
4936 * @return A newly instanced dictionary with the keys and values in it.
4937 **/
4938 + (instancetype)dictionaryWithFloats:(const float [])values
4939 forKeys:(const int64_t [])keys
4940 count:(NSUInteger)count;
4941
4942 /**
4943 * Creates and initializes a dictionary with the entries from the given.
4944 * dictionary.
4945 *
4946 * @param dictionary Dictionary containing the entries to add to the dictionary.
4947 *
4948 * @return A newly instanced dictionary with the entries from the given
4949 * dictionary in it.
4950 **/
4951 + (instancetype)dictionaryWithDictionary:(GPBInt64FloatDictionary *)dictionary; 1270 + (instancetype)dictionaryWithDictionary:(GPBInt64FloatDictionary *)dictionary;
4952 1271 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4953 /** 1272
4954 * Creates and initializes a dictionary with the given capacity. 1273 - (instancetype)initWithValues:(const float [])values
4955 * 1274 forKeys:(const int64_t [])keys
4956 * @param numItems Capacity needed for the dictionary. 1275 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4957 *
4958 * @return A newly instanced dictionary with the given capacity.
4959 **/
4960 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
4961
4962 /**
4963 * Initializes this dictionary, copying the given values and keys.
4964 *
4965 * @param values The values to be placed in this dictionary.
4966 * @param keys The keys under which to store the values.
4967 * @param count The number of elements to copy into the dictionary.
4968 *
4969 * @return A newly initialized dictionary with a copy of the values and keys.
4970 **/
4971 - (instancetype)initWithFloats:(const float [])values
4972 forKeys:(const int64_t [])keys
4973 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
4974
4975 /**
4976 * Initializes this dictionary, copying the entries from the given dictionary.
4977 *
4978 * @param dictionary Dictionary containing the entries to add to this dictionary .
4979 *
4980 * @return A newly initialized dictionary with the entries of the given dictiona ry.
4981 **/
4982 - (instancetype)initWithDictionary:(GPBInt64FloatDictionary *)dictionary; 1276 - (instancetype)initWithDictionary:(GPBInt64FloatDictionary *)dictionary;
4983 1277 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4984 /** 1278
4985 * Initializes this dictionary with the requested capacity. 1279 - (BOOL)valueForKey:(int64_t)key value:(nullable float *)value;
4986 * 1280
4987 * @param numItems Number of items needed for this dictionary. 1281 - (void)enumerateKeysAndValuesUsingBlock:
4988 *
4989 * @return A newly initialized dictionary with the requested capacity.
4990 **/
4991 - (instancetype)initWithCapacity:(NSUInteger)numItems;
4992
4993 /**
4994 * Gets the value for the given key.
4995 *
4996 * @param value Pointer into which the value will be set, if found.
4997 * @param key Key under which the value is stored, if present.
4998 *
4999 * @return YES if the key was found and the value was copied, NO otherwise.
5000 **/
5001 - (BOOL)getFloat:(nullable float *)value forKey:(int64_t)key;
5002
5003 /**
5004 * Enumerates the keys and values on this dictionary with the given block.
5005 *
5006 * @param block The block to enumerate with.
5007 * **key**: The key for the current entry.
5008 * **value**: The value for the current entry
5009 * **stop**: A pointer to a boolean that when set stops the enumeration.
5010 **/
5011 - (void)enumerateKeysAndFloatsUsingBlock:
5012 (void (^)(int64_t key, float value, BOOL *stop))block; 1282 (void (^)(int64_t key, float value, BOOL *stop))block;
5013 1283
5014 /**
5015 * Adds the keys and values from another dictionary.
5016 *
5017 * @param otherDictionary Dictionary containing entries to be added to this
5018 * dictionary.
5019 **/
5020 - (void)addEntriesFromDictionary:(GPBInt64FloatDictionary *)otherDictionary; 1284 - (void)addEntriesFromDictionary:(GPBInt64FloatDictionary *)otherDictionary;
5021 1285
5022 /** 1286 - (void)setValue:(float)value forKey:(int64_t)key;
5023 * Sets the value for the given key. 1287
5024 * 1288 - (void)removeValueForKey:(int64_t)aKey;
5025 * @param value The value to set.
5026 * @param key The key under which to store the value.
5027 **/
5028 - (void)setFloat:(float)value forKey:(int64_t)key;
5029
5030 /**
5031 * Removes the entry for the given key.
5032 *
5033 * @param aKey Key to be removed from this dictionary.
5034 **/
5035 - (void)removeFloatForKey:(int64_t)aKey;
5036
5037 /**
5038 * Removes all entries in this dictionary.
5039 **/
5040 - (void)removeAll; 1289 - (void)removeAll;
5041 1290
5042 @end 1291 @end
5043 1292
5044 #pragma mark - Int64 -> Double 1293 #pragma mark - Int64 -> Double
5045 1294
5046 /**
5047 * Class used for map fields of <int64_t, double>
5048 * values. This performs better than boxing into NSNumbers in NSDictionaries.
5049 *
5050 * @note This class is not meant to be subclassed.
5051 **/
5052 @interface GPBInt64DoubleDictionary : NSObject <NSCopying> 1295 @interface GPBInt64DoubleDictionary : NSObject <NSCopying>
5053 1296
5054 /** Number of entries stored in this dictionary. */ 1297 @property(nonatomic, readonly) NSUInteger count;
5055 @property(nonatomic, readonly) NSUInteger count; 1298
5056 1299 + (instancetype)dictionary;
5057 /** 1300 + (instancetype)dictionaryWithValue:(double)value
5058 * @return A newly instanced and empty dictionary. 1301 forKey:(int64_t)key;
5059 **/ 1302 + (instancetype)dictionaryWithValues:(const double [])values
5060 + (instancetype)dictionary; 1303 forKeys:(const int64_t [])keys
5061 1304 count:(NSUInteger)count;
5062 /**
5063 * Creates and initializes a dictionary with the single entry given.
5064 *
5065 * @param value The value to be placed in the dictionary.
5066 * @param key The key under which to store the value.
5067 *
5068 * @return A newly instanced dictionary with the key and value in it.
5069 **/
5070 + (instancetype)dictionaryWithDouble:(double)value
5071 forKey:(int64_t)key;
5072
5073 /**
5074 * Creates and initializes a dictionary with the entries given.
5075 *
5076 * @param values The values to be placed in the dictionary.
5077 * @param keys The keys under which to store the values.
5078 * @param count The number of entries to store in the dictionary.
5079 *
5080 * @return A newly instanced dictionary with the keys and values in it.
5081 **/
5082 + (instancetype)dictionaryWithDoubles:(const double [])values
5083 forKeys:(const int64_t [])keys
5084 count:(NSUInteger)count;
5085
5086 /**
5087 * Creates and initializes a dictionary with the entries from the given.
5088 * dictionary.
5089 *
5090 * @param dictionary Dictionary containing the entries to add to the dictionary.
5091 *
5092 * @return A newly instanced dictionary with the entries from the given
5093 * dictionary in it.
5094 **/
5095 + (instancetype)dictionaryWithDictionary:(GPBInt64DoubleDictionary *)dictionary; 1305 + (instancetype)dictionaryWithDictionary:(GPBInt64DoubleDictionary *)dictionary;
5096 1306 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
5097 /** 1307
5098 * Creates and initializes a dictionary with the given capacity. 1308 - (instancetype)initWithValues:(const double [])values
5099 * 1309 forKeys:(const int64_t [])keys
5100 * @param numItems Capacity needed for the dictionary. 1310 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5101 *
5102 * @return A newly instanced dictionary with the given capacity.
5103 **/
5104 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
5105
5106 /**
5107 * Initializes this dictionary, copying the given values and keys.
5108 *
5109 * @param values The values to be placed in this dictionary.
5110 * @param keys The keys under which to store the values.
5111 * @param count The number of elements to copy into the dictionary.
5112 *
5113 * @return A newly initialized dictionary with a copy of the values and keys.
5114 **/
5115 - (instancetype)initWithDoubles:(const double [])values
5116 forKeys:(const int64_t [])keys
5117 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5118
5119 /**
5120 * Initializes this dictionary, copying the entries from the given dictionary.
5121 *
5122 * @param dictionary Dictionary containing the entries to add to this dictionary .
5123 *
5124 * @return A newly initialized dictionary with the entries of the given dictiona ry.
5125 **/
5126 - (instancetype)initWithDictionary:(GPBInt64DoubleDictionary *)dictionary; 1311 - (instancetype)initWithDictionary:(GPBInt64DoubleDictionary *)dictionary;
5127 1312 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5128 /** 1313
5129 * Initializes this dictionary with the requested capacity. 1314 - (BOOL)valueForKey:(int64_t)key value:(nullable double *)value;
5130 * 1315
5131 * @param numItems Number of items needed for this dictionary. 1316 - (void)enumerateKeysAndValuesUsingBlock:
5132 *
5133 * @return A newly initialized dictionary with the requested capacity.
5134 **/
5135 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5136
5137 /**
5138 * Gets the value for the given key.
5139 *
5140 * @param value Pointer into which the value will be set, if found.
5141 * @param key Key under which the value is stored, if present.
5142 *
5143 * @return YES if the key was found and the value was copied, NO otherwise.
5144 **/
5145 - (BOOL)getDouble:(nullable double *)value forKey:(int64_t)key;
5146
5147 /**
5148 * Enumerates the keys and values on this dictionary with the given block.
5149 *
5150 * @param block The block to enumerate with.
5151 * **key**: The key for the current entry.
5152 * **value**: The value for the current entry
5153 * **stop**: A pointer to a boolean that when set stops the enumeration.
5154 **/
5155 - (void)enumerateKeysAndDoublesUsingBlock:
5156 (void (^)(int64_t key, double value, BOOL *stop))block; 1317 (void (^)(int64_t key, double value, BOOL *stop))block;
5157 1318
5158 /**
5159 * Adds the keys and values from another dictionary.
5160 *
5161 * @param otherDictionary Dictionary containing entries to be added to this
5162 * dictionary.
5163 **/
5164 - (void)addEntriesFromDictionary:(GPBInt64DoubleDictionary *)otherDictionary; 1319 - (void)addEntriesFromDictionary:(GPBInt64DoubleDictionary *)otherDictionary;
5165 1320
5166 /** 1321 - (void)setValue:(double)value forKey:(int64_t)key;
5167 * Sets the value for the given key. 1322
5168 * 1323 - (void)removeValueForKey:(int64_t)aKey;
5169 * @param value The value to set.
5170 * @param key The key under which to store the value.
5171 **/
5172 - (void)setDouble:(double)value forKey:(int64_t)key;
5173
5174 /**
5175 * Removes the entry for the given key.
5176 *
5177 * @param aKey Key to be removed from this dictionary.
5178 **/
5179 - (void)removeDoubleForKey:(int64_t)aKey;
5180
5181 /**
5182 * Removes all entries in this dictionary.
5183 **/
5184 - (void)removeAll; 1324 - (void)removeAll;
5185 1325
5186 @end 1326 @end
5187 1327
5188 #pragma mark - Int64 -> Enum 1328 #pragma mark - Int64 -> Enum
5189 1329
5190 /**
5191 * Class used for map fields of <int64_t, int32_t>
5192 * values. This performs better than boxing into NSNumbers in NSDictionaries.
5193 *
5194 * @note This class is not meant to be subclassed.
5195 **/
5196 @interface GPBInt64EnumDictionary : NSObject <NSCopying> 1330 @interface GPBInt64EnumDictionary : NSObject <NSCopying>
5197 1331
5198 /** Number of entries stored in this dictionary. */ 1332 @property(nonatomic, readonly) NSUInteger count;
5199 @property(nonatomic, readonly) NSUInteger count;
5200 /** The validation function to check if the enums are valid. */
5201 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 1333 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
5202 1334
5203 /** 1335 + (instancetype)dictionary;
5204 * @return A newly instanced and empty dictionary.
5205 **/
5206 + (instancetype)dictionary;
5207
5208 /**
5209 * Creates and initializes a dictionary with the given validation function.
5210 *
5211 * @param func The enum validation function for the dictionary.
5212 *
5213 * @return A newly instanced dictionary.
5214 **/
5215 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func; 1336 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func;
5216
5217 /**
5218 * Creates and initializes a dictionary with the single entry given.
5219 *
5220 * @param func The enum validation function for the dictionary.
5221 * @param rawValue The raw enum value to be placed in the dictionary.
5222 * @param key The key under which to store the value.
5223 *
5224 * @return A newly instanced dictionary with the key and value in it.
5225 **/
5226 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 1337 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
5227 rawValue:(int32_t)rawValue 1338 rawValue:(int32_t)rawValue
5228 forKey:(int64_t)key; 1339 forKey:(int64_t)key;
5229
5230 /**
5231 * Creates and initializes a dictionary with the entries given.
5232 *
5233 * @param func The enum validation function for the dictionary.
5234 * @param values The raw enum values values to be placed in the dictionary.
5235 * @param keys The keys under which to store the values.
5236 * @param count The number of entries to store in the dictionary.
5237 *
5238 * @return A newly instanced dictionary with the keys and values in it.
5239 **/
5240 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 1340 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
5241 rawValues:(const int32_t [])values 1341 rawValues:(const int32_t [])values
5242 forKeys:(const int64_t [])keys 1342 forKeys:(const int64_t [])keys
5243 count:(NSUInteger)count; 1343 count:(NSUInteger)count;
5244
5245 /**
5246 * Creates and initializes a dictionary with the entries from the given.
5247 * dictionary.
5248 *
5249 * @param dictionary Dictionary containing the entries to add to the dictionary.
5250 *
5251 * @return A newly instanced dictionary with the entries from the given
5252 * dictionary in it.
5253 **/
5254 + (instancetype)dictionaryWithDictionary:(GPBInt64EnumDictionary *)dictionary; 1344 + (instancetype)dictionaryWithDictionary:(GPBInt64EnumDictionary *)dictionary;
5255
5256 /**
5257 * Creates and initializes a dictionary with the given capacity.
5258 *
5259 * @param func The enum validation function for the dictionary.
5260 * @param numItems Capacity needed for the dictionary.
5261 *
5262 * @return A newly instanced dictionary with the given capacity.
5263 **/
5264 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 1345 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
5265 capacity:(NSUInteger)numItems; 1346 capacity:(NSUInteger)numItems;
5266 1347
5267 /**
5268 * Initializes a dictionary with the given validation function.
5269 *
5270 * @param func The enum validation function for the dictionary.
5271 *
5272 * @return A newly initialized dictionary.
5273 **/
5274 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 1348 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
5275
5276 /**
5277 * Initializes a dictionary with the entries given.
5278 *
5279 * @param func The enum validation function for the dictionary.
5280 * @param values The raw enum values values to be placed in the dictionary.
5281 * @param keys The keys under which to store the values.
5282 * @param count The number of entries to store in the dictionary.
5283 *
5284 * @return A newly initialized dictionary with the keys and values in it.
5285 **/
5286 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1349 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
5287 rawValues:(const int32_t [])values 1350 rawValues:(const int32_t [])values
5288 forKeys:(const int64_t [])keys 1351 forKeys:(const int64_t [])keys
5289 count:(NSUInteger)count NS_DESIGNATED_INITI ALIZER; 1352 count:(NSUInteger)count NS_DESIGNATED_INITI ALIZER;
5290
5291 /**
5292 * Initializes a dictionary with the entries from the given.
5293 * dictionary.
5294 *
5295 * @param dictionary Dictionary containing the entries to add to the dictionary.
5296 *
5297 * @return A newly initialized dictionary with the entries from the given
5298 * dictionary in it.
5299 **/
5300 - (instancetype)initWithDictionary:(GPBInt64EnumDictionary *)dictionary; 1353 - (instancetype)initWithDictionary:(GPBInt64EnumDictionary *)dictionary;
5301
5302 /**
5303 * Initializes a dictionary with the given capacity.
5304 *
5305 * @param func The enum validation function for the dictionary.
5306 * @param numItems Capacity needed for the dictionary.
5307 *
5308 * @return A newly initialized dictionary with the given capacity.
5309 **/
5310 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1354 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
5311 capacity:(NSUInteger)numItems; 1355 capacity:(NSUInteger)numItems;
5312 1356
5313 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 1357 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
5314 // is not a valid enumerator as defined by validationFunc. If the actual value i s 1358 // is not a valid enumerator as defined by validationFunc. If the actual value i s
5315 // desired, use "raw" version of the method. 1359 // desired, use "raw" version of the method.
5316 1360
5317 /** 1361 - (BOOL)valueForKey:(int64_t)key value:(nullable int32_t *)value;
5318 * Gets the value for the given key.
5319 *
5320 * @param value Pointer into which the value will be set, if found.
5321 * @param key Key under which the value is stored, if present.
5322 *
5323 * @return YES if the key was found and the value was copied, NO otherwise.
5324 **/
5325 - (BOOL)getEnum:(nullable int32_t *)value forKey:(int64_t)key;
5326 1362
5327 /** 1363 - (void)enumerateKeysAndValuesUsingBlock:
5328 * Enumerates the keys and values on this dictionary with the given block.
5329 *
5330 * @param block The block to enumerate with.
5331 * **key**: The key for the current entry.
5332 * **value**: The value for the current entry
5333 * **stop**: A pointer to a boolean that when set stops the enumeration.
5334 **/
5335 - (void)enumerateKeysAndEnumsUsingBlock:
5336 (void (^)(int64_t key, int32_t value, BOOL *stop))block; 1364 (void (^)(int64_t key, int32_t value, BOOL *stop))block;
5337 1365
5338 /** 1366 // These methods bypass the validationFunc to provide access to values that were not
5339 * Gets the raw enum value for the given key. 1367 // known at the time the binary was compiled.
5340 *
5341 * @note This method bypass the validationFunc to enable the access of values th at
5342 * were not known at the time the binary was compiled.
5343 *
5344 * @param rawValue Pointer into which the value will be set, if found.
5345 * @param key Key under which the value is stored, if present.
5346 *
5347 * @return YES if the key was found and the value was copied, NO otherwise.
5348 **/
5349 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int64_t)key;
5350 1368
5351 /** 1369 - (BOOL)valueForKey:(int64_t)key rawValue:(nullable int32_t *)rawValue;
5352 * Enumerates the keys and values on this dictionary with the given block. 1370
5353 *
5354 * @note This method bypass the validationFunc to enable the access of values th at
5355 * were not known at the time the binary was compiled.
5356 *
5357 * @param block The block to enumerate with.
5358 * **key**: The key for the current entry.
5359 * **rawValue**: The value for the current entry
5360 * **stop**: A pointer to a boolean that when set stops the enumeration.
5361 **/
5362 - (void)enumerateKeysAndRawValuesUsingBlock: 1371 - (void)enumerateKeysAndRawValuesUsingBlock:
5363 (void (^)(int64_t key, int32_t rawValue, BOOL *stop))block; 1372 (void (^)(int64_t key, int32_t rawValue, BOOL *stop))block;
5364 1373
5365 /**
5366 * Adds the keys and raw enum values from another dictionary.
5367 *
5368 * @note This method bypass the validationFunc to enable the setting of values t hat
5369 * were not known at the time the binary was compiled.
5370 *
5371 * @param otherDictionary Dictionary containing entries to be added to this
5372 * dictionary.
5373 **/
5374 - (void)addRawEntriesFromDictionary:(GPBInt64EnumDictionary *)otherDictionary; 1374 - (void)addRawEntriesFromDictionary:(GPBInt64EnumDictionary *)otherDictionary;
5375 1375
5376 // If value is not a valid enumerator as defined by validationFunc, these 1376 // If value is not a valid enumerator as defined by validationFunc, these
5377 // methods will assert in debug, and will log in release and assign the value 1377 // methods will assert in debug, and will log in release and assign the value
5378 // to the default value. Use the rawValue methods below to assign non enumerator 1378 // to the default value. Use the rawValue methods below to assign non enumerator
5379 // values. 1379 // values.
5380 1380
5381 /** 1381 - (void)setValue:(int32_t)value forKey:(int64_t)key;
5382 * Sets the value for the given key. 1382
5383 * 1383 // This method bypass the validationFunc to provide setting of values that were not
5384 * @param value The value to set. 1384 // known at the time the binary was compiled.
5385 * @param key The key under which to store the value.
5386 **/
5387 - (void)setEnum:(int32_t)value forKey:(int64_t)key;
5388
5389 /**
5390 * Sets the raw enum value for the given key.
5391 *
5392 * @note This method bypass the validationFunc to enable the setting of values t hat
5393 * were not known at the time the binary was compiled.
5394 *
5395 * @param rawValue The raw enum value to set.
5396 * @param key The key under which to store the raw enum value.
5397 **/
5398 - (void)setRawValue:(int32_t)rawValue forKey:(int64_t)key; 1385 - (void)setRawValue:(int32_t)rawValue forKey:(int64_t)key;
5399 1386
5400 /** 1387 // No validation applies to these methods.
5401 * Removes the entry for the given key. 1388
5402 * 1389 - (void)removeValueForKey:(int64_t)aKey;
5403 * @param aKey Key to be removed from this dictionary.
5404 **/
5405 - (void)removeEnumForKey:(int64_t)aKey;
5406
5407 /**
5408 * Removes all entries in this dictionary.
5409 **/
5410 - (void)removeAll; 1390 - (void)removeAll;
5411 1391
5412 @end 1392 @end
5413 1393
5414 #pragma mark - Int64 -> Object 1394 #pragma mark - Int64 -> Object
5415 1395
5416 /**
5417 * Class used for map fields of <int64_t, ObjectType>
5418 * values. This performs better than boxing into NSNumbers in NSDictionaries.
5419 *
5420 * @note This class is not meant to be subclassed.
5421 **/
5422 @interface GPBInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyin g> 1396 @interface GPBInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopyin g>
5423 1397
5424 /** Number of entries stored in this dictionary. */ 1398 @property(nonatomic, readonly) NSUInteger count;
5425 @property(nonatomic, readonly) NSUInteger count; 1399
5426 1400 + (instancetype)dictionary;
5427 /**
5428 * @return A newly instanced and empty dictionary.
5429 **/
5430 + (instancetype)dictionary;
5431
5432 /**
5433 * Creates and initializes a dictionary with the single entry given.
5434 *
5435 * @param object The value to be placed in the dictionary.
5436 * @param key The key under which to store the value.
5437 *
5438 * @return A newly instanced dictionary with the key and value in it.
5439 **/
5440 + (instancetype)dictionaryWithObject:(ObjectType)object 1401 + (instancetype)dictionaryWithObject:(ObjectType)object
5441 forKey:(int64_t)key; 1402 forKey:(int64_t)key;
5442
5443 /**
5444 * Creates and initializes a dictionary with the entries given.
5445 *
5446 * @param objects The values to be placed in the dictionary.
5447 * @param keys The keys under which to store the values.
5448 * @param count The number of entries to store in the dictionary.
5449 *
5450 * @return A newly instanced dictionary with the keys and values in it.
5451 **/
5452 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [] )objects 1403 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [] )objects
5453 forKeys:(const int64_t [])keys 1404 forKeys:(const int64_t [])keys
5454 count:(NSUInteger)count; 1405 count:(NSUInteger)count;
5455
5456 /**
5457 * Creates and initializes a dictionary with the entries from the given.
5458 * dictionary.
5459 *
5460 * @param dictionary Dictionary containing the entries to add to the dictionary.
5461 *
5462 * @return A newly instanced dictionary with the entries from the given
5463 * dictionary in it.
5464 **/
5465 + (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary; 1406 + (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
5466 1407 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
5467 /** 1408
5468 * Creates and initializes a dictionary with the given capacity.
5469 *
5470 * @param numItems Capacity needed for the dictionary.
5471 *
5472 * @return A newly instanced dictionary with the given capacity.
5473 **/
5474 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
5475
5476 /**
5477 * Initializes this dictionary, copying the given values and keys.
5478 *
5479 * @param objects The values to be placed in this dictionary.
5480 * @param keys The keys under which to store the values.
5481 * @param count The number of elements to copy into the dictionary.
5482 *
5483 * @return A newly initialized dictionary with a copy of the values and keys.
5484 **/
5485 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec ts 1409 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec ts
5486 forKeys:(const int64_t [])keys 1410 forKeys:(const int64_t [])keys
5487 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1411 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5488
5489 /**
5490 * Initializes this dictionary, copying the entries from the given dictionary.
5491 *
5492 * @param dictionary Dictionary containing the entries to add to this dictionary .
5493 *
5494 * @return A newly initialized dictionary with the entries of the given dictiona ry.
5495 **/
5496 - (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary; 1412 - (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
5497 1413 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5498 /** 1414
5499 * Initializes this dictionary with the requested capacity.
5500 *
5501 * @param numItems Number of items needed for this dictionary.
5502 *
5503 * @return A newly initialized dictionary with the requested capacity.
5504 **/
5505 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5506
5507 /**
5508 * Fetches the object stored under the given key.
5509 *
5510 * @param key Key under which the value is stored, if present.
5511 *
5512 * @return The object if found, nil otherwise.
5513 **/
5514 - (ObjectType)objectForKey:(int64_t)key; 1415 - (ObjectType)objectForKey:(int64_t)key;
5515 1416
5516 /**
5517 * Enumerates the keys and values on this dictionary with the given block.
5518 *
5519 * @param block The block to enumerate with.
5520 * **key**: The key for the current entry.
5521 * **object**: The value for the current entry
5522 * **stop**: A pointer to a boolean that when set stops the enumeration .
5523 **/
5524 - (void)enumerateKeysAndObjectsUsingBlock: 1417 - (void)enumerateKeysAndObjectsUsingBlock:
5525 (void (^)(int64_t key, ObjectType object, BOOL *stop))block; 1418 (void (^)(int64_t key, ObjectType object, BOOL *stop))block;
5526 1419
5527 /**
5528 * Adds the keys and values from another dictionary.
5529 *
5530 * @param otherDictionary Dictionary containing entries to be added to this
5531 * dictionary.
5532 **/
5533 - (void)addEntriesFromDictionary:(GPBInt64ObjectDictionary *)otherDictionary; 1420 - (void)addEntriesFromDictionary:(GPBInt64ObjectDictionary *)otherDictionary;
5534 1421
5535 /**
5536 * Sets the value for the given key.
5537 *
5538 * @param object The value to set.
5539 * @param key The key under which to store the value.
5540 **/
5541 - (void)setObject:(ObjectType)object forKey:(int64_t)key; 1422 - (void)setObject:(ObjectType)object forKey:(int64_t)key;
5542 1423
5543 /**
5544 * Removes the entry for the given key.
5545 *
5546 * @param aKey Key to be removed from this dictionary.
5547 **/
5548 - (void)removeObjectForKey:(int64_t)aKey; 1424 - (void)removeObjectForKey:(int64_t)aKey;
5549
5550 /**
5551 * Removes all entries in this dictionary.
5552 **/
5553 - (void)removeAll; 1425 - (void)removeAll;
5554 1426
5555 @end 1427 @end
5556 1428
5557 #pragma mark - Bool -> UInt32 1429 #pragma mark - Bool -> UInt32
5558 1430
5559 /**
5560 * Class used for map fields of <BOOL, uint32_t>
5561 * values. This performs better than boxing into NSNumbers in NSDictionaries.
5562 *
5563 * @note This class is not meant to be subclassed.
5564 **/
5565 @interface GPBBoolUInt32Dictionary : NSObject <NSCopying> 1431 @interface GPBBoolUInt32Dictionary : NSObject <NSCopying>
5566 1432
5567 /** Number of entries stored in this dictionary. */ 1433 @property(nonatomic, readonly) NSUInteger count;
5568 @property(nonatomic, readonly) NSUInteger count; 1434
5569 1435 + (instancetype)dictionary;
5570 /** 1436 + (instancetype)dictionaryWithValue:(uint32_t)value
5571 * @return A newly instanced and empty dictionary. 1437 forKey:(BOOL)key;
5572 **/ 1438 + (instancetype)dictionaryWithValues:(const uint32_t [])values
5573 + (instancetype)dictionary; 1439 forKeys:(const BOOL [])keys
5574 1440 count:(NSUInteger)count;
5575 /**
5576 * Creates and initializes a dictionary with the single entry given.
5577 *
5578 * @param value The value to be placed in the dictionary.
5579 * @param key The key under which to store the value.
5580 *
5581 * @return A newly instanced dictionary with the key and value in it.
5582 **/
5583 + (instancetype)dictionaryWithUInt32:(uint32_t)value
5584 forKey:(BOOL)key;
5585
5586 /**
5587 * Creates and initializes a dictionary with the entries given.
5588 *
5589 * @param values The values to be placed in the dictionary.
5590 * @param keys The keys under which to store the values.
5591 * @param count The number of entries to store in the dictionary.
5592 *
5593 * @return A newly instanced dictionary with the keys and values in it.
5594 **/
5595 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
5596 forKeys:(const BOOL [])keys
5597 count:(NSUInteger)count;
5598
5599 /**
5600 * Creates and initializes a dictionary with the entries from the given.
5601 * dictionary.
5602 *
5603 * @param dictionary Dictionary containing the entries to add to the dictionary.
5604 *
5605 * @return A newly instanced dictionary with the entries from the given
5606 * dictionary in it.
5607 **/
5608 + (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary; 1441 + (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary;
5609 1442 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
5610 /** 1443
5611 * Creates and initializes a dictionary with the given capacity. 1444 - (instancetype)initWithValues:(const uint32_t [])values
5612 * 1445 forKeys:(const BOOL [])keys
5613 * @param numItems Capacity needed for the dictionary. 1446 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5614 *
5615 * @return A newly instanced dictionary with the given capacity.
5616 **/
5617 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
5618
5619 /**
5620 * Initializes this dictionary, copying the given values and keys.
5621 *
5622 * @param values The values to be placed in this dictionary.
5623 * @param keys The keys under which to store the values.
5624 * @param count The number of elements to copy into the dictionary.
5625 *
5626 * @return A newly initialized dictionary with a copy of the values and keys.
5627 **/
5628 - (instancetype)initWithUInt32s:(const uint32_t [])values
5629 forKeys:(const BOOL [])keys
5630 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5631
5632 /**
5633 * Initializes this dictionary, copying the entries from the given dictionary.
5634 *
5635 * @param dictionary Dictionary containing the entries to add to this dictionary .
5636 *
5637 * @return A newly initialized dictionary with the entries of the given dictiona ry.
5638 **/
5639 - (instancetype)initWithDictionary:(GPBBoolUInt32Dictionary *)dictionary; 1447 - (instancetype)initWithDictionary:(GPBBoolUInt32Dictionary *)dictionary;
5640 1448 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5641 /** 1449
5642 * Initializes this dictionary with the requested capacity. 1450 - (BOOL)valueForKey:(BOOL)key value:(nullable uint32_t *)value;
5643 * 1451
5644 * @param numItems Number of items needed for this dictionary. 1452 - (void)enumerateKeysAndValuesUsingBlock:
5645 *
5646 * @return A newly initialized dictionary with the requested capacity.
5647 **/
5648 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5649
5650 /**
5651 * Gets the value for the given key.
5652 *
5653 * @param value Pointer into which the value will be set, if found.
5654 * @param key Key under which the value is stored, if present.
5655 *
5656 * @return YES if the key was found and the value was copied, NO otherwise.
5657 **/
5658 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(BOOL)key;
5659
5660 /**
5661 * Enumerates the keys and values on this dictionary with the given block.
5662 *
5663 * @param block The block to enumerate with.
5664 * **key**: The key for the current entry.
5665 * **value**: The value for the current entry
5666 * **stop**: A pointer to a boolean that when set stops the enumeration.
5667 **/
5668 - (void)enumerateKeysAndUInt32sUsingBlock:
5669 (void (^)(BOOL key, uint32_t value, BOOL *stop))block; 1453 (void (^)(BOOL key, uint32_t value, BOOL *stop))block;
5670 1454
5671 /**
5672 * Adds the keys and values from another dictionary.
5673 *
5674 * @param otherDictionary Dictionary containing entries to be added to this
5675 * dictionary.
5676 **/
5677 - (void)addEntriesFromDictionary:(GPBBoolUInt32Dictionary *)otherDictionary; 1455 - (void)addEntriesFromDictionary:(GPBBoolUInt32Dictionary *)otherDictionary;
5678 1456
5679 /** 1457 - (void)setValue:(uint32_t)value forKey:(BOOL)key;
5680 * Sets the value for the given key. 1458
5681 * 1459 - (void)removeValueForKey:(BOOL)aKey;
5682 * @param value The value to set.
5683 * @param key The key under which to store the value.
5684 **/
5685 - (void)setUInt32:(uint32_t)value forKey:(BOOL)key;
5686
5687 /**
5688 * Removes the entry for the given key.
5689 *
5690 * @param aKey Key to be removed from this dictionary.
5691 **/
5692 - (void)removeUInt32ForKey:(BOOL)aKey;
5693
5694 /**
5695 * Removes all entries in this dictionary.
5696 **/
5697 - (void)removeAll; 1460 - (void)removeAll;
5698 1461
5699 @end 1462 @end
5700 1463
5701 #pragma mark - Bool -> Int32 1464 #pragma mark - Bool -> Int32
5702 1465
5703 /**
5704 * Class used for map fields of <BOOL, int32_t>
5705 * values. This performs better than boxing into NSNumbers in NSDictionaries.
5706 *
5707 * @note This class is not meant to be subclassed.
5708 **/
5709 @interface GPBBoolInt32Dictionary : NSObject <NSCopying> 1466 @interface GPBBoolInt32Dictionary : NSObject <NSCopying>
5710 1467
5711 /** Number of entries stored in this dictionary. */ 1468 @property(nonatomic, readonly) NSUInteger count;
5712 @property(nonatomic, readonly) NSUInteger count; 1469
5713 1470 + (instancetype)dictionary;
5714 /** 1471 + (instancetype)dictionaryWithValue:(int32_t)value
5715 * @return A newly instanced and empty dictionary. 1472 forKey:(BOOL)key;
5716 **/ 1473 + (instancetype)dictionaryWithValues:(const int32_t [])values
5717 + (instancetype)dictionary; 1474 forKeys:(const BOOL [])keys
5718 1475 count:(NSUInteger)count;
5719 /**
5720 * Creates and initializes a dictionary with the single entry given.
5721 *
5722 * @param value The value to be placed in the dictionary.
5723 * @param key The key under which to store the value.
5724 *
5725 * @return A newly instanced dictionary with the key and value in it.
5726 **/
5727 + (instancetype)dictionaryWithInt32:(int32_t)value
5728 forKey:(BOOL)key;
5729
5730 /**
5731 * Creates and initializes a dictionary with the entries given.
5732 *
5733 * @param values The values to be placed in the dictionary.
5734 * @param keys The keys under which to store the values.
5735 * @param count The number of entries to store in the dictionary.
5736 *
5737 * @return A newly instanced dictionary with the keys and values in it.
5738 **/
5739 + (instancetype)dictionaryWithInt32s:(const int32_t [])values
5740 forKeys:(const BOOL [])keys
5741 count:(NSUInteger)count;
5742
5743 /**
5744 * Creates and initializes a dictionary with the entries from the given.
5745 * dictionary.
5746 *
5747 * @param dictionary Dictionary containing the entries to add to the dictionary.
5748 *
5749 * @return A newly instanced dictionary with the entries from the given
5750 * dictionary in it.
5751 **/
5752 + (instancetype)dictionaryWithDictionary:(GPBBoolInt32Dictionary *)dictionary; 1476 + (instancetype)dictionaryWithDictionary:(GPBBoolInt32Dictionary *)dictionary;
5753 1477 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
5754 /** 1478
5755 * Creates and initializes a dictionary with the given capacity. 1479 - (instancetype)initWithValues:(const int32_t [])values
5756 * 1480 forKeys:(const BOOL [])keys
5757 * @param numItems Capacity needed for the dictionary. 1481 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5758 *
5759 * @return A newly instanced dictionary with the given capacity.
5760 **/
5761 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
5762
5763 /**
5764 * Initializes this dictionary, copying the given values and keys.
5765 *
5766 * @param values The values to be placed in this dictionary.
5767 * @param keys The keys under which to store the values.
5768 * @param count The number of elements to copy into the dictionary.
5769 *
5770 * @return A newly initialized dictionary with a copy of the values and keys.
5771 **/
5772 - (instancetype)initWithInt32s:(const int32_t [])values
5773 forKeys:(const BOOL [])keys
5774 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5775
5776 /**
5777 * Initializes this dictionary, copying the entries from the given dictionary.
5778 *
5779 * @param dictionary Dictionary containing the entries to add to this dictionary .
5780 *
5781 * @return A newly initialized dictionary with the entries of the given dictiona ry.
5782 **/
5783 - (instancetype)initWithDictionary:(GPBBoolInt32Dictionary *)dictionary; 1482 - (instancetype)initWithDictionary:(GPBBoolInt32Dictionary *)dictionary;
5784 1483 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5785 /** 1484
5786 * Initializes this dictionary with the requested capacity. 1485 - (BOOL)valueForKey:(BOOL)key value:(nullable int32_t *)value;
5787 * 1486
5788 * @param numItems Number of items needed for this dictionary. 1487 - (void)enumerateKeysAndValuesUsingBlock:
5789 *
5790 * @return A newly initialized dictionary with the requested capacity.
5791 **/
5792 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5793
5794 /**
5795 * Gets the value for the given key.
5796 *
5797 * @param value Pointer into which the value will be set, if found.
5798 * @param key Key under which the value is stored, if present.
5799 *
5800 * @return YES if the key was found and the value was copied, NO otherwise.
5801 **/
5802 - (BOOL)getInt32:(nullable int32_t *)value forKey:(BOOL)key;
5803
5804 /**
5805 * Enumerates the keys and values on this dictionary with the given block.
5806 *
5807 * @param block The block to enumerate with.
5808 * **key**: The key for the current entry.
5809 * **value**: The value for the current entry
5810 * **stop**: A pointer to a boolean that when set stops the enumeration.
5811 **/
5812 - (void)enumerateKeysAndInt32sUsingBlock:
5813 (void (^)(BOOL key, int32_t value, BOOL *stop))block; 1488 (void (^)(BOOL key, int32_t value, BOOL *stop))block;
5814 1489
5815 /**
5816 * Adds the keys and values from another dictionary.
5817 *
5818 * @param otherDictionary Dictionary containing entries to be added to this
5819 * dictionary.
5820 **/
5821 - (void)addEntriesFromDictionary:(GPBBoolInt32Dictionary *)otherDictionary; 1490 - (void)addEntriesFromDictionary:(GPBBoolInt32Dictionary *)otherDictionary;
5822 1491
5823 /** 1492 - (void)setValue:(int32_t)value forKey:(BOOL)key;
5824 * Sets the value for the given key. 1493
5825 * 1494 - (void)removeValueForKey:(BOOL)aKey;
5826 * @param value The value to set.
5827 * @param key The key under which to store the value.
5828 **/
5829 - (void)setInt32:(int32_t)value forKey:(BOOL)key;
5830
5831 /**
5832 * Removes the entry for the given key.
5833 *
5834 * @param aKey Key to be removed from this dictionary.
5835 **/
5836 - (void)removeInt32ForKey:(BOOL)aKey;
5837
5838 /**
5839 * Removes all entries in this dictionary.
5840 **/
5841 - (void)removeAll; 1495 - (void)removeAll;
5842 1496
5843 @end 1497 @end
5844 1498
5845 #pragma mark - Bool -> UInt64 1499 #pragma mark - Bool -> UInt64
5846 1500
5847 /**
5848 * Class used for map fields of <BOOL, uint64_t>
5849 * values. This performs better than boxing into NSNumbers in NSDictionaries.
5850 *
5851 * @note This class is not meant to be subclassed.
5852 **/
5853 @interface GPBBoolUInt64Dictionary : NSObject <NSCopying> 1501 @interface GPBBoolUInt64Dictionary : NSObject <NSCopying>
5854 1502
5855 /** Number of entries stored in this dictionary. */ 1503 @property(nonatomic, readonly) NSUInteger count;
5856 @property(nonatomic, readonly) NSUInteger count; 1504
5857 1505 + (instancetype)dictionary;
5858 /** 1506 + (instancetype)dictionaryWithValue:(uint64_t)value
5859 * @return A newly instanced and empty dictionary. 1507 forKey:(BOOL)key;
5860 **/ 1508 + (instancetype)dictionaryWithValues:(const uint64_t [])values
5861 + (instancetype)dictionary; 1509 forKeys:(const BOOL [])keys
5862 1510 count:(NSUInteger)count;
5863 /**
5864 * Creates and initializes a dictionary with the single entry given.
5865 *
5866 * @param value The value to be placed in the dictionary.
5867 * @param key The key under which to store the value.
5868 *
5869 * @return A newly instanced dictionary with the key and value in it.
5870 **/
5871 + (instancetype)dictionaryWithUInt64:(uint64_t)value
5872 forKey:(BOOL)key;
5873
5874 /**
5875 * Creates and initializes a dictionary with the entries given.
5876 *
5877 * @param values The values to be placed in the dictionary.
5878 * @param keys The keys under which to store the values.
5879 * @param count The number of entries to store in the dictionary.
5880 *
5881 * @return A newly instanced dictionary with the keys and values in it.
5882 **/
5883 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
5884 forKeys:(const BOOL [])keys
5885 count:(NSUInteger)count;
5886
5887 /**
5888 * Creates and initializes a dictionary with the entries from the given.
5889 * dictionary.
5890 *
5891 * @param dictionary Dictionary containing the entries to add to the dictionary.
5892 *
5893 * @return A newly instanced dictionary with the entries from the given
5894 * dictionary in it.
5895 **/
5896 + (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary; 1511 + (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary;
5897 1512 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
5898 /** 1513
5899 * Creates and initializes a dictionary with the given capacity. 1514 - (instancetype)initWithValues:(const uint64_t [])values
5900 * 1515 forKeys:(const BOOL [])keys
5901 * @param numItems Capacity needed for the dictionary. 1516 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5902 *
5903 * @return A newly instanced dictionary with the given capacity.
5904 **/
5905 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
5906
5907 /**
5908 * Initializes this dictionary, copying the given values and keys.
5909 *
5910 * @param values The values to be placed in this dictionary.
5911 * @param keys The keys under which to store the values.
5912 * @param count The number of elements to copy into the dictionary.
5913 *
5914 * @return A newly initialized dictionary with a copy of the values and keys.
5915 **/
5916 - (instancetype)initWithUInt64s:(const uint64_t [])values
5917 forKeys:(const BOOL [])keys
5918 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
5919
5920 /**
5921 * Initializes this dictionary, copying the entries from the given dictionary.
5922 *
5923 * @param dictionary Dictionary containing the entries to add to this dictionary .
5924 *
5925 * @return A newly initialized dictionary with the entries of the given dictiona ry.
5926 **/
5927 - (instancetype)initWithDictionary:(GPBBoolUInt64Dictionary *)dictionary; 1517 - (instancetype)initWithDictionary:(GPBBoolUInt64Dictionary *)dictionary;
5928 1518 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5929 /** 1519
5930 * Initializes this dictionary with the requested capacity. 1520 - (BOOL)valueForKey:(BOOL)key value:(nullable uint64_t *)value;
5931 * 1521
5932 * @param numItems Number of items needed for this dictionary. 1522 - (void)enumerateKeysAndValuesUsingBlock:
5933 *
5934 * @return A newly initialized dictionary with the requested capacity.
5935 **/
5936 - (instancetype)initWithCapacity:(NSUInteger)numItems;
5937
5938 /**
5939 * Gets the value for the given key.
5940 *
5941 * @param value Pointer into which the value will be set, if found.
5942 * @param key Key under which the value is stored, if present.
5943 *
5944 * @return YES if the key was found and the value was copied, NO otherwise.
5945 **/
5946 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(BOOL)key;
5947
5948 /**
5949 * Enumerates the keys and values on this dictionary with the given block.
5950 *
5951 * @param block The block to enumerate with.
5952 * **key**: The key for the current entry.
5953 * **value**: The value for the current entry
5954 * **stop**: A pointer to a boolean that when set stops the enumeration.
5955 **/
5956 - (void)enumerateKeysAndUInt64sUsingBlock:
5957 (void (^)(BOOL key, uint64_t value, BOOL *stop))block; 1523 (void (^)(BOOL key, uint64_t value, BOOL *stop))block;
5958 1524
5959 /**
5960 * Adds the keys and values from another dictionary.
5961 *
5962 * @param otherDictionary Dictionary containing entries to be added to this
5963 * dictionary.
5964 **/
5965 - (void)addEntriesFromDictionary:(GPBBoolUInt64Dictionary *)otherDictionary; 1525 - (void)addEntriesFromDictionary:(GPBBoolUInt64Dictionary *)otherDictionary;
5966 1526
5967 /** 1527 - (void)setValue:(uint64_t)value forKey:(BOOL)key;
5968 * Sets the value for the given key. 1528
5969 * 1529 - (void)removeValueForKey:(BOOL)aKey;
5970 * @param value The value to set.
5971 * @param key The key under which to store the value.
5972 **/
5973 - (void)setUInt64:(uint64_t)value forKey:(BOOL)key;
5974
5975 /**
5976 * Removes the entry for the given key.
5977 *
5978 * @param aKey Key to be removed from this dictionary.
5979 **/
5980 - (void)removeUInt64ForKey:(BOOL)aKey;
5981
5982 /**
5983 * Removes all entries in this dictionary.
5984 **/
5985 - (void)removeAll; 1530 - (void)removeAll;
5986 1531
5987 @end 1532 @end
5988 1533
5989 #pragma mark - Bool -> Int64 1534 #pragma mark - Bool -> Int64
5990 1535
5991 /**
5992 * Class used for map fields of <BOOL, int64_t>
5993 * values. This performs better than boxing into NSNumbers in NSDictionaries.
5994 *
5995 * @note This class is not meant to be subclassed.
5996 **/
5997 @interface GPBBoolInt64Dictionary : NSObject <NSCopying> 1536 @interface GPBBoolInt64Dictionary : NSObject <NSCopying>
5998 1537
5999 /** Number of entries stored in this dictionary. */ 1538 @property(nonatomic, readonly) NSUInteger count;
6000 @property(nonatomic, readonly) NSUInteger count; 1539
6001 1540 + (instancetype)dictionary;
6002 /** 1541 + (instancetype)dictionaryWithValue:(int64_t)value
6003 * @return A newly instanced and empty dictionary. 1542 forKey:(BOOL)key;
6004 **/ 1543 + (instancetype)dictionaryWithValues:(const int64_t [])values
6005 + (instancetype)dictionary; 1544 forKeys:(const BOOL [])keys
6006 1545 count:(NSUInteger)count;
6007 /**
6008 * Creates and initializes a dictionary with the single entry given.
6009 *
6010 * @param value The value to be placed in the dictionary.
6011 * @param key The key under which to store the value.
6012 *
6013 * @return A newly instanced dictionary with the key and value in it.
6014 **/
6015 + (instancetype)dictionaryWithInt64:(int64_t)value
6016 forKey:(BOOL)key;
6017
6018 /**
6019 * Creates and initializes a dictionary with the entries given.
6020 *
6021 * @param values The values to be placed in the dictionary.
6022 * @param keys The keys under which to store the values.
6023 * @param count The number of entries to store in the dictionary.
6024 *
6025 * @return A newly instanced dictionary with the keys and values in it.
6026 **/
6027 + (instancetype)dictionaryWithInt64s:(const int64_t [])values
6028 forKeys:(const BOOL [])keys
6029 count:(NSUInteger)count;
6030
6031 /**
6032 * Creates and initializes a dictionary with the entries from the given.
6033 * dictionary.
6034 *
6035 * @param dictionary Dictionary containing the entries to add to the dictionary.
6036 *
6037 * @return A newly instanced dictionary with the entries from the given
6038 * dictionary in it.
6039 **/
6040 + (instancetype)dictionaryWithDictionary:(GPBBoolInt64Dictionary *)dictionary; 1546 + (instancetype)dictionaryWithDictionary:(GPBBoolInt64Dictionary *)dictionary;
6041 1547 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
6042 /** 1548
6043 * Creates and initializes a dictionary with the given capacity. 1549 - (instancetype)initWithValues:(const int64_t [])values
6044 * 1550 forKeys:(const BOOL [])keys
6045 * @param numItems Capacity needed for the dictionary. 1551 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
6046 *
6047 * @return A newly instanced dictionary with the given capacity.
6048 **/
6049 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
6050
6051 /**
6052 * Initializes this dictionary, copying the given values and keys.
6053 *
6054 * @param values The values to be placed in this dictionary.
6055 * @param keys The keys under which to store the values.
6056 * @param count The number of elements to copy into the dictionary.
6057 *
6058 * @return A newly initialized dictionary with a copy of the values and keys.
6059 **/
6060 - (instancetype)initWithInt64s:(const int64_t [])values
6061 forKeys:(const BOOL [])keys
6062 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
6063
6064 /**
6065 * Initializes this dictionary, copying the entries from the given dictionary.
6066 *
6067 * @param dictionary Dictionary containing the entries to add to this dictionary .
6068 *
6069 * @return A newly initialized dictionary with the entries of the given dictiona ry.
6070 **/
6071 - (instancetype)initWithDictionary:(GPBBoolInt64Dictionary *)dictionary; 1552 - (instancetype)initWithDictionary:(GPBBoolInt64Dictionary *)dictionary;
6072 1553 - (instancetype)initWithCapacity:(NSUInteger)numItems;
6073 /** 1554
6074 * Initializes this dictionary with the requested capacity. 1555 - (BOOL)valueForKey:(BOOL)key value:(nullable int64_t *)value;
6075 * 1556
6076 * @param numItems Number of items needed for this dictionary. 1557 - (void)enumerateKeysAndValuesUsingBlock:
6077 *
6078 * @return A newly initialized dictionary with the requested capacity.
6079 **/
6080 - (instancetype)initWithCapacity:(NSUInteger)numItems;
6081
6082 /**
6083 * Gets the value for the given key.
6084 *
6085 * @param value Pointer into which the value will be set, if found.
6086 * @param key Key under which the value is stored, if present.
6087 *
6088 * @return YES if the key was found and the value was copied, NO otherwise.
6089 **/
6090 - (BOOL)getInt64:(nullable int64_t *)value forKey:(BOOL)key;
6091
6092 /**
6093 * Enumerates the keys and values on this dictionary with the given block.
6094 *
6095 * @param block The block to enumerate with.
6096 * **key**: The key for the current entry.
6097 * **value**: The value for the current entry
6098 * **stop**: A pointer to a boolean that when set stops the enumeration.
6099 **/
6100 - (void)enumerateKeysAndInt64sUsingBlock:
6101 (void (^)(BOOL key, int64_t value, BOOL *stop))block; 1558 (void (^)(BOOL key, int64_t value, BOOL *stop))block;
6102 1559
6103 /**
6104 * Adds the keys and values from another dictionary.
6105 *
6106 * @param otherDictionary Dictionary containing entries to be added to this
6107 * dictionary.
6108 **/
6109 - (void)addEntriesFromDictionary:(GPBBoolInt64Dictionary *)otherDictionary; 1560 - (void)addEntriesFromDictionary:(GPBBoolInt64Dictionary *)otherDictionary;
6110 1561
6111 /** 1562 - (void)setValue:(int64_t)value forKey:(BOOL)key;
6112 * Sets the value for the given key. 1563
6113 * 1564 - (void)removeValueForKey:(BOOL)aKey;
6114 * @param value The value to set.
6115 * @param key The key under which to store the value.
6116 **/
6117 - (void)setInt64:(int64_t)value forKey:(BOOL)key;
6118
6119 /**
6120 * Removes the entry for the given key.
6121 *
6122 * @param aKey Key to be removed from this dictionary.
6123 **/
6124 - (void)removeInt64ForKey:(BOOL)aKey;
6125
6126 /**
6127 * Removes all entries in this dictionary.
6128 **/
6129 - (void)removeAll; 1565 - (void)removeAll;
6130 1566
6131 @end 1567 @end
6132 1568
6133 #pragma mark - Bool -> Bool 1569 #pragma mark - Bool -> Bool
6134 1570
6135 /**
6136 * Class used for map fields of <BOOL, BOOL>
6137 * values. This performs better than boxing into NSNumbers in NSDictionaries.
6138 *
6139 * @note This class is not meant to be subclassed.
6140 **/
6141 @interface GPBBoolBoolDictionary : NSObject <NSCopying> 1571 @interface GPBBoolBoolDictionary : NSObject <NSCopying>
6142 1572
6143 /** Number of entries stored in this dictionary. */ 1573 @property(nonatomic, readonly) NSUInteger count;
6144 @property(nonatomic, readonly) NSUInteger count; 1574
6145 1575 + (instancetype)dictionary;
6146 /** 1576 + (instancetype)dictionaryWithValue:(BOOL)value
6147 * @return A newly instanced and empty dictionary. 1577 forKey:(BOOL)key;
6148 **/ 1578 + (instancetype)dictionaryWithValues:(const BOOL [])values
6149 + (instancetype)dictionary; 1579 forKeys:(const BOOL [])keys
6150 1580 count:(NSUInteger)count;
6151 /**
6152 * Creates and initializes a dictionary with the single entry given.
6153 *
6154 * @param value The value to be placed in the dictionary.
6155 * @param key The key under which to store the value.
6156 *
6157 * @return A newly instanced dictionary with the key and value in it.
6158 **/
6159 + (instancetype)dictionaryWithBool:(BOOL)value
6160 forKey:(BOOL)key;
6161
6162 /**
6163 * Creates and initializes a dictionary with the entries given.
6164 *
6165 * @param values The values to be placed in the dictionary.
6166 * @param keys The keys under which to store the values.
6167 * @param count The number of entries to store in the dictionary.
6168 *
6169 * @return A newly instanced dictionary with the keys and values in it.
6170 **/
6171 + (instancetype)dictionaryWithBools:(const BOOL [])values
6172 forKeys:(const BOOL [])keys
6173 count:(NSUInteger)count;
6174
6175 /**
6176 * Creates and initializes a dictionary with the entries from the given.
6177 * dictionary.
6178 *
6179 * @param dictionary Dictionary containing the entries to add to the dictionary.
6180 *
6181 * @return A newly instanced dictionary with the entries from the given
6182 * dictionary in it.
6183 **/
6184 + (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary; 1581 + (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary;
6185 1582 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
6186 /** 1583
6187 * Creates and initializes a dictionary with the given capacity. 1584 - (instancetype)initWithValues:(const BOOL [])values
6188 * 1585 forKeys:(const BOOL [])keys
6189 * @param numItems Capacity needed for the dictionary. 1586 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
6190 *
6191 * @return A newly instanced dictionary with the given capacity.
6192 **/
6193 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
6194
6195 /**
6196 * Initializes this dictionary, copying the given values and keys.
6197 *
6198 * @param values The values to be placed in this dictionary.
6199 * @param keys The keys under which to store the values.
6200 * @param count The number of elements to copy into the dictionary.
6201 *
6202 * @return A newly initialized dictionary with a copy of the values and keys.
6203 **/
6204 - (instancetype)initWithBools:(const BOOL [])values
6205 forKeys:(const BOOL [])keys
6206 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
6207
6208 /**
6209 * Initializes this dictionary, copying the entries from the given dictionary.
6210 *
6211 * @param dictionary Dictionary containing the entries to add to this dictionary .
6212 *
6213 * @return A newly initialized dictionary with the entries of the given dictiona ry.
6214 **/
6215 - (instancetype)initWithDictionary:(GPBBoolBoolDictionary *)dictionary; 1587 - (instancetype)initWithDictionary:(GPBBoolBoolDictionary *)dictionary;
6216 1588 - (instancetype)initWithCapacity:(NSUInteger)numItems;
6217 /** 1589
6218 * Initializes this dictionary with the requested capacity. 1590 - (BOOL)valueForKey:(BOOL)key value:(nullable BOOL *)value;
6219 * 1591
6220 * @param numItems Number of items needed for this dictionary. 1592 - (void)enumerateKeysAndValuesUsingBlock:
6221 *
6222 * @return A newly initialized dictionary with the requested capacity.
6223 **/
6224 - (instancetype)initWithCapacity:(NSUInteger)numItems;
6225
6226 /**
6227 * Gets the value for the given key.
6228 *
6229 * @param value Pointer into which the value will be set, if found.
6230 * @param key Key under which the value is stored, if present.
6231 *
6232 * @return YES if the key was found and the value was copied, NO otherwise.
6233 **/
6234 - (BOOL)getBool:(nullable BOOL *)value forKey:(BOOL)key;
6235
6236 /**
6237 * Enumerates the keys and values on this dictionary with the given block.
6238 *
6239 * @param block The block to enumerate with.
6240 * **key**: The key for the current entry.
6241 * **value**: The value for the current entry
6242 * **stop**: A pointer to a boolean that when set stops the enumeration.
6243 **/
6244 - (void)enumerateKeysAndBoolsUsingBlock:
6245 (void (^)(BOOL key, BOOL value, BOOL *stop))block; 1593 (void (^)(BOOL key, BOOL value, BOOL *stop))block;
6246 1594
6247 /**
6248 * Adds the keys and values from another dictionary.
6249 *
6250 * @param otherDictionary Dictionary containing entries to be added to this
6251 * dictionary.
6252 **/
6253 - (void)addEntriesFromDictionary:(GPBBoolBoolDictionary *)otherDictionary; 1595 - (void)addEntriesFromDictionary:(GPBBoolBoolDictionary *)otherDictionary;
6254 1596
6255 /** 1597 - (void)setValue:(BOOL)value forKey:(BOOL)key;
6256 * Sets the value for the given key. 1598
6257 * 1599 - (void)removeValueForKey:(BOOL)aKey;
6258 * @param value The value to set.
6259 * @param key The key under which to store the value.
6260 **/
6261 - (void)setBool:(BOOL)value forKey:(BOOL)key;
6262
6263 /**
6264 * Removes the entry for the given key.
6265 *
6266 * @param aKey Key to be removed from this dictionary.
6267 **/
6268 - (void)removeBoolForKey:(BOOL)aKey;
6269
6270 /**
6271 * Removes all entries in this dictionary.
6272 **/
6273 - (void)removeAll; 1600 - (void)removeAll;
6274 1601
6275 @end 1602 @end
6276 1603
6277 #pragma mark - Bool -> Float 1604 #pragma mark - Bool -> Float
6278 1605
6279 /**
6280 * Class used for map fields of <BOOL, float>
6281 * values. This performs better than boxing into NSNumbers in NSDictionaries.
6282 *
6283 * @note This class is not meant to be subclassed.
6284 **/
6285 @interface GPBBoolFloatDictionary : NSObject <NSCopying> 1606 @interface GPBBoolFloatDictionary : NSObject <NSCopying>
6286 1607
6287 /** Number of entries stored in this dictionary. */ 1608 @property(nonatomic, readonly) NSUInteger count;
6288 @property(nonatomic, readonly) NSUInteger count; 1609
6289 1610 + (instancetype)dictionary;
6290 /** 1611 + (instancetype)dictionaryWithValue:(float)value
6291 * @return A newly instanced and empty dictionary. 1612 forKey:(BOOL)key;
6292 **/ 1613 + (instancetype)dictionaryWithValues:(const float [])values
6293 + (instancetype)dictionary; 1614 forKeys:(const BOOL [])keys
6294 1615 count:(NSUInteger)count;
6295 /**
6296 * Creates and initializes a dictionary with the single entry given.
6297 *
6298 * @param value The value to be placed in the dictionary.
6299 * @param key The key under which to store the value.
6300 *
6301 * @return A newly instanced dictionary with the key and value in it.
6302 **/
6303 + (instancetype)dictionaryWithFloat:(float)value
6304 forKey:(BOOL)key;
6305
6306 /**
6307 * Creates and initializes a dictionary with the entries given.
6308 *
6309 * @param values The values to be placed in the dictionary.
6310 * @param keys The keys under which to store the values.
6311 * @param count The number of entries to store in the dictionary.
6312 *
6313 * @return A newly instanced dictionary with the keys and values in it.
6314 **/
6315 + (instancetype)dictionaryWithFloats:(const float [])values
6316 forKeys:(const BOOL [])keys
6317 count:(NSUInteger)count;
6318
6319 /**
6320 * Creates and initializes a dictionary with the entries from the given.
6321 * dictionary.
6322 *
6323 * @param dictionary Dictionary containing the entries to add to the dictionary.
6324 *
6325 * @return A newly instanced dictionary with the entries from the given
6326 * dictionary in it.
6327 **/
6328 + (instancetype)dictionaryWithDictionary:(GPBBoolFloatDictionary *)dictionary; 1616 + (instancetype)dictionaryWithDictionary:(GPBBoolFloatDictionary *)dictionary;
6329 1617 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
6330 /** 1618
6331 * Creates and initializes a dictionary with the given capacity. 1619 - (instancetype)initWithValues:(const float [])values
6332 * 1620 forKeys:(const BOOL [])keys
6333 * @param numItems Capacity needed for the dictionary. 1621 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
6334 *
6335 * @return A newly instanced dictionary with the given capacity.
6336 **/
6337 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
6338
6339 /**
6340 * Initializes this dictionary, copying the given values and keys.
6341 *
6342 * @param values The values to be placed in this dictionary.
6343 * @param keys The keys under which to store the values.
6344 * @param count The number of elements to copy into the dictionary.
6345 *
6346 * @return A newly initialized dictionary with a copy of the values and keys.
6347 **/
6348 - (instancetype)initWithFloats:(const float [])values
6349 forKeys:(const BOOL [])keys
6350 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
6351
6352 /**
6353 * Initializes this dictionary, copying the entries from the given dictionary.
6354 *
6355 * @param dictionary Dictionary containing the entries to add to this dictionary .
6356 *
6357 * @return A newly initialized dictionary with the entries of the given dictiona ry.
6358 **/
6359 - (instancetype)initWithDictionary:(GPBBoolFloatDictionary *)dictionary; 1622 - (instancetype)initWithDictionary:(GPBBoolFloatDictionary *)dictionary;
6360 1623 - (instancetype)initWithCapacity:(NSUInteger)numItems;
6361 /** 1624
6362 * Initializes this dictionary with the requested capacity. 1625 - (BOOL)valueForKey:(BOOL)key value:(nullable float *)value;
6363 * 1626
6364 * @param numItems Number of items needed for this dictionary. 1627 - (void)enumerateKeysAndValuesUsingBlock:
6365 *
6366 * @return A newly initialized dictionary with the requested capacity.
6367 **/
6368 - (instancetype)initWithCapacity:(NSUInteger)numItems;
6369
6370 /**
6371 * Gets the value for the given key.
6372 *
6373 * @param value Pointer into which the value will be set, if found.
6374 * @param key Key under which the value is stored, if present.
6375 *
6376 * @return YES if the key was found and the value was copied, NO otherwise.
6377 **/
6378 - (BOOL)getFloat:(nullable float *)value forKey:(BOOL)key;
6379
6380 /**
6381 * Enumerates the keys and values on this dictionary with the given block.
6382 *
6383 * @param block The block to enumerate with.
6384 * **key**: The key for the current entry.
6385 * **value**: The value for the current entry
6386 * **stop**: A pointer to a boolean that when set stops the enumeration.
6387 **/
6388 - (void)enumerateKeysAndFloatsUsingBlock:
6389 (void (^)(BOOL key, float value, BOOL *stop))block; 1628 (void (^)(BOOL key, float value, BOOL *stop))block;
6390 1629
6391 /**
6392 * Adds the keys and values from another dictionary.
6393 *
6394 * @param otherDictionary Dictionary containing entries to be added to this
6395 * dictionary.
6396 **/
6397 - (void)addEntriesFromDictionary:(GPBBoolFloatDictionary *)otherDictionary; 1630 - (void)addEntriesFromDictionary:(GPBBoolFloatDictionary *)otherDictionary;
6398 1631
6399 /** 1632 - (void)setValue:(float)value forKey:(BOOL)key;
6400 * Sets the value for the given key. 1633
6401 * 1634 - (void)removeValueForKey:(BOOL)aKey;
6402 * @param value The value to set.
6403 * @param key The key under which to store the value.
6404 **/
6405 - (void)setFloat:(float)value forKey:(BOOL)key;
6406
6407 /**
6408 * Removes the entry for the given key.
6409 *
6410 * @param aKey Key to be removed from this dictionary.
6411 **/
6412 - (void)removeFloatForKey:(BOOL)aKey;
6413
6414 /**
6415 * Removes all entries in this dictionary.
6416 **/
6417 - (void)removeAll; 1635 - (void)removeAll;
6418 1636
6419 @end 1637 @end
6420 1638
6421 #pragma mark - Bool -> Double 1639 #pragma mark - Bool -> Double
6422 1640
6423 /**
6424 * Class used for map fields of <BOOL, double>
6425 * values. This performs better than boxing into NSNumbers in NSDictionaries.
6426 *
6427 * @note This class is not meant to be subclassed.
6428 **/
6429 @interface GPBBoolDoubleDictionary : NSObject <NSCopying> 1641 @interface GPBBoolDoubleDictionary : NSObject <NSCopying>
6430 1642
6431 /** Number of entries stored in this dictionary. */ 1643 @property(nonatomic, readonly) NSUInteger count;
6432 @property(nonatomic, readonly) NSUInteger count; 1644
6433 1645 + (instancetype)dictionary;
6434 /** 1646 + (instancetype)dictionaryWithValue:(double)value
6435 * @return A newly instanced and empty dictionary. 1647 forKey:(BOOL)key;
6436 **/ 1648 + (instancetype)dictionaryWithValues:(const double [])values
6437 + (instancetype)dictionary; 1649 forKeys:(const BOOL [])keys
6438 1650 count:(NSUInteger)count;
6439 /**
6440 * Creates and initializes a dictionary with the single entry given.
6441 *
6442 * @param value The value to be placed in the dictionary.
6443 * @param key The key under which to store the value.
6444 *
6445 * @return A newly instanced dictionary with the key and value in it.
6446 **/
6447 + (instancetype)dictionaryWithDouble:(double)value
6448 forKey:(BOOL)key;
6449
6450 /**
6451 * Creates and initializes a dictionary with the entries given.
6452 *
6453 * @param values The values to be placed in the dictionary.
6454 * @param keys The keys under which to store the values.
6455 * @param count The number of entries to store in the dictionary.
6456 *
6457 * @return A newly instanced dictionary with the keys and values in it.
6458 **/
6459 + (instancetype)dictionaryWithDoubles:(const double [])values
6460 forKeys:(const BOOL [])keys
6461 count:(NSUInteger)count;
6462
6463 /**
6464 * Creates and initializes a dictionary with the entries from the given.
6465 * dictionary.
6466 *
6467 * @param dictionary Dictionary containing the entries to add to the dictionary.
6468 *
6469 * @return A newly instanced dictionary with the entries from the given
6470 * dictionary in it.
6471 **/
6472 + (instancetype)dictionaryWithDictionary:(GPBBoolDoubleDictionary *)dictionary; 1651 + (instancetype)dictionaryWithDictionary:(GPBBoolDoubleDictionary *)dictionary;
6473 1652 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
6474 /** 1653
6475 * Creates and initializes a dictionary with the given capacity. 1654 - (instancetype)initWithValues:(const double [])values
6476 * 1655 forKeys:(const BOOL [])keys
6477 * @param numItems Capacity needed for the dictionary. 1656 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
6478 *
6479 * @return A newly instanced dictionary with the given capacity.
6480 **/
6481 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
6482
6483 /**
6484 * Initializes this dictionary, copying the given values and keys.
6485 *
6486 * @param values The values to be placed in this dictionary.
6487 * @param keys The keys under which to store the values.
6488 * @param count The number of elements to copy into the dictionary.
6489 *
6490 * @return A newly initialized dictionary with a copy of the values and keys.
6491 **/
6492 - (instancetype)initWithDoubles:(const double [])values
6493 forKeys:(const BOOL [])keys
6494 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
6495
6496 /**
6497 * Initializes this dictionary, copying the entries from the given dictionary.
6498 *
6499 * @param dictionary Dictionary containing the entries to add to this dictionary .
6500 *
6501 * @return A newly initialized dictionary with the entries of the given dictiona ry.
6502 **/
6503 - (instancetype)initWithDictionary:(GPBBoolDoubleDictionary *)dictionary; 1657 - (instancetype)initWithDictionary:(GPBBoolDoubleDictionary *)dictionary;
6504 1658 - (instancetype)initWithCapacity:(NSUInteger)numItems;
6505 /** 1659
6506 * Initializes this dictionary with the requested capacity. 1660 - (BOOL)valueForKey:(BOOL)key value:(nullable double *)value;
6507 * 1661
6508 * @param numItems Number of items needed for this dictionary. 1662 - (void)enumerateKeysAndValuesUsingBlock:
6509 *
6510 * @return A newly initialized dictionary with the requested capacity.
6511 **/
6512 - (instancetype)initWithCapacity:(NSUInteger)numItems;
6513
6514 /**
6515 * Gets the value for the given key.
6516 *
6517 * @param value Pointer into which the value will be set, if found.
6518 * @param key Key under which the value is stored, if present.
6519 *
6520 * @return YES if the key was found and the value was copied, NO otherwise.
6521 **/
6522 - (BOOL)getDouble:(nullable double *)value forKey:(BOOL)key;
6523
6524 /**
6525 * Enumerates the keys and values on this dictionary with the given block.
6526 *
6527 * @param block The block to enumerate with.
6528 * **key**: The key for the current entry.
6529 * **value**: The value for the current entry
6530 * **stop**: A pointer to a boolean that when set stops the enumeration.
6531 **/
6532 - (void)enumerateKeysAndDoublesUsingBlock:
6533 (void (^)(BOOL key, double value, BOOL *stop))block; 1663 (void (^)(BOOL key, double value, BOOL *stop))block;
6534 1664
6535 /**
6536 * Adds the keys and values from another dictionary.
6537 *
6538 * @param otherDictionary Dictionary containing entries to be added to this
6539 * dictionary.
6540 **/
6541 - (void)addEntriesFromDictionary:(GPBBoolDoubleDictionary *)otherDictionary; 1665 - (void)addEntriesFromDictionary:(GPBBoolDoubleDictionary *)otherDictionary;
6542 1666
6543 /** 1667 - (void)setValue:(double)value forKey:(BOOL)key;
6544 * Sets the value for the given key. 1668
6545 * 1669 - (void)removeValueForKey:(BOOL)aKey;
6546 * @param value The value to set.
6547 * @param key The key under which to store the value.
6548 **/
6549 - (void)setDouble:(double)value forKey:(BOOL)key;
6550
6551 /**
6552 * Removes the entry for the given key.
6553 *
6554 * @param aKey Key to be removed from this dictionary.
6555 **/
6556 - (void)removeDoubleForKey:(BOOL)aKey;
6557
6558 /**
6559 * Removes all entries in this dictionary.
6560 **/
6561 - (void)removeAll; 1670 - (void)removeAll;
6562 1671
6563 @end 1672 @end
6564 1673
6565 #pragma mark - Bool -> Enum 1674 #pragma mark - Bool -> Enum
6566 1675
6567 /**
6568 * Class used for map fields of <BOOL, int32_t>
6569 * values. This performs better than boxing into NSNumbers in NSDictionaries.
6570 *
6571 * @note This class is not meant to be subclassed.
6572 **/
6573 @interface GPBBoolEnumDictionary : NSObject <NSCopying> 1676 @interface GPBBoolEnumDictionary : NSObject <NSCopying>
6574 1677
6575 /** Number of entries stored in this dictionary. */ 1678 @property(nonatomic, readonly) NSUInteger count;
6576 @property(nonatomic, readonly) NSUInteger count;
6577 /** The validation function to check if the enums are valid. */
6578 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 1679 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
6579 1680
6580 /** 1681 + (instancetype)dictionary;
6581 * @return A newly instanced and empty dictionary.
6582 **/
6583 + (instancetype)dictionary;
6584
6585 /**
6586 * Creates and initializes a dictionary with the given validation function.
6587 *
6588 * @param func The enum validation function for the dictionary.
6589 *
6590 * @return A newly instanced dictionary.
6591 **/
6592 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func; 1682 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func;
6593
6594 /**
6595 * Creates and initializes a dictionary with the single entry given.
6596 *
6597 * @param func The enum validation function for the dictionary.
6598 * @param rawValue The raw enum value to be placed in the dictionary.
6599 * @param key The key under which to store the value.
6600 *
6601 * @return A newly instanced dictionary with the key and value in it.
6602 **/
6603 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 1683 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
6604 rawValue:(int32_t)rawValue 1684 rawValue:(int32_t)rawValue
6605 forKey:(BOOL)key; 1685 forKey:(BOOL)key;
6606
6607 /**
6608 * Creates and initializes a dictionary with the entries given.
6609 *
6610 * @param func The enum validation function for the dictionary.
6611 * @param values The raw enum values values to be placed in the dictionary.
6612 * @param keys The keys under which to store the values.
6613 * @param count The number of entries to store in the dictionary.
6614 *
6615 * @return A newly instanced dictionary with the keys and values in it.
6616 **/
6617 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 1686 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
6618 rawValues:(const int32_t [])values 1687 rawValues:(const int32_t [])values
6619 forKeys:(const BOOL [])keys 1688 forKeys:(const BOOL [])keys
6620 count:(NSUInteger)count; 1689 count:(NSUInteger)count;
6621
6622 /**
6623 * Creates and initializes a dictionary with the entries from the given.
6624 * dictionary.
6625 *
6626 * @param dictionary Dictionary containing the entries to add to the dictionary.
6627 *
6628 * @return A newly instanced dictionary with the entries from the given
6629 * dictionary in it.
6630 **/
6631 + (instancetype)dictionaryWithDictionary:(GPBBoolEnumDictionary *)dictionary; 1690 + (instancetype)dictionaryWithDictionary:(GPBBoolEnumDictionary *)dictionary;
6632
6633 /**
6634 * Creates and initializes a dictionary with the given capacity.
6635 *
6636 * @param func The enum validation function for the dictionary.
6637 * @param numItems Capacity needed for the dictionary.
6638 *
6639 * @return A newly instanced dictionary with the given capacity.
6640 **/
6641 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 1691 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
6642 capacity:(NSUInteger)numItems; 1692 capacity:(NSUInteger)numItems;
6643 1693
6644 /**
6645 * Initializes a dictionary with the given validation function.
6646 *
6647 * @param func The enum validation function for the dictionary.
6648 *
6649 * @return A newly initialized dictionary.
6650 **/
6651 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 1694 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
6652
6653 /**
6654 * Initializes a dictionary with the entries given.
6655 *
6656 * @param func The enum validation function for the dictionary.
6657 * @param values The raw enum values values to be placed in the dictionary.
6658 * @param keys The keys under which to store the values.
6659 * @param count The number of entries to store in the dictionary.
6660 *
6661 * @return A newly initialized dictionary with the keys and values in it.
6662 **/
6663 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1695 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
6664 rawValues:(const int32_t [])values 1696 rawValues:(const int32_t [])values
6665 forKeys:(const BOOL [])keys 1697 forKeys:(const BOOL [])keys
6666 count:(NSUInteger)count NS_DESIGNATED_INITI ALIZER; 1698 count:(NSUInteger)count NS_DESIGNATED_INITI ALIZER;
6667
6668 /**
6669 * Initializes a dictionary with the entries from the given.
6670 * dictionary.
6671 *
6672 * @param dictionary Dictionary containing the entries to add to the dictionary.
6673 *
6674 * @return A newly initialized dictionary with the entries from the given
6675 * dictionary in it.
6676 **/
6677 - (instancetype)initWithDictionary:(GPBBoolEnumDictionary *)dictionary; 1699 - (instancetype)initWithDictionary:(GPBBoolEnumDictionary *)dictionary;
6678
6679 /**
6680 * Initializes a dictionary with the given capacity.
6681 *
6682 * @param func The enum validation function for the dictionary.
6683 * @param numItems Capacity needed for the dictionary.
6684 *
6685 * @return A newly initialized dictionary with the given capacity.
6686 **/
6687 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1700 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
6688 capacity:(NSUInteger)numItems; 1701 capacity:(NSUInteger)numItems;
6689 1702
6690 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 1703 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
6691 // is not a valid enumerator as defined by validationFunc. If the actual value i s 1704 // is not a valid enumerator as defined by validationFunc. If the actual value i s
6692 // desired, use "raw" version of the method. 1705 // desired, use "raw" version of the method.
6693 1706
6694 /** 1707 - (BOOL)valueForKey:(BOOL)key value:(nullable int32_t *)value;
6695 * Gets the value for the given key.
6696 *
6697 * @param value Pointer into which the value will be set, if found.
6698 * @param key Key under which the value is stored, if present.
6699 *
6700 * @return YES if the key was found and the value was copied, NO otherwise.
6701 **/
6702 - (BOOL)getEnum:(nullable int32_t *)value forKey:(BOOL)key;
6703 1708
6704 /** 1709 - (void)enumerateKeysAndValuesUsingBlock:
6705 * Enumerates the keys and values on this dictionary with the given block.
6706 *
6707 * @param block The block to enumerate with.
6708 * **key**: The key for the current entry.
6709 * **value**: The value for the current entry
6710 * **stop**: A pointer to a boolean that when set stops the enumeration.
6711 **/
6712 - (void)enumerateKeysAndEnumsUsingBlock:
6713 (void (^)(BOOL key, int32_t value, BOOL *stop))block; 1710 (void (^)(BOOL key, int32_t value, BOOL *stop))block;
6714 1711
6715 /** 1712 // These methods bypass the validationFunc to provide access to values that were not
6716 * Gets the raw enum value for the given key. 1713 // known at the time the binary was compiled.
6717 *
6718 * @note This method bypass the validationFunc to enable the access of values th at
6719 * were not known at the time the binary was compiled.
6720 *
6721 * @param rawValue Pointer into which the value will be set, if found.
6722 * @param key Key under which the value is stored, if present.
6723 *
6724 * @return YES if the key was found and the value was copied, NO otherwise.
6725 **/
6726 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(BOOL)key;
6727 1714
6728 /** 1715 - (BOOL)valueForKey:(BOOL)key rawValue:(nullable int32_t *)rawValue;
6729 * Enumerates the keys and values on this dictionary with the given block. 1716
6730 *
6731 * @note This method bypass the validationFunc to enable the access of values th at
6732 * were not known at the time the binary was compiled.
6733 *
6734 * @param block The block to enumerate with.
6735 * **key**: The key for the current entry.
6736 * **rawValue**: The value for the current entry
6737 * **stop**: A pointer to a boolean that when set stops the enumeration.
6738 **/
6739 - (void)enumerateKeysAndRawValuesUsingBlock: 1717 - (void)enumerateKeysAndRawValuesUsingBlock:
6740 (void (^)(BOOL key, int32_t rawValue, BOOL *stop))block; 1718 (void (^)(BOOL key, int32_t rawValue, BOOL *stop))block;
6741 1719
6742 /**
6743 * Adds the keys and raw enum values from another dictionary.
6744 *
6745 * @note This method bypass the validationFunc to enable the setting of values t hat
6746 * were not known at the time the binary was compiled.
6747 *
6748 * @param otherDictionary Dictionary containing entries to be added to this
6749 * dictionary.
6750 **/
6751 - (void)addRawEntriesFromDictionary:(GPBBoolEnumDictionary *)otherDictionary; 1720 - (void)addRawEntriesFromDictionary:(GPBBoolEnumDictionary *)otherDictionary;
6752 1721
6753 // If value is not a valid enumerator as defined by validationFunc, these 1722 // If value is not a valid enumerator as defined by validationFunc, these
6754 // methods will assert in debug, and will log in release and assign the value 1723 // methods will assert in debug, and will log in release and assign the value
6755 // to the default value. Use the rawValue methods below to assign non enumerator 1724 // to the default value. Use the rawValue methods below to assign non enumerator
6756 // values. 1725 // values.
6757 1726
6758 /** 1727 - (void)setValue:(int32_t)value forKey:(BOOL)key;
6759 * Sets the value for the given key. 1728
6760 * 1729 // This method bypass the validationFunc to provide setting of values that were not
6761 * @param value The value to set. 1730 // known at the time the binary was compiled.
6762 * @param key The key under which to store the value.
6763 **/
6764 - (void)setEnum:(int32_t)value forKey:(BOOL)key;
6765
6766 /**
6767 * Sets the raw enum value for the given key.
6768 *
6769 * @note This method bypass the validationFunc to enable the setting of values t hat
6770 * were not known at the time the binary was compiled.
6771 *
6772 * @param rawValue The raw enum value to set.
6773 * @param key The key under which to store the raw enum value.
6774 **/
6775 - (void)setRawValue:(int32_t)rawValue forKey:(BOOL)key; 1731 - (void)setRawValue:(int32_t)rawValue forKey:(BOOL)key;
6776 1732
6777 /** 1733 // No validation applies to these methods.
6778 * Removes the entry for the given key. 1734
6779 * 1735 - (void)removeValueForKey:(BOOL)aKey;
6780 * @param aKey Key to be removed from this dictionary.
6781 **/
6782 - (void)removeEnumForKey:(BOOL)aKey;
6783
6784 /**
6785 * Removes all entries in this dictionary.
6786 **/
6787 - (void)removeAll; 1736 - (void)removeAll;
6788 1737
6789 @end 1738 @end
6790 1739
6791 #pragma mark - Bool -> Object 1740 #pragma mark - Bool -> Object
6792 1741
6793 /**
6794 * Class used for map fields of <BOOL, ObjectType>
6795 * values. This performs better than boxing into NSNumbers in NSDictionaries.
6796 *
6797 * @note This class is not meant to be subclassed.
6798 **/
6799 @interface GPBBoolObjectDictionary<__covariant ObjectType> : NSObject <NSCopying > 1742 @interface GPBBoolObjectDictionary<__covariant ObjectType> : NSObject <NSCopying >
6800 1743
6801 /** Number of entries stored in this dictionary. */ 1744 @property(nonatomic, readonly) NSUInteger count;
6802 @property(nonatomic, readonly) NSUInteger count; 1745
6803 1746 + (instancetype)dictionary;
6804 /**
6805 * @return A newly instanced and empty dictionary.
6806 **/
6807 + (instancetype)dictionary;
6808
6809 /**
6810 * Creates and initializes a dictionary with the single entry given.
6811 *
6812 * @param object The value to be placed in the dictionary.
6813 * @param key The key under which to store the value.
6814 *
6815 * @return A newly instanced dictionary with the key and value in it.
6816 **/
6817 + (instancetype)dictionaryWithObject:(ObjectType)object 1747 + (instancetype)dictionaryWithObject:(ObjectType)object
6818 forKey:(BOOL)key; 1748 forKey:(BOOL)key;
6819
6820 /**
6821 * Creates and initializes a dictionary with the entries given.
6822 *
6823 * @param objects The values to be placed in the dictionary.
6824 * @param keys The keys under which to store the values.
6825 * @param count The number of entries to store in the dictionary.
6826 *
6827 * @return A newly instanced dictionary with the keys and values in it.
6828 **/
6829 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [] )objects 1749 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [] )objects
6830 forKeys:(const BOOL [])keys 1750 forKeys:(const BOOL [])keys
6831 count:(NSUInteger)count; 1751 count:(NSUInteger)count;
6832
6833 /**
6834 * Creates and initializes a dictionary with the entries from the given.
6835 * dictionary.
6836 *
6837 * @param dictionary Dictionary containing the entries to add to the dictionary.
6838 *
6839 * @return A newly instanced dictionary with the entries from the given
6840 * dictionary in it.
6841 **/
6842 + (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary; 1752 + (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary;
6843 1753 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
6844 /** 1754
6845 * Creates and initializes a dictionary with the given capacity.
6846 *
6847 * @param numItems Capacity needed for the dictionary.
6848 *
6849 * @return A newly instanced dictionary with the given capacity.
6850 **/
6851 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
6852
6853 /**
6854 * Initializes this dictionary, copying the given values and keys.
6855 *
6856 * @param objects The values to be placed in this dictionary.
6857 * @param keys The keys under which to store the values.
6858 * @param count The number of elements to copy into the dictionary.
6859 *
6860 * @return A newly initialized dictionary with a copy of the values and keys.
6861 **/
6862 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec ts 1755 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objec ts
6863 forKeys:(const BOOL [])keys 1756 forKeys:(const BOOL [])keys
6864 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1757 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
6865
6866 /**
6867 * Initializes this dictionary, copying the entries from the given dictionary.
6868 *
6869 * @param dictionary Dictionary containing the entries to add to this dictionary .
6870 *
6871 * @return A newly initialized dictionary with the entries of the given dictiona ry.
6872 **/
6873 - (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary; 1758 - (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary;
6874 1759 - (instancetype)initWithCapacity:(NSUInteger)numItems;
6875 /** 1760
6876 * Initializes this dictionary with the requested capacity.
6877 *
6878 * @param numItems Number of items needed for this dictionary.
6879 *
6880 * @return A newly initialized dictionary with the requested capacity.
6881 **/
6882 - (instancetype)initWithCapacity:(NSUInteger)numItems;
6883
6884 /**
6885 * Fetches the object stored under the given key.
6886 *
6887 * @param key Key under which the value is stored, if present.
6888 *
6889 * @return The object if found, nil otherwise.
6890 **/
6891 - (ObjectType)objectForKey:(BOOL)key; 1761 - (ObjectType)objectForKey:(BOOL)key;
6892 1762
6893 /**
6894 * Enumerates the keys and values on this dictionary with the given block.
6895 *
6896 * @param block The block to enumerate with.
6897 * **key**: The key for the current entry.
6898 * **object**: The value for the current entry
6899 * **stop**: A pointer to a boolean that when set stops the enumeration .
6900 **/
6901 - (void)enumerateKeysAndObjectsUsingBlock: 1763 - (void)enumerateKeysAndObjectsUsingBlock:
6902 (void (^)(BOOL key, ObjectType object, BOOL *stop))block; 1764 (void (^)(BOOL key, ObjectType object, BOOL *stop))block;
6903 1765
6904 /**
6905 * Adds the keys and values from another dictionary.
6906 *
6907 * @param otherDictionary Dictionary containing entries to be added to this
6908 * dictionary.
6909 **/
6910 - (void)addEntriesFromDictionary:(GPBBoolObjectDictionary *)otherDictionary; 1766 - (void)addEntriesFromDictionary:(GPBBoolObjectDictionary *)otherDictionary;
6911 1767
6912 /**
6913 * Sets the value for the given key.
6914 *
6915 * @param object The value to set.
6916 * @param key The key under which to store the value.
6917 **/
6918 - (void)setObject:(ObjectType)object forKey:(BOOL)key; 1768 - (void)setObject:(ObjectType)object forKey:(BOOL)key;
6919 1769
6920 /**
6921 * Removes the entry for the given key.
6922 *
6923 * @param aKey Key to be removed from this dictionary.
6924 **/
6925 - (void)removeObjectForKey:(BOOL)aKey; 1770 - (void)removeObjectForKey:(BOOL)aKey;
6926
6927 /**
6928 * Removes all entries in this dictionary.
6929 **/
6930 - (void)removeAll; 1771 - (void)removeAll;
6931 1772
6932 @end 1773 @end
6933 1774
6934 #pragma mark - String -> UInt32 1775 #pragma mark - String -> UInt32
6935 1776
6936 /**
6937 * Class used for map fields of <NSString, uint32_t>
6938 * values. This performs better than boxing into NSNumbers in NSDictionaries.
6939 *
6940 * @note This class is not meant to be subclassed.
6941 **/
6942 @interface GPBStringUInt32Dictionary : NSObject <NSCopying> 1777 @interface GPBStringUInt32Dictionary : NSObject <NSCopying>
6943 1778
6944 /** Number of entries stored in this dictionary. */ 1779 @property(nonatomic, readonly) NSUInteger count;
6945 @property(nonatomic, readonly) NSUInteger count; 1780
6946 1781 + (instancetype)dictionary;
6947 /** 1782 + (instancetype)dictionaryWithValue:(uint32_t)value
6948 * @return A newly instanced and empty dictionary. 1783 forKey:(NSString *)key;
6949 **/ 1784 + (instancetype)dictionaryWithValues:(const uint32_t [])values
6950 + (instancetype)dictionary; 1785 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []) keys
6951 1786 count:(NSUInteger)count;
6952 /**
6953 * Creates and initializes a dictionary with the single entry given.
6954 *
6955 * @param value The value to be placed in the dictionary.
6956 * @param key The key under which to store the value.
6957 *
6958 * @return A newly instanced dictionary with the key and value in it.
6959 **/
6960 + (instancetype)dictionaryWithUInt32:(uint32_t)value
6961 forKey:(NSString *)key;
6962
6963 /**
6964 * Creates and initializes a dictionary with the entries given.
6965 *
6966 * @param values The values to be placed in the dictionary.
6967 * @param keys The keys under which to store the values.
6968 * @param count The number of entries to store in the dictionary.
6969 *
6970 * @return A newly instanced dictionary with the keys and values in it.
6971 **/
6972 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
6973 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [] )keys
6974 count:(NSUInteger)count;
6975
6976 /**
6977 * Creates and initializes a dictionary with the entries from the given.
6978 * dictionary.
6979 *
6980 * @param dictionary Dictionary containing the entries to add to the dictionary.
6981 *
6982 * @return A newly instanced dictionary with the entries from the given
6983 * dictionary in it.
6984 **/
6985 + (instancetype)dictionaryWithDictionary:(GPBStringUInt32Dictionary *)dictionary ; 1787 + (instancetype)dictionaryWithDictionary:(GPBStringUInt32Dictionary *)dictionary ;
6986 1788 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
6987 /** 1789
6988 * Creates and initializes a dictionary with the given capacity. 1790 - (instancetype)initWithValues:(const uint32_t [])values
6989 * 1791 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
6990 * @param numItems Capacity needed for the dictionary. 1792 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
6991 *
6992 * @return A newly instanced dictionary with the given capacity.
6993 **/
6994 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
6995
6996 /**
6997 * Initializes this dictionary, copying the given values and keys.
6998 *
6999 * @param values The values to be placed in this dictionary.
7000 * @param keys The keys under which to store the values.
7001 * @param count The number of elements to copy into the dictionary.
7002 *
7003 * @return A newly initialized dictionary with a copy of the values and keys.
7004 **/
7005 - (instancetype)initWithUInt32s:(const uint32_t [])values
7006 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7007 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7008
7009 /**
7010 * Initializes this dictionary, copying the entries from the given dictionary.
7011 *
7012 * @param dictionary Dictionary containing the entries to add to this dictionary .
7013 *
7014 * @return A newly initialized dictionary with the entries of the given dictiona ry.
7015 **/
7016 - (instancetype)initWithDictionary:(GPBStringUInt32Dictionary *)dictionary; 1793 - (instancetype)initWithDictionary:(GPBStringUInt32Dictionary *)dictionary;
7017 1794 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7018 /** 1795
7019 * Initializes this dictionary with the requested capacity. 1796 - (BOOL)valueForKey:(NSString *)key value:(nullable uint32_t *)value;
7020 * 1797
7021 * @param numItems Number of items needed for this dictionary. 1798 - (void)enumerateKeysAndValuesUsingBlock:
7022 *
7023 * @return A newly initialized dictionary with the requested capacity.
7024 **/
7025 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7026
7027 /**
7028 * Gets the value for the given key.
7029 *
7030 * @param value Pointer into which the value will be set, if found.
7031 * @param key Key under which the value is stored, if present.
7032 *
7033 * @return YES if the key was found and the value was copied, NO otherwise.
7034 **/
7035 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(NSString *)key;
7036
7037 /**
7038 * Enumerates the keys and values on this dictionary with the given block.
7039 *
7040 * @param block The block to enumerate with.
7041 * **key**: The key for the current entry.
7042 * **value**: The value for the current entry
7043 * **stop**: A pointer to a boolean that when set stops the enumeration.
7044 **/
7045 - (void)enumerateKeysAndUInt32sUsingBlock:
7046 (void (^)(NSString *key, uint32_t value, BOOL *stop))block; 1799 (void (^)(NSString *key, uint32_t value, BOOL *stop))block;
7047 1800
7048 /**
7049 * Adds the keys and values from another dictionary.
7050 *
7051 * @param otherDictionary Dictionary containing entries to be added to this
7052 * dictionary.
7053 **/
7054 - (void)addEntriesFromDictionary:(GPBStringUInt32Dictionary *)otherDictionary; 1801 - (void)addEntriesFromDictionary:(GPBStringUInt32Dictionary *)otherDictionary;
7055 1802
7056 /** 1803 - (void)setValue:(uint32_t)value forKey:(NSString *)key;
7057 * Sets the value for the given key. 1804
7058 * 1805 - (void)removeValueForKey:(NSString *)aKey;
7059 * @param value The value to set.
7060 * @param key The key under which to store the value.
7061 **/
7062 - (void)setUInt32:(uint32_t)value forKey:(NSString *)key;
7063
7064 /**
7065 * Removes the entry for the given key.
7066 *
7067 * @param aKey Key to be removed from this dictionary.
7068 **/
7069 - (void)removeUInt32ForKey:(NSString *)aKey;
7070
7071 /**
7072 * Removes all entries in this dictionary.
7073 **/
7074 - (void)removeAll; 1806 - (void)removeAll;
7075 1807
7076 @end 1808 @end
7077 1809
7078 #pragma mark - String -> Int32 1810 #pragma mark - String -> Int32
7079 1811
7080 /**
7081 * Class used for map fields of <NSString, int32_t>
7082 * values. This performs better than boxing into NSNumbers in NSDictionaries.
7083 *
7084 * @note This class is not meant to be subclassed.
7085 **/
7086 @interface GPBStringInt32Dictionary : NSObject <NSCopying> 1812 @interface GPBStringInt32Dictionary : NSObject <NSCopying>
7087 1813
7088 /** Number of entries stored in this dictionary. */ 1814 @property(nonatomic, readonly) NSUInteger count;
7089 @property(nonatomic, readonly) NSUInteger count; 1815
7090 1816 + (instancetype)dictionary;
7091 /** 1817 + (instancetype)dictionaryWithValue:(int32_t)value
7092 * @return A newly instanced and empty dictionary. 1818 forKey:(NSString *)key;
7093 **/ 1819 + (instancetype)dictionaryWithValues:(const int32_t [])values
7094 + (instancetype)dictionary; 1820 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []) keys
7095 1821 count:(NSUInteger)count;
7096 /**
7097 * Creates and initializes a dictionary with the single entry given.
7098 *
7099 * @param value The value to be placed in the dictionary.
7100 * @param key The key under which to store the value.
7101 *
7102 * @return A newly instanced dictionary with the key and value in it.
7103 **/
7104 + (instancetype)dictionaryWithInt32:(int32_t)value
7105 forKey:(NSString *)key;
7106
7107 /**
7108 * Creates and initializes a dictionary with the entries given.
7109 *
7110 * @param values The values to be placed in the dictionary.
7111 * @param keys The keys under which to store the values.
7112 * @param count The number of entries to store in the dictionary.
7113 *
7114 * @return A newly instanced dictionary with the keys and values in it.
7115 **/
7116 + (instancetype)dictionaryWithInt32s:(const int32_t [])values
7117 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []) keys
7118 count:(NSUInteger)count;
7119
7120 /**
7121 * Creates and initializes a dictionary with the entries from the given.
7122 * dictionary.
7123 *
7124 * @param dictionary Dictionary containing the entries to add to the dictionary.
7125 *
7126 * @return A newly instanced dictionary with the entries from the given
7127 * dictionary in it.
7128 **/
7129 + (instancetype)dictionaryWithDictionary:(GPBStringInt32Dictionary *)dictionary; 1822 + (instancetype)dictionaryWithDictionary:(GPBStringInt32Dictionary *)dictionary;
7130 1823 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
7131 /** 1824
7132 * Creates and initializes a dictionary with the given capacity. 1825 - (instancetype)initWithValues:(const int32_t [])values
7133 * 1826 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7134 * @param numItems Capacity needed for the dictionary. 1827 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7135 *
7136 * @return A newly instanced dictionary with the given capacity.
7137 **/
7138 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
7139
7140 /**
7141 * Initializes this dictionary, copying the given values and keys.
7142 *
7143 * @param values The values to be placed in this dictionary.
7144 * @param keys The keys under which to store the values.
7145 * @param count The number of elements to copy into the dictionary.
7146 *
7147 * @return A newly initialized dictionary with a copy of the values and keys.
7148 **/
7149 - (instancetype)initWithInt32s:(const int32_t [])values
7150 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7151 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7152
7153 /**
7154 * Initializes this dictionary, copying the entries from the given dictionary.
7155 *
7156 * @param dictionary Dictionary containing the entries to add to this dictionary .
7157 *
7158 * @return A newly initialized dictionary with the entries of the given dictiona ry.
7159 **/
7160 - (instancetype)initWithDictionary:(GPBStringInt32Dictionary *)dictionary; 1828 - (instancetype)initWithDictionary:(GPBStringInt32Dictionary *)dictionary;
7161 1829 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7162 /** 1830
7163 * Initializes this dictionary with the requested capacity. 1831 - (BOOL)valueForKey:(NSString *)key value:(nullable int32_t *)value;
7164 * 1832
7165 * @param numItems Number of items needed for this dictionary. 1833 - (void)enumerateKeysAndValuesUsingBlock:
7166 *
7167 * @return A newly initialized dictionary with the requested capacity.
7168 **/
7169 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7170
7171 /**
7172 * Gets the value for the given key.
7173 *
7174 * @param value Pointer into which the value will be set, if found.
7175 * @param key Key under which the value is stored, if present.
7176 *
7177 * @return YES if the key was found and the value was copied, NO otherwise.
7178 **/
7179 - (BOOL)getInt32:(nullable int32_t *)value forKey:(NSString *)key;
7180
7181 /**
7182 * Enumerates the keys and values on this dictionary with the given block.
7183 *
7184 * @param block The block to enumerate with.
7185 * **key**: The key for the current entry.
7186 * **value**: The value for the current entry
7187 * **stop**: A pointer to a boolean that when set stops the enumeration.
7188 **/
7189 - (void)enumerateKeysAndInt32sUsingBlock:
7190 (void (^)(NSString *key, int32_t value, BOOL *stop))block; 1834 (void (^)(NSString *key, int32_t value, BOOL *stop))block;
7191 1835
7192 /**
7193 * Adds the keys and values from another dictionary.
7194 *
7195 * @param otherDictionary Dictionary containing entries to be added to this
7196 * dictionary.
7197 **/
7198 - (void)addEntriesFromDictionary:(GPBStringInt32Dictionary *)otherDictionary; 1836 - (void)addEntriesFromDictionary:(GPBStringInt32Dictionary *)otherDictionary;
7199 1837
7200 /** 1838 - (void)setValue:(int32_t)value forKey:(NSString *)key;
7201 * Sets the value for the given key. 1839
7202 * 1840 - (void)removeValueForKey:(NSString *)aKey;
7203 * @param value The value to set.
7204 * @param key The key under which to store the value.
7205 **/
7206 - (void)setInt32:(int32_t)value forKey:(NSString *)key;
7207
7208 /**
7209 * Removes the entry for the given key.
7210 *
7211 * @param aKey Key to be removed from this dictionary.
7212 **/
7213 - (void)removeInt32ForKey:(NSString *)aKey;
7214
7215 /**
7216 * Removes all entries in this dictionary.
7217 **/
7218 - (void)removeAll; 1841 - (void)removeAll;
7219 1842
7220 @end 1843 @end
7221 1844
7222 #pragma mark - String -> UInt64 1845 #pragma mark - String -> UInt64
7223 1846
7224 /**
7225 * Class used for map fields of <NSString, uint64_t>
7226 * values. This performs better than boxing into NSNumbers in NSDictionaries.
7227 *
7228 * @note This class is not meant to be subclassed.
7229 **/
7230 @interface GPBStringUInt64Dictionary : NSObject <NSCopying> 1847 @interface GPBStringUInt64Dictionary : NSObject <NSCopying>
7231 1848
7232 /** Number of entries stored in this dictionary. */ 1849 @property(nonatomic, readonly) NSUInteger count;
7233 @property(nonatomic, readonly) NSUInteger count; 1850
7234 1851 + (instancetype)dictionary;
7235 /** 1852 + (instancetype)dictionaryWithValue:(uint64_t)value
7236 * @return A newly instanced and empty dictionary. 1853 forKey:(NSString *)key;
7237 **/ 1854 + (instancetype)dictionaryWithValues:(const uint64_t [])values
7238 + (instancetype)dictionary; 1855 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []) keys
7239 1856 count:(NSUInteger)count;
7240 /**
7241 * Creates and initializes a dictionary with the single entry given.
7242 *
7243 * @param value The value to be placed in the dictionary.
7244 * @param key The key under which to store the value.
7245 *
7246 * @return A newly instanced dictionary with the key and value in it.
7247 **/
7248 + (instancetype)dictionaryWithUInt64:(uint64_t)value
7249 forKey:(NSString *)key;
7250
7251 /**
7252 * Creates and initializes a dictionary with the entries given.
7253 *
7254 * @param values The values to be placed in the dictionary.
7255 * @param keys The keys under which to store the values.
7256 * @param count The number of entries to store in the dictionary.
7257 *
7258 * @return A newly instanced dictionary with the keys and values in it.
7259 **/
7260 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
7261 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [] )keys
7262 count:(NSUInteger)count;
7263
7264 /**
7265 * Creates and initializes a dictionary with the entries from the given.
7266 * dictionary.
7267 *
7268 * @param dictionary Dictionary containing the entries to add to the dictionary.
7269 *
7270 * @return A newly instanced dictionary with the entries from the given
7271 * dictionary in it.
7272 **/
7273 + (instancetype)dictionaryWithDictionary:(GPBStringUInt64Dictionary *)dictionary ; 1857 + (instancetype)dictionaryWithDictionary:(GPBStringUInt64Dictionary *)dictionary ;
7274 1858 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
7275 /** 1859
7276 * Creates and initializes a dictionary with the given capacity. 1860 - (instancetype)initWithValues:(const uint64_t [])values
7277 * 1861 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7278 * @param numItems Capacity needed for the dictionary. 1862 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7279 *
7280 * @return A newly instanced dictionary with the given capacity.
7281 **/
7282 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
7283
7284 /**
7285 * Initializes this dictionary, copying the given values and keys.
7286 *
7287 * @param values The values to be placed in this dictionary.
7288 * @param keys The keys under which to store the values.
7289 * @param count The number of elements to copy into the dictionary.
7290 *
7291 * @return A newly initialized dictionary with a copy of the values and keys.
7292 **/
7293 - (instancetype)initWithUInt64s:(const uint64_t [])values
7294 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7295 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7296
7297 /**
7298 * Initializes this dictionary, copying the entries from the given dictionary.
7299 *
7300 * @param dictionary Dictionary containing the entries to add to this dictionary .
7301 *
7302 * @return A newly initialized dictionary with the entries of the given dictiona ry.
7303 **/
7304 - (instancetype)initWithDictionary:(GPBStringUInt64Dictionary *)dictionary; 1863 - (instancetype)initWithDictionary:(GPBStringUInt64Dictionary *)dictionary;
7305 1864 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7306 /** 1865
7307 * Initializes this dictionary with the requested capacity. 1866 - (BOOL)valueForKey:(NSString *)key value:(nullable uint64_t *)value;
7308 * 1867
7309 * @param numItems Number of items needed for this dictionary. 1868 - (void)enumerateKeysAndValuesUsingBlock:
7310 *
7311 * @return A newly initialized dictionary with the requested capacity.
7312 **/
7313 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7314
7315 /**
7316 * Gets the value for the given key.
7317 *
7318 * @param value Pointer into which the value will be set, if found.
7319 * @param key Key under which the value is stored, if present.
7320 *
7321 * @return YES if the key was found and the value was copied, NO otherwise.
7322 **/
7323 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(NSString *)key;
7324
7325 /**
7326 * Enumerates the keys and values on this dictionary with the given block.
7327 *
7328 * @param block The block to enumerate with.
7329 * **key**: The key for the current entry.
7330 * **value**: The value for the current entry
7331 * **stop**: A pointer to a boolean that when set stops the enumeration.
7332 **/
7333 - (void)enumerateKeysAndUInt64sUsingBlock:
7334 (void (^)(NSString *key, uint64_t value, BOOL *stop))block; 1869 (void (^)(NSString *key, uint64_t value, BOOL *stop))block;
7335 1870
7336 /**
7337 * Adds the keys and values from another dictionary.
7338 *
7339 * @param otherDictionary Dictionary containing entries to be added to this
7340 * dictionary.
7341 **/
7342 - (void)addEntriesFromDictionary:(GPBStringUInt64Dictionary *)otherDictionary; 1871 - (void)addEntriesFromDictionary:(GPBStringUInt64Dictionary *)otherDictionary;
7343 1872
7344 /** 1873 - (void)setValue:(uint64_t)value forKey:(NSString *)key;
7345 * Sets the value for the given key. 1874
7346 * 1875 - (void)removeValueForKey:(NSString *)aKey;
7347 * @param value The value to set.
7348 * @param key The key under which to store the value.
7349 **/
7350 - (void)setUInt64:(uint64_t)value forKey:(NSString *)key;
7351
7352 /**
7353 * Removes the entry for the given key.
7354 *
7355 * @param aKey Key to be removed from this dictionary.
7356 **/
7357 - (void)removeUInt64ForKey:(NSString *)aKey;
7358
7359 /**
7360 * Removes all entries in this dictionary.
7361 **/
7362 - (void)removeAll; 1876 - (void)removeAll;
7363 1877
7364 @end 1878 @end
7365 1879
7366 #pragma mark - String -> Int64 1880 #pragma mark - String -> Int64
7367 1881
7368 /**
7369 * Class used for map fields of <NSString, int64_t>
7370 * values. This performs better than boxing into NSNumbers in NSDictionaries.
7371 *
7372 * @note This class is not meant to be subclassed.
7373 **/
7374 @interface GPBStringInt64Dictionary : NSObject <NSCopying> 1882 @interface GPBStringInt64Dictionary : NSObject <NSCopying>
7375 1883
7376 /** Number of entries stored in this dictionary. */ 1884 @property(nonatomic, readonly) NSUInteger count;
7377 @property(nonatomic, readonly) NSUInteger count; 1885
7378 1886 + (instancetype)dictionary;
7379 /** 1887 + (instancetype)dictionaryWithValue:(int64_t)value
7380 * @return A newly instanced and empty dictionary. 1888 forKey:(NSString *)key;
7381 **/ 1889 + (instancetype)dictionaryWithValues:(const int64_t [])values
7382 + (instancetype)dictionary; 1890 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []) keys
7383 1891 count:(NSUInteger)count;
7384 /**
7385 * Creates and initializes a dictionary with the single entry given.
7386 *
7387 * @param value The value to be placed in the dictionary.
7388 * @param key The key under which to store the value.
7389 *
7390 * @return A newly instanced dictionary with the key and value in it.
7391 **/
7392 + (instancetype)dictionaryWithInt64:(int64_t)value
7393 forKey:(NSString *)key;
7394
7395 /**
7396 * Creates and initializes a dictionary with the entries given.
7397 *
7398 * @param values The values to be placed in the dictionary.
7399 * @param keys The keys under which to store the values.
7400 * @param count The number of entries to store in the dictionary.
7401 *
7402 * @return A newly instanced dictionary with the keys and values in it.
7403 **/
7404 + (instancetype)dictionaryWithInt64s:(const int64_t [])values
7405 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []) keys
7406 count:(NSUInteger)count;
7407
7408 /**
7409 * Creates and initializes a dictionary with the entries from the given.
7410 * dictionary.
7411 *
7412 * @param dictionary Dictionary containing the entries to add to the dictionary.
7413 *
7414 * @return A newly instanced dictionary with the entries from the given
7415 * dictionary in it.
7416 **/
7417 + (instancetype)dictionaryWithDictionary:(GPBStringInt64Dictionary *)dictionary; 1892 + (instancetype)dictionaryWithDictionary:(GPBStringInt64Dictionary *)dictionary;
7418 1893 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
7419 /** 1894
7420 * Creates and initializes a dictionary with the given capacity. 1895 - (instancetype)initWithValues:(const int64_t [])values
7421 * 1896 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7422 * @param numItems Capacity needed for the dictionary. 1897 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7423 *
7424 * @return A newly instanced dictionary with the given capacity.
7425 **/
7426 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
7427
7428 /**
7429 * Initializes this dictionary, copying the given values and keys.
7430 *
7431 * @param values The values to be placed in this dictionary.
7432 * @param keys The keys under which to store the values.
7433 * @param count The number of elements to copy into the dictionary.
7434 *
7435 * @return A newly initialized dictionary with a copy of the values and keys.
7436 **/
7437 - (instancetype)initWithInt64s:(const int64_t [])values
7438 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7439 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7440
7441 /**
7442 * Initializes this dictionary, copying the entries from the given dictionary.
7443 *
7444 * @param dictionary Dictionary containing the entries to add to this dictionary .
7445 *
7446 * @return A newly initialized dictionary with the entries of the given dictiona ry.
7447 **/
7448 - (instancetype)initWithDictionary:(GPBStringInt64Dictionary *)dictionary; 1898 - (instancetype)initWithDictionary:(GPBStringInt64Dictionary *)dictionary;
7449 1899 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7450 /** 1900
7451 * Initializes this dictionary with the requested capacity. 1901 - (BOOL)valueForKey:(NSString *)key value:(nullable int64_t *)value;
7452 * 1902
7453 * @param numItems Number of items needed for this dictionary. 1903 - (void)enumerateKeysAndValuesUsingBlock:
7454 *
7455 * @return A newly initialized dictionary with the requested capacity.
7456 **/
7457 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7458
7459 /**
7460 * Gets the value for the given key.
7461 *
7462 * @param value Pointer into which the value will be set, if found.
7463 * @param key Key under which the value is stored, if present.
7464 *
7465 * @return YES if the key was found and the value was copied, NO otherwise.
7466 **/
7467 - (BOOL)getInt64:(nullable int64_t *)value forKey:(NSString *)key;
7468
7469 /**
7470 * Enumerates the keys and values on this dictionary with the given block.
7471 *
7472 * @param block The block to enumerate with.
7473 * **key**: The key for the current entry.
7474 * **value**: The value for the current entry
7475 * **stop**: A pointer to a boolean that when set stops the enumeration.
7476 **/
7477 - (void)enumerateKeysAndInt64sUsingBlock:
7478 (void (^)(NSString *key, int64_t value, BOOL *stop))block; 1904 (void (^)(NSString *key, int64_t value, BOOL *stop))block;
7479 1905
7480 /**
7481 * Adds the keys and values from another dictionary.
7482 *
7483 * @param otherDictionary Dictionary containing entries to be added to this
7484 * dictionary.
7485 **/
7486 - (void)addEntriesFromDictionary:(GPBStringInt64Dictionary *)otherDictionary; 1906 - (void)addEntriesFromDictionary:(GPBStringInt64Dictionary *)otherDictionary;
7487 1907
7488 /** 1908 - (void)setValue:(int64_t)value forKey:(NSString *)key;
7489 * Sets the value for the given key. 1909
7490 * 1910 - (void)removeValueForKey:(NSString *)aKey;
7491 * @param value The value to set.
7492 * @param key The key under which to store the value.
7493 **/
7494 - (void)setInt64:(int64_t)value forKey:(NSString *)key;
7495
7496 /**
7497 * Removes the entry for the given key.
7498 *
7499 * @param aKey Key to be removed from this dictionary.
7500 **/
7501 - (void)removeInt64ForKey:(NSString *)aKey;
7502
7503 /**
7504 * Removes all entries in this dictionary.
7505 **/
7506 - (void)removeAll; 1911 - (void)removeAll;
7507 1912
7508 @end 1913 @end
7509 1914
7510 #pragma mark - String -> Bool 1915 #pragma mark - String -> Bool
7511 1916
7512 /**
7513 * Class used for map fields of <NSString, BOOL>
7514 * values. This performs better than boxing into NSNumbers in NSDictionaries.
7515 *
7516 * @note This class is not meant to be subclassed.
7517 **/
7518 @interface GPBStringBoolDictionary : NSObject <NSCopying> 1917 @interface GPBStringBoolDictionary : NSObject <NSCopying>
7519 1918
7520 /** Number of entries stored in this dictionary. */ 1919 @property(nonatomic, readonly) NSUInteger count;
7521 @property(nonatomic, readonly) NSUInteger count; 1920
7522 1921 + (instancetype)dictionary;
7523 /** 1922 + (instancetype)dictionaryWithValue:(BOOL)value
7524 * @return A newly instanced and empty dictionary. 1923 forKey:(NSString *)key;
7525 **/ 1924 + (instancetype)dictionaryWithValues:(const BOOL [])values
7526 + (instancetype)dictionary; 1925 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []) keys
7527 1926 count:(NSUInteger)count;
7528 /**
7529 * Creates and initializes a dictionary with the single entry given.
7530 *
7531 * @param value The value to be placed in the dictionary.
7532 * @param key The key under which to store the value.
7533 *
7534 * @return A newly instanced dictionary with the key and value in it.
7535 **/
7536 + (instancetype)dictionaryWithBool:(BOOL)value
7537 forKey:(NSString *)key;
7538
7539 /**
7540 * Creates and initializes a dictionary with the entries given.
7541 *
7542 * @param values The values to be placed in the dictionary.
7543 * @param keys The keys under which to store the values.
7544 * @param count The number of entries to store in the dictionary.
7545 *
7546 * @return A newly instanced dictionary with the keys and values in it.
7547 **/
7548 + (instancetype)dictionaryWithBools:(const BOOL [])values
7549 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])k eys
7550 count:(NSUInteger)count;
7551
7552 /**
7553 * Creates and initializes a dictionary with the entries from the given.
7554 * dictionary.
7555 *
7556 * @param dictionary Dictionary containing the entries to add to the dictionary.
7557 *
7558 * @return A newly instanced dictionary with the entries from the given
7559 * dictionary in it.
7560 **/
7561 + (instancetype)dictionaryWithDictionary:(GPBStringBoolDictionary *)dictionary; 1927 + (instancetype)dictionaryWithDictionary:(GPBStringBoolDictionary *)dictionary;
7562 1928 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
7563 /** 1929
7564 * Creates and initializes a dictionary with the given capacity. 1930 - (instancetype)initWithValues:(const BOOL [])values
7565 * 1931 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7566 * @param numItems Capacity needed for the dictionary. 1932 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7567 *
7568 * @return A newly instanced dictionary with the given capacity.
7569 **/
7570 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
7571
7572 /**
7573 * Initializes this dictionary, copying the given values and keys.
7574 *
7575 * @param values The values to be placed in this dictionary.
7576 * @param keys The keys under which to store the values.
7577 * @param count The number of elements to copy into the dictionary.
7578 *
7579 * @return A newly initialized dictionary with a copy of the values and keys.
7580 **/
7581 - (instancetype)initWithBools:(const BOOL [])values
7582 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7583 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7584
7585 /**
7586 * Initializes this dictionary, copying the entries from the given dictionary.
7587 *
7588 * @param dictionary Dictionary containing the entries to add to this dictionary .
7589 *
7590 * @return A newly initialized dictionary with the entries of the given dictiona ry.
7591 **/
7592 - (instancetype)initWithDictionary:(GPBStringBoolDictionary *)dictionary; 1933 - (instancetype)initWithDictionary:(GPBStringBoolDictionary *)dictionary;
7593 1934 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7594 /** 1935
7595 * Initializes this dictionary with the requested capacity. 1936 - (BOOL)valueForKey:(NSString *)key value:(nullable BOOL *)value;
7596 * 1937
7597 * @param numItems Number of items needed for this dictionary. 1938 - (void)enumerateKeysAndValuesUsingBlock:
7598 *
7599 * @return A newly initialized dictionary with the requested capacity.
7600 **/
7601 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7602
7603 /**
7604 * Gets the value for the given key.
7605 *
7606 * @param value Pointer into which the value will be set, if found.
7607 * @param key Key under which the value is stored, if present.
7608 *
7609 * @return YES if the key was found and the value was copied, NO otherwise.
7610 **/
7611 - (BOOL)getBool:(nullable BOOL *)value forKey:(NSString *)key;
7612
7613 /**
7614 * Enumerates the keys and values on this dictionary with the given block.
7615 *
7616 * @param block The block to enumerate with.
7617 * **key**: The key for the current entry.
7618 * **value**: The value for the current entry
7619 * **stop**: A pointer to a boolean that when set stops the enumeration.
7620 **/
7621 - (void)enumerateKeysAndBoolsUsingBlock:
7622 (void (^)(NSString *key, BOOL value, BOOL *stop))block; 1939 (void (^)(NSString *key, BOOL value, BOOL *stop))block;
7623 1940
7624 /**
7625 * Adds the keys and values from another dictionary.
7626 *
7627 * @param otherDictionary Dictionary containing entries to be added to this
7628 * dictionary.
7629 **/
7630 - (void)addEntriesFromDictionary:(GPBStringBoolDictionary *)otherDictionary; 1941 - (void)addEntriesFromDictionary:(GPBStringBoolDictionary *)otherDictionary;
7631 1942
7632 /** 1943 - (void)setValue:(BOOL)value forKey:(NSString *)key;
7633 * Sets the value for the given key. 1944
7634 * 1945 - (void)removeValueForKey:(NSString *)aKey;
7635 * @param value The value to set.
7636 * @param key The key under which to store the value.
7637 **/
7638 - (void)setBool:(BOOL)value forKey:(NSString *)key;
7639
7640 /**
7641 * Removes the entry for the given key.
7642 *
7643 * @param aKey Key to be removed from this dictionary.
7644 **/
7645 - (void)removeBoolForKey:(NSString *)aKey;
7646
7647 /**
7648 * Removes all entries in this dictionary.
7649 **/
7650 - (void)removeAll; 1946 - (void)removeAll;
7651 1947
7652 @end 1948 @end
7653 1949
7654 #pragma mark - String -> Float 1950 #pragma mark - String -> Float
7655 1951
7656 /**
7657 * Class used for map fields of <NSString, float>
7658 * values. This performs better than boxing into NSNumbers in NSDictionaries.
7659 *
7660 * @note This class is not meant to be subclassed.
7661 **/
7662 @interface GPBStringFloatDictionary : NSObject <NSCopying> 1952 @interface GPBStringFloatDictionary : NSObject <NSCopying>
7663 1953
7664 /** Number of entries stored in this dictionary. */ 1954 @property(nonatomic, readonly) NSUInteger count;
7665 @property(nonatomic, readonly) NSUInteger count; 1955
7666 1956 + (instancetype)dictionary;
7667 /** 1957 + (instancetype)dictionaryWithValue:(float)value
7668 * @return A newly instanced and empty dictionary. 1958 forKey:(NSString *)key;
7669 **/ 1959 + (instancetype)dictionaryWithValues:(const float [])values
7670 + (instancetype)dictionary; 1960 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []) keys
7671 1961 count:(NSUInteger)count;
7672 /**
7673 * Creates and initializes a dictionary with the single entry given.
7674 *
7675 * @param value The value to be placed in the dictionary.
7676 * @param key The key under which to store the value.
7677 *
7678 * @return A newly instanced dictionary with the key and value in it.
7679 **/
7680 + (instancetype)dictionaryWithFloat:(float)value
7681 forKey:(NSString *)key;
7682
7683 /**
7684 * Creates and initializes a dictionary with the entries given.
7685 *
7686 * @param values The values to be placed in the dictionary.
7687 * @param keys The keys under which to store the values.
7688 * @param count The number of entries to store in the dictionary.
7689 *
7690 * @return A newly instanced dictionary with the keys and values in it.
7691 **/
7692 + (instancetype)dictionaryWithFloats:(const float [])values
7693 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []) keys
7694 count:(NSUInteger)count;
7695
7696 /**
7697 * Creates and initializes a dictionary with the entries from the given.
7698 * dictionary.
7699 *
7700 * @param dictionary Dictionary containing the entries to add to the dictionary.
7701 *
7702 * @return A newly instanced dictionary with the entries from the given
7703 * dictionary in it.
7704 **/
7705 + (instancetype)dictionaryWithDictionary:(GPBStringFloatDictionary *)dictionary; 1962 + (instancetype)dictionaryWithDictionary:(GPBStringFloatDictionary *)dictionary;
7706 1963 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
7707 /** 1964
7708 * Creates and initializes a dictionary with the given capacity. 1965 - (instancetype)initWithValues:(const float [])values
7709 * 1966 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7710 * @param numItems Capacity needed for the dictionary. 1967 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7711 *
7712 * @return A newly instanced dictionary with the given capacity.
7713 **/
7714 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
7715
7716 /**
7717 * Initializes this dictionary, copying the given values and keys.
7718 *
7719 * @param values The values to be placed in this dictionary.
7720 * @param keys The keys under which to store the values.
7721 * @param count The number of elements to copy into the dictionary.
7722 *
7723 * @return A newly initialized dictionary with a copy of the values and keys.
7724 **/
7725 - (instancetype)initWithFloats:(const float [])values
7726 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7727 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7728
7729 /**
7730 * Initializes this dictionary, copying the entries from the given dictionary.
7731 *
7732 * @param dictionary Dictionary containing the entries to add to this dictionary .
7733 *
7734 * @return A newly initialized dictionary with the entries of the given dictiona ry.
7735 **/
7736 - (instancetype)initWithDictionary:(GPBStringFloatDictionary *)dictionary; 1968 - (instancetype)initWithDictionary:(GPBStringFloatDictionary *)dictionary;
7737 1969 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7738 /** 1970
7739 * Initializes this dictionary with the requested capacity. 1971 - (BOOL)valueForKey:(NSString *)key value:(nullable float *)value;
7740 * 1972
7741 * @param numItems Number of items needed for this dictionary. 1973 - (void)enumerateKeysAndValuesUsingBlock:
7742 *
7743 * @return A newly initialized dictionary with the requested capacity.
7744 **/
7745 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7746
7747 /**
7748 * Gets the value for the given key.
7749 *
7750 * @param value Pointer into which the value will be set, if found.
7751 * @param key Key under which the value is stored, if present.
7752 *
7753 * @return YES if the key was found and the value was copied, NO otherwise.
7754 **/
7755 - (BOOL)getFloat:(nullable float *)value forKey:(NSString *)key;
7756
7757 /**
7758 * Enumerates the keys and values on this dictionary with the given block.
7759 *
7760 * @param block The block to enumerate with.
7761 * **key**: The key for the current entry.
7762 * **value**: The value for the current entry
7763 * **stop**: A pointer to a boolean that when set stops the enumeration.
7764 **/
7765 - (void)enumerateKeysAndFloatsUsingBlock:
7766 (void (^)(NSString *key, float value, BOOL *stop))block; 1974 (void (^)(NSString *key, float value, BOOL *stop))block;
7767 1975
7768 /**
7769 * Adds the keys and values from another dictionary.
7770 *
7771 * @param otherDictionary Dictionary containing entries to be added to this
7772 * dictionary.
7773 **/
7774 - (void)addEntriesFromDictionary:(GPBStringFloatDictionary *)otherDictionary; 1976 - (void)addEntriesFromDictionary:(GPBStringFloatDictionary *)otherDictionary;
7775 1977
7776 /** 1978 - (void)setValue:(float)value forKey:(NSString *)key;
7777 * Sets the value for the given key. 1979
7778 * 1980 - (void)removeValueForKey:(NSString *)aKey;
7779 * @param value The value to set.
7780 * @param key The key under which to store the value.
7781 **/
7782 - (void)setFloat:(float)value forKey:(NSString *)key;
7783
7784 /**
7785 * Removes the entry for the given key.
7786 *
7787 * @param aKey Key to be removed from this dictionary.
7788 **/
7789 - (void)removeFloatForKey:(NSString *)aKey;
7790
7791 /**
7792 * Removes all entries in this dictionary.
7793 **/
7794 - (void)removeAll; 1981 - (void)removeAll;
7795 1982
7796 @end 1983 @end
7797 1984
7798 #pragma mark - String -> Double 1985 #pragma mark - String -> Double
7799 1986
7800 /**
7801 * Class used for map fields of <NSString, double>
7802 * values. This performs better than boxing into NSNumbers in NSDictionaries.
7803 *
7804 * @note This class is not meant to be subclassed.
7805 **/
7806 @interface GPBStringDoubleDictionary : NSObject <NSCopying> 1987 @interface GPBStringDoubleDictionary : NSObject <NSCopying>
7807 1988
7808 /** Number of entries stored in this dictionary. */ 1989 @property(nonatomic, readonly) NSUInteger count;
7809 @property(nonatomic, readonly) NSUInteger count; 1990
7810 1991 + (instancetype)dictionary;
7811 /** 1992 + (instancetype)dictionaryWithValue:(double)value
7812 * @return A newly instanced and empty dictionary. 1993 forKey:(NSString *)key;
7813 **/ 1994 + (instancetype)dictionaryWithValues:(const double [])values
7814 + (instancetype)dictionary; 1995 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED []) keys
7815 1996 count:(NSUInteger)count;
7816 /**
7817 * Creates and initializes a dictionary with the single entry given.
7818 *
7819 * @param value The value to be placed in the dictionary.
7820 * @param key The key under which to store the value.
7821 *
7822 * @return A newly instanced dictionary with the key and value in it.
7823 **/
7824 + (instancetype)dictionaryWithDouble:(double)value
7825 forKey:(NSString *)key;
7826
7827 /**
7828 * Creates and initializes a dictionary with the entries given.
7829 *
7830 * @param values The values to be placed in the dictionary.
7831 * @param keys The keys under which to store the values.
7832 * @param count The number of entries to store in the dictionary.
7833 *
7834 * @return A newly instanced dictionary with the keys and values in it.
7835 **/
7836 + (instancetype)dictionaryWithDoubles:(const double [])values
7837 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [] )keys
7838 count:(NSUInteger)count;
7839
7840 /**
7841 * Creates and initializes a dictionary with the entries from the given.
7842 * dictionary.
7843 *
7844 * @param dictionary Dictionary containing the entries to add to the dictionary.
7845 *
7846 * @return A newly instanced dictionary with the entries from the given
7847 * dictionary in it.
7848 **/
7849 + (instancetype)dictionaryWithDictionary:(GPBStringDoubleDictionary *)dictionary ; 1997 + (instancetype)dictionaryWithDictionary:(GPBStringDoubleDictionary *)dictionary ;
7850 1998 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
7851 /** 1999
7852 * Creates and initializes a dictionary with the given capacity. 2000 - (instancetype)initWithValues:(const double [])values
7853 * 2001 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7854 * @param numItems Capacity needed for the dictionary. 2002 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7855 *
7856 * @return A newly instanced dictionary with the given capacity.
7857 **/
7858 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
7859
7860 /**
7861 * Initializes this dictionary, copying the given values and keys.
7862 *
7863 * @param values The values to be placed in this dictionary.
7864 * @param keys The keys under which to store the values.
7865 * @param count The number of elements to copy into the dictionary.
7866 *
7867 * @return A newly initialized dictionary with a copy of the values and keys.
7868 **/
7869 - (instancetype)initWithDoubles:(const double [])values
7870 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
7871 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
7872
7873 /**
7874 * Initializes this dictionary, copying the entries from the given dictionary.
7875 *
7876 * @param dictionary Dictionary containing the entries to add to this dictionary .
7877 *
7878 * @return A newly initialized dictionary with the entries of the given dictiona ry.
7879 **/
7880 - (instancetype)initWithDictionary:(GPBStringDoubleDictionary *)dictionary; 2003 - (instancetype)initWithDictionary:(GPBStringDoubleDictionary *)dictionary;
7881 2004 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7882 /** 2005
7883 * Initializes this dictionary with the requested capacity. 2006 - (BOOL)valueForKey:(NSString *)key value:(nullable double *)value;
7884 * 2007
7885 * @param numItems Number of items needed for this dictionary. 2008 - (void)enumerateKeysAndValuesUsingBlock:
7886 *
7887 * @return A newly initialized dictionary with the requested capacity.
7888 **/
7889 - (instancetype)initWithCapacity:(NSUInteger)numItems;
7890
7891 /**
7892 * Gets the value for the given key.
7893 *
7894 * @param value Pointer into which the value will be set, if found.
7895 * @param key Key under which the value is stored, if present.
7896 *
7897 * @return YES if the key was found and the value was copied, NO otherwise.
7898 **/
7899 - (BOOL)getDouble:(nullable double *)value forKey:(NSString *)key;
7900
7901 /**
7902 * Enumerates the keys and values on this dictionary with the given block.
7903 *
7904 * @param block The block to enumerate with.
7905 * **key**: The key for the current entry.
7906 * **value**: The value for the current entry
7907 * **stop**: A pointer to a boolean that when set stops the enumeration.
7908 **/
7909 - (void)enumerateKeysAndDoublesUsingBlock:
7910 (void (^)(NSString *key, double value, BOOL *stop))block; 2009 (void (^)(NSString *key, double value, BOOL *stop))block;
7911 2010
7912 /**
7913 * Adds the keys and values from another dictionary.
7914 *
7915 * @param otherDictionary Dictionary containing entries to be added to this
7916 * dictionary.
7917 **/
7918 - (void)addEntriesFromDictionary:(GPBStringDoubleDictionary *)otherDictionary; 2011 - (void)addEntriesFromDictionary:(GPBStringDoubleDictionary *)otherDictionary;
7919 2012
7920 /** 2013 - (void)setValue:(double)value forKey:(NSString *)key;
7921 * Sets the value for the given key. 2014
7922 * 2015 - (void)removeValueForKey:(NSString *)aKey;
7923 * @param value The value to set.
7924 * @param key The key under which to store the value.
7925 **/
7926 - (void)setDouble:(double)value forKey:(NSString *)key;
7927
7928 /**
7929 * Removes the entry for the given key.
7930 *
7931 * @param aKey Key to be removed from this dictionary.
7932 **/
7933 - (void)removeDoubleForKey:(NSString *)aKey;
7934
7935 /**
7936 * Removes all entries in this dictionary.
7937 **/
7938 - (void)removeAll; 2016 - (void)removeAll;
7939 2017
7940 @end 2018 @end
7941 2019
7942 #pragma mark - String -> Enum 2020 #pragma mark - String -> Enum
7943 2021
7944 /**
7945 * Class used for map fields of <NSString, int32_t>
7946 * values. This performs better than boxing into NSNumbers in NSDictionaries.
7947 *
7948 * @note This class is not meant to be subclassed.
7949 **/
7950 @interface GPBStringEnumDictionary : NSObject <NSCopying> 2022 @interface GPBStringEnumDictionary : NSObject <NSCopying>
7951 2023
7952 /** Number of entries stored in this dictionary. */ 2024 @property(nonatomic, readonly) NSUInteger count;
7953 @property(nonatomic, readonly) NSUInteger count;
7954 /** The validation function to check if the enums are valid. */
7955 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 2025 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
7956 2026
7957 /** 2027 + (instancetype)dictionary;
7958 * @return A newly instanced and empty dictionary.
7959 **/
7960 + (instancetype)dictionary;
7961
7962 /**
7963 * Creates and initializes a dictionary with the given validation function.
7964 *
7965 * @param func The enum validation function for the dictionary.
7966 *
7967 * @return A newly instanced dictionary.
7968 **/
7969 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func; 2028 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func;
7970
7971 /**
7972 * Creates and initializes a dictionary with the single entry given.
7973 *
7974 * @param func The enum validation function for the dictionary.
7975 * @param rawValue The raw enum value to be placed in the dictionary.
7976 * @param key The key under which to store the value.
7977 *
7978 * @return A newly instanced dictionary with the key and value in it.
7979 **/
7980 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 2029 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
7981 rawValue:(int32_t)rawValue 2030 rawValue:(int32_t)rawValue
7982 forKey:(NSString *)key; 2031 forKey:(NSString *)key;
7983
7984 /**
7985 * Creates and initializes a dictionary with the entries given.
7986 *
7987 * @param func The enum validation function for the dictionary.
7988 * @param values The raw enum values values to be placed in the dictionary.
7989 * @param keys The keys under which to store the values.
7990 * @param count The number of entries to store in the dictionary.
7991 *
7992 * @return A newly instanced dictionary with the keys and values in it.
7993 **/
7994 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 2032 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
7995 rawValues:(const int32_t [])values 2033 rawValues:(const int32_t [])values
7996 forKeys:(const NSString * GPB_UNSAFE_UN RETAINED [])keys 2034 forKeys:(const NSString * GPB_UNSAFE_UN RETAINED [])keys
7997 count:(NSUInteger)count; 2035 count:(NSUInteger)count;
7998
7999 /**
8000 * Creates and initializes a dictionary with the entries from the given.
8001 * dictionary.
8002 *
8003 * @param dictionary Dictionary containing the entries to add to the dictionary.
8004 *
8005 * @return A newly instanced dictionary with the entries from the given
8006 * dictionary in it.
8007 **/
8008 + (instancetype)dictionaryWithDictionary:(GPBStringEnumDictionary *)dictionary; 2036 + (instancetype)dictionaryWithDictionary:(GPBStringEnumDictionary *)dictionary;
8009
8010 /**
8011 * Creates and initializes a dictionary with the given capacity.
8012 *
8013 * @param func The enum validation function for the dictionary.
8014 * @param numItems Capacity needed for the dictionary.
8015 *
8016 * @return A newly instanced dictionary with the given capacity.
8017 **/
8018 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func 2037 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc )func
8019 capacity:(NSUInteger)numItems; 2038 capacity:(NSUInteger)numItems;
8020 2039
8021 /**
8022 * Initializes a dictionary with the given validation function.
8023 *
8024 * @param func The enum validation function for the dictionary.
8025 *
8026 * @return A newly initialized dictionary.
8027 **/
8028 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 2040 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
8029
8030 /**
8031 * Initializes a dictionary with the entries given.
8032 *
8033 * @param func The enum validation function for the dictionary.
8034 * @param values The raw enum values values to be placed in the dictionary.
8035 * @param keys The keys under which to store the values.
8036 * @param count The number of entries to store in the dictionary.
8037 *
8038 * @return A newly initialized dictionary with the keys and values in it.
8039 **/
8040 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 2041 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
8041 rawValues:(const int32_t [])values 2042 rawValues:(const int32_t [])values
8042 forKeys:(const NSString * GPB_UNSAFE_UNRETAIN ED [])keys 2043 forKeys:(const NSString * GPB_UNSAFE_UNRETAIN ED [])keys
8043 count:(NSUInteger)count NS_DESIGNATED_INITI ALIZER; 2044 count:(NSUInteger)count NS_DESIGNATED_INITI ALIZER;
8044
8045 /**
8046 * Initializes a dictionary with the entries from the given.
8047 * dictionary.
8048 *
8049 * @param dictionary Dictionary containing the entries to add to the dictionary.
8050 *
8051 * @return A newly initialized dictionary with the entries from the given
8052 * dictionary in it.
8053 **/
8054 - (instancetype)initWithDictionary:(GPBStringEnumDictionary *)dictionary; 2045 - (instancetype)initWithDictionary:(GPBStringEnumDictionary *)dictionary;
8055
8056 /**
8057 * Initializes a dictionary with the given capacity.
8058 *
8059 * @param func The enum validation function for the dictionary.
8060 * @param numItems Capacity needed for the dictionary.
8061 *
8062 * @return A newly initialized dictionary with the given capacity.
8063 **/
8064 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 2046 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
8065 capacity:(NSUInteger)numItems; 2047 capacity:(NSUInteger)numItems;
8066 2048
8067 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 2049 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
8068 // is not a valid enumerator as defined by validationFunc. If the actual value i s 2050 // is not a valid enumerator as defined by validationFunc. If the actual value i s
8069 // desired, use "raw" version of the method. 2051 // desired, use "raw" version of the method.
8070 2052
8071 /** 2053 - (BOOL)valueForKey:(NSString *)key value:(nullable int32_t *)value;
8072 * Gets the value for the given key.
8073 *
8074 * @param value Pointer into which the value will be set, if found.
8075 * @param key Key under which the value is stored, if present.
8076 *
8077 * @return YES if the key was found and the value was copied, NO otherwise.
8078 **/
8079 - (BOOL)getEnum:(nullable int32_t *)value forKey:(NSString *)key;
8080 2054
8081 /** 2055 - (void)enumerateKeysAndValuesUsingBlock:
8082 * Enumerates the keys and values on this dictionary with the given block.
8083 *
8084 * @param block The block to enumerate with.
8085 * **key**: The key for the current entry.
8086 * **value**: The value for the current entry
8087 * **stop**: A pointer to a boolean that when set stops the enumeration.
8088 **/
8089 - (void)enumerateKeysAndEnumsUsingBlock:
8090 (void (^)(NSString *key, int32_t value, BOOL *stop))block; 2056 (void (^)(NSString *key, int32_t value, BOOL *stop))block;
8091 2057
8092 /** 2058 // These methods bypass the validationFunc to provide access to values that were not
8093 * Gets the raw enum value for the given key. 2059 // known at the time the binary was compiled.
8094 *
8095 * @note This method bypass the validationFunc to enable the access of values th at
8096 * were not known at the time the binary was compiled.
8097 *
8098 * @param rawValue Pointer into which the value will be set, if found.
8099 * @param key Key under which the value is stored, if present.
8100 *
8101 * @return YES if the key was found and the value was copied, NO otherwise.
8102 **/
8103 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(NSString *)key;
8104 2060
8105 /** 2061 - (BOOL)valueForKey:(NSString *)key rawValue:(nullable int32_t *)rawValue;
8106 * Enumerates the keys and values on this dictionary with the given block. 2062
8107 *
8108 * @note This method bypass the validationFunc to enable the access of values th at
8109 * were not known at the time the binary was compiled.
8110 *
8111 * @param block The block to enumerate with.
8112 * **key**: The key for the current entry.
8113 * **rawValue**: The value for the current entry
8114 * **stop**: A pointer to a boolean that when set stops the enumeration.
8115 **/
8116 - (void)enumerateKeysAndRawValuesUsingBlock: 2063 - (void)enumerateKeysAndRawValuesUsingBlock:
8117 (void (^)(NSString *key, int32_t rawValue, BOOL *stop))block; 2064 (void (^)(NSString *key, int32_t rawValue, BOOL *stop))block;
8118 2065
8119 /**
8120 * Adds the keys and raw enum values from another dictionary.
8121 *
8122 * @note This method bypass the validationFunc to enable the setting of values t hat
8123 * were not known at the time the binary was compiled.
8124 *
8125 * @param otherDictionary Dictionary containing entries to be added to this
8126 * dictionary.
8127 **/
8128 - (void)addRawEntriesFromDictionary:(GPBStringEnumDictionary *)otherDictionary; 2066 - (void)addRawEntriesFromDictionary:(GPBStringEnumDictionary *)otherDictionary;
8129 2067
8130 // If value is not a valid enumerator as defined by validationFunc, these 2068 // If value is not a valid enumerator as defined by validationFunc, these
8131 // methods will assert in debug, and will log in release and assign the value 2069 // methods will assert in debug, and will log in release and assign the value
8132 // to the default value. Use the rawValue methods below to assign non enumerator 2070 // to the default value. Use the rawValue methods below to assign non enumerator
8133 // values. 2071 // values.
8134 2072
8135 /** 2073 - (void)setValue:(int32_t)value forKey:(NSString *)key;
8136 * Sets the value for the given key.
8137 *
8138 * @param value The value to set.
8139 * @param key The key under which to store the value.
8140 **/
8141 - (void)setEnum:(int32_t)value forKey:(NSString *)key;
8142 2074
8143 /** 2075 // This method bypass the validationFunc to provide setting of values that were not
8144 * Sets the raw enum value for the given key. 2076 // known at the time the binary was compiled.
8145 *
8146 * @note This method bypass the validationFunc to enable the setting of values t hat
8147 * were not known at the time the binary was compiled.
8148 *
8149 * @param rawValue The raw enum value to set.
8150 * @param key The key under which to store the raw enum value.
8151 **/
8152 - (void)setRawValue:(int32_t)rawValue forKey:(NSString *)key; 2077 - (void)setRawValue:(int32_t)rawValue forKey:(NSString *)key;
8153 2078
8154 /** 2079 // No validation applies to these methods.
8155 * Removes the entry for the given key.
8156 *
8157 * @param aKey Key to be removed from this dictionary.
8158 **/
8159 - (void)removeEnumForKey:(NSString *)aKey;
8160 2080
8161 /** 2081 - (void)removeValueForKey:(NSString *)aKey;
8162 * Removes all entries in this dictionary.
8163 **/
8164 - (void)removeAll; 2082 - (void)removeAll;
8165 2083
8166 @end 2084 @end
8167 2085
8168 //%PDDM-EXPAND-END DECLARE_DICTIONARIES() 2086 //%PDDM-EXPAND-END DECLARE_DICTIONARIES()
8169 2087
8170 NS_ASSUME_NONNULL_END 2088 NS_ASSUME_NONNULL_END
8171 2089
8172 //%PDDM-DEFINE DECLARE_DICTIONARIES() 2090 //%PDDM-DEFINE DECLARE_DICTIONARIES()
8173 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt32, uint32_t) 2091 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt32, uint32_t)
8174 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int32, int32_t) 2092 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int32, int32_t)
8175 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt64, uint64_t) 2093 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt64, uint64_t)
8176 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int64, int64_t) 2094 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int64, int64_t)
8177 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Bool, BOOL) 2095 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Bool, BOOL)
8178 //%DICTIONARY_POD_INTERFACES_FOR_KEY(String, NSString, *, OBJECT) 2096 //%DICTIONARY_POD_INTERFACES_FOR_KEY(String, NSString, *, OBJECT)
8179 //%PDDM-DEFINE DICTIONARY_INTERFACES_FOR_POD_KEY(KEY_NAME, KEY_TYPE) 2097 //%PDDM-DEFINE DICTIONARY_INTERFACES_FOR_POD_KEY(KEY_NAME, KEY_TYPE)
8180 //%DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, , POD) 2098 //%DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, , POD)
8181 //%DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, Object, ObjectType ) 2099 //%DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, Object, ObjectType )
8182 //%PDDM-DEFINE DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, KisP, KHELP ER) 2100 //%PDDM-DEFINE DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, KisP, KHELP ER)
8183 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt32, ui nt32_t) 2101 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt32, ui nt32_t)
8184 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int32, int 32_t) 2102 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int32, int 32_t)
8185 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt64, ui nt64_t) 2103 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt64, ui nt64_t)
8186 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int64, int 64_t) 2104 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int64, int 64_t)
8187 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Bool, BOOL ) 2105 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Bool, BOOL )
8188 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Float, flo at) 2106 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Float, flo at)
8189 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Double, do uble) 2107 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Double, do uble)
8190 //%DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Enum, int 32_t) 2108 //%DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Enum, int 32_t)
8191 //%PDDM-DEFINE DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER , VALUE_NAME, VALUE_TYPE) 2109 //%PDDM-DEFINE DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER , VALUE_NAME, VALUE_TYPE)
8192 //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VA LUE_TYPE, POD, VALUE_NAME, value) 2110 //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VA LUE_TYPE, POD, value)
8193 //%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, VALUE_ NAME, VALUE_TYPE) 2111 //%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, VALUE_ NAME, VALUE_TYPE)
8194 //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE , OBJECT, Object, object) 2112 //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE , OBJECT, object)
8195 //%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME) 2113 //%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE)
8196 //%/** 2114 //%- (BOOL)valueForKey:(KEY_TYPE)key value:(nullable VALUE_TYPE *)value;
8197 //% * Gets the value for the given key. 2115 //%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_TYPE)
8198 //% *
8199 //% * @param value Pointer into which the value will be set, if found.
8200 //% * @param key Key under which the value is stored, if present.
8201 //% *
8202 //% * @return YES if the key was found and the value was copied, NO otherwise.
8203 //% **/
8204 //%- (BOOL)get##VNAME##:(nullable VALUE_TYPE *)value forKey:(KEY_TYPE)key;
8205 //%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_TYPE, VNAME)
8206 //%/**
8207 //% * Fetches the object stored under the given key.
8208 //% *
8209 //% * @param key Key under which the value is stored, if present.
8210 //% *
8211 //% * @return The object if found, nil otherwise.
8212 //% **/
8213 //%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key; 2116 //%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key;
8214 //%PDDM-DEFINE VALUE_FOR_KEY_Enum(KEY_TYPE, VALUE_TYPE, VNAME) 2117 //%PDDM-DEFINE VALUE_FOR_KEY_Enum(KEY_TYPE, VALUE_TYPE)
8215 //%VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME) 2118 //%VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE)
8216 //%PDDM-DEFINE ARRAY_ARG_MODIFIERPOD() 2119 //%PDDM-DEFINE ARRAY_ARG_MODIFIERPOD()
8217 // Nothing 2120 // Nothing
8218 //%PDDM-DEFINE ARRAY_ARG_MODIFIEREnum() 2121 //%PDDM-DEFINE ARRAY_ARG_MODIFIEREnum()
8219 // Nothing 2122 // Nothing
8220 //%PDDM-DEFINE ARRAY_ARG_MODIFIEROBJECT() 2123 //%PDDM-DEFINE ARRAY_ARG_MODIFIEROBJECT()
8221 //%GPB_UNSAFE_UNRETAINED ## 2124 //%GPB_UNSAFE_UNRETAINED ##
8222 //%PDDM-DEFINE DICTIONARY_CLASS_DECLPOD(KEY_NAME, VALUE_NAME, VALUE_TYPE) 2125 //%PDDM-DEFINE DICTIONARY_CLASS_DECLPOD(KEY_NAME, VALUE_NAME, VALUE_TYPE)
8223 //%GPB##KEY_NAME##VALUE_NAME##Dictionary 2126 //%GPB##KEY_NAME##VALUE_NAME##Dictionary
8224 //%PDDM-DEFINE DICTIONARY_CLASS_DECLEnum(KEY_NAME, VALUE_NAME, VALUE_TYPE) 2127 //%PDDM-DEFINE DICTIONARY_CLASS_DECLEnum(KEY_NAME, VALUE_NAME, VALUE_TYPE)
8225 //%GPB##KEY_NAME##VALUE_NAME##Dictionary 2128 //%GPB##KEY_NAME##VALUE_NAME##Dictionary
8226 //%PDDM-DEFINE DICTIONARY_CLASS_DECLOBJECT(KEY_NAME, VALUE_NAME, VALUE_TYPE) 2129 //%PDDM-DEFINE DICTIONARY_CLASS_DECLOBJECT(KEY_NAME, VALUE_NAME, VALUE_TYPE)
8227 //%GPB##KEY_NAME##VALUE_NAME##Dictionary<__covariant VALUE_TYPE> 2130 //%GPB##KEY_NAME##VALUE_NAME##Dictionary<__covariant VALUE_TYPE>
8228 //%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VA LUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 2131 //%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VA LUE_NAME, VALUE_TYPE, VHELPER, VNAME)
8229 //%#pragma mark - KEY_NAME -> VALUE_NAME 2132 //%#pragma mark - KEY_NAME -> VALUE_NAME
8230 //% 2133 //%
8231 //%/**
8232 //% * Class used for map fields of <##KEY_TYPE##, ##VALUE_TYPE##>
8233 //% * values. This performs better than boxing into NSNumbers in NSDictionaries.
8234 //% *
8235 //% * @note This class is not meant to be subclassed.
8236 //% **/
8237 //%@interface DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) : NSObject <NSCopying> 2134 //%@interface DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) : NSObject <NSCopying>
8238 //% 2135 //%
8239 //%/** Number of entries stored in this dictionary. */
8240 //%@property(nonatomic, readonly) NSUInteger count; 2136 //%@property(nonatomic, readonly) NSUInteger count;
8241 //% 2137 //%
8242 //%/**
8243 //% * @return A newly instanced and empty dictionary.
8244 //% **/
8245 //%+ (instancetype)dictionary; 2138 //%+ (instancetype)dictionary;
8246 //% 2139 //%+ (instancetype)dictionaryWith##VNAME$u##:(VALUE_TYPE)##VNAME
8247 //%/**
8248 //% * Creates and initializes a dictionary with the single entry given.
8249 //% *
8250 //% * @param ##VNAME_VAR The value to be placed in the dictionary.
8251 //% * @param key ##VNAME_VAR$S## The key under which to store the value.
8252 //% *
8253 //% * @return A newly instanced dictionary with the key and value in it.
8254 //% **/
8255 //%+ (instancetype)dictionaryWith##VNAME##:(VALUE_TYPE)##VNAME_VAR
8256 //% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key; 2140 //% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key;
8257 //% 2141 //%+ (instancetype)dictionaryWith##VNAME$u##s:(const VALUE_TYPE ARRAY_ARG_MODIFI ER##VHELPER()[])##VNAME##s
8258 //%/**
8259 //% * Creates and initializes a dictionary with the entries given.
8260 //% *
8261 //% * @param ##VNAME_VAR##s The values to be placed in the dictionary.
8262 //% * @param keys ##VNAME_VAR$S## The keys under which to store the values.
8263 //% * @param count ##VNAME_VAR$S## The number of entries to store in the diction ary.
8264 //% *
8265 //% * @return A newly instanced dictionary with the keys and values in it.
8266 //% **/
8267 //%+ (instancetype)dictionaryWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER ##VHELPER()[])##VNAME_VAR##s
8268 //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRA Y_ARG_MODIFIER##KHELPER()[])keys 2142 //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRA Y_ARG_MODIFIER##KHELPER()[])keys
8269 //% ##VNAME$S## count:(NSUInteger)count; 2143 //% ##VNAME$S## count:(NSUInteger)count;
8270 //%
8271 //%/**
8272 //% * Creates and initializes a dictionary with the entries from the given.
8273 //% * dictionary.
8274 //% *
8275 //% * @param dictionary Dictionary containing the entries to add to the dictiona ry.
8276 //% *
8277 //% * @return A newly instanced dictionary with the entries from the given
8278 //% * dictionary in it.
8279 //% **/
8280 //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictiona ry *)dictionary; 2144 //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictiona ry *)dictionary;
8281 //%
8282 //%/**
8283 //% * Creates and initializes a dictionary with the given capacity.
8284 //% *
8285 //% * @param numItems Capacity needed for the dictionary.
8286 //% *
8287 //% * @return A newly instanced dictionary with the given capacity.
8288 //% **/
8289 //%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 2145 //%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
8290 //% 2146 //%
8291 //%/** 2147 //%- (instancetype)initWith##VNAME$u##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VH ELPER()[])##VNAME##s
8292 //% * Initializes this dictionary, copying the given values and keys.
8293 //% *
8294 //% * @param ##VNAME_VAR##s The values to be placed in this dictionary.
8295 //% * @param keys ##VNAME_VAR$S## The keys under which to store the values.
8296 //% * @param count ##VNAME_VAR$S## The number of elements to copy into the dicti onary.
8297 //% *
8298 //% * @return A newly initialized dictionary with a copy of the values and keys.
8299 //% **/
8300 //%- (instancetype)initWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHEL PER()[])##VNAME_VAR##s
8301 //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_ MODIFIER##KHELPER()[])keys 2148 //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_ MODIFIER##KHELPER()[])keys
8302 //% ##VNAME$S## count:(NSUInteger)count NS_DESIGNATED_INITIALI ZER; 2149 //% ##VNAME$S## count:(NSUInteger)count NS_DESIGNATED_INITIALI ZER;
8303 //%
8304 //%/**
8305 //% * Initializes this dictionary, copying the entries from the given dictionary .
8306 //% *
8307 //% * @param dictionary Dictionary containing the entries to add to this diction ary.
8308 //% *
8309 //% * @return A newly initialized dictionary with the entries of the given dicti onary.
8310 //% **/
8311 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)d ictionary; 2150 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)d ictionary;
8312 //%
8313 //%/**
8314 //% * Initializes this dictionary with the requested capacity.
8315 //% *
8316 //% * @param numItems Number of items needed for this dictionary.
8317 //% *
8318 //% * @return A newly initialized dictionary with the requested capacity.
8319 //% **/
8320 //%- (instancetype)initWithCapacity:(NSUInteger)numItems; 2151 //%- (instancetype)initWithCapacity:(NSUInteger)numItems;
8321 //% 2152 //%
8322 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TY PE, VHELPER, VNAME, VNAME_VAR) 2153 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TY PE, VHELPER, VNAME)
8323 //% 2154 //%
8324 //%/**
8325 //% * Adds the keys and values from another dictionary.
8326 //% *
8327 //% * @param otherDictionary Dictionary containing entries to be added to this
8328 //% * dictionary.
8329 //% **/
8330 //%- (void)addEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)oth erDictionary; 2155 //%- (void)addEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)oth erDictionary;
8331 //% 2156 //%
8332 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE , VHELPER, VNAME, VNAME_VAR) 2157 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE , VHELPER, VNAME)
8333 //% 2158 //%
8334 //%@end 2159 //%@end
8335 //% 2160 //%
8336 2161
8337 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPE R, VALUE_NAME, VALUE_TYPE) 2162 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPE R, VALUE_NAME, VALUE_TYPE)
8338 //%DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NA ME, VALUE_TYPE, Enum) 2163 //%DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NA ME, VALUE_TYPE, Enum)
8339 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELP ER, VALUE_NAME, VALUE_TYPE, VHELPER) 2164 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELP ER, VALUE_NAME, VALUE_TYPE, VHELPER)
8340 //%#pragma mark - KEY_NAME -> VALUE_NAME 2165 //%#pragma mark - KEY_NAME -> VALUE_NAME
8341 //% 2166 //%
8342 //%/**
8343 //% * Class used for map fields of <##KEY_TYPE##, ##VALUE_TYPE##>
8344 //% * values. This performs better than boxing into NSNumbers in NSDictionaries.
8345 //% *
8346 //% * @note This class is not meant to be subclassed.
8347 //% **/
8348 //%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary : NSObject <NSCopying> 2167 //%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary : NSObject <NSCopying>
8349 //% 2168 //%
8350 //%/** Number of entries stored in this dictionary. */
8351 //%@property(nonatomic, readonly) NSUInteger count; 2169 //%@property(nonatomic, readonly) NSUInteger count;
8352 //%/** The validation function to check if the enums are valid. */
8353 //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 2170 //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
8354 //% 2171 //%
8355 //%/**
8356 //% * @return A newly instanced and empty dictionary.
8357 //% **/
8358 //%+ (instancetype)dictionary; 2172 //%+ (instancetype)dictionary;
8359 //%
8360 //%/**
8361 //% * Creates and initializes a dictionary with the given validation function.
8362 //% *
8363 //% * @param func The enum validation function for the dictionary.
8364 //% *
8365 //% * @return A newly instanced dictionary.
8366 //% **/
8367 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF unc)func; 2173 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF unc)func;
8368 //%
8369 //%/**
8370 //% * Creates and initializes a dictionary with the single entry given.
8371 //% *
8372 //% * @param func The enum validation function for the dictionary.
8373 //% * @param rawValue The raw enum value to be placed in the dictionary.
8374 //% * @param key The key under which to store the value.
8375 //% *
8376 //% * @return A newly instanced dictionary with the key and value in it.
8377 //% **/
8378 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF unc)func 2174 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF unc)func
8379 //% rawValue:(VALUE_TYPE)rawValue 2175 //% rawValue:(VALUE_TYPE)rawValue
8380 //% forKey:(KEY_TYPE##KisP$S##KisP)key; 2176 //% forKey:(KEY_TYPE##KisP$S##KisP)key;
8381 //%
8382 //%/**
8383 //% * Creates and initializes a dictionary with the entries given.
8384 //% *
8385 //% * @param func The enum validation function for the dictionary.
8386 //% * @param values The raw enum values values to be placed in the dictionary.
8387 //% * @param keys The keys under which to store the values.
8388 //% * @param count The number of entries to store in the dictionary.
8389 //% *
8390 //% * @return A newly instanced dictionary with the keys and values in it.
8391 //% **/
8392 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF unc)func 2177 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF unc)func
8393 //% rawValues:(const VALUE_TYPE ARRAY_ARG_ MODIFIER##VHELPER()[])values 2178 //% rawValues:(const VALUE_TYPE ARRAY_ARG_ MODIFIER##VHELPER()[])values
8394 //% forKeys:(const KEY_TYPE##KisP$S##Kis P ARRAY_ARG_MODIFIER##KHELPER()[])keys 2179 //% forKeys:(const KEY_TYPE##KisP$S##Kis P ARRAY_ARG_MODIFIER##KHELPER()[])keys
8395 //% count:(NSUInteger)count; 2180 //% count:(NSUInteger)count;
8396 //%
8397 //%/**
8398 //% * Creates and initializes a dictionary with the entries from the given.
8399 //% * dictionary.
8400 //% *
8401 //% * @param dictionary Dictionary containing the entries to add to the dictiona ry.
8402 //% *
8403 //% * @return A newly instanced dictionary with the entries from the given
8404 //% * dictionary in it.
8405 //% **/
8406 //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictiona ry *)dictionary; 2181 //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictiona ry *)dictionary;
8407 //%
8408 //%/**
8409 //% * Creates and initializes a dictionary with the given capacity.
8410 //% *
8411 //% * @param func The enum validation function for the dictionary.
8412 //% * @param numItems Capacity needed for the dictionary.
8413 //% *
8414 //% * @return A newly instanced dictionary with the given capacity.
8415 //% **/
8416 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF unc)func 2182 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationF unc)func
8417 //% capacity:(NSUInteger)numItems; 2183 //% capacity:(NSUInteger)numItems;
8418 //% 2184 //%
8419 //%/**
8420 //% * Initializes a dictionary with the given validation function.
8421 //% *
8422 //% * @param func The enum validation function for the dictionary.
8423 //% *
8424 //% * @return A newly initialized dictionary.
8425 //% **/
8426 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)fu nc; 2185 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)fu nc;
8427 //%
8428 //%/**
8429 //% * Initializes a dictionary with the entries given.
8430 //% *
8431 //% * @param func The enum validation function for the dictionary.
8432 //% * @param values The raw enum values values to be placed in the dictionary.
8433 //% * @param keys The keys under which to store the values.
8434 //% * @param count The number of entries to store in the dictionary.
8435 //% *
8436 //% * @return A newly initialized dictionary with the keys and values in it.
8437 //% **/
8438 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)fu nc 2186 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)fu nc
8439 //% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFI ER##VHELPER()[])values 2187 //% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFI ER##VHELPER()[])values
8440 //% forKeys:(const KEY_TYPE##KisP$S##KisP ARRA Y_ARG_MODIFIER##KHELPER()[])keys 2188 //% forKeys:(const KEY_TYPE##KisP$S##KisP ARRA Y_ARG_MODIFIER##KHELPER()[])keys
8441 //% count:(NSUInteger)count NS_DESIGNATED_IN ITIALIZER; 2189 //% count:(NSUInteger)count NS_DESIGNATED_IN ITIALIZER;
8442 //%
8443 //%/**
8444 //% * Initializes a dictionary with the entries from the given.
8445 //% * dictionary.
8446 //% *
8447 //% * @param dictionary Dictionary containing the entries to add to the dictiona ry.
8448 //% *
8449 //% * @return A newly initialized dictionary with the entries from the given
8450 //% * dictionary in it.
8451 //% **/
8452 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)d ictionary; 2190 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)d ictionary;
8453 //%
8454 //%/**
8455 //% * Initializes a dictionary with the given capacity.
8456 //% *
8457 //% * @param func The enum validation function for the dictionary.
8458 //% * @param numItems Capacity needed for the dictionary.
8459 //% *
8460 //% * @return A newly initialized dictionary with the given capacity.
8461 //% **/
8462 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)fu nc 2191 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)fu nc
8463 //% capacity:(NSUInteger)numItems; 2192 //% capacity:(NSUInteger)numItems;
8464 //% 2193 //%
8465 //%// These will return kGPBUnrecognizedEnumeratorValue if the value for the key 2194 //%// These will return kGPBUnrecognizedEnumeratorValue if the value for the key
8466 //%// is not a valid enumerator as defined by validationFunc. If the actual valu e is 2195 //%// is not a valid enumerator as defined by validationFunc. If the actual valu e is
8467 //%// desired, use "raw" version of the method. 2196 //%// desired, use "raw" version of the method.
8468 //% 2197 //%
8469 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TY PE, VHELPER, Enum, value) 2198 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TY PE, VHELPER, value)
8470 //% 2199 //%
8471 //%/** 2200 //%// These methods bypass the validationFunc to provide access to values that w ere not
8472 //% * Gets the raw enum value for the given key. 2201 //%// known at the time the binary was compiled.
8473 //% *
8474 //% * @note This method bypass the validationFunc to enable the access of values that
8475 //% * were not known at the time the binary was compiled.
8476 //% *
8477 //% * @param rawValue Pointer into which the value will be set, if found.
8478 //% * @param key Key under which the value is stored, if present.
8479 //% *
8480 //% * @return YES if the key was found and the value was copied, NO otherwise.
8481 //% **/
8482 //%- (BOOL)getRawValue:(nullable VALUE_TYPE *)rawValue forKey:(KEY_TYPE##KisP$S# #KisP)key;
8483 //% 2202 //%
8484 //%/** 2203 //%- (BOOL)valueForKey:(KEY_TYPE##KisP$S##KisP)key rawValue:(nullable VALUE_TYPE *)rawValue;
8485 //% * Enumerates the keys and values on this dictionary with the given block. 2204 //%
8486 //% *
8487 //% * @note This method bypass the validationFunc to enable the access of values that
8488 //% * were not known at the time the binary was compiled.
8489 //% *
8490 //% * @param block The block to enumerate with.
8491 //% * **key**: The key for the current entry.
8492 //% * **rawValue**: The value for the current entry
8493 //% * **stop**: A pointer to a boolean that when set stops the enumeration .
8494 //% **/
8495 //%- (void)enumerateKeysAndRawValuesUsingBlock: 2205 //%- (void)enumerateKeysAndRawValuesUsingBlock:
8496 //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE rawValue, BOOL *stop))block; 2206 //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE rawValue, BOOL *stop))block;
8497 //% 2207 //%
8498 //%/**
8499 //% * Adds the keys and raw enum values from another dictionary.
8500 //% *
8501 //% * @note This method bypass the validationFunc to enable the setting of value s that
8502 //% * were not known at the time the binary was compiled.
8503 //% *
8504 //% * @param otherDictionary Dictionary containing entries to be added to this
8505 //% * dictionary.
8506 //% **/
8507 //%- (void)addRawEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *) otherDictionary; 2208 //%- (void)addRawEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *) otherDictionary;
8508 //% 2209 //%
8509 //%// If value is not a valid enumerator as defined by validationFunc, these 2210 //%// If value is not a valid enumerator as defined by validationFunc, these
8510 //%// methods will assert in debug, and will log in release and assign the value 2211 //%// methods will assert in debug, and will log in release and assign the value
8511 //%// to the default value. Use the rawValue methods below to assign non enumera tor 2212 //%// to the default value. Use the rawValue methods below to assign non enumera tor
8512 //%// values. 2213 //%// values.
8513 //% 2214 //%
8514 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE , VHELPER, Enum, value) 2215 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE , VHELPER, value)
8515 //% 2216 //%
8516 //%@end 2217 //%@end
8517 //% 2218 //%
8518 2219
8519 //%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NA ME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 2220 //%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NA ME, VALUE_TYPE, VHELPER, VNAME)
8520 //%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_TYPE, VNAME) 2221 //%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_TYPE)
8521 //% 2222 //%
8522 //%/** 2223 //%- (void)enumerateKeysAnd##VNAME$u##sUsingBlock:
8523 //% * Enumerates the keys and values on this dictionary with the given block. 2224 //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME, BOOL *stop))block;
8524 //% *
8525 //% * @param block The block to enumerate with.
8526 //% * **key**: ##VNAME_VAR$S## The key for the current entry.
8527 //% * **VNAME_VAR**: The value for the current entry
8528 //% * **stop**: ##VNAME_VAR$S## A pointer to a boolean that when set stops the enumeration.
8529 //% **/
8530 //%- (void)enumerateKeysAnd##VNAME##sUsingBlock:
8531 //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME_VAR, BOOL *stop))block;
8532 2225
8533 //%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME , VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 2226 //%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME , VALUE_TYPE, VHELPER, VNAME)
8534 //%/** 2227 //%- (void)set##VNAME$u##:(VALUE_TYPE)##VNAME forKey:(KEY_TYPE##KisP$S##KisP)key ;
8535 //% * Sets the value for the given key.
8536 //% *
8537 //% * @param ##VNAME_VAR The value to set.
8538 //% * @param key ##VNAME_VAR$S## The key under which to store the value.
8539 //% **/
8540 //%- (void)set##VNAME##:(VALUE_TYPE)##VNAME_VAR forKey:(KEY_TYPE##KisP$S##KisP)k ey;
8541 //%DICTIONARY_EXTRA_MUTABLE_METHODS_##VHELPER(KEY_NAME, KEY_TYPE, KisP, VALUE_NA ME, VALUE_TYPE) 2228 //%DICTIONARY_EXTRA_MUTABLE_METHODS_##VHELPER(KEY_NAME, KEY_TYPE, KisP, VALUE_NA ME, VALUE_TYPE)
8542 //%/** 2229 //%- (void)remove##VNAME$u##ForKey:(KEY_TYPE##KisP$S##KisP)aKey;
8543 //% * Removes the entry for the given key.
8544 //% *
8545 //% * @param aKey Key to be removed from this dictionary.
8546 //% **/
8547 //%- (void)remove##VNAME##ForKey:(KEY_TYPE##KisP$S##KisP)aKey;
8548 //%
8549 //%/**
8550 //% * Removes all entries in this dictionary.
8551 //% **/
8552 //%- (void)removeAll; 2230 //%- (void)removeAll;
8553 2231
8554 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_POD(KEY_NAME, KEY_TYPE, KisP, VA LUE_NAME, VALUE_TYPE) 2232 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_POD(KEY_NAME, KEY_TYPE, KisP, VA LUE_NAME, VALUE_TYPE)
8555 // Empty 2233 // Empty
8556 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_OBJECT(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE) 2234 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_OBJECT(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
8557 // Empty 2235 // Empty
8558 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_Enum(KEY_NAME, KEY_TYPE, KisP, V ALUE_NAME, VALUE_TYPE) 2236 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_Enum(KEY_NAME, KEY_TYPE, KisP, V ALUE_NAME, VALUE_TYPE)
8559 //% 2237 //%
8560 //%/** 2238 //%// This method bypass the validationFunc to provide setting of values that we re not
8561 //% * Sets the raw enum value for the given key. 2239 //%// known at the time the binary was compiled.
8562 //% *
8563 //% * @note This method bypass the validationFunc to enable the setting of value s that
8564 //% * were not known at the time the binary was compiled.
8565 //% *
8566 //% * @param rawValue The raw enum value to set.
8567 //% * @param key The key under which to store the raw enum value.
8568 //% **/
8569 //%- (void)setRawValue:(VALUE_TYPE)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key; 2240 //%- (void)setRawValue:(VALUE_TYPE)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key;
8570 //% 2241 //%
2242 //%// No validation applies to these methods.
2243 //%
OLDNEW
« no previous file with comments | « third_party/protobuf/objectivec/GPBDescriptor_PackagePrivate.h ('k') | third_party/protobuf/objectivec/GPBDictionary.m » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698