1 // Protocol Buffers - Google's data interchange format 2 // Copyright 2008 Google Inc. All rights reserved. 3 // https://developers.google.com/protocol-buffers/ 4 // 5 // Redistribution and use in source and binary forms, with or without 6 // modification, are permitted provided that the following conditions are 7 // met: 8 // 9 // * Redistributions of source code must retain the above copyright 10 // notice, this list of conditions and the following disclaimer. 11 // * Redistributions in binary form must reproduce the above 12 // copyright notice, this list of conditions and the following disclaimer 13 // in the documentation and/or other materials provided with the 14 // distribution. 15 // * Neither the name of Google Inc. nor the names of its 16 // contributors may be used to endorse or promote products derived from 17 // this software without specific prior written permission. 18 // 19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 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. 30 31 #import <Foundation/Foundation.h> 32 33 #import "GPBRuntimeTypes.h" 34 35 // These classes are used for map fields of basic data types. They are used because 36 // they perform better than boxing into NSNumbers in NSDictionaries. 37 38 // Note: These are not meant to be subclassed. 39 40 // Note on naming: for the classes holding numeric values, a more natural 41 // naming of the method might be things like "-valueForKey:", 42 // "-setValue:forKey:"; etc. But those selectors are also defined by Key Value 43 // Coding (KVC) as categories on NSObject. So "overloading" the selectors with 44 // other meanings can cause warnings (based on compiler settings), but more 45 // importantly, some of those selector get called as KVC breaks up keypaths. 46 // So if those selectors are used, using KVC will compile cleanly, but could 47 // crash as it invokes those selectors with the wrong types of arguments. 48 49 NS_ASSUME_NONNULL_BEGIN 50 51 //%PDDM-EXPAND DECLARE_DICTIONARIES() 52 // This block of code is generated, do not edit it directly. 53 54 #pragma mark - UInt32 -> UInt32 55 56 @interface GPBUInt32UInt32Dictionary : NSObject <NSCopying> 57 58 @property(nonatomic, readonly) NSUInteger count; 59 60 + (instancetype)dictionary; 61 + (instancetype)dictionaryWithUInt32:(uint32_t)value 62 forKey:(uint32_t)key; 63 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values 64 forKeys:(const uint32_t [])keys 65 count:(NSUInteger)count; 66 + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary; 67 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 68 69 - (instancetype)initWithUInt32s:(const uint32_t [])values 70 forKeys:(const uint32_t [])keys 71 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 72 - (instancetype)initWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary; 73 - (instancetype)initWithCapacity:(NSUInteger)numItems; 74 75 // Returns YES/NO to indicate if the key was found or not, filling in the value 76 // only when the key was found. 77 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint32_t)key; 78 79 - (void)enumerateKeysAndUInt32sUsingBlock: 80 (void (^)(uint32_t key, uint32_t value, BOOL *stop))block; 81 82 - (void)addEntriesFromDictionary:(GPBUInt32UInt32Dictionary *)otherDictionary; 83 84 - (void)setUInt32:(uint32_t)value forKey:(uint32_t)key; 85 86 - (void)removeUInt32ForKey:(uint32_t)aKey; 87 - (void)removeAll; 88 89 @end 90 91 #pragma mark - UInt32 -> Int32 92 93 @interface GPBUInt32Int32Dictionary : NSObject <NSCopying> 94 95 @property(nonatomic, readonly) NSUInteger count; 96 97 + (instancetype)dictionary; 98 + (instancetype)dictionaryWithInt32:(int32_t)value 99 forKey:(uint32_t)key; 100 + (instancetype)dictionaryWithInt32s:(const int32_t [])values 101 forKeys:(const uint32_t [])keys 102 count:(NSUInteger)count; 103 + (instancetype)dictionaryWithDictionary:(GPBUInt32Int32Dictionary *)dictionary; 104 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 105 106 - (instancetype)initWithInt32s:(const int32_t [])values 107 forKeys:(const uint32_t [])keys 108 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 109 - (instancetype)initWithDictionary:(GPBUInt32Int32Dictionary *)dictionary; 110 - (instancetype)initWithCapacity:(NSUInteger)numItems; 111 112 // Returns YES/NO to indicate if the key was found or not, filling in the value 113 // only when the key was found. 114 - (BOOL)getInt32:(nullable int32_t *)value forKey:(uint32_t)key; 115 116 - (void)enumerateKeysAndInt32sUsingBlock: 117 (void (^)(uint32_t key, int32_t value, BOOL *stop))block; 118 119 - (void)addEntriesFromDictionary:(GPBUInt32Int32Dictionary *)otherDictionary; 120 121 - (void)setInt32:(int32_t)value forKey:(uint32_t)key; 122 123 - (void)removeInt32ForKey:(uint32_t)aKey; 124 - (void)removeAll; 125 126 @end 127 128 #pragma mark - UInt32 -> UInt64 129 130 @interface GPBUInt32UInt64Dictionary : NSObject <NSCopying> 131 132 @property(nonatomic, readonly) NSUInteger count; 133 134 + (instancetype)dictionary; 135 + (instancetype)dictionaryWithUInt64:(uint64_t)value 136 forKey:(uint32_t)key; 137 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values 138 forKeys:(const uint32_t [])keys 139 count:(NSUInteger)count; 140 + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary; 141 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 142 143 - (instancetype)initWithUInt64s:(const uint64_t [])values 144 forKeys:(const uint32_t [])keys 145 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 146 - (instancetype)initWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary; 147 - (instancetype)initWithCapacity:(NSUInteger)numItems; 148 149 // Returns YES/NO to indicate if the key was found or not, filling in the value 150 // only when the key was found. 151 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint32_t)key; 152 153 - (void)enumerateKeysAndUInt64sUsingBlock: 154 (void (^)(uint32_t key, uint64_t value, BOOL *stop))block; 155 156 - (void)addEntriesFromDictionary:(GPBUInt32UInt64Dictionary *)otherDictionary; 157 158 - (void)setUInt64:(uint64_t)value forKey:(uint32_t)key; 159 160 - (void)removeUInt64ForKey:(uint32_t)aKey; 161 - (void)removeAll; 162 163 @end 164 165 #pragma mark - UInt32 -> Int64 166 167 @interface GPBUInt32Int64Dictionary : NSObject <NSCopying> 168 169 @property(nonatomic, readonly) NSUInteger count; 170 171 + (instancetype)dictionary; 172 + (instancetype)dictionaryWithInt64:(int64_t)value 173 forKey:(uint32_t)key; 174 + (instancetype)dictionaryWithInt64s:(const int64_t [])values 175 forKeys:(const uint32_t [])keys 176 count:(NSUInteger)count; 177 + (instancetype)dictionaryWithDictionary:(GPBUInt32Int64Dictionary *)dictionary; 178 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 179 180 - (instancetype)initWithInt64s:(const int64_t [])values 181 forKeys:(const uint32_t [])keys 182 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 183 - (instancetype)initWithDictionary:(GPBUInt32Int64Dictionary *)dictionary; 184 - (instancetype)initWithCapacity:(NSUInteger)numItems; 185 186 // Returns YES/NO to indicate if the key was found or not, filling in the value 187 // only when the key was found. 188 - (BOOL)getInt64:(nullable int64_t *)value forKey:(uint32_t)key; 189 190 - (void)enumerateKeysAndInt64sUsingBlock: 191 (void (^)(uint32_t key, int64_t value, BOOL *stop))block; 192 193 - (void)addEntriesFromDictionary:(GPBUInt32Int64Dictionary *)otherDictionary; 194 195 - (void)setInt64:(int64_t)value forKey:(uint32_t)key; 196 197 - (void)removeInt64ForKey:(uint32_t)aKey; 198 - (void)removeAll; 199 200 @end 201 202 #pragma mark - UInt32 -> Bool 203 204 @interface GPBUInt32BoolDictionary : NSObject <NSCopying> 205 206 @property(nonatomic, readonly) NSUInteger count; 207 208 + (instancetype)dictionary; 209 + (instancetype)dictionaryWithBool:(BOOL)value 210 forKey:(uint32_t)key; 211 + (instancetype)dictionaryWithBools:(const BOOL [])values 212 forKeys:(const uint32_t [])keys 213 count:(NSUInteger)count; 214 + (instancetype)dictionaryWithDictionary:(GPBUInt32BoolDictionary *)dictionary; 215 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 216 217 - (instancetype)initWithBools:(const BOOL [])values 218 forKeys:(const uint32_t [])keys 219 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 220 - (instancetype)initWithDictionary:(GPBUInt32BoolDictionary *)dictionary; 221 - (instancetype)initWithCapacity:(NSUInteger)numItems; 222 223 // Returns YES/NO to indicate if the key was found or not, filling in the value 224 // only when the key was found. 225 - (BOOL)getBool:(nullable BOOL *)value forKey:(uint32_t)key; 226 227 - (void)enumerateKeysAndBoolsUsingBlock: 228 (void (^)(uint32_t key, BOOL value, BOOL *stop))block; 229 230 - (void)addEntriesFromDictionary:(GPBUInt32BoolDictionary *)otherDictionary; 231 232 - (void)setBool:(BOOL)value forKey:(uint32_t)key; 233 234 - (void)removeBoolForKey:(uint32_t)aKey; 235 - (void)removeAll; 236 237 @end 238 239 #pragma mark - UInt32 -> Float 240 241 @interface GPBUInt32FloatDictionary : NSObject <NSCopying> 242 243 @property(nonatomic, readonly) NSUInteger count; 244 245 + (instancetype)dictionary; 246 + (instancetype)dictionaryWithFloat:(float)value 247 forKey:(uint32_t)key; 248 + (instancetype)dictionaryWithFloats:(const float [])values 249 forKeys:(const uint32_t [])keys 250 count:(NSUInteger)count; 251 + (instancetype)dictionaryWithDictionary:(GPBUInt32FloatDictionary *)dictionary; 252 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 253 254 - (instancetype)initWithFloats:(const float [])values 255 forKeys:(const uint32_t [])keys 256 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 257 - (instancetype)initWithDictionary:(GPBUInt32FloatDictionary *)dictionary; 258 - (instancetype)initWithCapacity:(NSUInteger)numItems; 259 260 // Returns YES/NO to indicate if the key was found or not, filling in the value 261 // only when the key was found. 262 - (BOOL)getFloat:(nullable float *)value forKey:(uint32_t)key; 263 264 - (void)enumerateKeysAndFloatsUsingBlock: 265 (void (^)(uint32_t key, float value, BOOL *stop))block; 266 267 - (void)addEntriesFromDictionary:(GPBUInt32FloatDictionary *)otherDictionary; 268 269 - (void)setFloat:(float)value forKey:(uint32_t)key; 270 271 - (void)removeFloatForKey:(uint32_t)aKey; 272 - (void)removeAll; 273 274 @end 275 276 #pragma mark - UInt32 -> Double 277 278 @interface GPBUInt32DoubleDictionary : NSObject <NSCopying> 279 280 @property(nonatomic, readonly) NSUInteger count; 281 282 + (instancetype)dictionary; 283 + (instancetype)dictionaryWithDouble:(double)value 284 forKey:(uint32_t)key; 285 + (instancetype)dictionaryWithDoubles:(const double [])values 286 forKeys:(const uint32_t [])keys 287 count:(NSUInteger)count; 288 + (instancetype)dictionaryWithDictionary:(GPBUInt32DoubleDictionary *)dictionary; 289 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 290 291 - (instancetype)initWithDoubles:(const double [])values 292 forKeys:(const uint32_t [])keys 293 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 294 - (instancetype)initWithDictionary:(GPBUInt32DoubleDictionary *)dictionary; 295 - (instancetype)initWithCapacity:(NSUInteger)numItems; 296 297 // Returns YES/NO to indicate if the key was found or not, filling in the value 298 // only when the key was found. 299 - (BOOL)getDouble:(nullable double *)value forKey:(uint32_t)key; 300 301 - (void)enumerateKeysAndDoublesUsingBlock: 302 (void (^)(uint32_t key, double value, BOOL *stop))block; 303 304 - (void)addEntriesFromDictionary:(GPBUInt32DoubleDictionary *)otherDictionary; 305 306 - (void)setDouble:(double)value forKey:(uint32_t)key; 307 308 - (void)removeDoubleForKey:(uint32_t)aKey; 309 - (void)removeAll; 310 311 @end 312 313 #pragma mark - UInt32 -> Enum 314 315 @interface GPBUInt32EnumDictionary : NSObject <NSCopying> 316 317 @property(nonatomic, readonly) NSUInteger count; 318 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 319 320 + (instancetype)dictionary; 321 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func; 322 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 323 rawValue:(int32_t)rawValue 324 forKey:(uint32_t)key; 325 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 326 rawValues:(const int32_t [])values 327 forKeys:(const uint32_t [])keys 328 count:(NSUInteger)count; 329 + (instancetype)dictionaryWithDictionary:(GPBUInt32EnumDictionary *)dictionary; 330 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 331 capacity:(NSUInteger)numItems; 332 333 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 334 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 335 rawValues:(const int32_t [])values 336 forKeys:(const uint32_t [])keys 337 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 338 - (instancetype)initWithDictionary:(GPBUInt32EnumDictionary *)dictionary; 339 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 340 capacity:(NSUInteger)numItems; 341 342 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 343 // is not a valid enumerator as defined by validationFunc. If the actual value is 344 // desired, use "raw" version of the method. 345 346 // Returns YES/NO to indicate if the key was found or not, filling in the value 347 // only when the key was found. 348 - (BOOL)getEnum:(nullable int32_t *)value forKey:(uint32_t)key; 349 350 - (void)enumerateKeysAndEnumsUsingBlock: 351 (void (^)(uint32_t key, int32_t value, BOOL *stop))block; 352 353 // These methods bypass the validationFunc to provide access to values that were not 354 // known at the time the binary was compiled. 355 356 // Returns YES/NO to indicate if the key was found or not, filling in the value 357 // only when the key was found. 358 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint32_t)key; 359 360 - (void)enumerateKeysAndRawValuesUsingBlock: 361 (void (^)(uint32_t key, int32_t rawValue, BOOL *stop))block; 362 363 - (void)addRawEntriesFromDictionary:(GPBUInt32EnumDictionary *)otherDictionary; 364 365 // If value is not a valid enumerator as defined by validationFunc, these 366 // methods will assert in debug, and will log in release and assign the value 367 // to the default value. Use the rawValue methods below to assign non enumerator 368 // values. 369 370 - (void)setEnum:(int32_t)value forKey:(uint32_t)key; 371 372 // This method bypass the validationFunc to provide setting of values that were not 373 // known at the time the binary was compiled. 374 - (void)setRawValue:(int32_t)rawValue forKey:(uint32_t)key; 375 376 // No validation applies to these methods. 377 378 - (void)removeEnumForKey:(uint32_t)aKey; 379 - (void)removeAll; 380 381 @end 382 383 #pragma mark - UInt32 -> Object 384 385 @interface GPBUInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying> 386 387 @property(nonatomic, readonly) NSUInteger count; 388 389 + (instancetype)dictionary; 390 + (instancetype)dictionaryWithObject:(ObjectType)object 391 forKey:(uint32_t)key; 392 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects 393 forKeys:(const uint32_t [])keys 394 count:(NSUInteger)count; 395 + (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary; 396 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 397 398 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects 399 forKeys:(const uint32_t [])keys 400 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 401 - (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary; 402 - (instancetype)initWithCapacity:(NSUInteger)numItems; 403 404 - (ObjectType)objectForKey:(uint32_t)key; 405 406 - (void)enumerateKeysAndObjectsUsingBlock: 407 (void (^)(uint32_t key, ObjectType object, BOOL *stop))block; 408 409 - (void)addEntriesFromDictionary:(GPBUInt32ObjectDictionary *)otherDictionary; 410 411 - (void)setObject:(ObjectType)object forKey:(uint32_t)key; 412 413 - (void)removeObjectForKey:(uint32_t)aKey; 414 - (void)removeAll; 415 416 @end 417 418 #pragma mark - Int32 -> UInt32 419 420 @interface GPBInt32UInt32Dictionary : NSObject <NSCopying> 421 422 @property(nonatomic, readonly) NSUInteger count; 423 424 + (instancetype)dictionary; 425 + (instancetype)dictionaryWithUInt32:(uint32_t)value 426 forKey:(int32_t)key; 427 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values 428 forKeys:(const int32_t [])keys 429 count:(NSUInteger)count; 430 + (instancetype)dictionaryWithDictionary:(GPBInt32UInt32Dictionary *)dictionary; 431 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 432 433 - (instancetype)initWithUInt32s:(const uint32_t [])values 434 forKeys:(const int32_t [])keys 435 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 436 - (instancetype)initWithDictionary:(GPBInt32UInt32Dictionary *)dictionary; 437 - (instancetype)initWithCapacity:(NSUInteger)numItems; 438 439 // Returns YES/NO to indicate if the key was found or not, filling in the value 440 // only when the key was found. 441 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int32_t)key; 442 443 - (void)enumerateKeysAndUInt32sUsingBlock: 444 (void (^)(int32_t key, uint32_t value, BOOL *stop))block; 445 446 - (void)addEntriesFromDictionary:(GPBInt32UInt32Dictionary *)otherDictionary; 447 448 - (void)setUInt32:(uint32_t)value forKey:(int32_t)key; 449 450 - (void)removeUInt32ForKey:(int32_t)aKey; 451 - (void)removeAll; 452 453 @end 454 455 #pragma mark - Int32 -> Int32 456 457 @interface GPBInt32Int32Dictionary : NSObject <NSCopying> 458 459 @property(nonatomic, readonly) NSUInteger count; 460 461 + (instancetype)dictionary; 462 + (instancetype)dictionaryWithInt32:(int32_t)value 463 forKey:(int32_t)key; 464 + (instancetype)dictionaryWithInt32s:(const int32_t [])values 465 forKeys:(const int32_t [])keys 466 count:(NSUInteger)count; 467 + (instancetype)dictionaryWithDictionary:(GPBInt32Int32Dictionary *)dictionary; 468 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 469 470 - (instancetype)initWithInt32s:(const int32_t [])values 471 forKeys:(const int32_t [])keys 472 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 473 - (instancetype)initWithDictionary:(GPBInt32Int32Dictionary *)dictionary; 474 - (instancetype)initWithCapacity:(NSUInteger)numItems; 475 476 // Returns YES/NO to indicate if the key was found or not, filling in the value 477 // only when the key was found. 478 - (BOOL)getInt32:(nullable int32_t *)value forKey:(int32_t)key; 479 480 - (void)enumerateKeysAndInt32sUsingBlock: 481 (void (^)(int32_t key, int32_t value, BOOL *stop))block; 482 483 - (void)addEntriesFromDictionary:(GPBInt32Int32Dictionary *)otherDictionary; 484 485 - (void)setInt32:(int32_t)value forKey:(int32_t)key; 486 487 - (void)removeInt32ForKey:(int32_t)aKey; 488 - (void)removeAll; 489 490 @end 491 492 #pragma mark - Int32 -> UInt64 493 494 @interface GPBInt32UInt64Dictionary : NSObject <NSCopying> 495 496 @property(nonatomic, readonly) NSUInteger count; 497 498 + (instancetype)dictionary; 499 + (instancetype)dictionaryWithUInt64:(uint64_t)value 500 forKey:(int32_t)key; 501 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values 502 forKeys:(const int32_t [])keys 503 count:(NSUInteger)count; 504 + (instancetype)dictionaryWithDictionary:(GPBInt32UInt64Dictionary *)dictionary; 505 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 506 507 - (instancetype)initWithUInt64s:(const uint64_t [])values 508 forKeys:(const int32_t [])keys 509 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 510 - (instancetype)initWithDictionary:(GPBInt32UInt64Dictionary *)dictionary; 511 - (instancetype)initWithCapacity:(NSUInteger)numItems; 512 513 // Returns YES/NO to indicate if the key was found or not, filling in the value 514 // only when the key was found. 515 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int32_t)key; 516 517 - (void)enumerateKeysAndUInt64sUsingBlock: 518 (void (^)(int32_t key, uint64_t value, BOOL *stop))block; 519 520 - (void)addEntriesFromDictionary:(GPBInt32UInt64Dictionary *)otherDictionary; 521 522 - (void)setUInt64:(uint64_t)value forKey:(int32_t)key; 523 524 - (void)removeUInt64ForKey:(int32_t)aKey; 525 - (void)removeAll; 526 527 @end 528 529 #pragma mark - Int32 -> Int64 530 531 @interface GPBInt32Int64Dictionary : NSObject <NSCopying> 532 533 @property(nonatomic, readonly) NSUInteger count; 534 535 + (instancetype)dictionary; 536 + (instancetype)dictionaryWithInt64:(int64_t)value 537 forKey:(int32_t)key; 538 + (instancetype)dictionaryWithInt64s:(const int64_t [])values 539 forKeys:(const int32_t [])keys 540 count:(NSUInteger)count; 541 + (instancetype)dictionaryWithDictionary:(GPBInt32Int64Dictionary *)dictionary; 542 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 543 544 - (instancetype)initWithInt64s:(const int64_t [])values 545 forKeys:(const int32_t [])keys 546 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 547 - (instancetype)initWithDictionary:(GPBInt32Int64Dictionary *)dictionary; 548 - (instancetype)initWithCapacity:(NSUInteger)numItems; 549 550 // Returns YES/NO to indicate if the key was found or not, filling in the value 551 // only when the key was found. 552 - (BOOL)getInt64:(nullable int64_t *)value forKey:(int32_t)key; 553 554 - (void)enumerateKeysAndInt64sUsingBlock: 555 (void (^)(int32_t key, int64_t value, BOOL *stop))block; 556 557 - (void)addEntriesFromDictionary:(GPBInt32Int64Dictionary *)otherDictionary; 558 559 - (void)setInt64:(int64_t)value forKey:(int32_t)key; 560 561 - (void)removeInt64ForKey:(int32_t)aKey; 562 - (void)removeAll; 563 564 @end 565 566 #pragma mark - Int32 -> Bool 567 568 @interface GPBInt32BoolDictionary : NSObject <NSCopying> 569 570 @property(nonatomic, readonly) NSUInteger count; 571 572 + (instancetype)dictionary; 573 + (instancetype)dictionaryWithBool:(BOOL)value 574 forKey:(int32_t)key; 575 + (instancetype)dictionaryWithBools:(const BOOL [])values 576 forKeys:(const int32_t [])keys 577 count:(NSUInteger)count; 578 + (instancetype)dictionaryWithDictionary:(GPBInt32BoolDictionary *)dictionary; 579 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 580 581 - (instancetype)initWithBools:(const BOOL [])values 582 forKeys:(const int32_t [])keys 583 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 584 - (instancetype)initWithDictionary:(GPBInt32BoolDictionary *)dictionary; 585 - (instancetype)initWithCapacity:(NSUInteger)numItems; 586 587 // Returns YES/NO to indicate if the key was found or not, filling in the value 588 // only when the key was found. 589 - (BOOL)getBool:(nullable BOOL *)value forKey:(int32_t)key; 590 591 - (void)enumerateKeysAndBoolsUsingBlock: 592 (void (^)(int32_t key, BOOL value, BOOL *stop))block; 593 594 - (void)addEntriesFromDictionary:(GPBInt32BoolDictionary *)otherDictionary; 595 596 - (void)setBool:(BOOL)value forKey:(int32_t)key; 597 598 - (void)removeBoolForKey:(int32_t)aKey; 599 - (void)removeAll; 600 601 @end 602 603 #pragma mark - Int32 -> Float 604 605 @interface GPBInt32FloatDictionary : NSObject <NSCopying> 606 607 @property(nonatomic, readonly) NSUInteger count; 608 609 + (instancetype)dictionary; 610 + (instancetype)dictionaryWithFloat:(float)value 611 forKey:(int32_t)key; 612 + (instancetype)dictionaryWithFloats:(const float [])values 613 forKeys:(const int32_t [])keys 614 count:(NSUInteger)count; 615 + (instancetype)dictionaryWithDictionary:(GPBInt32FloatDictionary *)dictionary; 616 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 617 618 - (instancetype)initWithFloats:(const float [])values 619 forKeys:(const int32_t [])keys 620 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 621 - (instancetype)initWithDictionary:(GPBInt32FloatDictionary *)dictionary; 622 - (instancetype)initWithCapacity:(NSUInteger)numItems; 623 624 // Returns YES/NO to indicate if the key was found or not, filling in the value 625 // only when the key was found. 626 - (BOOL)getFloat:(nullable float *)value forKey:(int32_t)key; 627 628 - (void)enumerateKeysAndFloatsUsingBlock: 629 (void (^)(int32_t key, float value, BOOL *stop))block; 630 631 - (void)addEntriesFromDictionary:(GPBInt32FloatDictionary *)otherDictionary; 632 633 - (void)setFloat:(float)value forKey:(int32_t)key; 634 635 - (void)removeFloatForKey:(int32_t)aKey; 636 - (void)removeAll; 637 638 @end 639 640 #pragma mark - Int32 -> Double 641 642 @interface GPBInt32DoubleDictionary : NSObject <NSCopying> 643 644 @property(nonatomic, readonly) NSUInteger count; 645 646 + (instancetype)dictionary; 647 + (instancetype)dictionaryWithDouble:(double)value 648 forKey:(int32_t)key; 649 + (instancetype)dictionaryWithDoubles:(const double [])values 650 forKeys:(const int32_t [])keys 651 count:(NSUInteger)count; 652 + (instancetype)dictionaryWithDictionary:(GPBInt32DoubleDictionary *)dictionary; 653 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 654 655 - (instancetype)initWithDoubles:(const double [])values 656 forKeys:(const int32_t [])keys 657 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 658 - (instancetype)initWithDictionary:(GPBInt32DoubleDictionary *)dictionary; 659 - (instancetype)initWithCapacity:(NSUInteger)numItems; 660 661 // Returns YES/NO to indicate if the key was found or not, filling in the value 662 // only when the key was found. 663 - (BOOL)getDouble:(nullable double *)value forKey:(int32_t)key; 664 665 - (void)enumerateKeysAndDoublesUsingBlock: 666 (void (^)(int32_t key, double value, BOOL *stop))block; 667 668 - (void)addEntriesFromDictionary:(GPBInt32DoubleDictionary *)otherDictionary; 669 670 - (void)setDouble:(double)value forKey:(int32_t)key; 671 672 - (void)removeDoubleForKey:(int32_t)aKey; 673 - (void)removeAll; 674 675 @end 676 677 #pragma mark - Int32 -> Enum 678 679 @interface GPBInt32EnumDictionary : NSObject <NSCopying> 680 681 @property(nonatomic, readonly) NSUInteger count; 682 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 683 684 + (instancetype)dictionary; 685 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func; 686 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 687 rawValue:(int32_t)rawValue 688 forKey:(int32_t)key; 689 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 690 rawValues:(const int32_t [])values 691 forKeys:(const int32_t [])keys 692 count:(NSUInteger)count; 693 + (instancetype)dictionaryWithDictionary:(GPBInt32EnumDictionary *)dictionary; 694 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 695 capacity:(NSUInteger)numItems; 696 697 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 698 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 699 rawValues:(const int32_t [])values 700 forKeys:(const int32_t [])keys 701 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 702 - (instancetype)initWithDictionary:(GPBInt32EnumDictionary *)dictionary; 703 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 704 capacity:(NSUInteger)numItems; 705 706 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 707 // is not a valid enumerator as defined by validationFunc. If the actual value is 708 // desired, use "raw" version of the method. 709 710 // Returns YES/NO to indicate if the key was found or not, filling in the value 711 // only when the key was found. 712 - (BOOL)getEnum:(nullable int32_t *)value forKey:(int32_t)key; 713 714 - (void)enumerateKeysAndEnumsUsingBlock: 715 (void (^)(int32_t key, int32_t value, BOOL *stop))block; 716 717 // These methods bypass the validationFunc to provide access to values that were not 718 // known at the time the binary was compiled. 719 720 // Returns YES/NO to indicate if the key was found or not, filling in the value 721 // only when the key was found. 722 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int32_t)key; 723 724 - (void)enumerateKeysAndRawValuesUsingBlock: 725 (void (^)(int32_t key, int32_t rawValue, BOOL *stop))block; 726 727 - (void)addRawEntriesFromDictionary:(GPBInt32EnumDictionary *)otherDictionary; 728 729 // If value is not a valid enumerator as defined by validationFunc, these 730 // methods will assert in debug, and will log in release and assign the value 731 // to the default value. Use the rawValue methods below to assign non enumerator 732 // values. 733 734 - (void)setEnum:(int32_t)value forKey:(int32_t)key; 735 736 // This method bypass the validationFunc to provide setting of values that were not 737 // known at the time the binary was compiled. 738 - (void)setRawValue:(int32_t)rawValue forKey:(int32_t)key; 739 740 // No validation applies to these methods. 741 742 - (void)removeEnumForKey:(int32_t)aKey; 743 - (void)removeAll; 744 745 @end 746 747 #pragma mark - Int32 -> Object 748 749 @interface GPBInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying> 750 751 @property(nonatomic, readonly) NSUInteger count; 752 753 + (instancetype)dictionary; 754 + (instancetype)dictionaryWithObject:(ObjectType)object 755 forKey:(int32_t)key; 756 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects 757 forKeys:(const int32_t [])keys 758 count:(NSUInteger)count; 759 + (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary; 760 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 761 762 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects 763 forKeys:(const int32_t [])keys 764 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 765 - (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary; 766 - (instancetype)initWithCapacity:(NSUInteger)numItems; 767 768 - (ObjectType)objectForKey:(int32_t)key; 769 770 - (void)enumerateKeysAndObjectsUsingBlock: 771 (void (^)(int32_t key, ObjectType object, BOOL *stop))block; 772 773 - (void)addEntriesFromDictionary:(GPBInt32ObjectDictionary *)otherDictionary; 774 775 - (void)setObject:(ObjectType)object forKey:(int32_t)key; 776 777 - (void)removeObjectForKey:(int32_t)aKey; 778 - (void)removeAll; 779 780 @end 781 782 #pragma mark - UInt64 -> UInt32 783 784 @interface GPBUInt64UInt32Dictionary : NSObject <NSCopying> 785 786 @property(nonatomic, readonly) NSUInteger count; 787 788 + (instancetype)dictionary; 789 + (instancetype)dictionaryWithUInt32:(uint32_t)value 790 forKey:(uint64_t)key; 791 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values 792 forKeys:(const uint64_t [])keys 793 count:(NSUInteger)count; 794 + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary; 795 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 796 797 - (instancetype)initWithUInt32s:(const uint32_t [])values 798 forKeys:(const uint64_t [])keys 799 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 800 - (instancetype)initWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary; 801 - (instancetype)initWithCapacity:(NSUInteger)numItems; 802 803 // Returns YES/NO to indicate if the key was found or not, filling in the value 804 // only when the key was found. 805 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint64_t)key; 806 807 - (void)enumerateKeysAndUInt32sUsingBlock: 808 (void (^)(uint64_t key, uint32_t value, BOOL *stop))block; 809 810 - (void)addEntriesFromDictionary:(GPBUInt64UInt32Dictionary *)otherDictionary; 811 812 - (void)setUInt32:(uint32_t)value forKey:(uint64_t)key; 813 814 - (void)removeUInt32ForKey:(uint64_t)aKey; 815 - (void)removeAll; 816 817 @end 818 819 #pragma mark - UInt64 -> Int32 820 821 @interface GPBUInt64Int32Dictionary : NSObject <NSCopying> 822 823 @property(nonatomic, readonly) NSUInteger count; 824 825 + (instancetype)dictionary; 826 + (instancetype)dictionaryWithInt32:(int32_t)value 827 forKey:(uint64_t)key; 828 + (instancetype)dictionaryWithInt32s:(const int32_t [])values 829 forKeys:(const uint64_t [])keys 830 count:(NSUInteger)count; 831 + (instancetype)dictionaryWithDictionary:(GPBUInt64Int32Dictionary *)dictionary; 832 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 833 834 - (instancetype)initWithInt32s:(const int32_t [])values 835 forKeys:(const uint64_t [])keys 836 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 837 - (instancetype)initWithDictionary:(GPBUInt64Int32Dictionary *)dictionary; 838 - (instancetype)initWithCapacity:(NSUInteger)numItems; 839 840 // Returns YES/NO to indicate if the key was found or not, filling in the value 841 // only when the key was found. 842 - (BOOL)getInt32:(nullable int32_t *)value forKey:(uint64_t)key; 843 844 - (void)enumerateKeysAndInt32sUsingBlock: 845 (void (^)(uint64_t key, int32_t value, BOOL *stop))block; 846 847 - (void)addEntriesFromDictionary:(GPBUInt64Int32Dictionary *)otherDictionary; 848 849 - (void)setInt32:(int32_t)value forKey:(uint64_t)key; 850 851 - (void)removeInt32ForKey:(uint64_t)aKey; 852 - (void)removeAll; 853 854 @end 855 856 #pragma mark - UInt64 -> UInt64 857 858 @interface GPBUInt64UInt64Dictionary : NSObject <NSCopying> 859 860 @property(nonatomic, readonly) NSUInteger count; 861 862 + (instancetype)dictionary; 863 + (instancetype)dictionaryWithUInt64:(uint64_t)value 864 forKey:(uint64_t)key; 865 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values 866 forKeys:(const uint64_t [])keys 867 count:(NSUInteger)count; 868 + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary; 869 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 870 871 - (instancetype)initWithUInt64s:(const uint64_t [])values 872 forKeys:(const uint64_t [])keys 873 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 874 - (instancetype)initWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary; 875 - (instancetype)initWithCapacity:(NSUInteger)numItems; 876 877 // Returns YES/NO to indicate if the key was found or not, filling in the value 878 // only when the key was found. 879 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint64_t)key; 880 881 - (void)enumerateKeysAndUInt64sUsingBlock: 882 (void (^)(uint64_t key, uint64_t value, BOOL *stop))block; 883 884 - (void)addEntriesFromDictionary:(GPBUInt64UInt64Dictionary *)otherDictionary; 885 886 - (void)setUInt64:(uint64_t)value forKey:(uint64_t)key; 887 888 - (void)removeUInt64ForKey:(uint64_t)aKey; 889 - (void)removeAll; 890 891 @end 892 893 #pragma mark - UInt64 -> Int64 894 895 @interface GPBUInt64Int64Dictionary : NSObject <NSCopying> 896 897 @property(nonatomic, readonly) NSUInteger count; 898 899 + (instancetype)dictionary; 900 + (instancetype)dictionaryWithInt64:(int64_t)value 901 forKey:(uint64_t)key; 902 + (instancetype)dictionaryWithInt64s:(const int64_t [])values 903 forKeys:(const uint64_t [])keys 904 count:(NSUInteger)count; 905 + (instancetype)dictionaryWithDictionary:(GPBUInt64Int64Dictionary *)dictionary; 906 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 907 908 - (instancetype)initWithInt64s:(const int64_t [])values 909 forKeys:(const uint64_t [])keys 910 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 911 - (instancetype)initWithDictionary:(GPBUInt64Int64Dictionary *)dictionary; 912 - (instancetype)initWithCapacity:(NSUInteger)numItems; 913 914 // Returns YES/NO to indicate if the key was found or not, filling in the value 915 // only when the key was found. 916 - (BOOL)getInt64:(nullable int64_t *)value forKey:(uint64_t)key; 917 918 - (void)enumerateKeysAndInt64sUsingBlock: 919 (void (^)(uint64_t key, int64_t value, BOOL *stop))block; 920 921 - (void)addEntriesFromDictionary:(GPBUInt64Int64Dictionary *)otherDictionary; 922 923 - (void)setInt64:(int64_t)value forKey:(uint64_t)key; 924 925 - (void)removeInt64ForKey:(uint64_t)aKey; 926 - (void)removeAll; 927 928 @end 929 930 #pragma mark - UInt64 -> Bool 931 932 @interface GPBUInt64BoolDictionary : NSObject <NSCopying> 933 934 @property(nonatomic, readonly) NSUInteger count; 935 936 + (instancetype)dictionary; 937 + (instancetype)dictionaryWithBool:(BOOL)value 938 forKey:(uint64_t)key; 939 + (instancetype)dictionaryWithBools:(const BOOL [])values 940 forKeys:(const uint64_t [])keys 941 count:(NSUInteger)count; 942 + (instancetype)dictionaryWithDictionary:(GPBUInt64BoolDictionary *)dictionary; 943 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 944 945 - (instancetype)initWithBools:(const BOOL [])values 946 forKeys:(const uint64_t [])keys 947 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 948 - (instancetype)initWithDictionary:(GPBUInt64BoolDictionary *)dictionary; 949 - (instancetype)initWithCapacity:(NSUInteger)numItems; 950 951 // Returns YES/NO to indicate if the key was found or not, filling in the value 952 // only when the key was found. 953 - (BOOL)getBool:(nullable BOOL *)value forKey:(uint64_t)key; 954 955 - (void)enumerateKeysAndBoolsUsingBlock: 956 (void (^)(uint64_t key, BOOL value, BOOL *stop))block; 957 958 - (void)addEntriesFromDictionary:(GPBUInt64BoolDictionary *)otherDictionary; 959 960 - (void)setBool:(BOOL)value forKey:(uint64_t)key; 961 962 - (void)removeBoolForKey:(uint64_t)aKey; 963 - (void)removeAll; 964 965 @end 966 967 #pragma mark - UInt64 -> Float 968 969 @interface GPBUInt64FloatDictionary : NSObject <NSCopying> 970 971 @property(nonatomic, readonly) NSUInteger count; 972 973 + (instancetype)dictionary; 974 + (instancetype)dictionaryWithFloat:(float)value 975 forKey:(uint64_t)key; 976 + (instancetype)dictionaryWithFloats:(const float [])values 977 forKeys:(const uint64_t [])keys 978 count:(NSUInteger)count; 979 + (instancetype)dictionaryWithDictionary:(GPBUInt64FloatDictionary *)dictionary; 980 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 981 982 - (instancetype)initWithFloats:(const float [])values 983 forKeys:(const uint64_t [])keys 984 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 985 - (instancetype)initWithDictionary:(GPBUInt64FloatDictionary *)dictionary; 986 - (instancetype)initWithCapacity:(NSUInteger)numItems; 987 988 // Returns YES/NO to indicate if the key was found or not, filling in the value 989 // only when the key was found. 990 - (BOOL)getFloat:(nullable float *)value forKey:(uint64_t)key; 991 992 - (void)enumerateKeysAndFloatsUsingBlock: 993 (void (^)(uint64_t key, float value, BOOL *stop))block; 994 995 - (void)addEntriesFromDictionary:(GPBUInt64FloatDictionary *)otherDictionary; 996 997 - (void)setFloat:(float)value forKey:(uint64_t)key; 998 999 - (void)removeFloatForKey:(uint64_t)aKey; 1000 - (void)removeAll; 1001 1002 @end 1003 1004 #pragma mark - UInt64 -> Double 1005 1006 @interface GPBUInt64DoubleDictionary : NSObject <NSCopying> 1007 1008 @property(nonatomic, readonly) NSUInteger count; 1009 1010 + (instancetype)dictionary; 1011 + (instancetype)dictionaryWithDouble:(double)value 1012 forKey:(uint64_t)key; 1013 + (instancetype)dictionaryWithDoubles:(const double [])values 1014 forKeys:(const uint64_t [])keys 1015 count:(NSUInteger)count; 1016 + (instancetype)dictionaryWithDictionary:(GPBUInt64DoubleDictionary *)dictionary; 1017 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1018 1019 - (instancetype)initWithDoubles:(const double [])values 1020 forKeys:(const uint64_t [])keys 1021 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1022 - (instancetype)initWithDictionary:(GPBUInt64DoubleDictionary *)dictionary; 1023 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1024 1025 // Returns YES/NO to indicate if the key was found or not, filling in the value 1026 // only when the key was found. 1027 - (BOOL)getDouble:(nullable double *)value forKey:(uint64_t)key; 1028 1029 - (void)enumerateKeysAndDoublesUsingBlock: 1030 (void (^)(uint64_t key, double value, BOOL *stop))block; 1031 1032 - (void)addEntriesFromDictionary:(GPBUInt64DoubleDictionary *)otherDictionary; 1033 1034 - (void)setDouble:(double)value forKey:(uint64_t)key; 1035 1036 - (void)removeDoubleForKey:(uint64_t)aKey; 1037 - (void)removeAll; 1038 1039 @end 1040 1041 #pragma mark - UInt64 -> Enum 1042 1043 @interface GPBUInt64EnumDictionary : NSObject <NSCopying> 1044 1045 @property(nonatomic, readonly) NSUInteger count; 1046 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 1047 1048 + (instancetype)dictionary; 1049 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func; 1050 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 1051 rawValue:(int32_t)rawValue 1052 forKey:(uint64_t)key; 1053 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 1054 rawValues:(const int32_t [])values 1055 forKeys:(const uint64_t [])keys 1056 count:(NSUInteger)count; 1057 + (instancetype)dictionaryWithDictionary:(GPBUInt64EnumDictionary *)dictionary; 1058 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 1059 capacity:(NSUInteger)numItems; 1060 1061 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 1062 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1063 rawValues:(const int32_t [])values 1064 forKeys:(const uint64_t [])keys 1065 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1066 - (instancetype)initWithDictionary:(GPBUInt64EnumDictionary *)dictionary; 1067 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1068 capacity:(NSUInteger)numItems; 1069 1070 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 1071 // is not a valid enumerator as defined by validationFunc. If the actual value is 1072 // desired, use "raw" version of the method. 1073 1074 // Returns YES/NO to indicate if the key was found or not, filling in the value 1075 // only when the key was found. 1076 - (BOOL)getEnum:(nullable int32_t *)value forKey:(uint64_t)key; 1077 1078 - (void)enumerateKeysAndEnumsUsingBlock: 1079 (void (^)(uint64_t key, int32_t value, BOOL *stop))block; 1080 1081 // These methods bypass the validationFunc to provide access to values that were not 1082 // known at the time the binary was compiled. 1083 1084 // Returns YES/NO to indicate if the key was found or not, filling in the value 1085 // only when the key was found. 1086 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint64_t)key; 1087 1088 - (void)enumerateKeysAndRawValuesUsingBlock: 1089 (void (^)(uint64_t key, int32_t rawValue, BOOL *stop))block; 1090 1091 - (void)addRawEntriesFromDictionary:(GPBUInt64EnumDictionary *)otherDictionary; 1092 1093 // If value is not a valid enumerator as defined by validationFunc, these 1094 // methods will assert in debug, and will log in release and assign the value 1095 // to the default value. Use the rawValue methods below to assign non enumerator 1096 // values. 1097 1098 - (void)setEnum:(int32_t)value forKey:(uint64_t)key; 1099 1100 // This method bypass the validationFunc to provide setting of values that were not 1101 // known at the time the binary was compiled. 1102 - (void)setRawValue:(int32_t)rawValue forKey:(uint64_t)key; 1103 1104 // No validation applies to these methods. 1105 1106 - (void)removeEnumForKey:(uint64_t)aKey; 1107 - (void)removeAll; 1108 1109 @end 1110 1111 #pragma mark - UInt64 -> Object 1112 1113 @interface GPBUInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying> 1114 1115 @property(nonatomic, readonly) NSUInteger count; 1116 1117 + (instancetype)dictionary; 1118 + (instancetype)dictionaryWithObject:(ObjectType)object 1119 forKey:(uint64_t)key; 1120 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects 1121 forKeys:(const uint64_t [])keys 1122 count:(NSUInteger)count; 1123 + (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary; 1124 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1125 1126 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects 1127 forKeys:(const uint64_t [])keys 1128 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1129 - (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary; 1130 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1131 1132 - (ObjectType)objectForKey:(uint64_t)key; 1133 1134 - (void)enumerateKeysAndObjectsUsingBlock: 1135 (void (^)(uint64_t key, ObjectType object, BOOL *stop))block; 1136 1137 - (void)addEntriesFromDictionary:(GPBUInt64ObjectDictionary *)otherDictionary; 1138 1139 - (void)setObject:(ObjectType)object forKey:(uint64_t)key; 1140 1141 - (void)removeObjectForKey:(uint64_t)aKey; 1142 - (void)removeAll; 1143 1144 @end 1145 1146 #pragma mark - Int64 -> UInt32 1147 1148 @interface GPBInt64UInt32Dictionary : NSObject <NSCopying> 1149 1150 @property(nonatomic, readonly) NSUInteger count; 1151 1152 + (instancetype)dictionary; 1153 + (instancetype)dictionaryWithUInt32:(uint32_t)value 1154 forKey:(int64_t)key; 1155 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values 1156 forKeys:(const int64_t [])keys 1157 count:(NSUInteger)count; 1158 + (instancetype)dictionaryWithDictionary:(GPBInt64UInt32Dictionary *)dictionary; 1159 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1160 1161 - (instancetype)initWithUInt32s:(const uint32_t [])values 1162 forKeys:(const int64_t [])keys 1163 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1164 - (instancetype)initWithDictionary:(GPBInt64UInt32Dictionary *)dictionary; 1165 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1166 1167 // Returns YES/NO to indicate if the key was found or not, filling in the value 1168 // only when the key was found. 1169 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int64_t)key; 1170 1171 - (void)enumerateKeysAndUInt32sUsingBlock: 1172 (void (^)(int64_t key, uint32_t value, BOOL *stop))block; 1173 1174 - (void)addEntriesFromDictionary:(GPBInt64UInt32Dictionary *)otherDictionary; 1175 1176 - (void)setUInt32:(uint32_t)value forKey:(int64_t)key; 1177 1178 - (void)removeUInt32ForKey:(int64_t)aKey; 1179 - (void)removeAll; 1180 1181 @end 1182 1183 #pragma mark - Int64 -> Int32 1184 1185 @interface GPBInt64Int32Dictionary : NSObject <NSCopying> 1186 1187 @property(nonatomic, readonly) NSUInteger count; 1188 1189 + (instancetype)dictionary; 1190 + (instancetype)dictionaryWithInt32:(int32_t)value 1191 forKey:(int64_t)key; 1192 + (instancetype)dictionaryWithInt32s:(const int32_t [])values 1193 forKeys:(const int64_t [])keys 1194 count:(NSUInteger)count; 1195 + (instancetype)dictionaryWithDictionary:(GPBInt64Int32Dictionary *)dictionary; 1196 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1197 1198 - (instancetype)initWithInt32s:(const int32_t [])values 1199 forKeys:(const int64_t [])keys 1200 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1201 - (instancetype)initWithDictionary:(GPBInt64Int32Dictionary *)dictionary; 1202 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1203 1204 // Returns YES/NO to indicate if the key was found or not, filling in the value 1205 // only when the key was found. 1206 - (BOOL)getInt32:(nullable int32_t *)value forKey:(int64_t)key; 1207 1208 - (void)enumerateKeysAndInt32sUsingBlock: 1209 (void (^)(int64_t key, int32_t value, BOOL *stop))block; 1210 1211 - (void)addEntriesFromDictionary:(GPBInt64Int32Dictionary *)otherDictionary; 1212 1213 - (void)setInt32:(int32_t)value forKey:(int64_t)key; 1214 1215 - (void)removeInt32ForKey:(int64_t)aKey; 1216 - (void)removeAll; 1217 1218 @end 1219 1220 #pragma mark - Int64 -> UInt64 1221 1222 @interface GPBInt64UInt64Dictionary : NSObject <NSCopying> 1223 1224 @property(nonatomic, readonly) NSUInteger count; 1225 1226 + (instancetype)dictionary; 1227 + (instancetype)dictionaryWithUInt64:(uint64_t)value 1228 forKey:(int64_t)key; 1229 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values 1230 forKeys:(const int64_t [])keys 1231 count:(NSUInteger)count; 1232 + (instancetype)dictionaryWithDictionary:(GPBInt64UInt64Dictionary *)dictionary; 1233 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1234 1235 - (instancetype)initWithUInt64s:(const uint64_t [])values 1236 forKeys:(const int64_t [])keys 1237 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1238 - (instancetype)initWithDictionary:(GPBInt64UInt64Dictionary *)dictionary; 1239 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1240 1241 // Returns YES/NO to indicate if the key was found or not, filling in the value 1242 // only when the key was found. 1243 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int64_t)key; 1244 1245 - (void)enumerateKeysAndUInt64sUsingBlock: 1246 (void (^)(int64_t key, uint64_t value, BOOL *stop))block; 1247 1248 - (void)addEntriesFromDictionary:(GPBInt64UInt64Dictionary *)otherDictionary; 1249 1250 - (void)setUInt64:(uint64_t)value forKey:(int64_t)key; 1251 1252 - (void)removeUInt64ForKey:(int64_t)aKey; 1253 - (void)removeAll; 1254 1255 @end 1256 1257 #pragma mark - Int64 -> Int64 1258 1259 @interface GPBInt64Int64Dictionary : NSObject <NSCopying> 1260 1261 @property(nonatomic, readonly) NSUInteger count; 1262 1263 + (instancetype)dictionary; 1264 + (instancetype)dictionaryWithInt64:(int64_t)value 1265 forKey:(int64_t)key; 1266 + (instancetype)dictionaryWithInt64s:(const int64_t [])values 1267 forKeys:(const int64_t [])keys 1268 count:(NSUInteger)count; 1269 + (instancetype)dictionaryWithDictionary:(GPBInt64Int64Dictionary *)dictionary; 1270 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1271 1272 - (instancetype)initWithInt64s:(const int64_t [])values 1273 forKeys:(const int64_t [])keys 1274 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1275 - (instancetype)initWithDictionary:(GPBInt64Int64Dictionary *)dictionary; 1276 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1277 1278 // Returns YES/NO to indicate if the key was found or not, filling in the value 1279 // only when the key was found. 1280 - (BOOL)getInt64:(nullable int64_t *)value forKey:(int64_t)key; 1281 1282 - (void)enumerateKeysAndInt64sUsingBlock: 1283 (void (^)(int64_t key, int64_t value, BOOL *stop))block; 1284 1285 - (void)addEntriesFromDictionary:(GPBInt64Int64Dictionary *)otherDictionary; 1286 1287 - (void)setInt64:(int64_t)value forKey:(int64_t)key; 1288 1289 - (void)removeInt64ForKey:(int64_t)aKey; 1290 - (void)removeAll; 1291 1292 @end 1293 1294 #pragma mark - Int64 -> Bool 1295 1296 @interface GPBInt64BoolDictionary : NSObject <NSCopying> 1297 1298 @property(nonatomic, readonly) NSUInteger count; 1299 1300 + (instancetype)dictionary; 1301 + (instancetype)dictionaryWithBool:(BOOL)value 1302 forKey:(int64_t)key; 1303 + (instancetype)dictionaryWithBools:(const BOOL [])values 1304 forKeys:(const int64_t [])keys 1305 count:(NSUInteger)count; 1306 + (instancetype)dictionaryWithDictionary:(GPBInt64BoolDictionary *)dictionary; 1307 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1308 1309 - (instancetype)initWithBools:(const BOOL [])values 1310 forKeys:(const int64_t [])keys 1311 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1312 - (instancetype)initWithDictionary:(GPBInt64BoolDictionary *)dictionary; 1313 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1314 1315 // Returns YES/NO to indicate if the key was found or not, filling in the value 1316 // only when the key was found. 1317 - (BOOL)getBool:(nullable BOOL *)value forKey:(int64_t)key; 1318 1319 - (void)enumerateKeysAndBoolsUsingBlock: 1320 (void (^)(int64_t key, BOOL value, BOOL *stop))block; 1321 1322 - (void)addEntriesFromDictionary:(GPBInt64BoolDictionary *)otherDictionary; 1323 1324 - (void)setBool:(BOOL)value forKey:(int64_t)key; 1325 1326 - (void)removeBoolForKey:(int64_t)aKey; 1327 - (void)removeAll; 1328 1329 @end 1330 1331 #pragma mark - Int64 -> Float 1332 1333 @interface GPBInt64FloatDictionary : NSObject <NSCopying> 1334 1335 @property(nonatomic, readonly) NSUInteger count; 1336 1337 + (instancetype)dictionary; 1338 + (instancetype)dictionaryWithFloat:(float)value 1339 forKey:(int64_t)key; 1340 + (instancetype)dictionaryWithFloats:(const float [])values 1341 forKeys:(const int64_t [])keys 1342 count:(NSUInteger)count; 1343 + (instancetype)dictionaryWithDictionary:(GPBInt64FloatDictionary *)dictionary; 1344 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1345 1346 - (instancetype)initWithFloats:(const float [])values 1347 forKeys:(const int64_t [])keys 1348 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1349 - (instancetype)initWithDictionary:(GPBInt64FloatDictionary *)dictionary; 1350 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1351 1352 // Returns YES/NO to indicate if the key was found or not, filling in the value 1353 // only when the key was found. 1354 - (BOOL)getFloat:(nullable float *)value forKey:(int64_t)key; 1355 1356 - (void)enumerateKeysAndFloatsUsingBlock: 1357 (void (^)(int64_t key, float value, BOOL *stop))block; 1358 1359 - (void)addEntriesFromDictionary:(GPBInt64FloatDictionary *)otherDictionary; 1360 1361 - (void)setFloat:(float)value forKey:(int64_t)key; 1362 1363 - (void)removeFloatForKey:(int64_t)aKey; 1364 - (void)removeAll; 1365 1366 @end 1367 1368 #pragma mark - Int64 -> Double 1369 1370 @interface GPBInt64DoubleDictionary : NSObject <NSCopying> 1371 1372 @property(nonatomic, readonly) NSUInteger count; 1373 1374 + (instancetype)dictionary; 1375 + (instancetype)dictionaryWithDouble:(double)value 1376 forKey:(int64_t)key; 1377 + (instancetype)dictionaryWithDoubles:(const double [])values 1378 forKeys:(const int64_t [])keys 1379 count:(NSUInteger)count; 1380 + (instancetype)dictionaryWithDictionary:(GPBInt64DoubleDictionary *)dictionary; 1381 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1382 1383 - (instancetype)initWithDoubles:(const double [])values 1384 forKeys:(const int64_t [])keys 1385 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1386 - (instancetype)initWithDictionary:(GPBInt64DoubleDictionary *)dictionary; 1387 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1388 1389 // Returns YES/NO to indicate if the key was found or not, filling in the value 1390 // only when the key was found. 1391 - (BOOL)getDouble:(nullable double *)value forKey:(int64_t)key; 1392 1393 - (void)enumerateKeysAndDoublesUsingBlock: 1394 (void (^)(int64_t key, double value, BOOL *stop))block; 1395 1396 - (void)addEntriesFromDictionary:(GPBInt64DoubleDictionary *)otherDictionary; 1397 1398 - (void)setDouble:(double)value forKey:(int64_t)key; 1399 1400 - (void)removeDoubleForKey:(int64_t)aKey; 1401 - (void)removeAll; 1402 1403 @end 1404 1405 #pragma mark - Int64 -> Enum 1406 1407 @interface GPBInt64EnumDictionary : NSObject <NSCopying> 1408 1409 @property(nonatomic, readonly) NSUInteger count; 1410 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 1411 1412 + (instancetype)dictionary; 1413 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func; 1414 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 1415 rawValue:(int32_t)rawValue 1416 forKey:(int64_t)key; 1417 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 1418 rawValues:(const int32_t [])values 1419 forKeys:(const int64_t [])keys 1420 count:(NSUInteger)count; 1421 + (instancetype)dictionaryWithDictionary:(GPBInt64EnumDictionary *)dictionary; 1422 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 1423 capacity:(NSUInteger)numItems; 1424 1425 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 1426 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1427 rawValues:(const int32_t [])values 1428 forKeys:(const int64_t [])keys 1429 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1430 - (instancetype)initWithDictionary:(GPBInt64EnumDictionary *)dictionary; 1431 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1432 capacity:(NSUInteger)numItems; 1433 1434 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 1435 // is not a valid enumerator as defined by validationFunc. If the actual value is 1436 // desired, use "raw" version of the method. 1437 1438 // Returns YES/NO to indicate if the key was found or not, filling in the value 1439 // only when the key was found. 1440 - (BOOL)getEnum:(nullable int32_t *)value forKey:(int64_t)key; 1441 1442 - (void)enumerateKeysAndEnumsUsingBlock: 1443 (void (^)(int64_t key, int32_t value, BOOL *stop))block; 1444 1445 // These methods bypass the validationFunc to provide access to values that were not 1446 // known at the time the binary was compiled. 1447 1448 // Returns YES/NO to indicate if the key was found or not, filling in the value 1449 // only when the key was found. 1450 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int64_t)key; 1451 1452 - (void)enumerateKeysAndRawValuesUsingBlock: 1453 (void (^)(int64_t key, int32_t rawValue, BOOL *stop))block; 1454 1455 - (void)addRawEntriesFromDictionary:(GPBInt64EnumDictionary *)otherDictionary; 1456 1457 // If value is not a valid enumerator as defined by validationFunc, these 1458 // methods will assert in debug, and will log in release and assign the value 1459 // to the default value. Use the rawValue methods below to assign non enumerator 1460 // values. 1461 1462 - (void)setEnum:(int32_t)value forKey:(int64_t)key; 1463 1464 // This method bypass the validationFunc to provide setting of values that were not 1465 // known at the time the binary was compiled. 1466 - (void)setRawValue:(int32_t)rawValue forKey:(int64_t)key; 1467 1468 // No validation applies to these methods. 1469 1470 - (void)removeEnumForKey:(int64_t)aKey; 1471 - (void)removeAll; 1472 1473 @end 1474 1475 #pragma mark - Int64 -> Object 1476 1477 @interface GPBInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying> 1478 1479 @property(nonatomic, readonly) NSUInteger count; 1480 1481 + (instancetype)dictionary; 1482 + (instancetype)dictionaryWithObject:(ObjectType)object 1483 forKey:(int64_t)key; 1484 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects 1485 forKeys:(const int64_t [])keys 1486 count:(NSUInteger)count; 1487 + (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary; 1488 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1489 1490 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects 1491 forKeys:(const int64_t [])keys 1492 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1493 - (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary; 1494 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1495 1496 - (ObjectType)objectForKey:(int64_t)key; 1497 1498 - (void)enumerateKeysAndObjectsUsingBlock: 1499 (void (^)(int64_t key, ObjectType object, BOOL *stop))block; 1500 1501 - (void)addEntriesFromDictionary:(GPBInt64ObjectDictionary *)otherDictionary; 1502 1503 - (void)setObject:(ObjectType)object forKey:(int64_t)key; 1504 1505 - (void)removeObjectForKey:(int64_t)aKey; 1506 - (void)removeAll; 1507 1508 @end 1509 1510 #pragma mark - Bool -> UInt32 1511 1512 @interface GPBBoolUInt32Dictionary : NSObject <NSCopying> 1513 1514 @property(nonatomic, readonly) NSUInteger count; 1515 1516 + (instancetype)dictionary; 1517 + (instancetype)dictionaryWithUInt32:(uint32_t)value 1518 forKey:(BOOL)key; 1519 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values 1520 forKeys:(const BOOL [])keys 1521 count:(NSUInteger)count; 1522 + (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary; 1523 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1524 1525 - (instancetype)initWithUInt32s:(const uint32_t [])values 1526 forKeys:(const BOOL [])keys 1527 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1528 - (instancetype)initWithDictionary:(GPBBoolUInt32Dictionary *)dictionary; 1529 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1530 1531 // Returns YES/NO to indicate if the key was found or not, filling in the value 1532 // only when the key was found. 1533 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(BOOL)key; 1534 1535 - (void)enumerateKeysAndUInt32sUsingBlock: 1536 (void (^)(BOOL key, uint32_t value, BOOL *stop))block; 1537 1538 - (void)addEntriesFromDictionary:(GPBBoolUInt32Dictionary *)otherDictionary; 1539 1540 - (void)setUInt32:(uint32_t)value forKey:(BOOL)key; 1541 1542 - (void)removeUInt32ForKey:(BOOL)aKey; 1543 - (void)removeAll; 1544 1545 @end 1546 1547 #pragma mark - Bool -> Int32 1548 1549 @interface GPBBoolInt32Dictionary : NSObject <NSCopying> 1550 1551 @property(nonatomic, readonly) NSUInteger count; 1552 1553 + (instancetype)dictionary; 1554 + (instancetype)dictionaryWithInt32:(int32_t)value 1555 forKey:(BOOL)key; 1556 + (instancetype)dictionaryWithInt32s:(const int32_t [])values 1557 forKeys:(const BOOL [])keys 1558 count:(NSUInteger)count; 1559 + (instancetype)dictionaryWithDictionary:(GPBBoolInt32Dictionary *)dictionary; 1560 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1561 1562 - (instancetype)initWithInt32s:(const int32_t [])values 1563 forKeys:(const BOOL [])keys 1564 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1565 - (instancetype)initWithDictionary:(GPBBoolInt32Dictionary *)dictionary; 1566 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1567 1568 // Returns YES/NO to indicate if the key was found or not, filling in the value 1569 // only when the key was found. 1570 - (BOOL)getInt32:(nullable int32_t *)value forKey:(BOOL)key; 1571 1572 - (void)enumerateKeysAndInt32sUsingBlock: 1573 (void (^)(BOOL key, int32_t value, BOOL *stop))block; 1574 1575 - (void)addEntriesFromDictionary:(GPBBoolInt32Dictionary *)otherDictionary; 1576 1577 - (void)setInt32:(int32_t)value forKey:(BOOL)key; 1578 1579 - (void)removeInt32ForKey:(BOOL)aKey; 1580 - (void)removeAll; 1581 1582 @end 1583 1584 #pragma mark - Bool -> UInt64 1585 1586 @interface GPBBoolUInt64Dictionary : NSObject <NSCopying> 1587 1588 @property(nonatomic, readonly) NSUInteger count; 1589 1590 + (instancetype)dictionary; 1591 + (instancetype)dictionaryWithUInt64:(uint64_t)value 1592 forKey:(BOOL)key; 1593 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values 1594 forKeys:(const BOOL [])keys 1595 count:(NSUInteger)count; 1596 + (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary; 1597 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1598 1599 - (instancetype)initWithUInt64s:(const uint64_t [])values 1600 forKeys:(const BOOL [])keys 1601 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1602 - (instancetype)initWithDictionary:(GPBBoolUInt64Dictionary *)dictionary; 1603 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1604 1605 // Returns YES/NO to indicate if the key was found or not, filling in the value 1606 // only when the key was found. 1607 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(BOOL)key; 1608 1609 - (void)enumerateKeysAndUInt64sUsingBlock: 1610 (void (^)(BOOL key, uint64_t value, BOOL *stop))block; 1611 1612 - (void)addEntriesFromDictionary:(GPBBoolUInt64Dictionary *)otherDictionary; 1613 1614 - (void)setUInt64:(uint64_t)value forKey:(BOOL)key; 1615 1616 - (void)removeUInt64ForKey:(BOOL)aKey; 1617 - (void)removeAll; 1618 1619 @end 1620 1621 #pragma mark - Bool -> Int64 1622 1623 @interface GPBBoolInt64Dictionary : NSObject <NSCopying> 1624 1625 @property(nonatomic, readonly) NSUInteger count; 1626 1627 + (instancetype)dictionary; 1628 + (instancetype)dictionaryWithInt64:(int64_t)value 1629 forKey:(BOOL)key; 1630 + (instancetype)dictionaryWithInt64s:(const int64_t [])values 1631 forKeys:(const BOOL [])keys 1632 count:(NSUInteger)count; 1633 + (instancetype)dictionaryWithDictionary:(GPBBoolInt64Dictionary *)dictionary; 1634 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1635 1636 - (instancetype)initWithInt64s:(const int64_t [])values 1637 forKeys:(const BOOL [])keys 1638 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1639 - (instancetype)initWithDictionary:(GPBBoolInt64Dictionary *)dictionary; 1640 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1641 1642 // Returns YES/NO to indicate if the key was found or not, filling in the value 1643 // only when the key was found. 1644 - (BOOL)getInt64:(nullable int64_t *)value forKey:(BOOL)key; 1645 1646 - (void)enumerateKeysAndInt64sUsingBlock: 1647 (void (^)(BOOL key, int64_t value, BOOL *stop))block; 1648 1649 - (void)addEntriesFromDictionary:(GPBBoolInt64Dictionary *)otherDictionary; 1650 1651 - (void)setInt64:(int64_t)value forKey:(BOOL)key; 1652 1653 - (void)removeInt64ForKey:(BOOL)aKey; 1654 - (void)removeAll; 1655 1656 @end 1657 1658 #pragma mark - Bool -> Bool 1659 1660 @interface GPBBoolBoolDictionary : NSObject <NSCopying> 1661 1662 @property(nonatomic, readonly) NSUInteger count; 1663 1664 + (instancetype)dictionary; 1665 + (instancetype)dictionaryWithBool:(BOOL)value 1666 forKey:(BOOL)key; 1667 + (instancetype)dictionaryWithBools:(const BOOL [])values 1668 forKeys:(const BOOL [])keys 1669 count:(NSUInteger)count; 1670 + (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary; 1671 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1672 1673 - (instancetype)initWithBools:(const BOOL [])values 1674 forKeys:(const BOOL [])keys 1675 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1676 - (instancetype)initWithDictionary:(GPBBoolBoolDictionary *)dictionary; 1677 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1678 1679 // Returns YES/NO to indicate if the key was found or not, filling in the value 1680 // only when the key was found. 1681 - (BOOL)getBool:(nullable BOOL *)value forKey:(BOOL)key; 1682 1683 - (void)enumerateKeysAndBoolsUsingBlock: 1684 (void (^)(BOOL key, BOOL value, BOOL *stop))block; 1685 1686 - (void)addEntriesFromDictionary:(GPBBoolBoolDictionary *)otherDictionary; 1687 1688 - (void)setBool:(BOOL)value forKey:(BOOL)key; 1689 1690 - (void)removeBoolForKey:(BOOL)aKey; 1691 - (void)removeAll; 1692 1693 @end 1694 1695 #pragma mark - Bool -> Float 1696 1697 @interface GPBBoolFloatDictionary : NSObject <NSCopying> 1698 1699 @property(nonatomic, readonly) NSUInteger count; 1700 1701 + (instancetype)dictionary; 1702 + (instancetype)dictionaryWithFloat:(float)value 1703 forKey:(BOOL)key; 1704 + (instancetype)dictionaryWithFloats:(const float [])values 1705 forKeys:(const BOOL [])keys 1706 count:(NSUInteger)count; 1707 + (instancetype)dictionaryWithDictionary:(GPBBoolFloatDictionary *)dictionary; 1708 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1709 1710 - (instancetype)initWithFloats:(const float [])values 1711 forKeys:(const BOOL [])keys 1712 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1713 - (instancetype)initWithDictionary:(GPBBoolFloatDictionary *)dictionary; 1714 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1715 1716 // Returns YES/NO to indicate if the key was found or not, filling in the value 1717 // only when the key was found. 1718 - (BOOL)getFloat:(nullable float *)value forKey:(BOOL)key; 1719 1720 - (void)enumerateKeysAndFloatsUsingBlock: 1721 (void (^)(BOOL key, float value, BOOL *stop))block; 1722 1723 - (void)addEntriesFromDictionary:(GPBBoolFloatDictionary *)otherDictionary; 1724 1725 - (void)setFloat:(float)value forKey:(BOOL)key; 1726 1727 - (void)removeFloatForKey:(BOOL)aKey; 1728 - (void)removeAll; 1729 1730 @end 1731 1732 #pragma mark - Bool -> Double 1733 1734 @interface GPBBoolDoubleDictionary : NSObject <NSCopying> 1735 1736 @property(nonatomic, readonly) NSUInteger count; 1737 1738 + (instancetype)dictionary; 1739 + (instancetype)dictionaryWithDouble:(double)value 1740 forKey:(BOOL)key; 1741 + (instancetype)dictionaryWithDoubles:(const double [])values 1742 forKeys:(const BOOL [])keys 1743 count:(NSUInteger)count; 1744 + (instancetype)dictionaryWithDictionary:(GPBBoolDoubleDictionary *)dictionary; 1745 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1746 1747 - (instancetype)initWithDoubles:(const double [])values 1748 forKeys:(const BOOL [])keys 1749 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1750 - (instancetype)initWithDictionary:(GPBBoolDoubleDictionary *)dictionary; 1751 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1752 1753 // Returns YES/NO to indicate if the key was found or not, filling in the value 1754 // only when the key was found. 1755 - (BOOL)getDouble:(nullable double *)value forKey:(BOOL)key; 1756 1757 - (void)enumerateKeysAndDoublesUsingBlock: 1758 (void (^)(BOOL key, double value, BOOL *stop))block; 1759 1760 - (void)addEntriesFromDictionary:(GPBBoolDoubleDictionary *)otherDictionary; 1761 1762 - (void)setDouble:(double)value forKey:(BOOL)key; 1763 1764 - (void)removeDoubleForKey:(BOOL)aKey; 1765 - (void)removeAll; 1766 1767 @end 1768 1769 #pragma mark - Bool -> Enum 1770 1771 @interface GPBBoolEnumDictionary : NSObject <NSCopying> 1772 1773 @property(nonatomic, readonly) NSUInteger count; 1774 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 1775 1776 + (instancetype)dictionary; 1777 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func; 1778 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 1779 rawValue:(int32_t)rawValue 1780 forKey:(BOOL)key; 1781 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 1782 rawValues:(const int32_t [])values 1783 forKeys:(const BOOL [])keys 1784 count:(NSUInteger)count; 1785 + (instancetype)dictionaryWithDictionary:(GPBBoolEnumDictionary *)dictionary; 1786 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 1787 capacity:(NSUInteger)numItems; 1788 1789 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 1790 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1791 rawValues:(const int32_t [])values 1792 forKeys:(const BOOL [])keys 1793 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1794 - (instancetype)initWithDictionary:(GPBBoolEnumDictionary *)dictionary; 1795 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1796 capacity:(NSUInteger)numItems; 1797 1798 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 1799 // is not a valid enumerator as defined by validationFunc. If the actual value is 1800 // desired, use "raw" version of the method. 1801 1802 // Returns YES/NO to indicate if the key was found or not, filling in the value 1803 // only when the key was found. 1804 - (BOOL)getEnum:(nullable int32_t *)value forKey:(BOOL)key; 1805 1806 - (void)enumerateKeysAndEnumsUsingBlock: 1807 (void (^)(BOOL key, int32_t value, BOOL *stop))block; 1808 1809 // These methods bypass the validationFunc to provide access to values that were not 1810 // known at the time the binary was compiled. 1811 1812 // Returns YES/NO to indicate if the key was found or not, filling in the value 1813 // only when the key was found. 1814 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(BOOL)key; 1815 1816 - (void)enumerateKeysAndRawValuesUsingBlock: 1817 (void (^)(BOOL key, int32_t rawValue, BOOL *stop))block; 1818 1819 - (void)addRawEntriesFromDictionary:(GPBBoolEnumDictionary *)otherDictionary; 1820 1821 // If value is not a valid enumerator as defined by validationFunc, these 1822 // methods will assert in debug, and will log in release and assign the value 1823 // to the default value. Use the rawValue methods below to assign non enumerator 1824 // values. 1825 1826 - (void)setEnum:(int32_t)value forKey:(BOOL)key; 1827 1828 // This method bypass the validationFunc to provide setting of values that were not 1829 // known at the time the binary was compiled. 1830 - (void)setRawValue:(int32_t)rawValue forKey:(BOOL)key; 1831 1832 // No validation applies to these methods. 1833 1834 - (void)removeEnumForKey:(BOOL)aKey; 1835 - (void)removeAll; 1836 1837 @end 1838 1839 #pragma mark - Bool -> Object 1840 1841 @interface GPBBoolObjectDictionary<__covariant ObjectType> : NSObject <NSCopying> 1842 1843 @property(nonatomic, readonly) NSUInteger count; 1844 1845 + (instancetype)dictionary; 1846 + (instancetype)dictionaryWithObject:(ObjectType)object 1847 forKey:(BOOL)key; 1848 + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects 1849 forKeys:(const BOOL [])keys 1850 count:(NSUInteger)count; 1851 + (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary; 1852 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1853 1854 - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects 1855 forKeys:(const BOOL [])keys 1856 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1857 - (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary; 1858 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1859 1860 - (ObjectType)objectForKey:(BOOL)key; 1861 1862 - (void)enumerateKeysAndObjectsUsingBlock: 1863 (void (^)(BOOL key, ObjectType object, BOOL *stop))block; 1864 1865 - (void)addEntriesFromDictionary:(GPBBoolObjectDictionary *)otherDictionary; 1866 1867 - (void)setObject:(ObjectType)object forKey:(BOOL)key; 1868 1869 - (void)removeObjectForKey:(BOOL)aKey; 1870 - (void)removeAll; 1871 1872 @end 1873 1874 #pragma mark - String -> UInt32 1875 1876 @interface GPBStringUInt32Dictionary : NSObject <NSCopying> 1877 1878 @property(nonatomic, readonly) NSUInteger count; 1879 1880 + (instancetype)dictionary; 1881 + (instancetype)dictionaryWithUInt32:(uint32_t)value 1882 forKey:(NSString *)key; 1883 + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values 1884 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 1885 count:(NSUInteger)count; 1886 + (instancetype)dictionaryWithDictionary:(GPBStringUInt32Dictionary *)dictionary; 1887 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1888 1889 - (instancetype)initWithUInt32s:(const uint32_t [])values 1890 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 1891 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1892 - (instancetype)initWithDictionary:(GPBStringUInt32Dictionary *)dictionary; 1893 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1894 1895 // Returns YES/NO to indicate if the key was found or not, filling in the value 1896 // only when the key was found. 1897 - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(NSString *)key; 1898 1899 - (void)enumerateKeysAndUInt32sUsingBlock: 1900 (void (^)(NSString *key, uint32_t value, BOOL *stop))block; 1901 1902 - (void)addEntriesFromDictionary:(GPBStringUInt32Dictionary *)otherDictionary; 1903 1904 - (void)setUInt32:(uint32_t)value forKey:(NSString *)key; 1905 1906 - (void)removeUInt32ForKey:(NSString *)aKey; 1907 - (void)removeAll; 1908 1909 @end 1910 1911 #pragma mark - String -> Int32 1912 1913 @interface GPBStringInt32Dictionary : NSObject <NSCopying> 1914 1915 @property(nonatomic, readonly) NSUInteger count; 1916 1917 + (instancetype)dictionary; 1918 + (instancetype)dictionaryWithInt32:(int32_t)value 1919 forKey:(NSString *)key; 1920 + (instancetype)dictionaryWithInt32s:(const int32_t [])values 1921 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 1922 count:(NSUInteger)count; 1923 + (instancetype)dictionaryWithDictionary:(GPBStringInt32Dictionary *)dictionary; 1924 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1925 1926 - (instancetype)initWithInt32s:(const int32_t [])values 1927 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 1928 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1929 - (instancetype)initWithDictionary:(GPBStringInt32Dictionary *)dictionary; 1930 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1931 1932 // Returns YES/NO to indicate if the key was found or not, filling in the value 1933 // only when the key was found. 1934 - (BOOL)getInt32:(nullable int32_t *)value forKey:(NSString *)key; 1935 1936 - (void)enumerateKeysAndInt32sUsingBlock: 1937 (void (^)(NSString *key, int32_t value, BOOL *stop))block; 1938 1939 - (void)addEntriesFromDictionary:(GPBStringInt32Dictionary *)otherDictionary; 1940 1941 - (void)setInt32:(int32_t)value forKey:(NSString *)key; 1942 1943 - (void)removeInt32ForKey:(NSString *)aKey; 1944 - (void)removeAll; 1945 1946 @end 1947 1948 #pragma mark - String -> UInt64 1949 1950 @interface GPBStringUInt64Dictionary : NSObject <NSCopying> 1951 1952 @property(nonatomic, readonly) NSUInteger count; 1953 1954 + (instancetype)dictionary; 1955 + (instancetype)dictionaryWithUInt64:(uint64_t)value 1956 forKey:(NSString *)key; 1957 + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values 1958 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 1959 count:(NSUInteger)count; 1960 + (instancetype)dictionaryWithDictionary:(GPBStringUInt64Dictionary *)dictionary; 1961 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1962 1963 - (instancetype)initWithUInt64s:(const uint64_t [])values 1964 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 1965 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1966 - (instancetype)initWithDictionary:(GPBStringUInt64Dictionary *)dictionary; 1967 - (instancetype)initWithCapacity:(NSUInteger)numItems; 1968 1969 // Returns YES/NO to indicate if the key was found or not, filling in the value 1970 // only when the key was found. 1971 - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(NSString *)key; 1972 1973 - (void)enumerateKeysAndUInt64sUsingBlock: 1974 (void (^)(NSString *key, uint64_t value, BOOL *stop))block; 1975 1976 - (void)addEntriesFromDictionary:(GPBStringUInt64Dictionary *)otherDictionary; 1977 1978 - (void)setUInt64:(uint64_t)value forKey:(NSString *)key; 1979 1980 - (void)removeUInt64ForKey:(NSString *)aKey; 1981 - (void)removeAll; 1982 1983 @end 1984 1985 #pragma mark - String -> Int64 1986 1987 @interface GPBStringInt64Dictionary : NSObject <NSCopying> 1988 1989 @property(nonatomic, readonly) NSUInteger count; 1990 1991 + (instancetype)dictionary; 1992 + (instancetype)dictionaryWithInt64:(int64_t)value 1993 forKey:(NSString *)key; 1994 + (instancetype)dictionaryWithInt64s:(const int64_t [])values 1995 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 1996 count:(NSUInteger)count; 1997 + (instancetype)dictionaryWithDictionary:(GPBStringInt64Dictionary *)dictionary; 1998 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 1999 2000 - (instancetype)initWithInt64s:(const int64_t [])values 2001 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 2002 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2003 - (instancetype)initWithDictionary:(GPBStringInt64Dictionary *)dictionary; 2004 - (instancetype)initWithCapacity:(NSUInteger)numItems; 2005 2006 // Returns YES/NO to indicate if the key was found or not, filling in the value 2007 // only when the key was found. 2008 - (BOOL)getInt64:(nullable int64_t *)value forKey:(NSString *)key; 2009 2010 - (void)enumerateKeysAndInt64sUsingBlock: 2011 (void (^)(NSString *key, int64_t value, BOOL *stop))block; 2012 2013 - (void)addEntriesFromDictionary:(GPBStringInt64Dictionary *)otherDictionary; 2014 2015 - (void)setInt64:(int64_t)value forKey:(NSString *)key; 2016 2017 - (void)removeInt64ForKey:(NSString *)aKey; 2018 - (void)removeAll; 2019 2020 @end 2021 2022 #pragma mark - String -> Bool 2023 2024 @interface GPBStringBoolDictionary : NSObject <NSCopying> 2025 2026 @property(nonatomic, readonly) NSUInteger count; 2027 2028 + (instancetype)dictionary; 2029 + (instancetype)dictionaryWithBool:(BOOL)value 2030 forKey:(NSString *)key; 2031 + (instancetype)dictionaryWithBools:(const BOOL [])values 2032 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 2033 count:(NSUInteger)count; 2034 + (instancetype)dictionaryWithDictionary:(GPBStringBoolDictionary *)dictionary; 2035 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 2036 2037 - (instancetype)initWithBools:(const BOOL [])values 2038 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 2039 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2040 - (instancetype)initWithDictionary:(GPBStringBoolDictionary *)dictionary; 2041 - (instancetype)initWithCapacity:(NSUInteger)numItems; 2042 2043 // Returns YES/NO to indicate if the key was found or not, filling in the value 2044 // only when the key was found. 2045 - (BOOL)getBool:(nullable BOOL *)value forKey:(NSString *)key; 2046 2047 - (void)enumerateKeysAndBoolsUsingBlock: 2048 (void (^)(NSString *key, BOOL value, BOOL *stop))block; 2049 2050 - (void)addEntriesFromDictionary:(GPBStringBoolDictionary *)otherDictionary; 2051 2052 - (void)setBool:(BOOL)value forKey:(NSString *)key; 2053 2054 - (void)removeBoolForKey:(NSString *)aKey; 2055 - (void)removeAll; 2056 2057 @end 2058 2059 #pragma mark - String -> Float 2060 2061 @interface GPBStringFloatDictionary : NSObject <NSCopying> 2062 2063 @property(nonatomic, readonly) NSUInteger count; 2064 2065 + (instancetype)dictionary; 2066 + (instancetype)dictionaryWithFloat:(float)value 2067 forKey:(NSString *)key; 2068 + (instancetype)dictionaryWithFloats:(const float [])values 2069 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 2070 count:(NSUInteger)count; 2071 + (instancetype)dictionaryWithDictionary:(GPBStringFloatDictionary *)dictionary; 2072 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 2073 2074 - (instancetype)initWithFloats:(const float [])values 2075 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 2076 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2077 - (instancetype)initWithDictionary:(GPBStringFloatDictionary *)dictionary; 2078 - (instancetype)initWithCapacity:(NSUInteger)numItems; 2079 2080 // Returns YES/NO to indicate if the key was found or not, filling in the value 2081 // only when the key was found. 2082 - (BOOL)getFloat:(nullable float *)value forKey:(NSString *)key; 2083 2084 - (void)enumerateKeysAndFloatsUsingBlock: 2085 (void (^)(NSString *key, float value, BOOL *stop))block; 2086 2087 - (void)addEntriesFromDictionary:(GPBStringFloatDictionary *)otherDictionary; 2088 2089 - (void)setFloat:(float)value forKey:(NSString *)key; 2090 2091 - (void)removeFloatForKey:(NSString *)aKey; 2092 - (void)removeAll; 2093 2094 @end 2095 2096 #pragma mark - String -> Double 2097 2098 @interface GPBStringDoubleDictionary : NSObject <NSCopying> 2099 2100 @property(nonatomic, readonly) NSUInteger count; 2101 2102 + (instancetype)dictionary; 2103 + (instancetype)dictionaryWithDouble:(double)value 2104 forKey:(NSString *)key; 2105 + (instancetype)dictionaryWithDoubles:(const double [])values 2106 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 2107 count:(NSUInteger)count; 2108 + (instancetype)dictionaryWithDictionary:(GPBStringDoubleDictionary *)dictionary; 2109 + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 2110 2111 - (instancetype)initWithDoubles:(const double [])values 2112 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 2113 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2114 - (instancetype)initWithDictionary:(GPBStringDoubleDictionary *)dictionary; 2115 - (instancetype)initWithCapacity:(NSUInteger)numItems; 2116 2117 // Returns YES/NO to indicate if the key was found or not, filling in the value 2118 // only when the key was found. 2119 - (BOOL)getDouble:(nullable double *)value forKey:(NSString *)key; 2120 2121 - (void)enumerateKeysAndDoublesUsingBlock: 2122 (void (^)(NSString *key, double value, BOOL *stop))block; 2123 2124 - (void)addEntriesFromDictionary:(GPBStringDoubleDictionary *)otherDictionary; 2125 2126 - (void)setDouble:(double)value forKey:(NSString *)key; 2127 2128 - (void)removeDoubleForKey:(NSString *)aKey; 2129 - (void)removeAll; 2130 2131 @end 2132 2133 #pragma mark - String -> Enum 2134 2135 @interface GPBStringEnumDictionary : NSObject <NSCopying> 2136 2137 @property(nonatomic, readonly) NSUInteger count; 2138 @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 2139 2140 + (instancetype)dictionary; 2141 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func; 2142 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 2143 rawValue:(int32_t)rawValue 2144 forKey:(NSString *)key; 2145 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 2146 rawValues:(const int32_t [])values 2147 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 2148 count:(NSUInteger)count; 2149 + (instancetype)dictionaryWithDictionary:(GPBStringEnumDictionary *)dictionary; 2150 + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 2151 capacity:(NSUInteger)numItems; 2152 2153 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 2154 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 2155 rawValues:(const int32_t [])values 2156 forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys 2157 count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2158 - (instancetype)initWithDictionary:(GPBStringEnumDictionary *)dictionary; 2159 - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 2160 capacity:(NSUInteger)numItems; 2161 2162 // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 2163 // is not a valid enumerator as defined by validationFunc. If the actual value is 2164 // desired, use "raw" version of the method. 2165 2166 // Returns YES/NO to indicate if the key was found or not, filling in the value 2167 // only when the key was found. 2168 - (BOOL)getEnum:(nullable int32_t *)value forKey:(NSString *)key; 2169 2170 - (void)enumerateKeysAndEnumsUsingBlock: 2171 (void (^)(NSString *key, int32_t value, BOOL *stop))block; 2172 2173 // These methods bypass the validationFunc to provide access to values that were not 2174 // known at the time the binary was compiled. 2175 2176 // Returns YES/NO to indicate if the key was found or not, filling in the value 2177 // only when the key was found. 2178 - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(NSString *)key; 2179 2180 - (void)enumerateKeysAndRawValuesUsingBlock: 2181 (void (^)(NSString *key, int32_t rawValue, BOOL *stop))block; 2182 2183 - (void)addRawEntriesFromDictionary:(GPBStringEnumDictionary *)otherDictionary; 2184 2185 // If value is not a valid enumerator as defined by validationFunc, these 2186 // methods will assert in debug, and will log in release and assign the value 2187 // to the default value. Use the rawValue methods below to assign non enumerator 2188 // values. 2189 2190 - (void)setEnum:(int32_t)value forKey:(NSString *)key; 2191 2192 // This method bypass the validationFunc to provide setting of values that were not 2193 // known at the time the binary was compiled. 2194 - (void)setRawValue:(int32_t)rawValue forKey:(NSString *)key; 2195 2196 // No validation applies to these methods. 2197 2198 - (void)removeEnumForKey:(NSString *)aKey; 2199 - (void)removeAll; 2200 2201 @end 2202 2203 //%PDDM-EXPAND-END DECLARE_DICTIONARIES() 2204 2205 NS_ASSUME_NONNULL_END 2206 2207 //%PDDM-DEFINE DECLARE_DICTIONARIES() 2208 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt32, uint32_t) 2209 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int32, int32_t) 2210 //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt64, uint64_t) 2211 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int64, int64_t) 2212 //%DICTIONARY_INTERFACES_FOR_POD_KEY(Bool, BOOL) 2213 //%DICTIONARY_POD_INTERFACES_FOR_KEY(String, NSString, *, OBJECT) 2214 //%PDDM-DEFINE DICTIONARY_INTERFACES_FOR_POD_KEY(KEY_NAME, KEY_TYPE) 2215 //%DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, , POD) 2216 //%DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, Object, ObjectType) 2217 //%PDDM-DEFINE DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, KisP, KHELPER) 2218 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt32, uint32_t) 2219 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int32, int32_t) 2220 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt64, uint64_t) 2221 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int64, int64_t) 2222 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Bool, BOOL) 2223 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Float, float) 2224 //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Double, double) 2225 //%DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Enum, int32_t) 2226 //%PDDM-DEFINE DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE) 2227 //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, POD, VALUE_NAME, value) 2228 //%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, VALUE_NAME, VALUE_TYPE) 2229 //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE, OBJECT, Object, object) 2230 //%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME) 2231 //%// Returns YES/NO to indicate if the key was found or not, filling in the value 2232 //%// only when the key was found. 2233 //%- (BOOL)get##VNAME##:(nullable VALUE_TYPE *)value forKey:(KEY_TYPE)key; 2234 //%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_TYPE, VNAME) 2235 //%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key; 2236 //%PDDM-DEFINE VALUE_FOR_KEY_Enum(KEY_TYPE, VALUE_TYPE, VNAME) 2237 //%VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME) 2238 //%PDDM-DEFINE ARRAY_ARG_MODIFIERPOD() 2239 // Nothing 2240 //%PDDM-DEFINE ARRAY_ARG_MODIFIEREnum() 2241 // Nothing 2242 //%PDDM-DEFINE ARRAY_ARG_MODIFIEROBJECT() 2243 //%GPB_UNSAFE_UNRETAINED ## 2244 //%PDDM-DEFINE DICTIONARY_CLASS_DECLPOD(KEY_NAME, VALUE_NAME, VALUE_TYPE) 2245 //%GPB##KEY_NAME##VALUE_NAME##Dictionary 2246 //%PDDM-DEFINE DICTIONARY_CLASS_DECLEnum(KEY_NAME, VALUE_NAME, VALUE_TYPE) 2247 //%GPB##KEY_NAME##VALUE_NAME##Dictionary 2248 //%PDDM-DEFINE DICTIONARY_CLASS_DECLOBJECT(KEY_NAME, VALUE_NAME, VALUE_TYPE) 2249 //%GPB##KEY_NAME##VALUE_NAME##Dictionary<__covariant VALUE_TYPE> 2250 //%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 2251 //%#pragma mark - KEY_NAME -> VALUE_NAME 2252 //% 2253 //%@interface DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) : NSObject <NSCopying> 2254 //% 2255 //%@property(nonatomic, readonly) NSUInteger count; 2256 //% 2257 //%+ (instancetype)dictionary; 2258 //%+ (instancetype)dictionaryWith##VNAME##:(VALUE_TYPE)##VNAME_VAR 2259 //% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key; 2260 //%+ (instancetype)dictionaryWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])##VNAME_VAR##s 2261 //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys 2262 //% ##VNAME$S## count:(NSUInteger)count; 2263 //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary; 2264 //%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems; 2265 //% 2266 //%- (instancetype)initWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])##VNAME_VAR##s 2267 //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys 2268 //% ##VNAME$S## count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2269 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary; 2270 //%- (instancetype)initWithCapacity:(NSUInteger)numItems; 2271 //% 2272 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 2273 //% 2274 //%- (void)addEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary; 2275 //% 2276 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 2277 //% 2278 //%@end 2279 //% 2280 2281 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE) 2282 //%DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, Enum) 2283 //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER) 2284 //%#pragma mark - KEY_NAME -> VALUE_NAME 2285 //% 2286 //%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary : NSObject <NSCopying> 2287 //% 2288 //%@property(nonatomic, readonly) NSUInteger count; 2289 //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 2290 //% 2291 //%+ (instancetype)dictionary; 2292 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func; 2293 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 2294 //% rawValue:(VALUE_TYPE)rawValue 2295 //% forKey:(KEY_TYPE##KisP$S##KisP)key; 2296 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 2297 //% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])values 2298 //% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys 2299 //% count:(NSUInteger)count; 2300 //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary; 2301 //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func 2302 //% capacity:(NSUInteger)numItems; 2303 //% 2304 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 2305 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 2306 //% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])values 2307 //% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys 2308 //% count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2309 //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary; 2310 //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 2311 //% capacity:(NSUInteger)numItems; 2312 //% 2313 //%// These will return kGPBUnrecognizedEnumeratorValue if the value for the key 2314 //%// is not a valid enumerator as defined by validationFunc. If the actual value is 2315 //%// desired, use "raw" version of the method. 2316 //% 2317 //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, Enum, value) 2318 //% 2319 //%// These methods bypass the validationFunc to provide access to values that were not 2320 //%// known at the time the binary was compiled. 2321 //% 2322 //%// Returns YES/NO to indicate if the key was found or not, filling in the value 2323 //%// only when the key was found. 2324 //%- (BOOL)getRawValue:(nullable VALUE_TYPE *)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key; 2325 //% 2326 //%- (void)enumerateKeysAndRawValuesUsingBlock: 2327 //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE rawValue, BOOL *stop))block; 2328 //% 2329 //%- (void)addRawEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary; 2330 //% 2331 //%// If value is not a valid enumerator as defined by validationFunc, these 2332 //%// methods will assert in debug, and will log in release and assign the value 2333 //%// to the default value. Use the rawValue methods below to assign non enumerator 2334 //%// values. 2335 //% 2336 //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, Enum, value) 2337 //% 2338 //%@end 2339 //% 2340 2341 //%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 2342 //%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_TYPE, VNAME) 2343 //% 2344 //%- (void)enumerateKeysAnd##VNAME##sUsingBlock: 2345 //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME_VAR, BOOL *stop))block; 2346 2347 //%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 2348 //%- (void)set##VNAME##:(VALUE_TYPE)##VNAME_VAR forKey:(KEY_TYPE##KisP$S##KisP)key; 2349 //%DICTIONARY_EXTRA_MUTABLE_METHODS_##VHELPER(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE) 2350 //%- (void)remove##VNAME##ForKey:(KEY_TYPE##KisP$S##KisP)aKey; 2351 //%- (void)removeAll; 2352 2353 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_POD(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE) 2354 // Empty 2355 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_OBJECT(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE) 2356 // Empty 2357 //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_Enum(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE) 2358 //% 2359 //%// This method bypass the validationFunc to provide setting of values that were not 2360 //%// known at the time the binary was compiled. 2361 //%- (void)setRawValue:(VALUE_TYPE)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key; 2362 //% 2363 //%// No validation applies to these methods. 2364 //% 2365