1*6777b538SAndroid Build Coastguard Worker // Protocol Buffers - Google's data interchange format 2*6777b538SAndroid Build Coastguard Worker // Copyright 2008 Google Inc. All rights reserved. 3*6777b538SAndroid Build Coastguard Worker // https://developers.google.com/protocol-buffers/ 4*6777b538SAndroid Build Coastguard Worker // 5*6777b538SAndroid Build Coastguard Worker // Redistribution and use in source and binary forms, with or without 6*6777b538SAndroid Build Coastguard Worker // modification, are permitted provided that the following conditions are 7*6777b538SAndroid Build Coastguard Worker // met: 8*6777b538SAndroid Build Coastguard Worker // 9*6777b538SAndroid Build Coastguard Worker // * Redistributions of source code must retain the above copyright 10*6777b538SAndroid Build Coastguard Worker // notice, this list of conditions and the following disclaimer. 11*6777b538SAndroid Build Coastguard Worker // * Redistributions in binary form must reproduce the above 12*6777b538SAndroid Build Coastguard Worker // copyright notice, this list of conditions and the following disclaimer 13*6777b538SAndroid Build Coastguard Worker // in the documentation and/or other materials provided with the 14*6777b538SAndroid Build Coastguard Worker // distribution. 15*6777b538SAndroid Build Coastguard Worker // * Neither the name of Google Inc. nor the names of its 16*6777b538SAndroid Build Coastguard Worker // contributors may be used to endorse or promote products derived from 17*6777b538SAndroid Build Coastguard Worker // this software without specific prior written permission. 18*6777b538SAndroid Build Coastguard Worker // 19*6777b538SAndroid Build Coastguard Worker // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20*6777b538SAndroid Build Coastguard Worker // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21*6777b538SAndroid Build Coastguard Worker // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22*6777b538SAndroid Build Coastguard Worker // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23*6777b538SAndroid Build Coastguard Worker // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24*6777b538SAndroid Build Coastguard Worker // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25*6777b538SAndroid Build Coastguard Worker // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26*6777b538SAndroid Build Coastguard Worker // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27*6777b538SAndroid Build Coastguard Worker // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28*6777b538SAndroid Build Coastguard Worker // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29*6777b538SAndroid Build Coastguard Worker // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30*6777b538SAndroid Build Coastguard Worker 31*6777b538SAndroid Build Coastguard Worker #import <Foundation/Foundation.h> 32*6777b538SAndroid Build Coastguard Worker 33*6777b538SAndroid Build Coastguard Worker #import "GPBRuntimeTypes.h" 34*6777b538SAndroid Build Coastguard Worker 35*6777b538SAndroid Build Coastguard Worker // Note on naming: for the classes holding numeric values, a more natural 36*6777b538SAndroid Build Coastguard Worker // naming of the method might be things like "-valueForKey:", 37*6777b538SAndroid Build Coastguard Worker // "-setValue:forKey:"; etc. But those selectors are also defined by Key Value 38*6777b538SAndroid Build Coastguard Worker // Coding (KVC) as categories on NSObject. So "overloading" the selectors with 39*6777b538SAndroid Build Coastguard Worker // other meanings can cause warnings (based on compiler settings), but more 40*6777b538SAndroid Build Coastguard Worker // importantly, some of those selector get called as KVC breaks up keypaths. 41*6777b538SAndroid Build Coastguard Worker // So if those selectors are used, using KVC will compile cleanly, but could 42*6777b538SAndroid Build Coastguard Worker // crash as it invokes those selectors with the wrong types of arguments. 43*6777b538SAndroid Build Coastguard Worker 44*6777b538SAndroid Build Coastguard Worker NS_ASSUME_NONNULL_BEGIN 45*6777b538SAndroid Build Coastguard Worker 46*6777b538SAndroid Build Coastguard Worker //%PDDM-EXPAND DECLARE_DICTIONARIES() 47*6777b538SAndroid Build Coastguard Worker // This block of code is generated, do not edit it directly. 48*6777b538SAndroid Build Coastguard Worker // clang-format off 49*6777b538SAndroid Build Coastguard Worker 50*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt32 -> UInt32 51*6777b538SAndroid Build Coastguard Worker 52*6777b538SAndroid Build Coastguard Worker /** 53*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint32_t, uint32_t> 54*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 55*6777b538SAndroid Build Coastguard Worker * 56*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 57*6777b538SAndroid Build Coastguard Worker **/ 58*6777b538SAndroid Build Coastguard Worker @interface GPBUInt32UInt32Dictionary : NSObject <NSCopying> 59*6777b538SAndroid Build Coastguard Worker 60*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 61*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 62*6777b538SAndroid Build Coastguard Worker 63*6777b538SAndroid Build Coastguard Worker /** 64*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 65*6777b538SAndroid Build Coastguard Worker * 66*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 67*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 68*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 69*6777b538SAndroid Build Coastguard Worker * 70*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 71*6777b538SAndroid Build Coastguard Worker **/ 72*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithUInt32s:(const uint32_t [__nullable])values 73*6777b538SAndroid Build Coastguard Worker forKeys:(const uint32_t [__nullable])keys 74*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 75*6777b538SAndroid Build Coastguard Worker 76*6777b538SAndroid Build Coastguard Worker /** 77*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 78*6777b538SAndroid Build Coastguard Worker * 79*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 80*6777b538SAndroid Build Coastguard Worker * 81*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 82*6777b538SAndroid Build Coastguard Worker **/ 83*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary; 84*6777b538SAndroid Build Coastguard Worker 85*6777b538SAndroid Build Coastguard Worker /** 86*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 87*6777b538SAndroid Build Coastguard Worker * 88*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 89*6777b538SAndroid Build Coastguard Worker * 90*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 91*6777b538SAndroid Build Coastguard Worker **/ 92*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 93*6777b538SAndroid Build Coastguard Worker 94*6777b538SAndroid Build Coastguard Worker /** 95*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 96*6777b538SAndroid Build Coastguard Worker * 97*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 98*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 99*6777b538SAndroid Build Coastguard Worker * 100*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 101*6777b538SAndroid Build Coastguard Worker **/ 102*6777b538SAndroid Build Coastguard Worker - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint32_t)key; 103*6777b538SAndroid Build Coastguard Worker 104*6777b538SAndroid Build Coastguard Worker /** 105*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 106*6777b538SAndroid Build Coastguard Worker * 107*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 108*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 109*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 110*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 111*6777b538SAndroid Build Coastguard Worker **/ 112*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndUInt32sUsingBlock: 113*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint32_t key, uint32_t value, BOOL *stop))block; 114*6777b538SAndroid Build Coastguard Worker 115*6777b538SAndroid Build Coastguard Worker /** 116*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 117*6777b538SAndroid Build Coastguard Worker * 118*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 119*6777b538SAndroid Build Coastguard Worker * dictionary. 120*6777b538SAndroid Build Coastguard Worker **/ 121*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt32UInt32Dictionary *)otherDictionary; 122*6777b538SAndroid Build Coastguard Worker 123*6777b538SAndroid Build Coastguard Worker /** 124*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 125*6777b538SAndroid Build Coastguard Worker * 126*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 127*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 128*6777b538SAndroid Build Coastguard Worker **/ 129*6777b538SAndroid Build Coastguard Worker - (void)setUInt32:(uint32_t)value forKey:(uint32_t)key; 130*6777b538SAndroid Build Coastguard Worker 131*6777b538SAndroid Build Coastguard Worker /** 132*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 133*6777b538SAndroid Build Coastguard Worker * 134*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 135*6777b538SAndroid Build Coastguard Worker **/ 136*6777b538SAndroid Build Coastguard Worker - (void)removeUInt32ForKey:(uint32_t)aKey; 137*6777b538SAndroid Build Coastguard Worker 138*6777b538SAndroid Build Coastguard Worker /** 139*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 140*6777b538SAndroid Build Coastguard Worker **/ 141*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 142*6777b538SAndroid Build Coastguard Worker 143*6777b538SAndroid Build Coastguard Worker @end 144*6777b538SAndroid Build Coastguard Worker 145*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt32 -> Int32 146*6777b538SAndroid Build Coastguard Worker 147*6777b538SAndroid Build Coastguard Worker /** 148*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint32_t, int32_t> 149*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 150*6777b538SAndroid Build Coastguard Worker * 151*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 152*6777b538SAndroid Build Coastguard Worker **/ 153*6777b538SAndroid Build Coastguard Worker @interface GPBUInt32Int32Dictionary : NSObject <NSCopying> 154*6777b538SAndroid Build Coastguard Worker 155*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 156*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 157*6777b538SAndroid Build Coastguard Worker 158*6777b538SAndroid Build Coastguard Worker /** 159*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 160*6777b538SAndroid Build Coastguard Worker * 161*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 162*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 163*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 164*6777b538SAndroid Build Coastguard Worker * 165*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 166*6777b538SAndroid Build Coastguard Worker **/ 167*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithInt32s:(const int32_t [__nullable])values 168*6777b538SAndroid Build Coastguard Worker forKeys:(const uint32_t [__nullable])keys 169*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 170*6777b538SAndroid Build Coastguard Worker 171*6777b538SAndroid Build Coastguard Worker /** 172*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 173*6777b538SAndroid Build Coastguard Worker * 174*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 175*6777b538SAndroid Build Coastguard Worker * 176*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 177*6777b538SAndroid Build Coastguard Worker **/ 178*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt32Int32Dictionary *)dictionary; 179*6777b538SAndroid Build Coastguard Worker 180*6777b538SAndroid Build Coastguard Worker /** 181*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 182*6777b538SAndroid Build Coastguard Worker * 183*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 184*6777b538SAndroid Build Coastguard Worker * 185*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 186*6777b538SAndroid Build Coastguard Worker **/ 187*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 188*6777b538SAndroid Build Coastguard Worker 189*6777b538SAndroid Build Coastguard Worker /** 190*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 191*6777b538SAndroid Build Coastguard Worker * 192*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 193*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 194*6777b538SAndroid Build Coastguard Worker * 195*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 196*6777b538SAndroid Build Coastguard Worker **/ 197*6777b538SAndroid Build Coastguard Worker - (BOOL)getInt32:(nullable int32_t *)value forKey:(uint32_t)key; 198*6777b538SAndroid Build Coastguard Worker 199*6777b538SAndroid Build Coastguard Worker /** 200*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 201*6777b538SAndroid Build Coastguard Worker * 202*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 203*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 204*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 205*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 206*6777b538SAndroid Build Coastguard Worker **/ 207*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndInt32sUsingBlock: 208*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint32_t key, int32_t value, BOOL *stop))block; 209*6777b538SAndroid Build Coastguard Worker 210*6777b538SAndroid Build Coastguard Worker /** 211*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 212*6777b538SAndroid Build Coastguard Worker * 213*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 214*6777b538SAndroid Build Coastguard Worker * dictionary. 215*6777b538SAndroid Build Coastguard Worker **/ 216*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt32Int32Dictionary *)otherDictionary; 217*6777b538SAndroid Build Coastguard Worker 218*6777b538SAndroid Build Coastguard Worker /** 219*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 220*6777b538SAndroid Build Coastguard Worker * 221*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 222*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 223*6777b538SAndroid Build Coastguard Worker **/ 224*6777b538SAndroid Build Coastguard Worker - (void)setInt32:(int32_t)value forKey:(uint32_t)key; 225*6777b538SAndroid Build Coastguard Worker 226*6777b538SAndroid Build Coastguard Worker /** 227*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 228*6777b538SAndroid Build Coastguard Worker * 229*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 230*6777b538SAndroid Build Coastguard Worker **/ 231*6777b538SAndroid Build Coastguard Worker - (void)removeInt32ForKey:(uint32_t)aKey; 232*6777b538SAndroid Build Coastguard Worker 233*6777b538SAndroid Build Coastguard Worker /** 234*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 235*6777b538SAndroid Build Coastguard Worker **/ 236*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 237*6777b538SAndroid Build Coastguard Worker 238*6777b538SAndroid Build Coastguard Worker @end 239*6777b538SAndroid Build Coastguard Worker 240*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt32 -> UInt64 241*6777b538SAndroid Build Coastguard Worker 242*6777b538SAndroid Build Coastguard Worker /** 243*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint32_t, uint64_t> 244*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 245*6777b538SAndroid Build Coastguard Worker * 246*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 247*6777b538SAndroid Build Coastguard Worker **/ 248*6777b538SAndroid Build Coastguard Worker @interface GPBUInt32UInt64Dictionary : NSObject <NSCopying> 249*6777b538SAndroid Build Coastguard Worker 250*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 251*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 252*6777b538SAndroid Build Coastguard Worker 253*6777b538SAndroid Build Coastguard Worker /** 254*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 255*6777b538SAndroid Build Coastguard Worker * 256*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 257*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 258*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 259*6777b538SAndroid Build Coastguard Worker * 260*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 261*6777b538SAndroid Build Coastguard Worker **/ 262*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithUInt64s:(const uint64_t [__nullable])values 263*6777b538SAndroid Build Coastguard Worker forKeys:(const uint32_t [__nullable])keys 264*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 265*6777b538SAndroid Build Coastguard Worker 266*6777b538SAndroid Build Coastguard Worker /** 267*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 268*6777b538SAndroid Build Coastguard Worker * 269*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 270*6777b538SAndroid Build Coastguard Worker * 271*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 272*6777b538SAndroid Build Coastguard Worker **/ 273*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary; 274*6777b538SAndroid Build Coastguard Worker 275*6777b538SAndroid Build Coastguard Worker /** 276*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 277*6777b538SAndroid Build Coastguard Worker * 278*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 279*6777b538SAndroid Build Coastguard Worker * 280*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 281*6777b538SAndroid Build Coastguard Worker **/ 282*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 283*6777b538SAndroid Build Coastguard Worker 284*6777b538SAndroid Build Coastguard Worker /** 285*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 286*6777b538SAndroid Build Coastguard Worker * 287*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 288*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 289*6777b538SAndroid Build Coastguard Worker * 290*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 291*6777b538SAndroid Build Coastguard Worker **/ 292*6777b538SAndroid Build Coastguard Worker - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint32_t)key; 293*6777b538SAndroid Build Coastguard Worker 294*6777b538SAndroid Build Coastguard Worker /** 295*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 296*6777b538SAndroid Build Coastguard Worker * 297*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 298*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 299*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 300*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 301*6777b538SAndroid Build Coastguard Worker **/ 302*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndUInt64sUsingBlock: 303*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint32_t key, uint64_t value, BOOL *stop))block; 304*6777b538SAndroid Build Coastguard Worker 305*6777b538SAndroid Build Coastguard Worker /** 306*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 307*6777b538SAndroid Build Coastguard Worker * 308*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 309*6777b538SAndroid Build Coastguard Worker * dictionary. 310*6777b538SAndroid Build Coastguard Worker **/ 311*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt32UInt64Dictionary *)otherDictionary; 312*6777b538SAndroid Build Coastguard Worker 313*6777b538SAndroid Build Coastguard Worker /** 314*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 315*6777b538SAndroid Build Coastguard Worker * 316*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 317*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 318*6777b538SAndroid Build Coastguard Worker **/ 319*6777b538SAndroid Build Coastguard Worker - (void)setUInt64:(uint64_t)value forKey:(uint32_t)key; 320*6777b538SAndroid Build Coastguard Worker 321*6777b538SAndroid Build Coastguard Worker /** 322*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 323*6777b538SAndroid Build Coastguard Worker * 324*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 325*6777b538SAndroid Build Coastguard Worker **/ 326*6777b538SAndroid Build Coastguard Worker - (void)removeUInt64ForKey:(uint32_t)aKey; 327*6777b538SAndroid Build Coastguard Worker 328*6777b538SAndroid Build Coastguard Worker /** 329*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 330*6777b538SAndroid Build Coastguard Worker **/ 331*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 332*6777b538SAndroid Build Coastguard Worker 333*6777b538SAndroid Build Coastguard Worker @end 334*6777b538SAndroid Build Coastguard Worker 335*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt32 -> Int64 336*6777b538SAndroid Build Coastguard Worker 337*6777b538SAndroid Build Coastguard Worker /** 338*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint32_t, int64_t> 339*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 340*6777b538SAndroid Build Coastguard Worker * 341*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 342*6777b538SAndroid Build Coastguard Worker **/ 343*6777b538SAndroid Build Coastguard Worker @interface GPBUInt32Int64Dictionary : NSObject <NSCopying> 344*6777b538SAndroid Build Coastguard Worker 345*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 346*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 347*6777b538SAndroid Build Coastguard Worker 348*6777b538SAndroid Build Coastguard Worker /** 349*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 350*6777b538SAndroid Build Coastguard Worker * 351*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 352*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 353*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 354*6777b538SAndroid Build Coastguard Worker * 355*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 356*6777b538SAndroid Build Coastguard Worker **/ 357*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithInt64s:(const int64_t [__nullable])values 358*6777b538SAndroid Build Coastguard Worker forKeys:(const uint32_t [__nullable])keys 359*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 360*6777b538SAndroid Build Coastguard Worker 361*6777b538SAndroid Build Coastguard Worker /** 362*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 363*6777b538SAndroid Build Coastguard Worker * 364*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 365*6777b538SAndroid Build Coastguard Worker * 366*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 367*6777b538SAndroid Build Coastguard Worker **/ 368*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt32Int64Dictionary *)dictionary; 369*6777b538SAndroid Build Coastguard Worker 370*6777b538SAndroid Build Coastguard Worker /** 371*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 372*6777b538SAndroid Build Coastguard Worker * 373*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 374*6777b538SAndroid Build Coastguard Worker * 375*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 376*6777b538SAndroid Build Coastguard Worker **/ 377*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 378*6777b538SAndroid Build Coastguard Worker 379*6777b538SAndroid Build Coastguard Worker /** 380*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 381*6777b538SAndroid Build Coastguard Worker * 382*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 383*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 384*6777b538SAndroid Build Coastguard Worker * 385*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 386*6777b538SAndroid Build Coastguard Worker **/ 387*6777b538SAndroid Build Coastguard Worker - (BOOL)getInt64:(nullable int64_t *)value forKey:(uint32_t)key; 388*6777b538SAndroid Build Coastguard Worker 389*6777b538SAndroid Build Coastguard Worker /** 390*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 391*6777b538SAndroid Build Coastguard Worker * 392*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 393*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 394*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 395*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 396*6777b538SAndroid Build Coastguard Worker **/ 397*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndInt64sUsingBlock: 398*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint32_t key, int64_t value, BOOL *stop))block; 399*6777b538SAndroid Build Coastguard Worker 400*6777b538SAndroid Build Coastguard Worker /** 401*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 402*6777b538SAndroid Build Coastguard Worker * 403*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 404*6777b538SAndroid Build Coastguard Worker * dictionary. 405*6777b538SAndroid Build Coastguard Worker **/ 406*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt32Int64Dictionary *)otherDictionary; 407*6777b538SAndroid Build Coastguard Worker 408*6777b538SAndroid Build Coastguard Worker /** 409*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 410*6777b538SAndroid Build Coastguard Worker * 411*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 412*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 413*6777b538SAndroid Build Coastguard Worker **/ 414*6777b538SAndroid Build Coastguard Worker - (void)setInt64:(int64_t)value forKey:(uint32_t)key; 415*6777b538SAndroid Build Coastguard Worker 416*6777b538SAndroid Build Coastguard Worker /** 417*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 418*6777b538SAndroid Build Coastguard Worker * 419*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 420*6777b538SAndroid Build Coastguard Worker **/ 421*6777b538SAndroid Build Coastguard Worker - (void)removeInt64ForKey:(uint32_t)aKey; 422*6777b538SAndroid Build Coastguard Worker 423*6777b538SAndroid Build Coastguard Worker /** 424*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 425*6777b538SAndroid Build Coastguard Worker **/ 426*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 427*6777b538SAndroid Build Coastguard Worker 428*6777b538SAndroid Build Coastguard Worker @end 429*6777b538SAndroid Build Coastguard Worker 430*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt32 -> Bool 431*6777b538SAndroid Build Coastguard Worker 432*6777b538SAndroid Build Coastguard Worker /** 433*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint32_t, BOOL> 434*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 435*6777b538SAndroid Build Coastguard Worker * 436*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 437*6777b538SAndroid Build Coastguard Worker **/ 438*6777b538SAndroid Build Coastguard Worker @interface GPBUInt32BoolDictionary : NSObject <NSCopying> 439*6777b538SAndroid Build Coastguard Worker 440*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 441*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 442*6777b538SAndroid Build Coastguard Worker 443*6777b538SAndroid Build Coastguard Worker /** 444*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 445*6777b538SAndroid Build Coastguard Worker * 446*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 447*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 448*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 449*6777b538SAndroid Build Coastguard Worker * 450*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 451*6777b538SAndroid Build Coastguard Worker **/ 452*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithBools:(const BOOL [__nullable])values 453*6777b538SAndroid Build Coastguard Worker forKeys:(const uint32_t [__nullable])keys 454*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 455*6777b538SAndroid Build Coastguard Worker 456*6777b538SAndroid Build Coastguard Worker /** 457*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 458*6777b538SAndroid Build Coastguard Worker * 459*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 460*6777b538SAndroid Build Coastguard Worker * 461*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 462*6777b538SAndroid Build Coastguard Worker **/ 463*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt32BoolDictionary *)dictionary; 464*6777b538SAndroid Build Coastguard Worker 465*6777b538SAndroid Build Coastguard Worker /** 466*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 467*6777b538SAndroid Build Coastguard Worker * 468*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 469*6777b538SAndroid Build Coastguard Worker * 470*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 471*6777b538SAndroid Build Coastguard Worker **/ 472*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 473*6777b538SAndroid Build Coastguard Worker 474*6777b538SAndroid Build Coastguard Worker /** 475*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 476*6777b538SAndroid Build Coastguard Worker * 477*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 478*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 479*6777b538SAndroid Build Coastguard Worker * 480*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 481*6777b538SAndroid Build Coastguard Worker **/ 482*6777b538SAndroid Build Coastguard Worker - (BOOL)getBool:(nullable BOOL *)value forKey:(uint32_t)key; 483*6777b538SAndroid Build Coastguard Worker 484*6777b538SAndroid Build Coastguard Worker /** 485*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 486*6777b538SAndroid Build Coastguard Worker * 487*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 488*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 489*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 490*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 491*6777b538SAndroid Build Coastguard Worker **/ 492*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndBoolsUsingBlock: 493*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint32_t key, BOOL value, BOOL *stop))block; 494*6777b538SAndroid Build Coastguard Worker 495*6777b538SAndroid Build Coastguard Worker /** 496*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 497*6777b538SAndroid Build Coastguard Worker * 498*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 499*6777b538SAndroid Build Coastguard Worker * dictionary. 500*6777b538SAndroid Build Coastguard Worker **/ 501*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt32BoolDictionary *)otherDictionary; 502*6777b538SAndroid Build Coastguard Worker 503*6777b538SAndroid Build Coastguard Worker /** 504*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 505*6777b538SAndroid Build Coastguard Worker * 506*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 507*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 508*6777b538SAndroid Build Coastguard Worker **/ 509*6777b538SAndroid Build Coastguard Worker - (void)setBool:(BOOL)value forKey:(uint32_t)key; 510*6777b538SAndroid Build Coastguard Worker 511*6777b538SAndroid Build Coastguard Worker /** 512*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 513*6777b538SAndroid Build Coastguard Worker * 514*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 515*6777b538SAndroid Build Coastguard Worker **/ 516*6777b538SAndroid Build Coastguard Worker - (void)removeBoolForKey:(uint32_t)aKey; 517*6777b538SAndroid Build Coastguard Worker 518*6777b538SAndroid Build Coastguard Worker /** 519*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 520*6777b538SAndroid Build Coastguard Worker **/ 521*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 522*6777b538SAndroid Build Coastguard Worker 523*6777b538SAndroid Build Coastguard Worker @end 524*6777b538SAndroid Build Coastguard Worker 525*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt32 -> Float 526*6777b538SAndroid Build Coastguard Worker 527*6777b538SAndroid Build Coastguard Worker /** 528*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint32_t, float> 529*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 530*6777b538SAndroid Build Coastguard Worker * 531*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 532*6777b538SAndroid Build Coastguard Worker **/ 533*6777b538SAndroid Build Coastguard Worker @interface GPBUInt32FloatDictionary : NSObject <NSCopying> 534*6777b538SAndroid Build Coastguard Worker 535*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 536*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 537*6777b538SAndroid Build Coastguard Worker 538*6777b538SAndroid Build Coastguard Worker /** 539*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 540*6777b538SAndroid Build Coastguard Worker * 541*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 542*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 543*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 544*6777b538SAndroid Build Coastguard Worker * 545*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 546*6777b538SAndroid Build Coastguard Worker **/ 547*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithFloats:(const float [__nullable])values 548*6777b538SAndroid Build Coastguard Worker forKeys:(const uint32_t [__nullable])keys 549*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 550*6777b538SAndroid Build Coastguard Worker 551*6777b538SAndroid Build Coastguard Worker /** 552*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 553*6777b538SAndroid Build Coastguard Worker * 554*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 555*6777b538SAndroid Build Coastguard Worker * 556*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 557*6777b538SAndroid Build Coastguard Worker **/ 558*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt32FloatDictionary *)dictionary; 559*6777b538SAndroid Build Coastguard Worker 560*6777b538SAndroid Build Coastguard Worker /** 561*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 562*6777b538SAndroid Build Coastguard Worker * 563*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 564*6777b538SAndroid Build Coastguard Worker * 565*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 566*6777b538SAndroid Build Coastguard Worker **/ 567*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 568*6777b538SAndroid Build Coastguard Worker 569*6777b538SAndroid Build Coastguard Worker /** 570*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 571*6777b538SAndroid Build Coastguard Worker * 572*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 573*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 574*6777b538SAndroid Build Coastguard Worker * 575*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 576*6777b538SAndroid Build Coastguard Worker **/ 577*6777b538SAndroid Build Coastguard Worker - (BOOL)getFloat:(nullable float *)value forKey:(uint32_t)key; 578*6777b538SAndroid Build Coastguard Worker 579*6777b538SAndroid Build Coastguard Worker /** 580*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 581*6777b538SAndroid Build Coastguard Worker * 582*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 583*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 584*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 585*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 586*6777b538SAndroid Build Coastguard Worker **/ 587*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndFloatsUsingBlock: 588*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint32_t key, float value, BOOL *stop))block; 589*6777b538SAndroid Build Coastguard Worker 590*6777b538SAndroid Build Coastguard Worker /** 591*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 592*6777b538SAndroid Build Coastguard Worker * 593*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 594*6777b538SAndroid Build Coastguard Worker * dictionary. 595*6777b538SAndroid Build Coastguard Worker **/ 596*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt32FloatDictionary *)otherDictionary; 597*6777b538SAndroid Build Coastguard Worker 598*6777b538SAndroid Build Coastguard Worker /** 599*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 600*6777b538SAndroid Build Coastguard Worker * 601*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 602*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 603*6777b538SAndroid Build Coastguard Worker **/ 604*6777b538SAndroid Build Coastguard Worker - (void)setFloat:(float)value forKey:(uint32_t)key; 605*6777b538SAndroid Build Coastguard Worker 606*6777b538SAndroid Build Coastguard Worker /** 607*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 608*6777b538SAndroid Build Coastguard Worker * 609*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 610*6777b538SAndroid Build Coastguard Worker **/ 611*6777b538SAndroid Build Coastguard Worker - (void)removeFloatForKey:(uint32_t)aKey; 612*6777b538SAndroid Build Coastguard Worker 613*6777b538SAndroid Build Coastguard Worker /** 614*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 615*6777b538SAndroid Build Coastguard Worker **/ 616*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 617*6777b538SAndroid Build Coastguard Worker 618*6777b538SAndroid Build Coastguard Worker @end 619*6777b538SAndroid Build Coastguard Worker 620*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt32 -> Double 621*6777b538SAndroid Build Coastguard Worker 622*6777b538SAndroid Build Coastguard Worker /** 623*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint32_t, double> 624*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 625*6777b538SAndroid Build Coastguard Worker * 626*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 627*6777b538SAndroid Build Coastguard Worker **/ 628*6777b538SAndroid Build Coastguard Worker @interface GPBUInt32DoubleDictionary : NSObject <NSCopying> 629*6777b538SAndroid Build Coastguard Worker 630*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 631*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 632*6777b538SAndroid Build Coastguard Worker 633*6777b538SAndroid Build Coastguard Worker /** 634*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 635*6777b538SAndroid Build Coastguard Worker * 636*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 637*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 638*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 639*6777b538SAndroid Build Coastguard Worker * 640*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 641*6777b538SAndroid Build Coastguard Worker **/ 642*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDoubles:(const double [__nullable])values 643*6777b538SAndroid Build Coastguard Worker forKeys:(const uint32_t [__nullable])keys 644*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 645*6777b538SAndroid Build Coastguard Worker 646*6777b538SAndroid Build Coastguard Worker /** 647*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 648*6777b538SAndroid Build Coastguard Worker * 649*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 650*6777b538SAndroid Build Coastguard Worker * 651*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 652*6777b538SAndroid Build Coastguard Worker **/ 653*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt32DoubleDictionary *)dictionary; 654*6777b538SAndroid Build Coastguard Worker 655*6777b538SAndroid Build Coastguard Worker /** 656*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 657*6777b538SAndroid Build Coastguard Worker * 658*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 659*6777b538SAndroid Build Coastguard Worker * 660*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 661*6777b538SAndroid Build Coastguard Worker **/ 662*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 663*6777b538SAndroid Build Coastguard Worker 664*6777b538SAndroid Build Coastguard Worker /** 665*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 666*6777b538SAndroid Build Coastguard Worker * 667*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 668*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 669*6777b538SAndroid Build Coastguard Worker * 670*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 671*6777b538SAndroid Build Coastguard Worker **/ 672*6777b538SAndroid Build Coastguard Worker - (BOOL)getDouble:(nullable double *)value forKey:(uint32_t)key; 673*6777b538SAndroid Build Coastguard Worker 674*6777b538SAndroid Build Coastguard Worker /** 675*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 676*6777b538SAndroid Build Coastguard Worker * 677*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 678*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 679*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 680*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 681*6777b538SAndroid Build Coastguard Worker **/ 682*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndDoublesUsingBlock: 683*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint32_t key, double value, BOOL *stop))block; 684*6777b538SAndroid Build Coastguard Worker 685*6777b538SAndroid Build Coastguard Worker /** 686*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 687*6777b538SAndroid Build Coastguard Worker * 688*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 689*6777b538SAndroid Build Coastguard Worker * dictionary. 690*6777b538SAndroid Build Coastguard Worker **/ 691*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt32DoubleDictionary *)otherDictionary; 692*6777b538SAndroid Build Coastguard Worker 693*6777b538SAndroid Build Coastguard Worker /** 694*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 695*6777b538SAndroid Build Coastguard Worker * 696*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 697*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 698*6777b538SAndroid Build Coastguard Worker **/ 699*6777b538SAndroid Build Coastguard Worker - (void)setDouble:(double)value forKey:(uint32_t)key; 700*6777b538SAndroid Build Coastguard Worker 701*6777b538SAndroid Build Coastguard Worker /** 702*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 703*6777b538SAndroid Build Coastguard Worker * 704*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 705*6777b538SAndroid Build Coastguard Worker **/ 706*6777b538SAndroid Build Coastguard Worker - (void)removeDoubleForKey:(uint32_t)aKey; 707*6777b538SAndroid Build Coastguard Worker 708*6777b538SAndroid Build Coastguard Worker /** 709*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 710*6777b538SAndroid Build Coastguard Worker **/ 711*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 712*6777b538SAndroid Build Coastguard Worker 713*6777b538SAndroid Build Coastguard Worker @end 714*6777b538SAndroid Build Coastguard Worker 715*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt32 -> Enum 716*6777b538SAndroid Build Coastguard Worker 717*6777b538SAndroid Build Coastguard Worker /** 718*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint32_t, int32_t> 719*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 720*6777b538SAndroid Build Coastguard Worker * 721*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 722*6777b538SAndroid Build Coastguard Worker **/ 723*6777b538SAndroid Build Coastguard Worker @interface GPBUInt32EnumDictionary : NSObject <NSCopying> 724*6777b538SAndroid Build Coastguard Worker 725*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 726*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 727*6777b538SAndroid Build Coastguard Worker /** The validation function to check if the enums are valid. */ 728*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 729*6777b538SAndroid Build Coastguard Worker 730*6777b538SAndroid Build Coastguard Worker /** 731*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the given validation function. 732*6777b538SAndroid Build Coastguard Worker * 733*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 734*6777b538SAndroid Build Coastguard Worker * 735*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary. 736*6777b538SAndroid Build Coastguard Worker **/ 737*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 738*6777b538SAndroid Build Coastguard Worker 739*6777b538SAndroid Build Coastguard Worker /** 740*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the entries given. 741*6777b538SAndroid Build Coastguard Worker * 742*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 743*6777b538SAndroid Build Coastguard Worker * @param values The raw enum values values to be placed in the dictionary. 744*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 745*6777b538SAndroid Build Coastguard Worker * @param count The number of entries to store in the dictionary. 746*6777b538SAndroid Build Coastguard Worker * 747*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the keys and values in it. 748*6777b538SAndroid Build Coastguard Worker **/ 749*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 750*6777b538SAndroid Build Coastguard Worker rawValues:(const int32_t [__nullable])values 751*6777b538SAndroid Build Coastguard Worker forKeys:(const uint32_t [__nullable])keys 752*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 753*6777b538SAndroid Build Coastguard Worker 754*6777b538SAndroid Build Coastguard Worker /** 755*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the entries from the given. 756*6777b538SAndroid Build Coastguard Worker * dictionary. 757*6777b538SAndroid Build Coastguard Worker * 758*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to the dictionary. 759*6777b538SAndroid Build Coastguard Worker * 760*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries from the given 761*6777b538SAndroid Build Coastguard Worker * dictionary in it. 762*6777b538SAndroid Build Coastguard Worker **/ 763*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt32EnumDictionary *)dictionary; 764*6777b538SAndroid Build Coastguard Worker 765*6777b538SAndroid Build Coastguard Worker /** 766*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the given capacity. 767*6777b538SAndroid Build Coastguard Worker * 768*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 769*6777b538SAndroid Build Coastguard Worker * @param numItems Capacity needed for the dictionary. 770*6777b538SAndroid Build Coastguard Worker * 771*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the given capacity. 772*6777b538SAndroid Build Coastguard Worker **/ 773*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 774*6777b538SAndroid Build Coastguard Worker capacity:(NSUInteger)numItems; 775*6777b538SAndroid Build Coastguard Worker 776*6777b538SAndroid Build Coastguard Worker // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 777*6777b538SAndroid Build Coastguard Worker // is not a valid enumerator as defined by validationFunc. If the actual value is 778*6777b538SAndroid Build Coastguard Worker // desired, use "raw" version of the method. 779*6777b538SAndroid Build Coastguard Worker 780*6777b538SAndroid Build Coastguard Worker /** 781*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 782*6777b538SAndroid Build Coastguard Worker * 783*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 784*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 785*6777b538SAndroid Build Coastguard Worker * 786*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 787*6777b538SAndroid Build Coastguard Worker **/ 788*6777b538SAndroid Build Coastguard Worker - (BOOL)getEnum:(nullable int32_t *)value forKey:(uint32_t)key; 789*6777b538SAndroid Build Coastguard Worker 790*6777b538SAndroid Build Coastguard Worker /** 791*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 792*6777b538SAndroid Build Coastguard Worker * 793*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 794*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 795*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 796*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 797*6777b538SAndroid Build Coastguard Worker **/ 798*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndEnumsUsingBlock: 799*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint32_t key, int32_t value, BOOL *stop))block; 800*6777b538SAndroid Build Coastguard Worker 801*6777b538SAndroid Build Coastguard Worker /** 802*6777b538SAndroid Build Coastguard Worker * Gets the raw enum value for the given key. 803*6777b538SAndroid Build Coastguard Worker * 804*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the access of values that 805*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 806*6777b538SAndroid Build Coastguard Worker * 807*6777b538SAndroid Build Coastguard Worker * @param rawValue Pointer into which the value will be set, if found. 808*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 809*6777b538SAndroid Build Coastguard Worker * 810*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 811*6777b538SAndroid Build Coastguard Worker **/ 812*6777b538SAndroid Build Coastguard Worker - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint32_t)key; 813*6777b538SAndroid Build Coastguard Worker 814*6777b538SAndroid Build Coastguard Worker /** 815*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 816*6777b538SAndroid Build Coastguard Worker * 817*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the access of values that 818*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 819*6777b538SAndroid Build Coastguard Worker * 820*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 821*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 822*6777b538SAndroid Build Coastguard Worker * **rawValue**: The value for the current entry 823*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 824*6777b538SAndroid Build Coastguard Worker **/ 825*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndRawValuesUsingBlock: 826*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint32_t key, int32_t rawValue, BOOL *stop))block; 827*6777b538SAndroid Build Coastguard Worker 828*6777b538SAndroid Build Coastguard Worker /** 829*6777b538SAndroid Build Coastguard Worker * Adds the keys and raw enum values from another dictionary. 830*6777b538SAndroid Build Coastguard Worker * 831*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the setting of values that 832*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 833*6777b538SAndroid Build Coastguard Worker * 834*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 835*6777b538SAndroid Build Coastguard Worker * dictionary. 836*6777b538SAndroid Build Coastguard Worker **/ 837*6777b538SAndroid Build Coastguard Worker - (void)addRawEntriesFromDictionary:(GPBUInt32EnumDictionary *)otherDictionary; 838*6777b538SAndroid Build Coastguard Worker 839*6777b538SAndroid Build Coastguard Worker // If value is not a valid enumerator as defined by validationFunc, these 840*6777b538SAndroid Build Coastguard Worker // methods will assert in debug, and will log in release and assign the value 841*6777b538SAndroid Build Coastguard Worker // to the default value. Use the rawValue methods below to assign non enumerator 842*6777b538SAndroid Build Coastguard Worker // values. 843*6777b538SAndroid Build Coastguard Worker 844*6777b538SAndroid Build Coastguard Worker /** 845*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 846*6777b538SAndroid Build Coastguard Worker * 847*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 848*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 849*6777b538SAndroid Build Coastguard Worker **/ 850*6777b538SAndroid Build Coastguard Worker - (void)setEnum:(int32_t)value forKey:(uint32_t)key; 851*6777b538SAndroid Build Coastguard Worker 852*6777b538SAndroid Build Coastguard Worker /** 853*6777b538SAndroid Build Coastguard Worker * Sets the raw enum value for the given key. 854*6777b538SAndroid Build Coastguard Worker * 855*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the setting of values that 856*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 857*6777b538SAndroid Build Coastguard Worker * 858*6777b538SAndroid Build Coastguard Worker * @param rawValue The raw enum value to set. 859*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the raw enum value. 860*6777b538SAndroid Build Coastguard Worker **/ 861*6777b538SAndroid Build Coastguard Worker - (void)setRawValue:(int32_t)rawValue forKey:(uint32_t)key; 862*6777b538SAndroid Build Coastguard Worker 863*6777b538SAndroid Build Coastguard Worker /** 864*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 865*6777b538SAndroid Build Coastguard Worker * 866*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 867*6777b538SAndroid Build Coastguard Worker **/ 868*6777b538SAndroid Build Coastguard Worker - (void)removeEnumForKey:(uint32_t)aKey; 869*6777b538SAndroid Build Coastguard Worker 870*6777b538SAndroid Build Coastguard Worker /** 871*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 872*6777b538SAndroid Build Coastguard Worker **/ 873*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 874*6777b538SAndroid Build Coastguard Worker 875*6777b538SAndroid Build Coastguard Worker @end 876*6777b538SAndroid Build Coastguard Worker 877*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt32 -> Object 878*6777b538SAndroid Build Coastguard Worker 879*6777b538SAndroid Build Coastguard Worker /** 880*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint32_t, ObjectType> 881*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 882*6777b538SAndroid Build Coastguard Worker * 883*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 884*6777b538SAndroid Build Coastguard Worker **/ 885*6777b538SAndroid Build Coastguard Worker @interface GPBUInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying> 886*6777b538SAndroid Build Coastguard Worker 887*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 888*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 889*6777b538SAndroid Build Coastguard Worker 890*6777b538SAndroid Build Coastguard Worker /** 891*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 892*6777b538SAndroid Build Coastguard Worker * 893*6777b538SAndroid Build Coastguard Worker * @param objects The values to be placed in this dictionary. 894*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 895*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 896*6777b538SAndroid Build Coastguard Worker * 897*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 898*6777b538SAndroid Build Coastguard Worker **/ 899*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects 900*6777b538SAndroid Build Coastguard Worker forKeys:(const uint32_t [__nullable])keys 901*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 902*6777b538SAndroid Build Coastguard Worker 903*6777b538SAndroid Build Coastguard Worker /** 904*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 905*6777b538SAndroid Build Coastguard Worker * 906*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 907*6777b538SAndroid Build Coastguard Worker * 908*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 909*6777b538SAndroid Build Coastguard Worker **/ 910*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary; 911*6777b538SAndroid Build Coastguard Worker 912*6777b538SAndroid Build Coastguard Worker /** 913*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 914*6777b538SAndroid Build Coastguard Worker * 915*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 916*6777b538SAndroid Build Coastguard Worker * 917*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 918*6777b538SAndroid Build Coastguard Worker **/ 919*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 920*6777b538SAndroid Build Coastguard Worker 921*6777b538SAndroid Build Coastguard Worker /** 922*6777b538SAndroid Build Coastguard Worker * Fetches the object stored under the given key. 923*6777b538SAndroid Build Coastguard Worker * 924*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 925*6777b538SAndroid Build Coastguard Worker * 926*6777b538SAndroid Build Coastguard Worker * @return The object if found, nil otherwise. 927*6777b538SAndroid Build Coastguard Worker **/ 928*6777b538SAndroid Build Coastguard Worker - (ObjectType)objectForKey:(uint32_t)key; 929*6777b538SAndroid Build Coastguard Worker 930*6777b538SAndroid Build Coastguard Worker /** 931*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 932*6777b538SAndroid Build Coastguard Worker * 933*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 934*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 935*6777b538SAndroid Build Coastguard Worker * **object**: The value for the current entry 936*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 937*6777b538SAndroid Build Coastguard Worker **/ 938*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndObjectsUsingBlock: 939*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint32_t key, ObjectType object, BOOL *stop))block; 940*6777b538SAndroid Build Coastguard Worker 941*6777b538SAndroid Build Coastguard Worker /** 942*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 943*6777b538SAndroid Build Coastguard Worker * 944*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 945*6777b538SAndroid Build Coastguard Worker * dictionary. 946*6777b538SAndroid Build Coastguard Worker **/ 947*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt32ObjectDictionary *)otherDictionary; 948*6777b538SAndroid Build Coastguard Worker 949*6777b538SAndroid Build Coastguard Worker /** 950*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 951*6777b538SAndroid Build Coastguard Worker * 952*6777b538SAndroid Build Coastguard Worker * @param object The value to set. 953*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 954*6777b538SAndroid Build Coastguard Worker **/ 955*6777b538SAndroid Build Coastguard Worker - (void)setObject:(ObjectType)object forKey:(uint32_t)key; 956*6777b538SAndroid Build Coastguard Worker 957*6777b538SAndroid Build Coastguard Worker /** 958*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 959*6777b538SAndroid Build Coastguard Worker * 960*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 961*6777b538SAndroid Build Coastguard Worker **/ 962*6777b538SAndroid Build Coastguard Worker - (void)removeObjectForKey:(uint32_t)aKey; 963*6777b538SAndroid Build Coastguard Worker 964*6777b538SAndroid Build Coastguard Worker /** 965*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 966*6777b538SAndroid Build Coastguard Worker **/ 967*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 968*6777b538SAndroid Build Coastguard Worker 969*6777b538SAndroid Build Coastguard Worker @end 970*6777b538SAndroid Build Coastguard Worker 971*6777b538SAndroid Build Coastguard Worker #pragma mark - Int32 -> UInt32 972*6777b538SAndroid Build Coastguard Worker 973*6777b538SAndroid Build Coastguard Worker /** 974*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int32_t, uint32_t> 975*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 976*6777b538SAndroid Build Coastguard Worker * 977*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 978*6777b538SAndroid Build Coastguard Worker **/ 979*6777b538SAndroid Build Coastguard Worker @interface GPBInt32UInt32Dictionary : NSObject <NSCopying> 980*6777b538SAndroid Build Coastguard Worker 981*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 982*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 983*6777b538SAndroid Build Coastguard Worker 984*6777b538SAndroid Build Coastguard Worker /** 985*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 986*6777b538SAndroid Build Coastguard Worker * 987*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 988*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 989*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 990*6777b538SAndroid Build Coastguard Worker * 991*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 992*6777b538SAndroid Build Coastguard Worker **/ 993*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithUInt32s:(const uint32_t [__nullable])values 994*6777b538SAndroid Build Coastguard Worker forKeys:(const int32_t [__nullable])keys 995*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 996*6777b538SAndroid Build Coastguard Worker 997*6777b538SAndroid Build Coastguard Worker /** 998*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 999*6777b538SAndroid Build Coastguard Worker * 1000*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 1001*6777b538SAndroid Build Coastguard Worker * 1002*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 1003*6777b538SAndroid Build Coastguard Worker **/ 1004*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt32UInt32Dictionary *)dictionary; 1005*6777b538SAndroid Build Coastguard Worker 1006*6777b538SAndroid Build Coastguard Worker /** 1007*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 1008*6777b538SAndroid Build Coastguard Worker * 1009*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 1010*6777b538SAndroid Build Coastguard Worker * 1011*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 1012*6777b538SAndroid Build Coastguard Worker **/ 1013*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 1014*6777b538SAndroid Build Coastguard Worker 1015*6777b538SAndroid Build Coastguard Worker /** 1016*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 1017*6777b538SAndroid Build Coastguard Worker * 1018*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 1019*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 1020*6777b538SAndroid Build Coastguard Worker * 1021*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 1022*6777b538SAndroid Build Coastguard Worker **/ 1023*6777b538SAndroid Build Coastguard Worker - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int32_t)key; 1024*6777b538SAndroid Build Coastguard Worker 1025*6777b538SAndroid Build Coastguard Worker /** 1026*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 1027*6777b538SAndroid Build Coastguard Worker * 1028*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 1029*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 1030*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 1031*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 1032*6777b538SAndroid Build Coastguard Worker **/ 1033*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndUInt32sUsingBlock: 1034*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int32_t key, uint32_t value, BOOL *stop))block; 1035*6777b538SAndroid Build Coastguard Worker 1036*6777b538SAndroid Build Coastguard Worker /** 1037*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 1038*6777b538SAndroid Build Coastguard Worker * 1039*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 1040*6777b538SAndroid Build Coastguard Worker * dictionary. 1041*6777b538SAndroid Build Coastguard Worker **/ 1042*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt32UInt32Dictionary *)otherDictionary; 1043*6777b538SAndroid Build Coastguard Worker 1044*6777b538SAndroid Build Coastguard Worker /** 1045*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 1046*6777b538SAndroid Build Coastguard Worker * 1047*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 1048*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 1049*6777b538SAndroid Build Coastguard Worker **/ 1050*6777b538SAndroid Build Coastguard Worker - (void)setUInt32:(uint32_t)value forKey:(int32_t)key; 1051*6777b538SAndroid Build Coastguard Worker 1052*6777b538SAndroid Build Coastguard Worker /** 1053*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 1054*6777b538SAndroid Build Coastguard Worker * 1055*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 1056*6777b538SAndroid Build Coastguard Worker **/ 1057*6777b538SAndroid Build Coastguard Worker - (void)removeUInt32ForKey:(int32_t)aKey; 1058*6777b538SAndroid Build Coastguard Worker 1059*6777b538SAndroid Build Coastguard Worker /** 1060*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 1061*6777b538SAndroid Build Coastguard Worker **/ 1062*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 1063*6777b538SAndroid Build Coastguard Worker 1064*6777b538SAndroid Build Coastguard Worker @end 1065*6777b538SAndroid Build Coastguard Worker 1066*6777b538SAndroid Build Coastguard Worker #pragma mark - Int32 -> Int32 1067*6777b538SAndroid Build Coastguard Worker 1068*6777b538SAndroid Build Coastguard Worker /** 1069*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int32_t, int32_t> 1070*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 1071*6777b538SAndroid Build Coastguard Worker * 1072*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 1073*6777b538SAndroid Build Coastguard Worker **/ 1074*6777b538SAndroid Build Coastguard Worker @interface GPBInt32Int32Dictionary : NSObject <NSCopying> 1075*6777b538SAndroid Build Coastguard Worker 1076*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 1077*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 1078*6777b538SAndroid Build Coastguard Worker 1079*6777b538SAndroid Build Coastguard Worker /** 1080*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 1081*6777b538SAndroid Build Coastguard Worker * 1082*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 1083*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 1084*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 1085*6777b538SAndroid Build Coastguard Worker * 1086*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 1087*6777b538SAndroid Build Coastguard Worker **/ 1088*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithInt32s:(const int32_t [__nullable])values 1089*6777b538SAndroid Build Coastguard Worker forKeys:(const int32_t [__nullable])keys 1090*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1091*6777b538SAndroid Build Coastguard Worker 1092*6777b538SAndroid Build Coastguard Worker /** 1093*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 1094*6777b538SAndroid Build Coastguard Worker * 1095*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 1096*6777b538SAndroid Build Coastguard Worker * 1097*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 1098*6777b538SAndroid Build Coastguard Worker **/ 1099*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt32Int32Dictionary *)dictionary; 1100*6777b538SAndroid Build Coastguard Worker 1101*6777b538SAndroid Build Coastguard Worker /** 1102*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 1103*6777b538SAndroid Build Coastguard Worker * 1104*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 1105*6777b538SAndroid Build Coastguard Worker * 1106*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 1107*6777b538SAndroid Build Coastguard Worker **/ 1108*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 1109*6777b538SAndroid Build Coastguard Worker 1110*6777b538SAndroid Build Coastguard Worker /** 1111*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 1112*6777b538SAndroid Build Coastguard Worker * 1113*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 1114*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 1115*6777b538SAndroid Build Coastguard Worker * 1116*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 1117*6777b538SAndroid Build Coastguard Worker **/ 1118*6777b538SAndroid Build Coastguard Worker - (BOOL)getInt32:(nullable int32_t *)value forKey:(int32_t)key; 1119*6777b538SAndroid Build Coastguard Worker 1120*6777b538SAndroid Build Coastguard Worker /** 1121*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 1122*6777b538SAndroid Build Coastguard Worker * 1123*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 1124*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 1125*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 1126*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 1127*6777b538SAndroid Build Coastguard Worker **/ 1128*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndInt32sUsingBlock: 1129*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int32_t key, int32_t value, BOOL *stop))block; 1130*6777b538SAndroid Build Coastguard Worker 1131*6777b538SAndroid Build Coastguard Worker /** 1132*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 1133*6777b538SAndroid Build Coastguard Worker * 1134*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 1135*6777b538SAndroid Build Coastguard Worker * dictionary. 1136*6777b538SAndroid Build Coastguard Worker **/ 1137*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt32Int32Dictionary *)otherDictionary; 1138*6777b538SAndroid Build Coastguard Worker 1139*6777b538SAndroid Build Coastguard Worker /** 1140*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 1141*6777b538SAndroid Build Coastguard Worker * 1142*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 1143*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 1144*6777b538SAndroid Build Coastguard Worker **/ 1145*6777b538SAndroid Build Coastguard Worker - (void)setInt32:(int32_t)value forKey:(int32_t)key; 1146*6777b538SAndroid Build Coastguard Worker 1147*6777b538SAndroid Build Coastguard Worker /** 1148*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 1149*6777b538SAndroid Build Coastguard Worker * 1150*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 1151*6777b538SAndroid Build Coastguard Worker **/ 1152*6777b538SAndroid Build Coastguard Worker - (void)removeInt32ForKey:(int32_t)aKey; 1153*6777b538SAndroid Build Coastguard Worker 1154*6777b538SAndroid Build Coastguard Worker /** 1155*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 1156*6777b538SAndroid Build Coastguard Worker **/ 1157*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 1158*6777b538SAndroid Build Coastguard Worker 1159*6777b538SAndroid Build Coastguard Worker @end 1160*6777b538SAndroid Build Coastguard Worker 1161*6777b538SAndroid Build Coastguard Worker #pragma mark - Int32 -> UInt64 1162*6777b538SAndroid Build Coastguard Worker 1163*6777b538SAndroid Build Coastguard Worker /** 1164*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int32_t, uint64_t> 1165*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 1166*6777b538SAndroid Build Coastguard Worker * 1167*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 1168*6777b538SAndroid Build Coastguard Worker **/ 1169*6777b538SAndroid Build Coastguard Worker @interface GPBInt32UInt64Dictionary : NSObject <NSCopying> 1170*6777b538SAndroid Build Coastguard Worker 1171*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 1172*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 1173*6777b538SAndroid Build Coastguard Worker 1174*6777b538SAndroid Build Coastguard Worker /** 1175*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 1176*6777b538SAndroid Build Coastguard Worker * 1177*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 1178*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 1179*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 1180*6777b538SAndroid Build Coastguard Worker * 1181*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 1182*6777b538SAndroid Build Coastguard Worker **/ 1183*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithUInt64s:(const uint64_t [__nullable])values 1184*6777b538SAndroid Build Coastguard Worker forKeys:(const int32_t [__nullable])keys 1185*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1186*6777b538SAndroid Build Coastguard Worker 1187*6777b538SAndroid Build Coastguard Worker /** 1188*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 1189*6777b538SAndroid Build Coastguard Worker * 1190*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 1191*6777b538SAndroid Build Coastguard Worker * 1192*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 1193*6777b538SAndroid Build Coastguard Worker **/ 1194*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt32UInt64Dictionary *)dictionary; 1195*6777b538SAndroid Build Coastguard Worker 1196*6777b538SAndroid Build Coastguard Worker /** 1197*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 1198*6777b538SAndroid Build Coastguard Worker * 1199*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 1200*6777b538SAndroid Build Coastguard Worker * 1201*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 1202*6777b538SAndroid Build Coastguard Worker **/ 1203*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 1204*6777b538SAndroid Build Coastguard Worker 1205*6777b538SAndroid Build Coastguard Worker /** 1206*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 1207*6777b538SAndroid Build Coastguard Worker * 1208*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 1209*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 1210*6777b538SAndroid Build Coastguard Worker * 1211*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 1212*6777b538SAndroid Build Coastguard Worker **/ 1213*6777b538SAndroid Build Coastguard Worker - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int32_t)key; 1214*6777b538SAndroid Build Coastguard Worker 1215*6777b538SAndroid Build Coastguard Worker /** 1216*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 1217*6777b538SAndroid Build Coastguard Worker * 1218*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 1219*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 1220*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 1221*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 1222*6777b538SAndroid Build Coastguard Worker **/ 1223*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndUInt64sUsingBlock: 1224*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int32_t key, uint64_t value, BOOL *stop))block; 1225*6777b538SAndroid Build Coastguard Worker 1226*6777b538SAndroid Build Coastguard Worker /** 1227*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 1228*6777b538SAndroid Build Coastguard Worker * 1229*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 1230*6777b538SAndroid Build Coastguard Worker * dictionary. 1231*6777b538SAndroid Build Coastguard Worker **/ 1232*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt32UInt64Dictionary *)otherDictionary; 1233*6777b538SAndroid Build Coastguard Worker 1234*6777b538SAndroid Build Coastguard Worker /** 1235*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 1236*6777b538SAndroid Build Coastguard Worker * 1237*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 1238*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 1239*6777b538SAndroid Build Coastguard Worker **/ 1240*6777b538SAndroid Build Coastguard Worker - (void)setUInt64:(uint64_t)value forKey:(int32_t)key; 1241*6777b538SAndroid Build Coastguard Worker 1242*6777b538SAndroid Build Coastguard Worker /** 1243*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 1244*6777b538SAndroid Build Coastguard Worker * 1245*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 1246*6777b538SAndroid Build Coastguard Worker **/ 1247*6777b538SAndroid Build Coastguard Worker - (void)removeUInt64ForKey:(int32_t)aKey; 1248*6777b538SAndroid Build Coastguard Worker 1249*6777b538SAndroid Build Coastguard Worker /** 1250*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 1251*6777b538SAndroid Build Coastguard Worker **/ 1252*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 1253*6777b538SAndroid Build Coastguard Worker 1254*6777b538SAndroid Build Coastguard Worker @end 1255*6777b538SAndroid Build Coastguard Worker 1256*6777b538SAndroid Build Coastguard Worker #pragma mark - Int32 -> Int64 1257*6777b538SAndroid Build Coastguard Worker 1258*6777b538SAndroid Build Coastguard Worker /** 1259*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int32_t, int64_t> 1260*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 1261*6777b538SAndroid Build Coastguard Worker * 1262*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 1263*6777b538SAndroid Build Coastguard Worker **/ 1264*6777b538SAndroid Build Coastguard Worker @interface GPBInt32Int64Dictionary : NSObject <NSCopying> 1265*6777b538SAndroid Build Coastguard Worker 1266*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 1267*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 1268*6777b538SAndroid Build Coastguard Worker 1269*6777b538SAndroid Build Coastguard Worker /** 1270*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 1271*6777b538SAndroid Build Coastguard Worker * 1272*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 1273*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 1274*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 1275*6777b538SAndroid Build Coastguard Worker * 1276*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 1277*6777b538SAndroid Build Coastguard Worker **/ 1278*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithInt64s:(const int64_t [__nullable])values 1279*6777b538SAndroid Build Coastguard Worker forKeys:(const int32_t [__nullable])keys 1280*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1281*6777b538SAndroid Build Coastguard Worker 1282*6777b538SAndroid Build Coastguard Worker /** 1283*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 1284*6777b538SAndroid Build Coastguard Worker * 1285*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 1286*6777b538SAndroid Build Coastguard Worker * 1287*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 1288*6777b538SAndroid Build Coastguard Worker **/ 1289*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt32Int64Dictionary *)dictionary; 1290*6777b538SAndroid Build Coastguard Worker 1291*6777b538SAndroid Build Coastguard Worker /** 1292*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 1293*6777b538SAndroid Build Coastguard Worker * 1294*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 1295*6777b538SAndroid Build Coastguard Worker * 1296*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 1297*6777b538SAndroid Build Coastguard Worker **/ 1298*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 1299*6777b538SAndroid Build Coastguard Worker 1300*6777b538SAndroid Build Coastguard Worker /** 1301*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 1302*6777b538SAndroid Build Coastguard Worker * 1303*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 1304*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 1305*6777b538SAndroid Build Coastguard Worker * 1306*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 1307*6777b538SAndroid Build Coastguard Worker **/ 1308*6777b538SAndroid Build Coastguard Worker - (BOOL)getInt64:(nullable int64_t *)value forKey:(int32_t)key; 1309*6777b538SAndroid Build Coastguard Worker 1310*6777b538SAndroid Build Coastguard Worker /** 1311*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 1312*6777b538SAndroid Build Coastguard Worker * 1313*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 1314*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 1315*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 1316*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 1317*6777b538SAndroid Build Coastguard Worker **/ 1318*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndInt64sUsingBlock: 1319*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int32_t key, int64_t value, BOOL *stop))block; 1320*6777b538SAndroid Build Coastguard Worker 1321*6777b538SAndroid Build Coastguard Worker /** 1322*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 1323*6777b538SAndroid Build Coastguard Worker * 1324*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 1325*6777b538SAndroid Build Coastguard Worker * dictionary. 1326*6777b538SAndroid Build Coastguard Worker **/ 1327*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt32Int64Dictionary *)otherDictionary; 1328*6777b538SAndroid Build Coastguard Worker 1329*6777b538SAndroid Build Coastguard Worker /** 1330*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 1331*6777b538SAndroid Build Coastguard Worker * 1332*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 1333*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 1334*6777b538SAndroid Build Coastguard Worker **/ 1335*6777b538SAndroid Build Coastguard Worker - (void)setInt64:(int64_t)value forKey:(int32_t)key; 1336*6777b538SAndroid Build Coastguard Worker 1337*6777b538SAndroid Build Coastguard Worker /** 1338*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 1339*6777b538SAndroid Build Coastguard Worker * 1340*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 1341*6777b538SAndroid Build Coastguard Worker **/ 1342*6777b538SAndroid Build Coastguard Worker - (void)removeInt64ForKey:(int32_t)aKey; 1343*6777b538SAndroid Build Coastguard Worker 1344*6777b538SAndroid Build Coastguard Worker /** 1345*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 1346*6777b538SAndroid Build Coastguard Worker **/ 1347*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 1348*6777b538SAndroid Build Coastguard Worker 1349*6777b538SAndroid Build Coastguard Worker @end 1350*6777b538SAndroid Build Coastguard Worker 1351*6777b538SAndroid Build Coastguard Worker #pragma mark - Int32 -> Bool 1352*6777b538SAndroid Build Coastguard Worker 1353*6777b538SAndroid Build Coastguard Worker /** 1354*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int32_t, BOOL> 1355*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 1356*6777b538SAndroid Build Coastguard Worker * 1357*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 1358*6777b538SAndroid Build Coastguard Worker **/ 1359*6777b538SAndroid Build Coastguard Worker @interface GPBInt32BoolDictionary : NSObject <NSCopying> 1360*6777b538SAndroid Build Coastguard Worker 1361*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 1362*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 1363*6777b538SAndroid Build Coastguard Worker 1364*6777b538SAndroid Build Coastguard Worker /** 1365*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 1366*6777b538SAndroid Build Coastguard Worker * 1367*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 1368*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 1369*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 1370*6777b538SAndroid Build Coastguard Worker * 1371*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 1372*6777b538SAndroid Build Coastguard Worker **/ 1373*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithBools:(const BOOL [__nullable])values 1374*6777b538SAndroid Build Coastguard Worker forKeys:(const int32_t [__nullable])keys 1375*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1376*6777b538SAndroid Build Coastguard Worker 1377*6777b538SAndroid Build Coastguard Worker /** 1378*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 1379*6777b538SAndroid Build Coastguard Worker * 1380*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 1381*6777b538SAndroid Build Coastguard Worker * 1382*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 1383*6777b538SAndroid Build Coastguard Worker **/ 1384*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt32BoolDictionary *)dictionary; 1385*6777b538SAndroid Build Coastguard Worker 1386*6777b538SAndroid Build Coastguard Worker /** 1387*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 1388*6777b538SAndroid Build Coastguard Worker * 1389*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 1390*6777b538SAndroid Build Coastguard Worker * 1391*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 1392*6777b538SAndroid Build Coastguard Worker **/ 1393*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 1394*6777b538SAndroid Build Coastguard Worker 1395*6777b538SAndroid Build Coastguard Worker /** 1396*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 1397*6777b538SAndroid Build Coastguard Worker * 1398*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 1399*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 1400*6777b538SAndroid Build Coastguard Worker * 1401*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 1402*6777b538SAndroid Build Coastguard Worker **/ 1403*6777b538SAndroid Build Coastguard Worker - (BOOL)getBool:(nullable BOOL *)value forKey:(int32_t)key; 1404*6777b538SAndroid Build Coastguard Worker 1405*6777b538SAndroid Build Coastguard Worker /** 1406*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 1407*6777b538SAndroid Build Coastguard Worker * 1408*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 1409*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 1410*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 1411*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 1412*6777b538SAndroid Build Coastguard Worker **/ 1413*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndBoolsUsingBlock: 1414*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int32_t key, BOOL value, BOOL *stop))block; 1415*6777b538SAndroid Build Coastguard Worker 1416*6777b538SAndroid Build Coastguard Worker /** 1417*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 1418*6777b538SAndroid Build Coastguard Worker * 1419*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 1420*6777b538SAndroid Build Coastguard Worker * dictionary. 1421*6777b538SAndroid Build Coastguard Worker **/ 1422*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt32BoolDictionary *)otherDictionary; 1423*6777b538SAndroid Build Coastguard Worker 1424*6777b538SAndroid Build Coastguard Worker /** 1425*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 1426*6777b538SAndroid Build Coastguard Worker * 1427*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 1428*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 1429*6777b538SAndroid Build Coastguard Worker **/ 1430*6777b538SAndroid Build Coastguard Worker - (void)setBool:(BOOL)value forKey:(int32_t)key; 1431*6777b538SAndroid Build Coastguard Worker 1432*6777b538SAndroid Build Coastguard Worker /** 1433*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 1434*6777b538SAndroid Build Coastguard Worker * 1435*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 1436*6777b538SAndroid Build Coastguard Worker **/ 1437*6777b538SAndroid Build Coastguard Worker - (void)removeBoolForKey:(int32_t)aKey; 1438*6777b538SAndroid Build Coastguard Worker 1439*6777b538SAndroid Build Coastguard Worker /** 1440*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 1441*6777b538SAndroid Build Coastguard Worker **/ 1442*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 1443*6777b538SAndroid Build Coastguard Worker 1444*6777b538SAndroid Build Coastguard Worker @end 1445*6777b538SAndroid Build Coastguard Worker 1446*6777b538SAndroid Build Coastguard Worker #pragma mark - Int32 -> Float 1447*6777b538SAndroid Build Coastguard Worker 1448*6777b538SAndroid Build Coastguard Worker /** 1449*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int32_t, float> 1450*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 1451*6777b538SAndroid Build Coastguard Worker * 1452*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 1453*6777b538SAndroid Build Coastguard Worker **/ 1454*6777b538SAndroid Build Coastguard Worker @interface GPBInt32FloatDictionary : NSObject <NSCopying> 1455*6777b538SAndroid Build Coastguard Worker 1456*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 1457*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 1458*6777b538SAndroid Build Coastguard Worker 1459*6777b538SAndroid Build Coastguard Worker /** 1460*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 1461*6777b538SAndroid Build Coastguard Worker * 1462*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 1463*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 1464*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 1465*6777b538SAndroid Build Coastguard Worker * 1466*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 1467*6777b538SAndroid Build Coastguard Worker **/ 1468*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithFloats:(const float [__nullable])values 1469*6777b538SAndroid Build Coastguard Worker forKeys:(const int32_t [__nullable])keys 1470*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1471*6777b538SAndroid Build Coastguard Worker 1472*6777b538SAndroid Build Coastguard Worker /** 1473*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 1474*6777b538SAndroid Build Coastguard Worker * 1475*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 1476*6777b538SAndroid Build Coastguard Worker * 1477*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 1478*6777b538SAndroid Build Coastguard Worker **/ 1479*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt32FloatDictionary *)dictionary; 1480*6777b538SAndroid Build Coastguard Worker 1481*6777b538SAndroid Build Coastguard Worker /** 1482*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 1483*6777b538SAndroid Build Coastguard Worker * 1484*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 1485*6777b538SAndroid Build Coastguard Worker * 1486*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 1487*6777b538SAndroid Build Coastguard Worker **/ 1488*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 1489*6777b538SAndroid Build Coastguard Worker 1490*6777b538SAndroid Build Coastguard Worker /** 1491*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 1492*6777b538SAndroid Build Coastguard Worker * 1493*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 1494*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 1495*6777b538SAndroid Build Coastguard Worker * 1496*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 1497*6777b538SAndroid Build Coastguard Worker **/ 1498*6777b538SAndroid Build Coastguard Worker - (BOOL)getFloat:(nullable float *)value forKey:(int32_t)key; 1499*6777b538SAndroid Build Coastguard Worker 1500*6777b538SAndroid Build Coastguard Worker /** 1501*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 1502*6777b538SAndroid Build Coastguard Worker * 1503*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 1504*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 1505*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 1506*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 1507*6777b538SAndroid Build Coastguard Worker **/ 1508*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndFloatsUsingBlock: 1509*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int32_t key, float value, BOOL *stop))block; 1510*6777b538SAndroid Build Coastguard Worker 1511*6777b538SAndroid Build Coastguard Worker /** 1512*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 1513*6777b538SAndroid Build Coastguard Worker * 1514*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 1515*6777b538SAndroid Build Coastguard Worker * dictionary. 1516*6777b538SAndroid Build Coastguard Worker **/ 1517*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt32FloatDictionary *)otherDictionary; 1518*6777b538SAndroid Build Coastguard Worker 1519*6777b538SAndroid Build Coastguard Worker /** 1520*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 1521*6777b538SAndroid Build Coastguard Worker * 1522*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 1523*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 1524*6777b538SAndroid Build Coastguard Worker **/ 1525*6777b538SAndroid Build Coastguard Worker - (void)setFloat:(float)value forKey:(int32_t)key; 1526*6777b538SAndroid Build Coastguard Worker 1527*6777b538SAndroid Build Coastguard Worker /** 1528*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 1529*6777b538SAndroid Build Coastguard Worker * 1530*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 1531*6777b538SAndroid Build Coastguard Worker **/ 1532*6777b538SAndroid Build Coastguard Worker - (void)removeFloatForKey:(int32_t)aKey; 1533*6777b538SAndroid Build Coastguard Worker 1534*6777b538SAndroid Build Coastguard Worker /** 1535*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 1536*6777b538SAndroid Build Coastguard Worker **/ 1537*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 1538*6777b538SAndroid Build Coastguard Worker 1539*6777b538SAndroid Build Coastguard Worker @end 1540*6777b538SAndroid Build Coastguard Worker 1541*6777b538SAndroid Build Coastguard Worker #pragma mark - Int32 -> Double 1542*6777b538SAndroid Build Coastguard Worker 1543*6777b538SAndroid Build Coastguard Worker /** 1544*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int32_t, double> 1545*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 1546*6777b538SAndroid Build Coastguard Worker * 1547*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 1548*6777b538SAndroid Build Coastguard Worker **/ 1549*6777b538SAndroid Build Coastguard Worker @interface GPBInt32DoubleDictionary : NSObject <NSCopying> 1550*6777b538SAndroid Build Coastguard Worker 1551*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 1552*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 1553*6777b538SAndroid Build Coastguard Worker 1554*6777b538SAndroid Build Coastguard Worker /** 1555*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 1556*6777b538SAndroid Build Coastguard Worker * 1557*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 1558*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 1559*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 1560*6777b538SAndroid Build Coastguard Worker * 1561*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 1562*6777b538SAndroid Build Coastguard Worker **/ 1563*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDoubles:(const double [__nullable])values 1564*6777b538SAndroid Build Coastguard Worker forKeys:(const int32_t [__nullable])keys 1565*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1566*6777b538SAndroid Build Coastguard Worker 1567*6777b538SAndroid Build Coastguard Worker /** 1568*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 1569*6777b538SAndroid Build Coastguard Worker * 1570*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 1571*6777b538SAndroid Build Coastguard Worker * 1572*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 1573*6777b538SAndroid Build Coastguard Worker **/ 1574*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt32DoubleDictionary *)dictionary; 1575*6777b538SAndroid Build Coastguard Worker 1576*6777b538SAndroid Build Coastguard Worker /** 1577*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 1578*6777b538SAndroid Build Coastguard Worker * 1579*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 1580*6777b538SAndroid Build Coastguard Worker * 1581*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 1582*6777b538SAndroid Build Coastguard Worker **/ 1583*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 1584*6777b538SAndroid Build Coastguard Worker 1585*6777b538SAndroid Build Coastguard Worker /** 1586*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 1587*6777b538SAndroid Build Coastguard Worker * 1588*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 1589*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 1590*6777b538SAndroid Build Coastguard Worker * 1591*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 1592*6777b538SAndroid Build Coastguard Worker **/ 1593*6777b538SAndroid Build Coastguard Worker - (BOOL)getDouble:(nullable double *)value forKey:(int32_t)key; 1594*6777b538SAndroid Build Coastguard Worker 1595*6777b538SAndroid Build Coastguard Worker /** 1596*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 1597*6777b538SAndroid Build Coastguard Worker * 1598*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 1599*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 1600*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 1601*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 1602*6777b538SAndroid Build Coastguard Worker **/ 1603*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndDoublesUsingBlock: 1604*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int32_t key, double value, BOOL *stop))block; 1605*6777b538SAndroid Build Coastguard Worker 1606*6777b538SAndroid Build Coastguard Worker /** 1607*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 1608*6777b538SAndroid Build Coastguard Worker * 1609*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 1610*6777b538SAndroid Build Coastguard Worker * dictionary. 1611*6777b538SAndroid Build Coastguard Worker **/ 1612*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt32DoubleDictionary *)otherDictionary; 1613*6777b538SAndroid Build Coastguard Worker 1614*6777b538SAndroid Build Coastguard Worker /** 1615*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 1616*6777b538SAndroid Build Coastguard Worker * 1617*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 1618*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 1619*6777b538SAndroid Build Coastguard Worker **/ 1620*6777b538SAndroid Build Coastguard Worker - (void)setDouble:(double)value forKey:(int32_t)key; 1621*6777b538SAndroid Build Coastguard Worker 1622*6777b538SAndroid Build Coastguard Worker /** 1623*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 1624*6777b538SAndroid Build Coastguard Worker * 1625*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 1626*6777b538SAndroid Build Coastguard Worker **/ 1627*6777b538SAndroid Build Coastguard Worker - (void)removeDoubleForKey:(int32_t)aKey; 1628*6777b538SAndroid Build Coastguard Worker 1629*6777b538SAndroid Build Coastguard Worker /** 1630*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 1631*6777b538SAndroid Build Coastguard Worker **/ 1632*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 1633*6777b538SAndroid Build Coastguard Worker 1634*6777b538SAndroid Build Coastguard Worker @end 1635*6777b538SAndroid Build Coastguard Worker 1636*6777b538SAndroid Build Coastguard Worker #pragma mark - Int32 -> Enum 1637*6777b538SAndroid Build Coastguard Worker 1638*6777b538SAndroid Build Coastguard Worker /** 1639*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int32_t, int32_t> 1640*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 1641*6777b538SAndroid Build Coastguard Worker * 1642*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 1643*6777b538SAndroid Build Coastguard Worker **/ 1644*6777b538SAndroid Build Coastguard Worker @interface GPBInt32EnumDictionary : NSObject <NSCopying> 1645*6777b538SAndroid Build Coastguard Worker 1646*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 1647*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 1648*6777b538SAndroid Build Coastguard Worker /** The validation function to check if the enums are valid. */ 1649*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 1650*6777b538SAndroid Build Coastguard Worker 1651*6777b538SAndroid Build Coastguard Worker /** 1652*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the given validation function. 1653*6777b538SAndroid Build Coastguard Worker * 1654*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 1655*6777b538SAndroid Build Coastguard Worker * 1656*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary. 1657*6777b538SAndroid Build Coastguard Worker **/ 1658*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 1659*6777b538SAndroid Build Coastguard Worker 1660*6777b538SAndroid Build Coastguard Worker /** 1661*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the entries given. 1662*6777b538SAndroid Build Coastguard Worker * 1663*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 1664*6777b538SAndroid Build Coastguard Worker * @param values The raw enum values values to be placed in the dictionary. 1665*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 1666*6777b538SAndroid Build Coastguard Worker * @param count The number of entries to store in the dictionary. 1667*6777b538SAndroid Build Coastguard Worker * 1668*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the keys and values in it. 1669*6777b538SAndroid Build Coastguard Worker **/ 1670*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1671*6777b538SAndroid Build Coastguard Worker rawValues:(const int32_t [__nullable])values 1672*6777b538SAndroid Build Coastguard Worker forKeys:(const int32_t [__nullable])keys 1673*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1674*6777b538SAndroid Build Coastguard Worker 1675*6777b538SAndroid Build Coastguard Worker /** 1676*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the entries from the given. 1677*6777b538SAndroid Build Coastguard Worker * dictionary. 1678*6777b538SAndroid Build Coastguard Worker * 1679*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to the dictionary. 1680*6777b538SAndroid Build Coastguard Worker * 1681*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries from the given 1682*6777b538SAndroid Build Coastguard Worker * dictionary in it. 1683*6777b538SAndroid Build Coastguard Worker **/ 1684*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt32EnumDictionary *)dictionary; 1685*6777b538SAndroid Build Coastguard Worker 1686*6777b538SAndroid Build Coastguard Worker /** 1687*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the given capacity. 1688*6777b538SAndroid Build Coastguard Worker * 1689*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 1690*6777b538SAndroid Build Coastguard Worker * @param numItems Capacity needed for the dictionary. 1691*6777b538SAndroid Build Coastguard Worker * 1692*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the given capacity. 1693*6777b538SAndroid Build Coastguard Worker **/ 1694*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 1695*6777b538SAndroid Build Coastguard Worker capacity:(NSUInteger)numItems; 1696*6777b538SAndroid Build Coastguard Worker 1697*6777b538SAndroid Build Coastguard Worker // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 1698*6777b538SAndroid Build Coastguard Worker // is not a valid enumerator as defined by validationFunc. If the actual value is 1699*6777b538SAndroid Build Coastguard Worker // desired, use "raw" version of the method. 1700*6777b538SAndroid Build Coastguard Worker 1701*6777b538SAndroid Build Coastguard Worker /** 1702*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 1703*6777b538SAndroid Build Coastguard Worker * 1704*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 1705*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 1706*6777b538SAndroid Build Coastguard Worker * 1707*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 1708*6777b538SAndroid Build Coastguard Worker **/ 1709*6777b538SAndroid Build Coastguard Worker - (BOOL)getEnum:(nullable int32_t *)value forKey:(int32_t)key; 1710*6777b538SAndroid Build Coastguard Worker 1711*6777b538SAndroid Build Coastguard Worker /** 1712*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 1713*6777b538SAndroid Build Coastguard Worker * 1714*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 1715*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 1716*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 1717*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 1718*6777b538SAndroid Build Coastguard Worker **/ 1719*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndEnumsUsingBlock: 1720*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int32_t key, int32_t value, BOOL *stop))block; 1721*6777b538SAndroid Build Coastguard Worker 1722*6777b538SAndroid Build Coastguard Worker /** 1723*6777b538SAndroid Build Coastguard Worker * Gets the raw enum value for the given key. 1724*6777b538SAndroid Build Coastguard Worker * 1725*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the access of values that 1726*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 1727*6777b538SAndroid Build Coastguard Worker * 1728*6777b538SAndroid Build Coastguard Worker * @param rawValue Pointer into which the value will be set, if found. 1729*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 1730*6777b538SAndroid Build Coastguard Worker * 1731*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 1732*6777b538SAndroid Build Coastguard Worker **/ 1733*6777b538SAndroid Build Coastguard Worker - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int32_t)key; 1734*6777b538SAndroid Build Coastguard Worker 1735*6777b538SAndroid Build Coastguard Worker /** 1736*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 1737*6777b538SAndroid Build Coastguard Worker * 1738*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the access of values that 1739*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 1740*6777b538SAndroid Build Coastguard Worker * 1741*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 1742*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 1743*6777b538SAndroid Build Coastguard Worker * **rawValue**: The value for the current entry 1744*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 1745*6777b538SAndroid Build Coastguard Worker **/ 1746*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndRawValuesUsingBlock: 1747*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int32_t key, int32_t rawValue, BOOL *stop))block; 1748*6777b538SAndroid Build Coastguard Worker 1749*6777b538SAndroid Build Coastguard Worker /** 1750*6777b538SAndroid Build Coastguard Worker * Adds the keys and raw enum values from another dictionary. 1751*6777b538SAndroid Build Coastguard Worker * 1752*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the setting of values that 1753*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 1754*6777b538SAndroid Build Coastguard Worker * 1755*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 1756*6777b538SAndroid Build Coastguard Worker * dictionary. 1757*6777b538SAndroid Build Coastguard Worker **/ 1758*6777b538SAndroid Build Coastguard Worker - (void)addRawEntriesFromDictionary:(GPBInt32EnumDictionary *)otherDictionary; 1759*6777b538SAndroid Build Coastguard Worker 1760*6777b538SAndroid Build Coastguard Worker // If value is not a valid enumerator as defined by validationFunc, these 1761*6777b538SAndroid Build Coastguard Worker // methods will assert in debug, and will log in release and assign the value 1762*6777b538SAndroid Build Coastguard Worker // to the default value. Use the rawValue methods below to assign non enumerator 1763*6777b538SAndroid Build Coastguard Worker // values. 1764*6777b538SAndroid Build Coastguard Worker 1765*6777b538SAndroid Build Coastguard Worker /** 1766*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 1767*6777b538SAndroid Build Coastguard Worker * 1768*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 1769*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 1770*6777b538SAndroid Build Coastguard Worker **/ 1771*6777b538SAndroid Build Coastguard Worker - (void)setEnum:(int32_t)value forKey:(int32_t)key; 1772*6777b538SAndroid Build Coastguard Worker 1773*6777b538SAndroid Build Coastguard Worker /** 1774*6777b538SAndroid Build Coastguard Worker * Sets the raw enum value for the given key. 1775*6777b538SAndroid Build Coastguard Worker * 1776*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the setting of values that 1777*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 1778*6777b538SAndroid Build Coastguard Worker * 1779*6777b538SAndroid Build Coastguard Worker * @param rawValue The raw enum value to set. 1780*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the raw enum value. 1781*6777b538SAndroid Build Coastguard Worker **/ 1782*6777b538SAndroid Build Coastguard Worker - (void)setRawValue:(int32_t)rawValue forKey:(int32_t)key; 1783*6777b538SAndroid Build Coastguard Worker 1784*6777b538SAndroid Build Coastguard Worker /** 1785*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 1786*6777b538SAndroid Build Coastguard Worker * 1787*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 1788*6777b538SAndroid Build Coastguard Worker **/ 1789*6777b538SAndroid Build Coastguard Worker - (void)removeEnumForKey:(int32_t)aKey; 1790*6777b538SAndroid Build Coastguard Worker 1791*6777b538SAndroid Build Coastguard Worker /** 1792*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 1793*6777b538SAndroid Build Coastguard Worker **/ 1794*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 1795*6777b538SAndroid Build Coastguard Worker 1796*6777b538SAndroid Build Coastguard Worker @end 1797*6777b538SAndroid Build Coastguard Worker 1798*6777b538SAndroid Build Coastguard Worker #pragma mark - Int32 -> Object 1799*6777b538SAndroid Build Coastguard Worker 1800*6777b538SAndroid Build Coastguard Worker /** 1801*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int32_t, ObjectType> 1802*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 1803*6777b538SAndroid Build Coastguard Worker * 1804*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 1805*6777b538SAndroid Build Coastguard Worker **/ 1806*6777b538SAndroid Build Coastguard Worker @interface GPBInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying> 1807*6777b538SAndroid Build Coastguard Worker 1808*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 1809*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 1810*6777b538SAndroid Build Coastguard Worker 1811*6777b538SAndroid Build Coastguard Worker /** 1812*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 1813*6777b538SAndroid Build Coastguard Worker * 1814*6777b538SAndroid Build Coastguard Worker * @param objects The values to be placed in this dictionary. 1815*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 1816*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 1817*6777b538SAndroid Build Coastguard Worker * 1818*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 1819*6777b538SAndroid Build Coastguard Worker **/ 1820*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects 1821*6777b538SAndroid Build Coastguard Worker forKeys:(const int32_t [__nullable])keys 1822*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1823*6777b538SAndroid Build Coastguard Worker 1824*6777b538SAndroid Build Coastguard Worker /** 1825*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 1826*6777b538SAndroid Build Coastguard Worker * 1827*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 1828*6777b538SAndroid Build Coastguard Worker * 1829*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 1830*6777b538SAndroid Build Coastguard Worker **/ 1831*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary; 1832*6777b538SAndroid Build Coastguard Worker 1833*6777b538SAndroid Build Coastguard Worker /** 1834*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 1835*6777b538SAndroid Build Coastguard Worker * 1836*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 1837*6777b538SAndroid Build Coastguard Worker * 1838*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 1839*6777b538SAndroid Build Coastguard Worker **/ 1840*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 1841*6777b538SAndroid Build Coastguard Worker 1842*6777b538SAndroid Build Coastguard Worker /** 1843*6777b538SAndroid Build Coastguard Worker * Fetches the object stored under the given key. 1844*6777b538SAndroid Build Coastguard Worker * 1845*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 1846*6777b538SAndroid Build Coastguard Worker * 1847*6777b538SAndroid Build Coastguard Worker * @return The object if found, nil otherwise. 1848*6777b538SAndroid Build Coastguard Worker **/ 1849*6777b538SAndroid Build Coastguard Worker - (ObjectType)objectForKey:(int32_t)key; 1850*6777b538SAndroid Build Coastguard Worker 1851*6777b538SAndroid Build Coastguard Worker /** 1852*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 1853*6777b538SAndroid Build Coastguard Worker * 1854*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 1855*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 1856*6777b538SAndroid Build Coastguard Worker * **object**: The value for the current entry 1857*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 1858*6777b538SAndroid Build Coastguard Worker **/ 1859*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndObjectsUsingBlock: 1860*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int32_t key, ObjectType object, BOOL *stop))block; 1861*6777b538SAndroid Build Coastguard Worker 1862*6777b538SAndroid Build Coastguard Worker /** 1863*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 1864*6777b538SAndroid Build Coastguard Worker * 1865*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 1866*6777b538SAndroid Build Coastguard Worker * dictionary. 1867*6777b538SAndroid Build Coastguard Worker **/ 1868*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt32ObjectDictionary *)otherDictionary; 1869*6777b538SAndroid Build Coastguard Worker 1870*6777b538SAndroid Build Coastguard Worker /** 1871*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 1872*6777b538SAndroid Build Coastguard Worker * 1873*6777b538SAndroid Build Coastguard Worker * @param object The value to set. 1874*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 1875*6777b538SAndroid Build Coastguard Worker **/ 1876*6777b538SAndroid Build Coastguard Worker - (void)setObject:(ObjectType)object forKey:(int32_t)key; 1877*6777b538SAndroid Build Coastguard Worker 1878*6777b538SAndroid Build Coastguard Worker /** 1879*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 1880*6777b538SAndroid Build Coastguard Worker * 1881*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 1882*6777b538SAndroid Build Coastguard Worker **/ 1883*6777b538SAndroid Build Coastguard Worker - (void)removeObjectForKey:(int32_t)aKey; 1884*6777b538SAndroid Build Coastguard Worker 1885*6777b538SAndroid Build Coastguard Worker /** 1886*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 1887*6777b538SAndroid Build Coastguard Worker **/ 1888*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 1889*6777b538SAndroid Build Coastguard Worker 1890*6777b538SAndroid Build Coastguard Worker @end 1891*6777b538SAndroid Build Coastguard Worker 1892*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt64 -> UInt32 1893*6777b538SAndroid Build Coastguard Worker 1894*6777b538SAndroid Build Coastguard Worker /** 1895*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint64_t, uint32_t> 1896*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 1897*6777b538SAndroid Build Coastguard Worker * 1898*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 1899*6777b538SAndroid Build Coastguard Worker **/ 1900*6777b538SAndroid Build Coastguard Worker @interface GPBUInt64UInt32Dictionary : NSObject <NSCopying> 1901*6777b538SAndroid Build Coastguard Worker 1902*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 1903*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 1904*6777b538SAndroid Build Coastguard Worker 1905*6777b538SAndroid Build Coastguard Worker /** 1906*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 1907*6777b538SAndroid Build Coastguard Worker * 1908*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 1909*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 1910*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 1911*6777b538SAndroid Build Coastguard Worker * 1912*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 1913*6777b538SAndroid Build Coastguard Worker **/ 1914*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithUInt32s:(const uint32_t [__nullable])values 1915*6777b538SAndroid Build Coastguard Worker forKeys:(const uint64_t [__nullable])keys 1916*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 1917*6777b538SAndroid Build Coastguard Worker 1918*6777b538SAndroid Build Coastguard Worker /** 1919*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 1920*6777b538SAndroid Build Coastguard Worker * 1921*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 1922*6777b538SAndroid Build Coastguard Worker * 1923*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 1924*6777b538SAndroid Build Coastguard Worker **/ 1925*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary; 1926*6777b538SAndroid Build Coastguard Worker 1927*6777b538SAndroid Build Coastguard Worker /** 1928*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 1929*6777b538SAndroid Build Coastguard Worker * 1930*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 1931*6777b538SAndroid Build Coastguard Worker * 1932*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 1933*6777b538SAndroid Build Coastguard Worker **/ 1934*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 1935*6777b538SAndroid Build Coastguard Worker 1936*6777b538SAndroid Build Coastguard Worker /** 1937*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 1938*6777b538SAndroid Build Coastguard Worker * 1939*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 1940*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 1941*6777b538SAndroid Build Coastguard Worker * 1942*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 1943*6777b538SAndroid Build Coastguard Worker **/ 1944*6777b538SAndroid Build Coastguard Worker - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint64_t)key; 1945*6777b538SAndroid Build Coastguard Worker 1946*6777b538SAndroid Build Coastguard Worker /** 1947*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 1948*6777b538SAndroid Build Coastguard Worker * 1949*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 1950*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 1951*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 1952*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 1953*6777b538SAndroid Build Coastguard Worker **/ 1954*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndUInt32sUsingBlock: 1955*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint64_t key, uint32_t value, BOOL *stop))block; 1956*6777b538SAndroid Build Coastguard Worker 1957*6777b538SAndroid Build Coastguard Worker /** 1958*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 1959*6777b538SAndroid Build Coastguard Worker * 1960*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 1961*6777b538SAndroid Build Coastguard Worker * dictionary. 1962*6777b538SAndroid Build Coastguard Worker **/ 1963*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt64UInt32Dictionary *)otherDictionary; 1964*6777b538SAndroid Build Coastguard Worker 1965*6777b538SAndroid Build Coastguard Worker /** 1966*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 1967*6777b538SAndroid Build Coastguard Worker * 1968*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 1969*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 1970*6777b538SAndroid Build Coastguard Worker **/ 1971*6777b538SAndroid Build Coastguard Worker - (void)setUInt32:(uint32_t)value forKey:(uint64_t)key; 1972*6777b538SAndroid Build Coastguard Worker 1973*6777b538SAndroid Build Coastguard Worker /** 1974*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 1975*6777b538SAndroid Build Coastguard Worker * 1976*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 1977*6777b538SAndroid Build Coastguard Worker **/ 1978*6777b538SAndroid Build Coastguard Worker - (void)removeUInt32ForKey:(uint64_t)aKey; 1979*6777b538SAndroid Build Coastguard Worker 1980*6777b538SAndroid Build Coastguard Worker /** 1981*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 1982*6777b538SAndroid Build Coastguard Worker **/ 1983*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 1984*6777b538SAndroid Build Coastguard Worker 1985*6777b538SAndroid Build Coastguard Worker @end 1986*6777b538SAndroid Build Coastguard Worker 1987*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt64 -> Int32 1988*6777b538SAndroid Build Coastguard Worker 1989*6777b538SAndroid Build Coastguard Worker /** 1990*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint64_t, int32_t> 1991*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 1992*6777b538SAndroid Build Coastguard Worker * 1993*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 1994*6777b538SAndroid Build Coastguard Worker **/ 1995*6777b538SAndroid Build Coastguard Worker @interface GPBUInt64Int32Dictionary : NSObject <NSCopying> 1996*6777b538SAndroid Build Coastguard Worker 1997*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 1998*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 1999*6777b538SAndroid Build Coastguard Worker 2000*6777b538SAndroid Build Coastguard Worker /** 2001*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 2002*6777b538SAndroid Build Coastguard Worker * 2003*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 2004*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 2005*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 2006*6777b538SAndroid Build Coastguard Worker * 2007*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 2008*6777b538SAndroid Build Coastguard Worker **/ 2009*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithInt32s:(const int32_t [__nullable])values 2010*6777b538SAndroid Build Coastguard Worker forKeys:(const uint64_t [__nullable])keys 2011*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2012*6777b538SAndroid Build Coastguard Worker 2013*6777b538SAndroid Build Coastguard Worker /** 2014*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 2015*6777b538SAndroid Build Coastguard Worker * 2016*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 2017*6777b538SAndroid Build Coastguard Worker * 2018*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 2019*6777b538SAndroid Build Coastguard Worker **/ 2020*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt64Int32Dictionary *)dictionary; 2021*6777b538SAndroid Build Coastguard Worker 2022*6777b538SAndroid Build Coastguard Worker /** 2023*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 2024*6777b538SAndroid Build Coastguard Worker * 2025*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 2026*6777b538SAndroid Build Coastguard Worker * 2027*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 2028*6777b538SAndroid Build Coastguard Worker **/ 2029*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 2030*6777b538SAndroid Build Coastguard Worker 2031*6777b538SAndroid Build Coastguard Worker /** 2032*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 2033*6777b538SAndroid Build Coastguard Worker * 2034*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 2035*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 2036*6777b538SAndroid Build Coastguard Worker * 2037*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 2038*6777b538SAndroid Build Coastguard Worker **/ 2039*6777b538SAndroid Build Coastguard Worker - (BOOL)getInt32:(nullable int32_t *)value forKey:(uint64_t)key; 2040*6777b538SAndroid Build Coastguard Worker 2041*6777b538SAndroid Build Coastguard Worker /** 2042*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 2043*6777b538SAndroid Build Coastguard Worker * 2044*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 2045*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 2046*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 2047*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 2048*6777b538SAndroid Build Coastguard Worker **/ 2049*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndInt32sUsingBlock: 2050*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint64_t key, int32_t value, BOOL *stop))block; 2051*6777b538SAndroid Build Coastguard Worker 2052*6777b538SAndroid Build Coastguard Worker /** 2053*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 2054*6777b538SAndroid Build Coastguard Worker * 2055*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 2056*6777b538SAndroid Build Coastguard Worker * dictionary. 2057*6777b538SAndroid Build Coastguard Worker **/ 2058*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt64Int32Dictionary *)otherDictionary; 2059*6777b538SAndroid Build Coastguard Worker 2060*6777b538SAndroid Build Coastguard Worker /** 2061*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 2062*6777b538SAndroid Build Coastguard Worker * 2063*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 2064*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 2065*6777b538SAndroid Build Coastguard Worker **/ 2066*6777b538SAndroid Build Coastguard Worker - (void)setInt32:(int32_t)value forKey:(uint64_t)key; 2067*6777b538SAndroid Build Coastguard Worker 2068*6777b538SAndroid Build Coastguard Worker /** 2069*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 2070*6777b538SAndroid Build Coastguard Worker * 2071*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 2072*6777b538SAndroid Build Coastguard Worker **/ 2073*6777b538SAndroid Build Coastguard Worker - (void)removeInt32ForKey:(uint64_t)aKey; 2074*6777b538SAndroid Build Coastguard Worker 2075*6777b538SAndroid Build Coastguard Worker /** 2076*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 2077*6777b538SAndroid Build Coastguard Worker **/ 2078*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 2079*6777b538SAndroid Build Coastguard Worker 2080*6777b538SAndroid Build Coastguard Worker @end 2081*6777b538SAndroid Build Coastguard Worker 2082*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt64 -> UInt64 2083*6777b538SAndroid Build Coastguard Worker 2084*6777b538SAndroid Build Coastguard Worker /** 2085*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint64_t, uint64_t> 2086*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 2087*6777b538SAndroid Build Coastguard Worker * 2088*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 2089*6777b538SAndroid Build Coastguard Worker **/ 2090*6777b538SAndroid Build Coastguard Worker @interface GPBUInt64UInt64Dictionary : NSObject <NSCopying> 2091*6777b538SAndroid Build Coastguard Worker 2092*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 2093*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 2094*6777b538SAndroid Build Coastguard Worker 2095*6777b538SAndroid Build Coastguard Worker /** 2096*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 2097*6777b538SAndroid Build Coastguard Worker * 2098*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 2099*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 2100*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 2101*6777b538SAndroid Build Coastguard Worker * 2102*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 2103*6777b538SAndroid Build Coastguard Worker **/ 2104*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithUInt64s:(const uint64_t [__nullable])values 2105*6777b538SAndroid Build Coastguard Worker forKeys:(const uint64_t [__nullable])keys 2106*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2107*6777b538SAndroid Build Coastguard Worker 2108*6777b538SAndroid Build Coastguard Worker /** 2109*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 2110*6777b538SAndroid Build Coastguard Worker * 2111*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 2112*6777b538SAndroid Build Coastguard Worker * 2113*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 2114*6777b538SAndroid Build Coastguard Worker **/ 2115*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary; 2116*6777b538SAndroid Build Coastguard Worker 2117*6777b538SAndroid Build Coastguard Worker /** 2118*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 2119*6777b538SAndroid Build Coastguard Worker * 2120*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 2121*6777b538SAndroid Build Coastguard Worker * 2122*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 2123*6777b538SAndroid Build Coastguard Worker **/ 2124*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 2125*6777b538SAndroid Build Coastguard Worker 2126*6777b538SAndroid Build Coastguard Worker /** 2127*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 2128*6777b538SAndroid Build Coastguard Worker * 2129*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 2130*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 2131*6777b538SAndroid Build Coastguard Worker * 2132*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 2133*6777b538SAndroid Build Coastguard Worker **/ 2134*6777b538SAndroid Build Coastguard Worker - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint64_t)key; 2135*6777b538SAndroid Build Coastguard Worker 2136*6777b538SAndroid Build Coastguard Worker /** 2137*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 2138*6777b538SAndroid Build Coastguard Worker * 2139*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 2140*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 2141*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 2142*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 2143*6777b538SAndroid Build Coastguard Worker **/ 2144*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndUInt64sUsingBlock: 2145*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint64_t key, uint64_t value, BOOL *stop))block; 2146*6777b538SAndroid Build Coastguard Worker 2147*6777b538SAndroid Build Coastguard Worker /** 2148*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 2149*6777b538SAndroid Build Coastguard Worker * 2150*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 2151*6777b538SAndroid Build Coastguard Worker * dictionary. 2152*6777b538SAndroid Build Coastguard Worker **/ 2153*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt64UInt64Dictionary *)otherDictionary; 2154*6777b538SAndroid Build Coastguard Worker 2155*6777b538SAndroid Build Coastguard Worker /** 2156*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 2157*6777b538SAndroid Build Coastguard Worker * 2158*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 2159*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 2160*6777b538SAndroid Build Coastguard Worker **/ 2161*6777b538SAndroid Build Coastguard Worker - (void)setUInt64:(uint64_t)value forKey:(uint64_t)key; 2162*6777b538SAndroid Build Coastguard Worker 2163*6777b538SAndroid Build Coastguard Worker /** 2164*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 2165*6777b538SAndroid Build Coastguard Worker * 2166*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 2167*6777b538SAndroid Build Coastguard Worker **/ 2168*6777b538SAndroid Build Coastguard Worker - (void)removeUInt64ForKey:(uint64_t)aKey; 2169*6777b538SAndroid Build Coastguard Worker 2170*6777b538SAndroid Build Coastguard Worker /** 2171*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 2172*6777b538SAndroid Build Coastguard Worker **/ 2173*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 2174*6777b538SAndroid Build Coastguard Worker 2175*6777b538SAndroid Build Coastguard Worker @end 2176*6777b538SAndroid Build Coastguard Worker 2177*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt64 -> Int64 2178*6777b538SAndroid Build Coastguard Worker 2179*6777b538SAndroid Build Coastguard Worker /** 2180*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint64_t, int64_t> 2181*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 2182*6777b538SAndroid Build Coastguard Worker * 2183*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 2184*6777b538SAndroid Build Coastguard Worker **/ 2185*6777b538SAndroid Build Coastguard Worker @interface GPBUInt64Int64Dictionary : NSObject <NSCopying> 2186*6777b538SAndroid Build Coastguard Worker 2187*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 2188*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 2189*6777b538SAndroid Build Coastguard Worker 2190*6777b538SAndroid Build Coastguard Worker /** 2191*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 2192*6777b538SAndroid Build Coastguard Worker * 2193*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 2194*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 2195*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 2196*6777b538SAndroid Build Coastguard Worker * 2197*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 2198*6777b538SAndroid Build Coastguard Worker **/ 2199*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithInt64s:(const int64_t [__nullable])values 2200*6777b538SAndroid Build Coastguard Worker forKeys:(const uint64_t [__nullable])keys 2201*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2202*6777b538SAndroid Build Coastguard Worker 2203*6777b538SAndroid Build Coastguard Worker /** 2204*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 2205*6777b538SAndroid Build Coastguard Worker * 2206*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 2207*6777b538SAndroid Build Coastguard Worker * 2208*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 2209*6777b538SAndroid Build Coastguard Worker **/ 2210*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt64Int64Dictionary *)dictionary; 2211*6777b538SAndroid Build Coastguard Worker 2212*6777b538SAndroid Build Coastguard Worker /** 2213*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 2214*6777b538SAndroid Build Coastguard Worker * 2215*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 2216*6777b538SAndroid Build Coastguard Worker * 2217*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 2218*6777b538SAndroid Build Coastguard Worker **/ 2219*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 2220*6777b538SAndroid Build Coastguard Worker 2221*6777b538SAndroid Build Coastguard Worker /** 2222*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 2223*6777b538SAndroid Build Coastguard Worker * 2224*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 2225*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 2226*6777b538SAndroid Build Coastguard Worker * 2227*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 2228*6777b538SAndroid Build Coastguard Worker **/ 2229*6777b538SAndroid Build Coastguard Worker - (BOOL)getInt64:(nullable int64_t *)value forKey:(uint64_t)key; 2230*6777b538SAndroid Build Coastguard Worker 2231*6777b538SAndroid Build Coastguard Worker /** 2232*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 2233*6777b538SAndroid Build Coastguard Worker * 2234*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 2235*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 2236*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 2237*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 2238*6777b538SAndroid Build Coastguard Worker **/ 2239*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndInt64sUsingBlock: 2240*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint64_t key, int64_t value, BOOL *stop))block; 2241*6777b538SAndroid Build Coastguard Worker 2242*6777b538SAndroid Build Coastguard Worker /** 2243*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 2244*6777b538SAndroid Build Coastguard Worker * 2245*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 2246*6777b538SAndroid Build Coastguard Worker * dictionary. 2247*6777b538SAndroid Build Coastguard Worker **/ 2248*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt64Int64Dictionary *)otherDictionary; 2249*6777b538SAndroid Build Coastguard Worker 2250*6777b538SAndroid Build Coastguard Worker /** 2251*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 2252*6777b538SAndroid Build Coastguard Worker * 2253*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 2254*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 2255*6777b538SAndroid Build Coastguard Worker **/ 2256*6777b538SAndroid Build Coastguard Worker - (void)setInt64:(int64_t)value forKey:(uint64_t)key; 2257*6777b538SAndroid Build Coastguard Worker 2258*6777b538SAndroid Build Coastguard Worker /** 2259*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 2260*6777b538SAndroid Build Coastguard Worker * 2261*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 2262*6777b538SAndroid Build Coastguard Worker **/ 2263*6777b538SAndroid Build Coastguard Worker - (void)removeInt64ForKey:(uint64_t)aKey; 2264*6777b538SAndroid Build Coastguard Worker 2265*6777b538SAndroid Build Coastguard Worker /** 2266*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 2267*6777b538SAndroid Build Coastguard Worker **/ 2268*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 2269*6777b538SAndroid Build Coastguard Worker 2270*6777b538SAndroid Build Coastguard Worker @end 2271*6777b538SAndroid Build Coastguard Worker 2272*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt64 -> Bool 2273*6777b538SAndroid Build Coastguard Worker 2274*6777b538SAndroid Build Coastguard Worker /** 2275*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint64_t, BOOL> 2276*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 2277*6777b538SAndroid Build Coastguard Worker * 2278*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 2279*6777b538SAndroid Build Coastguard Worker **/ 2280*6777b538SAndroid Build Coastguard Worker @interface GPBUInt64BoolDictionary : NSObject <NSCopying> 2281*6777b538SAndroid Build Coastguard Worker 2282*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 2283*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 2284*6777b538SAndroid Build Coastguard Worker 2285*6777b538SAndroid Build Coastguard Worker /** 2286*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 2287*6777b538SAndroid Build Coastguard Worker * 2288*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 2289*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 2290*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 2291*6777b538SAndroid Build Coastguard Worker * 2292*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 2293*6777b538SAndroid Build Coastguard Worker **/ 2294*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithBools:(const BOOL [__nullable])values 2295*6777b538SAndroid Build Coastguard Worker forKeys:(const uint64_t [__nullable])keys 2296*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2297*6777b538SAndroid Build Coastguard Worker 2298*6777b538SAndroid Build Coastguard Worker /** 2299*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 2300*6777b538SAndroid Build Coastguard Worker * 2301*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 2302*6777b538SAndroid Build Coastguard Worker * 2303*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 2304*6777b538SAndroid Build Coastguard Worker **/ 2305*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt64BoolDictionary *)dictionary; 2306*6777b538SAndroid Build Coastguard Worker 2307*6777b538SAndroid Build Coastguard Worker /** 2308*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 2309*6777b538SAndroid Build Coastguard Worker * 2310*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 2311*6777b538SAndroid Build Coastguard Worker * 2312*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 2313*6777b538SAndroid Build Coastguard Worker **/ 2314*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 2315*6777b538SAndroid Build Coastguard Worker 2316*6777b538SAndroid Build Coastguard Worker /** 2317*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 2318*6777b538SAndroid Build Coastguard Worker * 2319*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 2320*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 2321*6777b538SAndroid Build Coastguard Worker * 2322*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 2323*6777b538SAndroid Build Coastguard Worker **/ 2324*6777b538SAndroid Build Coastguard Worker - (BOOL)getBool:(nullable BOOL *)value forKey:(uint64_t)key; 2325*6777b538SAndroid Build Coastguard Worker 2326*6777b538SAndroid Build Coastguard Worker /** 2327*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 2328*6777b538SAndroid Build Coastguard Worker * 2329*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 2330*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 2331*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 2332*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 2333*6777b538SAndroid Build Coastguard Worker **/ 2334*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndBoolsUsingBlock: 2335*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint64_t key, BOOL value, BOOL *stop))block; 2336*6777b538SAndroid Build Coastguard Worker 2337*6777b538SAndroid Build Coastguard Worker /** 2338*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 2339*6777b538SAndroid Build Coastguard Worker * 2340*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 2341*6777b538SAndroid Build Coastguard Worker * dictionary. 2342*6777b538SAndroid Build Coastguard Worker **/ 2343*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt64BoolDictionary *)otherDictionary; 2344*6777b538SAndroid Build Coastguard Worker 2345*6777b538SAndroid Build Coastguard Worker /** 2346*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 2347*6777b538SAndroid Build Coastguard Worker * 2348*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 2349*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 2350*6777b538SAndroid Build Coastguard Worker **/ 2351*6777b538SAndroid Build Coastguard Worker - (void)setBool:(BOOL)value forKey:(uint64_t)key; 2352*6777b538SAndroid Build Coastguard Worker 2353*6777b538SAndroid Build Coastguard Worker /** 2354*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 2355*6777b538SAndroid Build Coastguard Worker * 2356*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 2357*6777b538SAndroid Build Coastguard Worker **/ 2358*6777b538SAndroid Build Coastguard Worker - (void)removeBoolForKey:(uint64_t)aKey; 2359*6777b538SAndroid Build Coastguard Worker 2360*6777b538SAndroid Build Coastguard Worker /** 2361*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 2362*6777b538SAndroid Build Coastguard Worker **/ 2363*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 2364*6777b538SAndroid Build Coastguard Worker 2365*6777b538SAndroid Build Coastguard Worker @end 2366*6777b538SAndroid Build Coastguard Worker 2367*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt64 -> Float 2368*6777b538SAndroid Build Coastguard Worker 2369*6777b538SAndroid Build Coastguard Worker /** 2370*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint64_t, float> 2371*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 2372*6777b538SAndroid Build Coastguard Worker * 2373*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 2374*6777b538SAndroid Build Coastguard Worker **/ 2375*6777b538SAndroid Build Coastguard Worker @interface GPBUInt64FloatDictionary : NSObject <NSCopying> 2376*6777b538SAndroid Build Coastguard Worker 2377*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 2378*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 2379*6777b538SAndroid Build Coastguard Worker 2380*6777b538SAndroid Build Coastguard Worker /** 2381*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 2382*6777b538SAndroid Build Coastguard Worker * 2383*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 2384*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 2385*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 2386*6777b538SAndroid Build Coastguard Worker * 2387*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 2388*6777b538SAndroid Build Coastguard Worker **/ 2389*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithFloats:(const float [__nullable])values 2390*6777b538SAndroid Build Coastguard Worker forKeys:(const uint64_t [__nullable])keys 2391*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2392*6777b538SAndroid Build Coastguard Worker 2393*6777b538SAndroid Build Coastguard Worker /** 2394*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 2395*6777b538SAndroid Build Coastguard Worker * 2396*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 2397*6777b538SAndroid Build Coastguard Worker * 2398*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 2399*6777b538SAndroid Build Coastguard Worker **/ 2400*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt64FloatDictionary *)dictionary; 2401*6777b538SAndroid Build Coastguard Worker 2402*6777b538SAndroid Build Coastguard Worker /** 2403*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 2404*6777b538SAndroid Build Coastguard Worker * 2405*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 2406*6777b538SAndroid Build Coastguard Worker * 2407*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 2408*6777b538SAndroid Build Coastguard Worker **/ 2409*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 2410*6777b538SAndroid Build Coastguard Worker 2411*6777b538SAndroid Build Coastguard Worker /** 2412*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 2413*6777b538SAndroid Build Coastguard Worker * 2414*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 2415*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 2416*6777b538SAndroid Build Coastguard Worker * 2417*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 2418*6777b538SAndroid Build Coastguard Worker **/ 2419*6777b538SAndroid Build Coastguard Worker - (BOOL)getFloat:(nullable float *)value forKey:(uint64_t)key; 2420*6777b538SAndroid Build Coastguard Worker 2421*6777b538SAndroid Build Coastguard Worker /** 2422*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 2423*6777b538SAndroid Build Coastguard Worker * 2424*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 2425*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 2426*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 2427*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 2428*6777b538SAndroid Build Coastguard Worker **/ 2429*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndFloatsUsingBlock: 2430*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint64_t key, float value, BOOL *stop))block; 2431*6777b538SAndroid Build Coastguard Worker 2432*6777b538SAndroid Build Coastguard Worker /** 2433*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 2434*6777b538SAndroid Build Coastguard Worker * 2435*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 2436*6777b538SAndroid Build Coastguard Worker * dictionary. 2437*6777b538SAndroid Build Coastguard Worker **/ 2438*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt64FloatDictionary *)otherDictionary; 2439*6777b538SAndroid Build Coastguard Worker 2440*6777b538SAndroid Build Coastguard Worker /** 2441*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 2442*6777b538SAndroid Build Coastguard Worker * 2443*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 2444*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 2445*6777b538SAndroid Build Coastguard Worker **/ 2446*6777b538SAndroid Build Coastguard Worker - (void)setFloat:(float)value forKey:(uint64_t)key; 2447*6777b538SAndroid Build Coastguard Worker 2448*6777b538SAndroid Build Coastguard Worker /** 2449*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 2450*6777b538SAndroid Build Coastguard Worker * 2451*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 2452*6777b538SAndroid Build Coastguard Worker **/ 2453*6777b538SAndroid Build Coastguard Worker - (void)removeFloatForKey:(uint64_t)aKey; 2454*6777b538SAndroid Build Coastguard Worker 2455*6777b538SAndroid Build Coastguard Worker /** 2456*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 2457*6777b538SAndroid Build Coastguard Worker **/ 2458*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 2459*6777b538SAndroid Build Coastguard Worker 2460*6777b538SAndroid Build Coastguard Worker @end 2461*6777b538SAndroid Build Coastguard Worker 2462*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt64 -> Double 2463*6777b538SAndroid Build Coastguard Worker 2464*6777b538SAndroid Build Coastguard Worker /** 2465*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint64_t, double> 2466*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 2467*6777b538SAndroid Build Coastguard Worker * 2468*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 2469*6777b538SAndroid Build Coastguard Worker **/ 2470*6777b538SAndroid Build Coastguard Worker @interface GPBUInt64DoubleDictionary : NSObject <NSCopying> 2471*6777b538SAndroid Build Coastguard Worker 2472*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 2473*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 2474*6777b538SAndroid Build Coastguard Worker 2475*6777b538SAndroid Build Coastguard Worker /** 2476*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 2477*6777b538SAndroid Build Coastguard Worker * 2478*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 2479*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 2480*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 2481*6777b538SAndroid Build Coastguard Worker * 2482*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 2483*6777b538SAndroid Build Coastguard Worker **/ 2484*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDoubles:(const double [__nullable])values 2485*6777b538SAndroid Build Coastguard Worker forKeys:(const uint64_t [__nullable])keys 2486*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2487*6777b538SAndroid Build Coastguard Worker 2488*6777b538SAndroid Build Coastguard Worker /** 2489*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 2490*6777b538SAndroid Build Coastguard Worker * 2491*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 2492*6777b538SAndroid Build Coastguard Worker * 2493*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 2494*6777b538SAndroid Build Coastguard Worker **/ 2495*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt64DoubleDictionary *)dictionary; 2496*6777b538SAndroid Build Coastguard Worker 2497*6777b538SAndroid Build Coastguard Worker /** 2498*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 2499*6777b538SAndroid Build Coastguard Worker * 2500*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 2501*6777b538SAndroid Build Coastguard Worker * 2502*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 2503*6777b538SAndroid Build Coastguard Worker **/ 2504*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 2505*6777b538SAndroid Build Coastguard Worker 2506*6777b538SAndroid Build Coastguard Worker /** 2507*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 2508*6777b538SAndroid Build Coastguard Worker * 2509*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 2510*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 2511*6777b538SAndroid Build Coastguard Worker * 2512*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 2513*6777b538SAndroid Build Coastguard Worker **/ 2514*6777b538SAndroid Build Coastguard Worker - (BOOL)getDouble:(nullable double *)value forKey:(uint64_t)key; 2515*6777b538SAndroid Build Coastguard Worker 2516*6777b538SAndroid Build Coastguard Worker /** 2517*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 2518*6777b538SAndroid Build Coastguard Worker * 2519*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 2520*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 2521*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 2522*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 2523*6777b538SAndroid Build Coastguard Worker **/ 2524*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndDoublesUsingBlock: 2525*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint64_t key, double value, BOOL *stop))block; 2526*6777b538SAndroid Build Coastguard Worker 2527*6777b538SAndroid Build Coastguard Worker /** 2528*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 2529*6777b538SAndroid Build Coastguard Worker * 2530*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 2531*6777b538SAndroid Build Coastguard Worker * dictionary. 2532*6777b538SAndroid Build Coastguard Worker **/ 2533*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt64DoubleDictionary *)otherDictionary; 2534*6777b538SAndroid Build Coastguard Worker 2535*6777b538SAndroid Build Coastguard Worker /** 2536*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 2537*6777b538SAndroid Build Coastguard Worker * 2538*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 2539*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 2540*6777b538SAndroid Build Coastguard Worker **/ 2541*6777b538SAndroid Build Coastguard Worker - (void)setDouble:(double)value forKey:(uint64_t)key; 2542*6777b538SAndroid Build Coastguard Worker 2543*6777b538SAndroid Build Coastguard Worker /** 2544*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 2545*6777b538SAndroid Build Coastguard Worker * 2546*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 2547*6777b538SAndroid Build Coastguard Worker **/ 2548*6777b538SAndroid Build Coastguard Worker - (void)removeDoubleForKey:(uint64_t)aKey; 2549*6777b538SAndroid Build Coastguard Worker 2550*6777b538SAndroid Build Coastguard Worker /** 2551*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 2552*6777b538SAndroid Build Coastguard Worker **/ 2553*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 2554*6777b538SAndroid Build Coastguard Worker 2555*6777b538SAndroid Build Coastguard Worker @end 2556*6777b538SAndroid Build Coastguard Worker 2557*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt64 -> Enum 2558*6777b538SAndroid Build Coastguard Worker 2559*6777b538SAndroid Build Coastguard Worker /** 2560*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint64_t, int32_t> 2561*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 2562*6777b538SAndroid Build Coastguard Worker * 2563*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 2564*6777b538SAndroid Build Coastguard Worker **/ 2565*6777b538SAndroid Build Coastguard Worker @interface GPBUInt64EnumDictionary : NSObject <NSCopying> 2566*6777b538SAndroid Build Coastguard Worker 2567*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 2568*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 2569*6777b538SAndroid Build Coastguard Worker /** The validation function to check if the enums are valid. */ 2570*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 2571*6777b538SAndroid Build Coastguard Worker 2572*6777b538SAndroid Build Coastguard Worker /** 2573*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the given validation function. 2574*6777b538SAndroid Build Coastguard Worker * 2575*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 2576*6777b538SAndroid Build Coastguard Worker * 2577*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary. 2578*6777b538SAndroid Build Coastguard Worker **/ 2579*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 2580*6777b538SAndroid Build Coastguard Worker 2581*6777b538SAndroid Build Coastguard Worker /** 2582*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the entries given. 2583*6777b538SAndroid Build Coastguard Worker * 2584*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 2585*6777b538SAndroid Build Coastguard Worker * @param values The raw enum values values to be placed in the dictionary. 2586*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 2587*6777b538SAndroid Build Coastguard Worker * @param count The number of entries to store in the dictionary. 2588*6777b538SAndroid Build Coastguard Worker * 2589*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the keys and values in it. 2590*6777b538SAndroid Build Coastguard Worker **/ 2591*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 2592*6777b538SAndroid Build Coastguard Worker rawValues:(const int32_t [__nullable])values 2593*6777b538SAndroid Build Coastguard Worker forKeys:(const uint64_t [__nullable])keys 2594*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2595*6777b538SAndroid Build Coastguard Worker 2596*6777b538SAndroid Build Coastguard Worker /** 2597*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the entries from the given. 2598*6777b538SAndroid Build Coastguard Worker * dictionary. 2599*6777b538SAndroid Build Coastguard Worker * 2600*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to the dictionary. 2601*6777b538SAndroid Build Coastguard Worker * 2602*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries from the given 2603*6777b538SAndroid Build Coastguard Worker * dictionary in it. 2604*6777b538SAndroid Build Coastguard Worker **/ 2605*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt64EnumDictionary *)dictionary; 2606*6777b538SAndroid Build Coastguard Worker 2607*6777b538SAndroid Build Coastguard Worker /** 2608*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the given capacity. 2609*6777b538SAndroid Build Coastguard Worker * 2610*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 2611*6777b538SAndroid Build Coastguard Worker * @param numItems Capacity needed for the dictionary. 2612*6777b538SAndroid Build Coastguard Worker * 2613*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the given capacity. 2614*6777b538SAndroid Build Coastguard Worker **/ 2615*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 2616*6777b538SAndroid Build Coastguard Worker capacity:(NSUInteger)numItems; 2617*6777b538SAndroid Build Coastguard Worker 2618*6777b538SAndroid Build Coastguard Worker // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 2619*6777b538SAndroid Build Coastguard Worker // is not a valid enumerator as defined by validationFunc. If the actual value is 2620*6777b538SAndroid Build Coastguard Worker // desired, use "raw" version of the method. 2621*6777b538SAndroid Build Coastguard Worker 2622*6777b538SAndroid Build Coastguard Worker /** 2623*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 2624*6777b538SAndroid Build Coastguard Worker * 2625*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 2626*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 2627*6777b538SAndroid Build Coastguard Worker * 2628*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 2629*6777b538SAndroid Build Coastguard Worker **/ 2630*6777b538SAndroid Build Coastguard Worker - (BOOL)getEnum:(nullable int32_t *)value forKey:(uint64_t)key; 2631*6777b538SAndroid Build Coastguard Worker 2632*6777b538SAndroid Build Coastguard Worker /** 2633*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 2634*6777b538SAndroid Build Coastguard Worker * 2635*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 2636*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 2637*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 2638*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 2639*6777b538SAndroid Build Coastguard Worker **/ 2640*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndEnumsUsingBlock: 2641*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint64_t key, int32_t value, BOOL *stop))block; 2642*6777b538SAndroid Build Coastguard Worker 2643*6777b538SAndroid Build Coastguard Worker /** 2644*6777b538SAndroid Build Coastguard Worker * Gets the raw enum value for the given key. 2645*6777b538SAndroid Build Coastguard Worker * 2646*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the access of values that 2647*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 2648*6777b538SAndroid Build Coastguard Worker * 2649*6777b538SAndroid Build Coastguard Worker * @param rawValue Pointer into which the value will be set, if found. 2650*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 2651*6777b538SAndroid Build Coastguard Worker * 2652*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 2653*6777b538SAndroid Build Coastguard Worker **/ 2654*6777b538SAndroid Build Coastguard Worker - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint64_t)key; 2655*6777b538SAndroid Build Coastguard Worker 2656*6777b538SAndroid Build Coastguard Worker /** 2657*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 2658*6777b538SAndroid Build Coastguard Worker * 2659*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the access of values that 2660*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 2661*6777b538SAndroid Build Coastguard Worker * 2662*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 2663*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 2664*6777b538SAndroid Build Coastguard Worker * **rawValue**: The value for the current entry 2665*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 2666*6777b538SAndroid Build Coastguard Worker **/ 2667*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndRawValuesUsingBlock: 2668*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint64_t key, int32_t rawValue, BOOL *stop))block; 2669*6777b538SAndroid Build Coastguard Worker 2670*6777b538SAndroid Build Coastguard Worker /** 2671*6777b538SAndroid Build Coastguard Worker * Adds the keys and raw enum values from another dictionary. 2672*6777b538SAndroid Build Coastguard Worker * 2673*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the setting of values that 2674*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 2675*6777b538SAndroid Build Coastguard Worker * 2676*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 2677*6777b538SAndroid Build Coastguard Worker * dictionary. 2678*6777b538SAndroid Build Coastguard Worker **/ 2679*6777b538SAndroid Build Coastguard Worker - (void)addRawEntriesFromDictionary:(GPBUInt64EnumDictionary *)otherDictionary; 2680*6777b538SAndroid Build Coastguard Worker 2681*6777b538SAndroid Build Coastguard Worker // If value is not a valid enumerator as defined by validationFunc, these 2682*6777b538SAndroid Build Coastguard Worker // methods will assert in debug, and will log in release and assign the value 2683*6777b538SAndroid Build Coastguard Worker // to the default value. Use the rawValue methods below to assign non enumerator 2684*6777b538SAndroid Build Coastguard Worker // values. 2685*6777b538SAndroid Build Coastguard Worker 2686*6777b538SAndroid Build Coastguard Worker /** 2687*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 2688*6777b538SAndroid Build Coastguard Worker * 2689*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 2690*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 2691*6777b538SAndroid Build Coastguard Worker **/ 2692*6777b538SAndroid Build Coastguard Worker - (void)setEnum:(int32_t)value forKey:(uint64_t)key; 2693*6777b538SAndroid Build Coastguard Worker 2694*6777b538SAndroid Build Coastguard Worker /** 2695*6777b538SAndroid Build Coastguard Worker * Sets the raw enum value for the given key. 2696*6777b538SAndroid Build Coastguard Worker * 2697*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the setting of values that 2698*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 2699*6777b538SAndroid Build Coastguard Worker * 2700*6777b538SAndroid Build Coastguard Worker * @param rawValue The raw enum value to set. 2701*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the raw enum value. 2702*6777b538SAndroid Build Coastguard Worker **/ 2703*6777b538SAndroid Build Coastguard Worker - (void)setRawValue:(int32_t)rawValue forKey:(uint64_t)key; 2704*6777b538SAndroid Build Coastguard Worker 2705*6777b538SAndroid Build Coastguard Worker /** 2706*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 2707*6777b538SAndroid Build Coastguard Worker * 2708*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 2709*6777b538SAndroid Build Coastguard Worker **/ 2710*6777b538SAndroid Build Coastguard Worker - (void)removeEnumForKey:(uint64_t)aKey; 2711*6777b538SAndroid Build Coastguard Worker 2712*6777b538SAndroid Build Coastguard Worker /** 2713*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 2714*6777b538SAndroid Build Coastguard Worker **/ 2715*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 2716*6777b538SAndroid Build Coastguard Worker 2717*6777b538SAndroid Build Coastguard Worker @end 2718*6777b538SAndroid Build Coastguard Worker 2719*6777b538SAndroid Build Coastguard Worker #pragma mark - UInt64 -> Object 2720*6777b538SAndroid Build Coastguard Worker 2721*6777b538SAndroid Build Coastguard Worker /** 2722*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <uint64_t, ObjectType> 2723*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 2724*6777b538SAndroid Build Coastguard Worker * 2725*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 2726*6777b538SAndroid Build Coastguard Worker **/ 2727*6777b538SAndroid Build Coastguard Worker @interface GPBUInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying> 2728*6777b538SAndroid Build Coastguard Worker 2729*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 2730*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 2731*6777b538SAndroid Build Coastguard Worker 2732*6777b538SAndroid Build Coastguard Worker /** 2733*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 2734*6777b538SAndroid Build Coastguard Worker * 2735*6777b538SAndroid Build Coastguard Worker * @param objects The values to be placed in this dictionary. 2736*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 2737*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 2738*6777b538SAndroid Build Coastguard Worker * 2739*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 2740*6777b538SAndroid Build Coastguard Worker **/ 2741*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects 2742*6777b538SAndroid Build Coastguard Worker forKeys:(const uint64_t [__nullable])keys 2743*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2744*6777b538SAndroid Build Coastguard Worker 2745*6777b538SAndroid Build Coastguard Worker /** 2746*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 2747*6777b538SAndroid Build Coastguard Worker * 2748*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 2749*6777b538SAndroid Build Coastguard Worker * 2750*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 2751*6777b538SAndroid Build Coastguard Worker **/ 2752*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary; 2753*6777b538SAndroid Build Coastguard Worker 2754*6777b538SAndroid Build Coastguard Worker /** 2755*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 2756*6777b538SAndroid Build Coastguard Worker * 2757*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 2758*6777b538SAndroid Build Coastguard Worker * 2759*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 2760*6777b538SAndroid Build Coastguard Worker **/ 2761*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 2762*6777b538SAndroid Build Coastguard Worker 2763*6777b538SAndroid Build Coastguard Worker /** 2764*6777b538SAndroid Build Coastguard Worker * Fetches the object stored under the given key. 2765*6777b538SAndroid Build Coastguard Worker * 2766*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 2767*6777b538SAndroid Build Coastguard Worker * 2768*6777b538SAndroid Build Coastguard Worker * @return The object if found, nil otherwise. 2769*6777b538SAndroid Build Coastguard Worker **/ 2770*6777b538SAndroid Build Coastguard Worker - (ObjectType)objectForKey:(uint64_t)key; 2771*6777b538SAndroid Build Coastguard Worker 2772*6777b538SAndroid Build Coastguard Worker /** 2773*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 2774*6777b538SAndroid Build Coastguard Worker * 2775*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 2776*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 2777*6777b538SAndroid Build Coastguard Worker * **object**: The value for the current entry 2778*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 2779*6777b538SAndroid Build Coastguard Worker **/ 2780*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndObjectsUsingBlock: 2781*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(uint64_t key, ObjectType object, BOOL *stop))block; 2782*6777b538SAndroid Build Coastguard Worker 2783*6777b538SAndroid Build Coastguard Worker /** 2784*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 2785*6777b538SAndroid Build Coastguard Worker * 2786*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 2787*6777b538SAndroid Build Coastguard Worker * dictionary. 2788*6777b538SAndroid Build Coastguard Worker **/ 2789*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBUInt64ObjectDictionary *)otherDictionary; 2790*6777b538SAndroid Build Coastguard Worker 2791*6777b538SAndroid Build Coastguard Worker /** 2792*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 2793*6777b538SAndroid Build Coastguard Worker * 2794*6777b538SAndroid Build Coastguard Worker * @param object The value to set. 2795*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 2796*6777b538SAndroid Build Coastguard Worker **/ 2797*6777b538SAndroid Build Coastguard Worker - (void)setObject:(ObjectType)object forKey:(uint64_t)key; 2798*6777b538SAndroid Build Coastguard Worker 2799*6777b538SAndroid Build Coastguard Worker /** 2800*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 2801*6777b538SAndroid Build Coastguard Worker * 2802*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 2803*6777b538SAndroid Build Coastguard Worker **/ 2804*6777b538SAndroid Build Coastguard Worker - (void)removeObjectForKey:(uint64_t)aKey; 2805*6777b538SAndroid Build Coastguard Worker 2806*6777b538SAndroid Build Coastguard Worker /** 2807*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 2808*6777b538SAndroid Build Coastguard Worker **/ 2809*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 2810*6777b538SAndroid Build Coastguard Worker 2811*6777b538SAndroid Build Coastguard Worker @end 2812*6777b538SAndroid Build Coastguard Worker 2813*6777b538SAndroid Build Coastguard Worker #pragma mark - Int64 -> UInt32 2814*6777b538SAndroid Build Coastguard Worker 2815*6777b538SAndroid Build Coastguard Worker /** 2816*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int64_t, uint32_t> 2817*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 2818*6777b538SAndroid Build Coastguard Worker * 2819*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 2820*6777b538SAndroid Build Coastguard Worker **/ 2821*6777b538SAndroid Build Coastguard Worker @interface GPBInt64UInt32Dictionary : NSObject <NSCopying> 2822*6777b538SAndroid Build Coastguard Worker 2823*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 2824*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 2825*6777b538SAndroid Build Coastguard Worker 2826*6777b538SAndroid Build Coastguard Worker /** 2827*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 2828*6777b538SAndroid Build Coastguard Worker * 2829*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 2830*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 2831*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 2832*6777b538SAndroid Build Coastguard Worker * 2833*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 2834*6777b538SAndroid Build Coastguard Worker **/ 2835*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithUInt32s:(const uint32_t [__nullable])values 2836*6777b538SAndroid Build Coastguard Worker forKeys:(const int64_t [__nullable])keys 2837*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2838*6777b538SAndroid Build Coastguard Worker 2839*6777b538SAndroid Build Coastguard Worker /** 2840*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 2841*6777b538SAndroid Build Coastguard Worker * 2842*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 2843*6777b538SAndroid Build Coastguard Worker * 2844*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 2845*6777b538SAndroid Build Coastguard Worker **/ 2846*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt64UInt32Dictionary *)dictionary; 2847*6777b538SAndroid Build Coastguard Worker 2848*6777b538SAndroid Build Coastguard Worker /** 2849*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 2850*6777b538SAndroid Build Coastguard Worker * 2851*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 2852*6777b538SAndroid Build Coastguard Worker * 2853*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 2854*6777b538SAndroid Build Coastguard Worker **/ 2855*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 2856*6777b538SAndroid Build Coastguard Worker 2857*6777b538SAndroid Build Coastguard Worker /** 2858*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 2859*6777b538SAndroid Build Coastguard Worker * 2860*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 2861*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 2862*6777b538SAndroid Build Coastguard Worker * 2863*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 2864*6777b538SAndroid Build Coastguard Worker **/ 2865*6777b538SAndroid Build Coastguard Worker - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int64_t)key; 2866*6777b538SAndroid Build Coastguard Worker 2867*6777b538SAndroid Build Coastguard Worker /** 2868*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 2869*6777b538SAndroid Build Coastguard Worker * 2870*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 2871*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 2872*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 2873*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 2874*6777b538SAndroid Build Coastguard Worker **/ 2875*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndUInt32sUsingBlock: 2876*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int64_t key, uint32_t value, BOOL *stop))block; 2877*6777b538SAndroid Build Coastguard Worker 2878*6777b538SAndroid Build Coastguard Worker /** 2879*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 2880*6777b538SAndroid Build Coastguard Worker * 2881*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 2882*6777b538SAndroid Build Coastguard Worker * dictionary. 2883*6777b538SAndroid Build Coastguard Worker **/ 2884*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt64UInt32Dictionary *)otherDictionary; 2885*6777b538SAndroid Build Coastguard Worker 2886*6777b538SAndroid Build Coastguard Worker /** 2887*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 2888*6777b538SAndroid Build Coastguard Worker * 2889*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 2890*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 2891*6777b538SAndroid Build Coastguard Worker **/ 2892*6777b538SAndroid Build Coastguard Worker - (void)setUInt32:(uint32_t)value forKey:(int64_t)key; 2893*6777b538SAndroid Build Coastguard Worker 2894*6777b538SAndroid Build Coastguard Worker /** 2895*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 2896*6777b538SAndroid Build Coastguard Worker * 2897*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 2898*6777b538SAndroid Build Coastguard Worker **/ 2899*6777b538SAndroid Build Coastguard Worker - (void)removeUInt32ForKey:(int64_t)aKey; 2900*6777b538SAndroid Build Coastguard Worker 2901*6777b538SAndroid Build Coastguard Worker /** 2902*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 2903*6777b538SAndroid Build Coastguard Worker **/ 2904*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 2905*6777b538SAndroid Build Coastguard Worker 2906*6777b538SAndroid Build Coastguard Worker @end 2907*6777b538SAndroid Build Coastguard Worker 2908*6777b538SAndroid Build Coastguard Worker #pragma mark - Int64 -> Int32 2909*6777b538SAndroid Build Coastguard Worker 2910*6777b538SAndroid Build Coastguard Worker /** 2911*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int64_t, int32_t> 2912*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 2913*6777b538SAndroid Build Coastguard Worker * 2914*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 2915*6777b538SAndroid Build Coastguard Worker **/ 2916*6777b538SAndroid Build Coastguard Worker @interface GPBInt64Int32Dictionary : NSObject <NSCopying> 2917*6777b538SAndroid Build Coastguard Worker 2918*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 2919*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 2920*6777b538SAndroid Build Coastguard Worker 2921*6777b538SAndroid Build Coastguard Worker /** 2922*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 2923*6777b538SAndroid Build Coastguard Worker * 2924*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 2925*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 2926*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 2927*6777b538SAndroid Build Coastguard Worker * 2928*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 2929*6777b538SAndroid Build Coastguard Worker **/ 2930*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithInt32s:(const int32_t [__nullable])values 2931*6777b538SAndroid Build Coastguard Worker forKeys:(const int64_t [__nullable])keys 2932*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 2933*6777b538SAndroid Build Coastguard Worker 2934*6777b538SAndroid Build Coastguard Worker /** 2935*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 2936*6777b538SAndroid Build Coastguard Worker * 2937*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 2938*6777b538SAndroid Build Coastguard Worker * 2939*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 2940*6777b538SAndroid Build Coastguard Worker **/ 2941*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt64Int32Dictionary *)dictionary; 2942*6777b538SAndroid Build Coastguard Worker 2943*6777b538SAndroid Build Coastguard Worker /** 2944*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 2945*6777b538SAndroid Build Coastguard Worker * 2946*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 2947*6777b538SAndroid Build Coastguard Worker * 2948*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 2949*6777b538SAndroid Build Coastguard Worker **/ 2950*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 2951*6777b538SAndroid Build Coastguard Worker 2952*6777b538SAndroid Build Coastguard Worker /** 2953*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 2954*6777b538SAndroid Build Coastguard Worker * 2955*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 2956*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 2957*6777b538SAndroid Build Coastguard Worker * 2958*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 2959*6777b538SAndroid Build Coastguard Worker **/ 2960*6777b538SAndroid Build Coastguard Worker - (BOOL)getInt32:(nullable int32_t *)value forKey:(int64_t)key; 2961*6777b538SAndroid Build Coastguard Worker 2962*6777b538SAndroid Build Coastguard Worker /** 2963*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 2964*6777b538SAndroid Build Coastguard Worker * 2965*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 2966*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 2967*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 2968*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 2969*6777b538SAndroid Build Coastguard Worker **/ 2970*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndInt32sUsingBlock: 2971*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int64_t key, int32_t value, BOOL *stop))block; 2972*6777b538SAndroid Build Coastguard Worker 2973*6777b538SAndroid Build Coastguard Worker /** 2974*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 2975*6777b538SAndroid Build Coastguard Worker * 2976*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 2977*6777b538SAndroid Build Coastguard Worker * dictionary. 2978*6777b538SAndroid Build Coastguard Worker **/ 2979*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt64Int32Dictionary *)otherDictionary; 2980*6777b538SAndroid Build Coastguard Worker 2981*6777b538SAndroid Build Coastguard Worker /** 2982*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 2983*6777b538SAndroid Build Coastguard Worker * 2984*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 2985*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 2986*6777b538SAndroid Build Coastguard Worker **/ 2987*6777b538SAndroid Build Coastguard Worker - (void)setInt32:(int32_t)value forKey:(int64_t)key; 2988*6777b538SAndroid Build Coastguard Worker 2989*6777b538SAndroid Build Coastguard Worker /** 2990*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 2991*6777b538SAndroid Build Coastguard Worker * 2992*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 2993*6777b538SAndroid Build Coastguard Worker **/ 2994*6777b538SAndroid Build Coastguard Worker - (void)removeInt32ForKey:(int64_t)aKey; 2995*6777b538SAndroid Build Coastguard Worker 2996*6777b538SAndroid Build Coastguard Worker /** 2997*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 2998*6777b538SAndroid Build Coastguard Worker **/ 2999*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 3000*6777b538SAndroid Build Coastguard Worker 3001*6777b538SAndroid Build Coastguard Worker @end 3002*6777b538SAndroid Build Coastguard Worker 3003*6777b538SAndroid Build Coastguard Worker #pragma mark - Int64 -> UInt64 3004*6777b538SAndroid Build Coastguard Worker 3005*6777b538SAndroid Build Coastguard Worker /** 3006*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int64_t, uint64_t> 3007*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 3008*6777b538SAndroid Build Coastguard Worker * 3009*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 3010*6777b538SAndroid Build Coastguard Worker **/ 3011*6777b538SAndroid Build Coastguard Worker @interface GPBInt64UInt64Dictionary : NSObject <NSCopying> 3012*6777b538SAndroid Build Coastguard Worker 3013*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 3014*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 3015*6777b538SAndroid Build Coastguard Worker 3016*6777b538SAndroid Build Coastguard Worker /** 3017*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 3018*6777b538SAndroid Build Coastguard Worker * 3019*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 3020*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 3021*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 3022*6777b538SAndroid Build Coastguard Worker * 3023*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 3024*6777b538SAndroid Build Coastguard Worker **/ 3025*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithUInt64s:(const uint64_t [__nullable])values 3026*6777b538SAndroid Build Coastguard Worker forKeys:(const int64_t [__nullable])keys 3027*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 3028*6777b538SAndroid Build Coastguard Worker 3029*6777b538SAndroid Build Coastguard Worker /** 3030*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 3031*6777b538SAndroid Build Coastguard Worker * 3032*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 3033*6777b538SAndroid Build Coastguard Worker * 3034*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 3035*6777b538SAndroid Build Coastguard Worker **/ 3036*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt64UInt64Dictionary *)dictionary; 3037*6777b538SAndroid Build Coastguard Worker 3038*6777b538SAndroid Build Coastguard Worker /** 3039*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 3040*6777b538SAndroid Build Coastguard Worker * 3041*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 3042*6777b538SAndroid Build Coastguard Worker * 3043*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 3044*6777b538SAndroid Build Coastguard Worker **/ 3045*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 3046*6777b538SAndroid Build Coastguard Worker 3047*6777b538SAndroid Build Coastguard Worker /** 3048*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 3049*6777b538SAndroid Build Coastguard Worker * 3050*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 3051*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 3052*6777b538SAndroid Build Coastguard Worker * 3053*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 3054*6777b538SAndroid Build Coastguard Worker **/ 3055*6777b538SAndroid Build Coastguard Worker - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int64_t)key; 3056*6777b538SAndroid Build Coastguard Worker 3057*6777b538SAndroid Build Coastguard Worker /** 3058*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 3059*6777b538SAndroid Build Coastguard Worker * 3060*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 3061*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 3062*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 3063*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 3064*6777b538SAndroid Build Coastguard Worker **/ 3065*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndUInt64sUsingBlock: 3066*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int64_t key, uint64_t value, BOOL *stop))block; 3067*6777b538SAndroid Build Coastguard Worker 3068*6777b538SAndroid Build Coastguard Worker /** 3069*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 3070*6777b538SAndroid Build Coastguard Worker * 3071*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 3072*6777b538SAndroid Build Coastguard Worker * dictionary. 3073*6777b538SAndroid Build Coastguard Worker **/ 3074*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt64UInt64Dictionary *)otherDictionary; 3075*6777b538SAndroid Build Coastguard Worker 3076*6777b538SAndroid Build Coastguard Worker /** 3077*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 3078*6777b538SAndroid Build Coastguard Worker * 3079*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 3080*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 3081*6777b538SAndroid Build Coastguard Worker **/ 3082*6777b538SAndroid Build Coastguard Worker - (void)setUInt64:(uint64_t)value forKey:(int64_t)key; 3083*6777b538SAndroid Build Coastguard Worker 3084*6777b538SAndroid Build Coastguard Worker /** 3085*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 3086*6777b538SAndroid Build Coastguard Worker * 3087*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 3088*6777b538SAndroid Build Coastguard Worker **/ 3089*6777b538SAndroid Build Coastguard Worker - (void)removeUInt64ForKey:(int64_t)aKey; 3090*6777b538SAndroid Build Coastguard Worker 3091*6777b538SAndroid Build Coastguard Worker /** 3092*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 3093*6777b538SAndroid Build Coastguard Worker **/ 3094*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 3095*6777b538SAndroid Build Coastguard Worker 3096*6777b538SAndroid Build Coastguard Worker @end 3097*6777b538SAndroid Build Coastguard Worker 3098*6777b538SAndroid Build Coastguard Worker #pragma mark - Int64 -> Int64 3099*6777b538SAndroid Build Coastguard Worker 3100*6777b538SAndroid Build Coastguard Worker /** 3101*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int64_t, int64_t> 3102*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 3103*6777b538SAndroid Build Coastguard Worker * 3104*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 3105*6777b538SAndroid Build Coastguard Worker **/ 3106*6777b538SAndroid Build Coastguard Worker @interface GPBInt64Int64Dictionary : NSObject <NSCopying> 3107*6777b538SAndroid Build Coastguard Worker 3108*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 3109*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 3110*6777b538SAndroid Build Coastguard Worker 3111*6777b538SAndroid Build Coastguard Worker /** 3112*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 3113*6777b538SAndroid Build Coastguard Worker * 3114*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 3115*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 3116*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 3117*6777b538SAndroid Build Coastguard Worker * 3118*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 3119*6777b538SAndroid Build Coastguard Worker **/ 3120*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithInt64s:(const int64_t [__nullable])values 3121*6777b538SAndroid Build Coastguard Worker forKeys:(const int64_t [__nullable])keys 3122*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 3123*6777b538SAndroid Build Coastguard Worker 3124*6777b538SAndroid Build Coastguard Worker /** 3125*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 3126*6777b538SAndroid Build Coastguard Worker * 3127*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 3128*6777b538SAndroid Build Coastguard Worker * 3129*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 3130*6777b538SAndroid Build Coastguard Worker **/ 3131*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt64Int64Dictionary *)dictionary; 3132*6777b538SAndroid Build Coastguard Worker 3133*6777b538SAndroid Build Coastguard Worker /** 3134*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 3135*6777b538SAndroid Build Coastguard Worker * 3136*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 3137*6777b538SAndroid Build Coastguard Worker * 3138*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 3139*6777b538SAndroid Build Coastguard Worker **/ 3140*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 3141*6777b538SAndroid Build Coastguard Worker 3142*6777b538SAndroid Build Coastguard Worker /** 3143*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 3144*6777b538SAndroid Build Coastguard Worker * 3145*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 3146*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 3147*6777b538SAndroid Build Coastguard Worker * 3148*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 3149*6777b538SAndroid Build Coastguard Worker **/ 3150*6777b538SAndroid Build Coastguard Worker - (BOOL)getInt64:(nullable int64_t *)value forKey:(int64_t)key; 3151*6777b538SAndroid Build Coastguard Worker 3152*6777b538SAndroid Build Coastguard Worker /** 3153*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 3154*6777b538SAndroid Build Coastguard Worker * 3155*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 3156*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 3157*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 3158*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 3159*6777b538SAndroid Build Coastguard Worker **/ 3160*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndInt64sUsingBlock: 3161*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int64_t key, int64_t value, BOOL *stop))block; 3162*6777b538SAndroid Build Coastguard Worker 3163*6777b538SAndroid Build Coastguard Worker /** 3164*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 3165*6777b538SAndroid Build Coastguard Worker * 3166*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 3167*6777b538SAndroid Build Coastguard Worker * dictionary. 3168*6777b538SAndroid Build Coastguard Worker **/ 3169*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt64Int64Dictionary *)otherDictionary; 3170*6777b538SAndroid Build Coastguard Worker 3171*6777b538SAndroid Build Coastguard Worker /** 3172*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 3173*6777b538SAndroid Build Coastguard Worker * 3174*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 3175*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 3176*6777b538SAndroid Build Coastguard Worker **/ 3177*6777b538SAndroid Build Coastguard Worker - (void)setInt64:(int64_t)value forKey:(int64_t)key; 3178*6777b538SAndroid Build Coastguard Worker 3179*6777b538SAndroid Build Coastguard Worker /** 3180*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 3181*6777b538SAndroid Build Coastguard Worker * 3182*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 3183*6777b538SAndroid Build Coastguard Worker **/ 3184*6777b538SAndroid Build Coastguard Worker - (void)removeInt64ForKey:(int64_t)aKey; 3185*6777b538SAndroid Build Coastguard Worker 3186*6777b538SAndroid Build Coastguard Worker /** 3187*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 3188*6777b538SAndroid Build Coastguard Worker **/ 3189*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 3190*6777b538SAndroid Build Coastguard Worker 3191*6777b538SAndroid Build Coastguard Worker @end 3192*6777b538SAndroid Build Coastguard Worker 3193*6777b538SAndroid Build Coastguard Worker #pragma mark - Int64 -> Bool 3194*6777b538SAndroid Build Coastguard Worker 3195*6777b538SAndroid Build Coastguard Worker /** 3196*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int64_t, BOOL> 3197*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 3198*6777b538SAndroid Build Coastguard Worker * 3199*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 3200*6777b538SAndroid Build Coastguard Worker **/ 3201*6777b538SAndroid Build Coastguard Worker @interface GPBInt64BoolDictionary : NSObject <NSCopying> 3202*6777b538SAndroid Build Coastguard Worker 3203*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 3204*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 3205*6777b538SAndroid Build Coastguard Worker 3206*6777b538SAndroid Build Coastguard Worker /** 3207*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 3208*6777b538SAndroid Build Coastguard Worker * 3209*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 3210*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 3211*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 3212*6777b538SAndroid Build Coastguard Worker * 3213*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 3214*6777b538SAndroid Build Coastguard Worker **/ 3215*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithBools:(const BOOL [__nullable])values 3216*6777b538SAndroid Build Coastguard Worker forKeys:(const int64_t [__nullable])keys 3217*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 3218*6777b538SAndroid Build Coastguard Worker 3219*6777b538SAndroid Build Coastguard Worker /** 3220*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 3221*6777b538SAndroid Build Coastguard Worker * 3222*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 3223*6777b538SAndroid Build Coastguard Worker * 3224*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 3225*6777b538SAndroid Build Coastguard Worker **/ 3226*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt64BoolDictionary *)dictionary; 3227*6777b538SAndroid Build Coastguard Worker 3228*6777b538SAndroid Build Coastguard Worker /** 3229*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 3230*6777b538SAndroid Build Coastguard Worker * 3231*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 3232*6777b538SAndroid Build Coastguard Worker * 3233*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 3234*6777b538SAndroid Build Coastguard Worker **/ 3235*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 3236*6777b538SAndroid Build Coastguard Worker 3237*6777b538SAndroid Build Coastguard Worker /** 3238*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 3239*6777b538SAndroid Build Coastguard Worker * 3240*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 3241*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 3242*6777b538SAndroid Build Coastguard Worker * 3243*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 3244*6777b538SAndroid Build Coastguard Worker **/ 3245*6777b538SAndroid Build Coastguard Worker - (BOOL)getBool:(nullable BOOL *)value forKey:(int64_t)key; 3246*6777b538SAndroid Build Coastguard Worker 3247*6777b538SAndroid Build Coastguard Worker /** 3248*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 3249*6777b538SAndroid Build Coastguard Worker * 3250*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 3251*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 3252*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 3253*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 3254*6777b538SAndroid Build Coastguard Worker **/ 3255*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndBoolsUsingBlock: 3256*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int64_t key, BOOL value, BOOL *stop))block; 3257*6777b538SAndroid Build Coastguard Worker 3258*6777b538SAndroid Build Coastguard Worker /** 3259*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 3260*6777b538SAndroid Build Coastguard Worker * 3261*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 3262*6777b538SAndroid Build Coastguard Worker * dictionary. 3263*6777b538SAndroid Build Coastguard Worker **/ 3264*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt64BoolDictionary *)otherDictionary; 3265*6777b538SAndroid Build Coastguard Worker 3266*6777b538SAndroid Build Coastguard Worker /** 3267*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 3268*6777b538SAndroid Build Coastguard Worker * 3269*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 3270*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 3271*6777b538SAndroid Build Coastguard Worker **/ 3272*6777b538SAndroid Build Coastguard Worker - (void)setBool:(BOOL)value forKey:(int64_t)key; 3273*6777b538SAndroid Build Coastguard Worker 3274*6777b538SAndroid Build Coastguard Worker /** 3275*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 3276*6777b538SAndroid Build Coastguard Worker * 3277*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 3278*6777b538SAndroid Build Coastguard Worker **/ 3279*6777b538SAndroid Build Coastguard Worker - (void)removeBoolForKey:(int64_t)aKey; 3280*6777b538SAndroid Build Coastguard Worker 3281*6777b538SAndroid Build Coastguard Worker /** 3282*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 3283*6777b538SAndroid Build Coastguard Worker **/ 3284*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 3285*6777b538SAndroid Build Coastguard Worker 3286*6777b538SAndroid Build Coastguard Worker @end 3287*6777b538SAndroid Build Coastguard Worker 3288*6777b538SAndroid Build Coastguard Worker #pragma mark - Int64 -> Float 3289*6777b538SAndroid Build Coastguard Worker 3290*6777b538SAndroid Build Coastguard Worker /** 3291*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int64_t, float> 3292*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 3293*6777b538SAndroid Build Coastguard Worker * 3294*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 3295*6777b538SAndroid Build Coastguard Worker **/ 3296*6777b538SAndroid Build Coastguard Worker @interface GPBInt64FloatDictionary : NSObject <NSCopying> 3297*6777b538SAndroid Build Coastguard Worker 3298*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 3299*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 3300*6777b538SAndroid Build Coastguard Worker 3301*6777b538SAndroid Build Coastguard Worker /** 3302*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 3303*6777b538SAndroid Build Coastguard Worker * 3304*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 3305*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 3306*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 3307*6777b538SAndroid Build Coastguard Worker * 3308*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 3309*6777b538SAndroid Build Coastguard Worker **/ 3310*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithFloats:(const float [__nullable])values 3311*6777b538SAndroid Build Coastguard Worker forKeys:(const int64_t [__nullable])keys 3312*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 3313*6777b538SAndroid Build Coastguard Worker 3314*6777b538SAndroid Build Coastguard Worker /** 3315*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 3316*6777b538SAndroid Build Coastguard Worker * 3317*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 3318*6777b538SAndroid Build Coastguard Worker * 3319*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 3320*6777b538SAndroid Build Coastguard Worker **/ 3321*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt64FloatDictionary *)dictionary; 3322*6777b538SAndroid Build Coastguard Worker 3323*6777b538SAndroid Build Coastguard Worker /** 3324*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 3325*6777b538SAndroid Build Coastguard Worker * 3326*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 3327*6777b538SAndroid Build Coastguard Worker * 3328*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 3329*6777b538SAndroid Build Coastguard Worker **/ 3330*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 3331*6777b538SAndroid Build Coastguard Worker 3332*6777b538SAndroid Build Coastguard Worker /** 3333*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 3334*6777b538SAndroid Build Coastguard Worker * 3335*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 3336*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 3337*6777b538SAndroid Build Coastguard Worker * 3338*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 3339*6777b538SAndroid Build Coastguard Worker **/ 3340*6777b538SAndroid Build Coastguard Worker - (BOOL)getFloat:(nullable float *)value forKey:(int64_t)key; 3341*6777b538SAndroid Build Coastguard Worker 3342*6777b538SAndroid Build Coastguard Worker /** 3343*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 3344*6777b538SAndroid Build Coastguard Worker * 3345*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 3346*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 3347*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 3348*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 3349*6777b538SAndroid Build Coastguard Worker **/ 3350*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndFloatsUsingBlock: 3351*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int64_t key, float value, BOOL *stop))block; 3352*6777b538SAndroid Build Coastguard Worker 3353*6777b538SAndroid Build Coastguard Worker /** 3354*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 3355*6777b538SAndroid Build Coastguard Worker * 3356*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 3357*6777b538SAndroid Build Coastguard Worker * dictionary. 3358*6777b538SAndroid Build Coastguard Worker **/ 3359*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt64FloatDictionary *)otherDictionary; 3360*6777b538SAndroid Build Coastguard Worker 3361*6777b538SAndroid Build Coastguard Worker /** 3362*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 3363*6777b538SAndroid Build Coastguard Worker * 3364*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 3365*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 3366*6777b538SAndroid Build Coastguard Worker **/ 3367*6777b538SAndroid Build Coastguard Worker - (void)setFloat:(float)value forKey:(int64_t)key; 3368*6777b538SAndroid Build Coastguard Worker 3369*6777b538SAndroid Build Coastguard Worker /** 3370*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 3371*6777b538SAndroid Build Coastguard Worker * 3372*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 3373*6777b538SAndroid Build Coastguard Worker **/ 3374*6777b538SAndroid Build Coastguard Worker - (void)removeFloatForKey:(int64_t)aKey; 3375*6777b538SAndroid Build Coastguard Worker 3376*6777b538SAndroid Build Coastguard Worker /** 3377*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 3378*6777b538SAndroid Build Coastguard Worker **/ 3379*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 3380*6777b538SAndroid Build Coastguard Worker 3381*6777b538SAndroid Build Coastguard Worker @end 3382*6777b538SAndroid Build Coastguard Worker 3383*6777b538SAndroid Build Coastguard Worker #pragma mark - Int64 -> Double 3384*6777b538SAndroid Build Coastguard Worker 3385*6777b538SAndroid Build Coastguard Worker /** 3386*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int64_t, double> 3387*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 3388*6777b538SAndroid Build Coastguard Worker * 3389*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 3390*6777b538SAndroid Build Coastguard Worker **/ 3391*6777b538SAndroid Build Coastguard Worker @interface GPBInt64DoubleDictionary : NSObject <NSCopying> 3392*6777b538SAndroid Build Coastguard Worker 3393*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 3394*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 3395*6777b538SAndroid Build Coastguard Worker 3396*6777b538SAndroid Build Coastguard Worker /** 3397*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 3398*6777b538SAndroid Build Coastguard Worker * 3399*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 3400*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 3401*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 3402*6777b538SAndroid Build Coastguard Worker * 3403*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 3404*6777b538SAndroid Build Coastguard Worker **/ 3405*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDoubles:(const double [__nullable])values 3406*6777b538SAndroid Build Coastguard Worker forKeys:(const int64_t [__nullable])keys 3407*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 3408*6777b538SAndroid Build Coastguard Worker 3409*6777b538SAndroid Build Coastguard Worker /** 3410*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 3411*6777b538SAndroid Build Coastguard Worker * 3412*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 3413*6777b538SAndroid Build Coastguard Worker * 3414*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 3415*6777b538SAndroid Build Coastguard Worker **/ 3416*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt64DoubleDictionary *)dictionary; 3417*6777b538SAndroid Build Coastguard Worker 3418*6777b538SAndroid Build Coastguard Worker /** 3419*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 3420*6777b538SAndroid Build Coastguard Worker * 3421*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 3422*6777b538SAndroid Build Coastguard Worker * 3423*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 3424*6777b538SAndroid Build Coastguard Worker **/ 3425*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 3426*6777b538SAndroid Build Coastguard Worker 3427*6777b538SAndroid Build Coastguard Worker /** 3428*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 3429*6777b538SAndroid Build Coastguard Worker * 3430*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 3431*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 3432*6777b538SAndroid Build Coastguard Worker * 3433*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 3434*6777b538SAndroid Build Coastguard Worker **/ 3435*6777b538SAndroid Build Coastguard Worker - (BOOL)getDouble:(nullable double *)value forKey:(int64_t)key; 3436*6777b538SAndroid Build Coastguard Worker 3437*6777b538SAndroid Build Coastguard Worker /** 3438*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 3439*6777b538SAndroid Build Coastguard Worker * 3440*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 3441*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 3442*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 3443*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 3444*6777b538SAndroid Build Coastguard Worker **/ 3445*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndDoublesUsingBlock: 3446*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int64_t key, double value, BOOL *stop))block; 3447*6777b538SAndroid Build Coastguard Worker 3448*6777b538SAndroid Build Coastguard Worker /** 3449*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 3450*6777b538SAndroid Build Coastguard Worker * 3451*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 3452*6777b538SAndroid Build Coastguard Worker * dictionary. 3453*6777b538SAndroid Build Coastguard Worker **/ 3454*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt64DoubleDictionary *)otherDictionary; 3455*6777b538SAndroid Build Coastguard Worker 3456*6777b538SAndroid Build Coastguard Worker /** 3457*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 3458*6777b538SAndroid Build Coastguard Worker * 3459*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 3460*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 3461*6777b538SAndroid Build Coastguard Worker **/ 3462*6777b538SAndroid Build Coastguard Worker - (void)setDouble:(double)value forKey:(int64_t)key; 3463*6777b538SAndroid Build Coastguard Worker 3464*6777b538SAndroid Build Coastguard Worker /** 3465*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 3466*6777b538SAndroid Build Coastguard Worker * 3467*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 3468*6777b538SAndroid Build Coastguard Worker **/ 3469*6777b538SAndroid Build Coastguard Worker - (void)removeDoubleForKey:(int64_t)aKey; 3470*6777b538SAndroid Build Coastguard Worker 3471*6777b538SAndroid Build Coastguard Worker /** 3472*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 3473*6777b538SAndroid Build Coastguard Worker **/ 3474*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 3475*6777b538SAndroid Build Coastguard Worker 3476*6777b538SAndroid Build Coastguard Worker @end 3477*6777b538SAndroid Build Coastguard Worker 3478*6777b538SAndroid Build Coastguard Worker #pragma mark - Int64 -> Enum 3479*6777b538SAndroid Build Coastguard Worker 3480*6777b538SAndroid Build Coastguard Worker /** 3481*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int64_t, int32_t> 3482*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 3483*6777b538SAndroid Build Coastguard Worker * 3484*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 3485*6777b538SAndroid Build Coastguard Worker **/ 3486*6777b538SAndroid Build Coastguard Worker @interface GPBInt64EnumDictionary : NSObject <NSCopying> 3487*6777b538SAndroid Build Coastguard Worker 3488*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 3489*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 3490*6777b538SAndroid Build Coastguard Worker /** The validation function to check if the enums are valid. */ 3491*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 3492*6777b538SAndroid Build Coastguard Worker 3493*6777b538SAndroid Build Coastguard Worker /** 3494*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the given validation function. 3495*6777b538SAndroid Build Coastguard Worker * 3496*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 3497*6777b538SAndroid Build Coastguard Worker * 3498*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary. 3499*6777b538SAndroid Build Coastguard Worker **/ 3500*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 3501*6777b538SAndroid Build Coastguard Worker 3502*6777b538SAndroid Build Coastguard Worker /** 3503*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the entries given. 3504*6777b538SAndroid Build Coastguard Worker * 3505*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 3506*6777b538SAndroid Build Coastguard Worker * @param values The raw enum values values to be placed in the dictionary. 3507*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 3508*6777b538SAndroid Build Coastguard Worker * @param count The number of entries to store in the dictionary. 3509*6777b538SAndroid Build Coastguard Worker * 3510*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the keys and values in it. 3511*6777b538SAndroid Build Coastguard Worker **/ 3512*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 3513*6777b538SAndroid Build Coastguard Worker rawValues:(const int32_t [__nullable])values 3514*6777b538SAndroid Build Coastguard Worker forKeys:(const int64_t [__nullable])keys 3515*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 3516*6777b538SAndroid Build Coastguard Worker 3517*6777b538SAndroid Build Coastguard Worker /** 3518*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the entries from the given. 3519*6777b538SAndroid Build Coastguard Worker * dictionary. 3520*6777b538SAndroid Build Coastguard Worker * 3521*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to the dictionary. 3522*6777b538SAndroid Build Coastguard Worker * 3523*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries from the given 3524*6777b538SAndroid Build Coastguard Worker * dictionary in it. 3525*6777b538SAndroid Build Coastguard Worker **/ 3526*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt64EnumDictionary *)dictionary; 3527*6777b538SAndroid Build Coastguard Worker 3528*6777b538SAndroid Build Coastguard Worker /** 3529*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the given capacity. 3530*6777b538SAndroid Build Coastguard Worker * 3531*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 3532*6777b538SAndroid Build Coastguard Worker * @param numItems Capacity needed for the dictionary. 3533*6777b538SAndroid Build Coastguard Worker * 3534*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the given capacity. 3535*6777b538SAndroid Build Coastguard Worker **/ 3536*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 3537*6777b538SAndroid Build Coastguard Worker capacity:(NSUInteger)numItems; 3538*6777b538SAndroid Build Coastguard Worker 3539*6777b538SAndroid Build Coastguard Worker // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 3540*6777b538SAndroid Build Coastguard Worker // is not a valid enumerator as defined by validationFunc. If the actual value is 3541*6777b538SAndroid Build Coastguard Worker // desired, use "raw" version of the method. 3542*6777b538SAndroid Build Coastguard Worker 3543*6777b538SAndroid Build Coastguard Worker /** 3544*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 3545*6777b538SAndroid Build Coastguard Worker * 3546*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 3547*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 3548*6777b538SAndroid Build Coastguard Worker * 3549*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 3550*6777b538SAndroid Build Coastguard Worker **/ 3551*6777b538SAndroid Build Coastguard Worker - (BOOL)getEnum:(nullable int32_t *)value forKey:(int64_t)key; 3552*6777b538SAndroid Build Coastguard Worker 3553*6777b538SAndroid Build Coastguard Worker /** 3554*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 3555*6777b538SAndroid Build Coastguard Worker * 3556*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 3557*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 3558*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 3559*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 3560*6777b538SAndroid Build Coastguard Worker **/ 3561*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndEnumsUsingBlock: 3562*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int64_t key, int32_t value, BOOL *stop))block; 3563*6777b538SAndroid Build Coastguard Worker 3564*6777b538SAndroid Build Coastguard Worker /** 3565*6777b538SAndroid Build Coastguard Worker * Gets the raw enum value for the given key. 3566*6777b538SAndroid Build Coastguard Worker * 3567*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the access of values that 3568*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 3569*6777b538SAndroid Build Coastguard Worker * 3570*6777b538SAndroid Build Coastguard Worker * @param rawValue Pointer into which the value will be set, if found. 3571*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 3572*6777b538SAndroid Build Coastguard Worker * 3573*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 3574*6777b538SAndroid Build Coastguard Worker **/ 3575*6777b538SAndroid Build Coastguard Worker - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int64_t)key; 3576*6777b538SAndroid Build Coastguard Worker 3577*6777b538SAndroid Build Coastguard Worker /** 3578*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 3579*6777b538SAndroid Build Coastguard Worker * 3580*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the access of values that 3581*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 3582*6777b538SAndroid Build Coastguard Worker * 3583*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 3584*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 3585*6777b538SAndroid Build Coastguard Worker * **rawValue**: The value for the current entry 3586*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 3587*6777b538SAndroid Build Coastguard Worker **/ 3588*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndRawValuesUsingBlock: 3589*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int64_t key, int32_t rawValue, BOOL *stop))block; 3590*6777b538SAndroid Build Coastguard Worker 3591*6777b538SAndroid Build Coastguard Worker /** 3592*6777b538SAndroid Build Coastguard Worker * Adds the keys and raw enum values from another dictionary. 3593*6777b538SAndroid Build Coastguard Worker * 3594*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the setting of values that 3595*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 3596*6777b538SAndroid Build Coastguard Worker * 3597*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 3598*6777b538SAndroid Build Coastguard Worker * dictionary. 3599*6777b538SAndroid Build Coastguard Worker **/ 3600*6777b538SAndroid Build Coastguard Worker - (void)addRawEntriesFromDictionary:(GPBInt64EnumDictionary *)otherDictionary; 3601*6777b538SAndroid Build Coastguard Worker 3602*6777b538SAndroid Build Coastguard Worker // If value is not a valid enumerator as defined by validationFunc, these 3603*6777b538SAndroid Build Coastguard Worker // methods will assert in debug, and will log in release and assign the value 3604*6777b538SAndroid Build Coastguard Worker // to the default value. Use the rawValue methods below to assign non enumerator 3605*6777b538SAndroid Build Coastguard Worker // values. 3606*6777b538SAndroid Build Coastguard Worker 3607*6777b538SAndroid Build Coastguard Worker /** 3608*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 3609*6777b538SAndroid Build Coastguard Worker * 3610*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 3611*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 3612*6777b538SAndroid Build Coastguard Worker **/ 3613*6777b538SAndroid Build Coastguard Worker - (void)setEnum:(int32_t)value forKey:(int64_t)key; 3614*6777b538SAndroid Build Coastguard Worker 3615*6777b538SAndroid Build Coastguard Worker /** 3616*6777b538SAndroid Build Coastguard Worker * Sets the raw enum value for the given key. 3617*6777b538SAndroid Build Coastguard Worker * 3618*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the setting of values that 3619*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 3620*6777b538SAndroid Build Coastguard Worker * 3621*6777b538SAndroid Build Coastguard Worker * @param rawValue The raw enum value to set. 3622*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the raw enum value. 3623*6777b538SAndroid Build Coastguard Worker **/ 3624*6777b538SAndroid Build Coastguard Worker - (void)setRawValue:(int32_t)rawValue forKey:(int64_t)key; 3625*6777b538SAndroid Build Coastguard Worker 3626*6777b538SAndroid Build Coastguard Worker /** 3627*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 3628*6777b538SAndroid Build Coastguard Worker * 3629*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 3630*6777b538SAndroid Build Coastguard Worker **/ 3631*6777b538SAndroid Build Coastguard Worker - (void)removeEnumForKey:(int64_t)aKey; 3632*6777b538SAndroid Build Coastguard Worker 3633*6777b538SAndroid Build Coastguard Worker /** 3634*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 3635*6777b538SAndroid Build Coastguard Worker **/ 3636*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 3637*6777b538SAndroid Build Coastguard Worker 3638*6777b538SAndroid Build Coastguard Worker @end 3639*6777b538SAndroid Build Coastguard Worker 3640*6777b538SAndroid Build Coastguard Worker #pragma mark - Int64 -> Object 3641*6777b538SAndroid Build Coastguard Worker 3642*6777b538SAndroid Build Coastguard Worker /** 3643*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <int64_t, ObjectType> 3644*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 3645*6777b538SAndroid Build Coastguard Worker * 3646*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 3647*6777b538SAndroid Build Coastguard Worker **/ 3648*6777b538SAndroid Build Coastguard Worker @interface GPBInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying> 3649*6777b538SAndroid Build Coastguard Worker 3650*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 3651*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 3652*6777b538SAndroid Build Coastguard Worker 3653*6777b538SAndroid Build Coastguard Worker /** 3654*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 3655*6777b538SAndroid Build Coastguard Worker * 3656*6777b538SAndroid Build Coastguard Worker * @param objects The values to be placed in this dictionary. 3657*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 3658*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 3659*6777b538SAndroid Build Coastguard Worker * 3660*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 3661*6777b538SAndroid Build Coastguard Worker **/ 3662*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects 3663*6777b538SAndroid Build Coastguard Worker forKeys:(const int64_t [__nullable])keys 3664*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 3665*6777b538SAndroid Build Coastguard Worker 3666*6777b538SAndroid Build Coastguard Worker /** 3667*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 3668*6777b538SAndroid Build Coastguard Worker * 3669*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 3670*6777b538SAndroid Build Coastguard Worker * 3671*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 3672*6777b538SAndroid Build Coastguard Worker **/ 3673*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary; 3674*6777b538SAndroid Build Coastguard Worker 3675*6777b538SAndroid Build Coastguard Worker /** 3676*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 3677*6777b538SAndroid Build Coastguard Worker * 3678*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 3679*6777b538SAndroid Build Coastguard Worker * 3680*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 3681*6777b538SAndroid Build Coastguard Worker **/ 3682*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 3683*6777b538SAndroid Build Coastguard Worker 3684*6777b538SAndroid Build Coastguard Worker /** 3685*6777b538SAndroid Build Coastguard Worker * Fetches the object stored under the given key. 3686*6777b538SAndroid Build Coastguard Worker * 3687*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 3688*6777b538SAndroid Build Coastguard Worker * 3689*6777b538SAndroid Build Coastguard Worker * @return The object if found, nil otherwise. 3690*6777b538SAndroid Build Coastguard Worker **/ 3691*6777b538SAndroid Build Coastguard Worker - (ObjectType)objectForKey:(int64_t)key; 3692*6777b538SAndroid Build Coastguard Worker 3693*6777b538SAndroid Build Coastguard Worker /** 3694*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 3695*6777b538SAndroid Build Coastguard Worker * 3696*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 3697*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 3698*6777b538SAndroid Build Coastguard Worker * **object**: The value for the current entry 3699*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 3700*6777b538SAndroid Build Coastguard Worker **/ 3701*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndObjectsUsingBlock: 3702*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(int64_t key, ObjectType object, BOOL *stop))block; 3703*6777b538SAndroid Build Coastguard Worker 3704*6777b538SAndroid Build Coastguard Worker /** 3705*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 3706*6777b538SAndroid Build Coastguard Worker * 3707*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 3708*6777b538SAndroid Build Coastguard Worker * dictionary. 3709*6777b538SAndroid Build Coastguard Worker **/ 3710*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBInt64ObjectDictionary *)otherDictionary; 3711*6777b538SAndroid Build Coastguard Worker 3712*6777b538SAndroid Build Coastguard Worker /** 3713*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 3714*6777b538SAndroid Build Coastguard Worker * 3715*6777b538SAndroid Build Coastguard Worker * @param object The value to set. 3716*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 3717*6777b538SAndroid Build Coastguard Worker **/ 3718*6777b538SAndroid Build Coastguard Worker - (void)setObject:(ObjectType)object forKey:(int64_t)key; 3719*6777b538SAndroid Build Coastguard Worker 3720*6777b538SAndroid Build Coastguard Worker /** 3721*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 3722*6777b538SAndroid Build Coastguard Worker * 3723*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 3724*6777b538SAndroid Build Coastguard Worker **/ 3725*6777b538SAndroid Build Coastguard Worker - (void)removeObjectForKey:(int64_t)aKey; 3726*6777b538SAndroid Build Coastguard Worker 3727*6777b538SAndroid Build Coastguard Worker /** 3728*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 3729*6777b538SAndroid Build Coastguard Worker **/ 3730*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 3731*6777b538SAndroid Build Coastguard Worker 3732*6777b538SAndroid Build Coastguard Worker @end 3733*6777b538SAndroid Build Coastguard Worker 3734*6777b538SAndroid Build Coastguard Worker #pragma mark - Bool -> UInt32 3735*6777b538SAndroid Build Coastguard Worker 3736*6777b538SAndroid Build Coastguard Worker /** 3737*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <BOOL, uint32_t> 3738*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 3739*6777b538SAndroid Build Coastguard Worker * 3740*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 3741*6777b538SAndroid Build Coastguard Worker **/ 3742*6777b538SAndroid Build Coastguard Worker @interface GPBBoolUInt32Dictionary : NSObject <NSCopying> 3743*6777b538SAndroid Build Coastguard Worker 3744*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 3745*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 3746*6777b538SAndroid Build Coastguard Worker 3747*6777b538SAndroid Build Coastguard Worker /** 3748*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 3749*6777b538SAndroid Build Coastguard Worker * 3750*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 3751*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 3752*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 3753*6777b538SAndroid Build Coastguard Worker * 3754*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 3755*6777b538SAndroid Build Coastguard Worker **/ 3756*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithUInt32s:(const uint32_t [__nullable])values 3757*6777b538SAndroid Build Coastguard Worker forKeys:(const BOOL [__nullable])keys 3758*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 3759*6777b538SAndroid Build Coastguard Worker 3760*6777b538SAndroid Build Coastguard Worker /** 3761*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 3762*6777b538SAndroid Build Coastguard Worker * 3763*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 3764*6777b538SAndroid Build Coastguard Worker * 3765*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 3766*6777b538SAndroid Build Coastguard Worker **/ 3767*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBBoolUInt32Dictionary *)dictionary; 3768*6777b538SAndroid Build Coastguard Worker 3769*6777b538SAndroid Build Coastguard Worker /** 3770*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 3771*6777b538SAndroid Build Coastguard Worker * 3772*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 3773*6777b538SAndroid Build Coastguard Worker * 3774*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 3775*6777b538SAndroid Build Coastguard Worker **/ 3776*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 3777*6777b538SAndroid Build Coastguard Worker 3778*6777b538SAndroid Build Coastguard Worker /** 3779*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 3780*6777b538SAndroid Build Coastguard Worker * 3781*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 3782*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 3783*6777b538SAndroid Build Coastguard Worker * 3784*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 3785*6777b538SAndroid Build Coastguard Worker **/ 3786*6777b538SAndroid Build Coastguard Worker - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(BOOL)key; 3787*6777b538SAndroid Build Coastguard Worker 3788*6777b538SAndroid Build Coastguard Worker /** 3789*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 3790*6777b538SAndroid Build Coastguard Worker * 3791*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 3792*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 3793*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 3794*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 3795*6777b538SAndroid Build Coastguard Worker **/ 3796*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndUInt32sUsingBlock: 3797*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(BOOL key, uint32_t value, BOOL *stop))block; 3798*6777b538SAndroid Build Coastguard Worker 3799*6777b538SAndroid Build Coastguard Worker /** 3800*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 3801*6777b538SAndroid Build Coastguard Worker * 3802*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 3803*6777b538SAndroid Build Coastguard Worker * dictionary. 3804*6777b538SAndroid Build Coastguard Worker **/ 3805*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBBoolUInt32Dictionary *)otherDictionary; 3806*6777b538SAndroid Build Coastguard Worker 3807*6777b538SAndroid Build Coastguard Worker /** 3808*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 3809*6777b538SAndroid Build Coastguard Worker * 3810*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 3811*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 3812*6777b538SAndroid Build Coastguard Worker **/ 3813*6777b538SAndroid Build Coastguard Worker - (void)setUInt32:(uint32_t)value forKey:(BOOL)key; 3814*6777b538SAndroid Build Coastguard Worker 3815*6777b538SAndroid Build Coastguard Worker /** 3816*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 3817*6777b538SAndroid Build Coastguard Worker * 3818*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 3819*6777b538SAndroid Build Coastguard Worker **/ 3820*6777b538SAndroid Build Coastguard Worker - (void)removeUInt32ForKey:(BOOL)aKey; 3821*6777b538SAndroid Build Coastguard Worker 3822*6777b538SAndroid Build Coastguard Worker /** 3823*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 3824*6777b538SAndroid Build Coastguard Worker **/ 3825*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 3826*6777b538SAndroid Build Coastguard Worker 3827*6777b538SAndroid Build Coastguard Worker @end 3828*6777b538SAndroid Build Coastguard Worker 3829*6777b538SAndroid Build Coastguard Worker #pragma mark - Bool -> Int32 3830*6777b538SAndroid Build Coastguard Worker 3831*6777b538SAndroid Build Coastguard Worker /** 3832*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <BOOL, int32_t> 3833*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 3834*6777b538SAndroid Build Coastguard Worker * 3835*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 3836*6777b538SAndroid Build Coastguard Worker **/ 3837*6777b538SAndroid Build Coastguard Worker @interface GPBBoolInt32Dictionary : NSObject <NSCopying> 3838*6777b538SAndroid Build Coastguard Worker 3839*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 3840*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 3841*6777b538SAndroid Build Coastguard Worker 3842*6777b538SAndroid Build Coastguard Worker /** 3843*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 3844*6777b538SAndroid Build Coastguard Worker * 3845*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 3846*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 3847*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 3848*6777b538SAndroid Build Coastguard Worker * 3849*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 3850*6777b538SAndroid Build Coastguard Worker **/ 3851*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithInt32s:(const int32_t [__nullable])values 3852*6777b538SAndroid Build Coastguard Worker forKeys:(const BOOL [__nullable])keys 3853*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 3854*6777b538SAndroid Build Coastguard Worker 3855*6777b538SAndroid Build Coastguard Worker /** 3856*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 3857*6777b538SAndroid Build Coastguard Worker * 3858*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 3859*6777b538SAndroid Build Coastguard Worker * 3860*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 3861*6777b538SAndroid Build Coastguard Worker **/ 3862*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBBoolInt32Dictionary *)dictionary; 3863*6777b538SAndroid Build Coastguard Worker 3864*6777b538SAndroid Build Coastguard Worker /** 3865*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 3866*6777b538SAndroid Build Coastguard Worker * 3867*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 3868*6777b538SAndroid Build Coastguard Worker * 3869*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 3870*6777b538SAndroid Build Coastguard Worker **/ 3871*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 3872*6777b538SAndroid Build Coastguard Worker 3873*6777b538SAndroid Build Coastguard Worker /** 3874*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 3875*6777b538SAndroid Build Coastguard Worker * 3876*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 3877*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 3878*6777b538SAndroid Build Coastguard Worker * 3879*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 3880*6777b538SAndroid Build Coastguard Worker **/ 3881*6777b538SAndroid Build Coastguard Worker - (BOOL)getInt32:(nullable int32_t *)value forKey:(BOOL)key; 3882*6777b538SAndroid Build Coastguard Worker 3883*6777b538SAndroid Build Coastguard Worker /** 3884*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 3885*6777b538SAndroid Build Coastguard Worker * 3886*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 3887*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 3888*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 3889*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 3890*6777b538SAndroid Build Coastguard Worker **/ 3891*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndInt32sUsingBlock: 3892*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(BOOL key, int32_t value, BOOL *stop))block; 3893*6777b538SAndroid Build Coastguard Worker 3894*6777b538SAndroid Build Coastguard Worker /** 3895*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 3896*6777b538SAndroid Build Coastguard Worker * 3897*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 3898*6777b538SAndroid Build Coastguard Worker * dictionary. 3899*6777b538SAndroid Build Coastguard Worker **/ 3900*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBBoolInt32Dictionary *)otherDictionary; 3901*6777b538SAndroid Build Coastguard Worker 3902*6777b538SAndroid Build Coastguard Worker /** 3903*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 3904*6777b538SAndroid Build Coastguard Worker * 3905*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 3906*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 3907*6777b538SAndroid Build Coastguard Worker **/ 3908*6777b538SAndroid Build Coastguard Worker - (void)setInt32:(int32_t)value forKey:(BOOL)key; 3909*6777b538SAndroid Build Coastguard Worker 3910*6777b538SAndroid Build Coastguard Worker /** 3911*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 3912*6777b538SAndroid Build Coastguard Worker * 3913*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 3914*6777b538SAndroid Build Coastguard Worker **/ 3915*6777b538SAndroid Build Coastguard Worker - (void)removeInt32ForKey:(BOOL)aKey; 3916*6777b538SAndroid Build Coastguard Worker 3917*6777b538SAndroid Build Coastguard Worker /** 3918*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 3919*6777b538SAndroid Build Coastguard Worker **/ 3920*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 3921*6777b538SAndroid Build Coastguard Worker 3922*6777b538SAndroid Build Coastguard Worker @end 3923*6777b538SAndroid Build Coastguard Worker 3924*6777b538SAndroid Build Coastguard Worker #pragma mark - Bool -> UInt64 3925*6777b538SAndroid Build Coastguard Worker 3926*6777b538SAndroid Build Coastguard Worker /** 3927*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <BOOL, uint64_t> 3928*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 3929*6777b538SAndroid Build Coastguard Worker * 3930*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 3931*6777b538SAndroid Build Coastguard Worker **/ 3932*6777b538SAndroid Build Coastguard Worker @interface GPBBoolUInt64Dictionary : NSObject <NSCopying> 3933*6777b538SAndroid Build Coastguard Worker 3934*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 3935*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 3936*6777b538SAndroid Build Coastguard Worker 3937*6777b538SAndroid Build Coastguard Worker /** 3938*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 3939*6777b538SAndroid Build Coastguard Worker * 3940*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 3941*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 3942*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 3943*6777b538SAndroid Build Coastguard Worker * 3944*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 3945*6777b538SAndroid Build Coastguard Worker **/ 3946*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithUInt64s:(const uint64_t [__nullable])values 3947*6777b538SAndroid Build Coastguard Worker forKeys:(const BOOL [__nullable])keys 3948*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 3949*6777b538SAndroid Build Coastguard Worker 3950*6777b538SAndroid Build Coastguard Worker /** 3951*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 3952*6777b538SAndroid Build Coastguard Worker * 3953*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 3954*6777b538SAndroid Build Coastguard Worker * 3955*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 3956*6777b538SAndroid Build Coastguard Worker **/ 3957*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBBoolUInt64Dictionary *)dictionary; 3958*6777b538SAndroid Build Coastguard Worker 3959*6777b538SAndroid Build Coastguard Worker /** 3960*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 3961*6777b538SAndroid Build Coastguard Worker * 3962*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 3963*6777b538SAndroid Build Coastguard Worker * 3964*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 3965*6777b538SAndroid Build Coastguard Worker **/ 3966*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 3967*6777b538SAndroid Build Coastguard Worker 3968*6777b538SAndroid Build Coastguard Worker /** 3969*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 3970*6777b538SAndroid Build Coastguard Worker * 3971*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 3972*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 3973*6777b538SAndroid Build Coastguard Worker * 3974*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 3975*6777b538SAndroid Build Coastguard Worker **/ 3976*6777b538SAndroid Build Coastguard Worker - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(BOOL)key; 3977*6777b538SAndroid Build Coastguard Worker 3978*6777b538SAndroid Build Coastguard Worker /** 3979*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 3980*6777b538SAndroid Build Coastguard Worker * 3981*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 3982*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 3983*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 3984*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 3985*6777b538SAndroid Build Coastguard Worker **/ 3986*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndUInt64sUsingBlock: 3987*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(BOOL key, uint64_t value, BOOL *stop))block; 3988*6777b538SAndroid Build Coastguard Worker 3989*6777b538SAndroid Build Coastguard Worker /** 3990*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 3991*6777b538SAndroid Build Coastguard Worker * 3992*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 3993*6777b538SAndroid Build Coastguard Worker * dictionary. 3994*6777b538SAndroid Build Coastguard Worker **/ 3995*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBBoolUInt64Dictionary *)otherDictionary; 3996*6777b538SAndroid Build Coastguard Worker 3997*6777b538SAndroid Build Coastguard Worker /** 3998*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 3999*6777b538SAndroid Build Coastguard Worker * 4000*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 4001*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 4002*6777b538SAndroid Build Coastguard Worker **/ 4003*6777b538SAndroid Build Coastguard Worker - (void)setUInt64:(uint64_t)value forKey:(BOOL)key; 4004*6777b538SAndroid Build Coastguard Worker 4005*6777b538SAndroid Build Coastguard Worker /** 4006*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 4007*6777b538SAndroid Build Coastguard Worker * 4008*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 4009*6777b538SAndroid Build Coastguard Worker **/ 4010*6777b538SAndroid Build Coastguard Worker - (void)removeUInt64ForKey:(BOOL)aKey; 4011*6777b538SAndroid Build Coastguard Worker 4012*6777b538SAndroid Build Coastguard Worker /** 4013*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 4014*6777b538SAndroid Build Coastguard Worker **/ 4015*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 4016*6777b538SAndroid Build Coastguard Worker 4017*6777b538SAndroid Build Coastguard Worker @end 4018*6777b538SAndroid Build Coastguard Worker 4019*6777b538SAndroid Build Coastguard Worker #pragma mark - Bool -> Int64 4020*6777b538SAndroid Build Coastguard Worker 4021*6777b538SAndroid Build Coastguard Worker /** 4022*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <BOOL, int64_t> 4023*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 4024*6777b538SAndroid Build Coastguard Worker * 4025*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 4026*6777b538SAndroid Build Coastguard Worker **/ 4027*6777b538SAndroid Build Coastguard Worker @interface GPBBoolInt64Dictionary : NSObject <NSCopying> 4028*6777b538SAndroid Build Coastguard Worker 4029*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 4030*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 4031*6777b538SAndroid Build Coastguard Worker 4032*6777b538SAndroid Build Coastguard Worker /** 4033*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 4034*6777b538SAndroid Build Coastguard Worker * 4035*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 4036*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 4037*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 4038*6777b538SAndroid Build Coastguard Worker * 4039*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 4040*6777b538SAndroid Build Coastguard Worker **/ 4041*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithInt64s:(const int64_t [__nullable])values 4042*6777b538SAndroid Build Coastguard Worker forKeys:(const BOOL [__nullable])keys 4043*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 4044*6777b538SAndroid Build Coastguard Worker 4045*6777b538SAndroid Build Coastguard Worker /** 4046*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 4047*6777b538SAndroid Build Coastguard Worker * 4048*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 4049*6777b538SAndroid Build Coastguard Worker * 4050*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 4051*6777b538SAndroid Build Coastguard Worker **/ 4052*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBBoolInt64Dictionary *)dictionary; 4053*6777b538SAndroid Build Coastguard Worker 4054*6777b538SAndroid Build Coastguard Worker /** 4055*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 4056*6777b538SAndroid Build Coastguard Worker * 4057*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 4058*6777b538SAndroid Build Coastguard Worker * 4059*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 4060*6777b538SAndroid Build Coastguard Worker **/ 4061*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 4062*6777b538SAndroid Build Coastguard Worker 4063*6777b538SAndroid Build Coastguard Worker /** 4064*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 4065*6777b538SAndroid Build Coastguard Worker * 4066*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 4067*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 4068*6777b538SAndroid Build Coastguard Worker * 4069*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 4070*6777b538SAndroid Build Coastguard Worker **/ 4071*6777b538SAndroid Build Coastguard Worker - (BOOL)getInt64:(nullable int64_t *)value forKey:(BOOL)key; 4072*6777b538SAndroid Build Coastguard Worker 4073*6777b538SAndroid Build Coastguard Worker /** 4074*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 4075*6777b538SAndroid Build Coastguard Worker * 4076*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 4077*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 4078*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 4079*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 4080*6777b538SAndroid Build Coastguard Worker **/ 4081*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndInt64sUsingBlock: 4082*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(BOOL key, int64_t value, BOOL *stop))block; 4083*6777b538SAndroid Build Coastguard Worker 4084*6777b538SAndroid Build Coastguard Worker /** 4085*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 4086*6777b538SAndroid Build Coastguard Worker * 4087*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 4088*6777b538SAndroid Build Coastguard Worker * dictionary. 4089*6777b538SAndroid Build Coastguard Worker **/ 4090*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBBoolInt64Dictionary *)otherDictionary; 4091*6777b538SAndroid Build Coastguard Worker 4092*6777b538SAndroid Build Coastguard Worker /** 4093*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 4094*6777b538SAndroid Build Coastguard Worker * 4095*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 4096*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 4097*6777b538SAndroid Build Coastguard Worker **/ 4098*6777b538SAndroid Build Coastguard Worker - (void)setInt64:(int64_t)value forKey:(BOOL)key; 4099*6777b538SAndroid Build Coastguard Worker 4100*6777b538SAndroid Build Coastguard Worker /** 4101*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 4102*6777b538SAndroid Build Coastguard Worker * 4103*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 4104*6777b538SAndroid Build Coastguard Worker **/ 4105*6777b538SAndroid Build Coastguard Worker - (void)removeInt64ForKey:(BOOL)aKey; 4106*6777b538SAndroid Build Coastguard Worker 4107*6777b538SAndroid Build Coastguard Worker /** 4108*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 4109*6777b538SAndroid Build Coastguard Worker **/ 4110*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 4111*6777b538SAndroid Build Coastguard Worker 4112*6777b538SAndroid Build Coastguard Worker @end 4113*6777b538SAndroid Build Coastguard Worker 4114*6777b538SAndroid Build Coastguard Worker #pragma mark - Bool -> Bool 4115*6777b538SAndroid Build Coastguard Worker 4116*6777b538SAndroid Build Coastguard Worker /** 4117*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <BOOL, BOOL> 4118*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 4119*6777b538SAndroid Build Coastguard Worker * 4120*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 4121*6777b538SAndroid Build Coastguard Worker **/ 4122*6777b538SAndroid Build Coastguard Worker @interface GPBBoolBoolDictionary : NSObject <NSCopying> 4123*6777b538SAndroid Build Coastguard Worker 4124*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 4125*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 4126*6777b538SAndroid Build Coastguard Worker 4127*6777b538SAndroid Build Coastguard Worker /** 4128*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 4129*6777b538SAndroid Build Coastguard Worker * 4130*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 4131*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 4132*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 4133*6777b538SAndroid Build Coastguard Worker * 4134*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 4135*6777b538SAndroid Build Coastguard Worker **/ 4136*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithBools:(const BOOL [__nullable])values 4137*6777b538SAndroid Build Coastguard Worker forKeys:(const BOOL [__nullable])keys 4138*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 4139*6777b538SAndroid Build Coastguard Worker 4140*6777b538SAndroid Build Coastguard Worker /** 4141*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 4142*6777b538SAndroid Build Coastguard Worker * 4143*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 4144*6777b538SAndroid Build Coastguard Worker * 4145*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 4146*6777b538SAndroid Build Coastguard Worker **/ 4147*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBBoolBoolDictionary *)dictionary; 4148*6777b538SAndroid Build Coastguard Worker 4149*6777b538SAndroid Build Coastguard Worker /** 4150*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 4151*6777b538SAndroid Build Coastguard Worker * 4152*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 4153*6777b538SAndroid Build Coastguard Worker * 4154*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 4155*6777b538SAndroid Build Coastguard Worker **/ 4156*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 4157*6777b538SAndroid Build Coastguard Worker 4158*6777b538SAndroid Build Coastguard Worker /** 4159*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 4160*6777b538SAndroid Build Coastguard Worker * 4161*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 4162*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 4163*6777b538SAndroid Build Coastguard Worker * 4164*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 4165*6777b538SAndroid Build Coastguard Worker **/ 4166*6777b538SAndroid Build Coastguard Worker - (BOOL)getBool:(nullable BOOL *)value forKey:(BOOL)key; 4167*6777b538SAndroid Build Coastguard Worker 4168*6777b538SAndroid Build Coastguard Worker /** 4169*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 4170*6777b538SAndroid Build Coastguard Worker * 4171*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 4172*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 4173*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 4174*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 4175*6777b538SAndroid Build Coastguard Worker **/ 4176*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndBoolsUsingBlock: 4177*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(BOOL key, BOOL value, BOOL *stop))block; 4178*6777b538SAndroid Build Coastguard Worker 4179*6777b538SAndroid Build Coastguard Worker /** 4180*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 4181*6777b538SAndroid Build Coastguard Worker * 4182*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 4183*6777b538SAndroid Build Coastguard Worker * dictionary. 4184*6777b538SAndroid Build Coastguard Worker **/ 4185*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBBoolBoolDictionary *)otherDictionary; 4186*6777b538SAndroid Build Coastguard Worker 4187*6777b538SAndroid Build Coastguard Worker /** 4188*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 4189*6777b538SAndroid Build Coastguard Worker * 4190*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 4191*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 4192*6777b538SAndroid Build Coastguard Worker **/ 4193*6777b538SAndroid Build Coastguard Worker - (void)setBool:(BOOL)value forKey:(BOOL)key; 4194*6777b538SAndroid Build Coastguard Worker 4195*6777b538SAndroid Build Coastguard Worker /** 4196*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 4197*6777b538SAndroid Build Coastguard Worker * 4198*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 4199*6777b538SAndroid Build Coastguard Worker **/ 4200*6777b538SAndroid Build Coastguard Worker - (void)removeBoolForKey:(BOOL)aKey; 4201*6777b538SAndroid Build Coastguard Worker 4202*6777b538SAndroid Build Coastguard Worker /** 4203*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 4204*6777b538SAndroid Build Coastguard Worker **/ 4205*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 4206*6777b538SAndroid Build Coastguard Worker 4207*6777b538SAndroid Build Coastguard Worker @end 4208*6777b538SAndroid Build Coastguard Worker 4209*6777b538SAndroid Build Coastguard Worker #pragma mark - Bool -> Float 4210*6777b538SAndroid Build Coastguard Worker 4211*6777b538SAndroid Build Coastguard Worker /** 4212*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <BOOL, float> 4213*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 4214*6777b538SAndroid Build Coastguard Worker * 4215*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 4216*6777b538SAndroid Build Coastguard Worker **/ 4217*6777b538SAndroid Build Coastguard Worker @interface GPBBoolFloatDictionary : NSObject <NSCopying> 4218*6777b538SAndroid Build Coastguard Worker 4219*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 4220*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 4221*6777b538SAndroid Build Coastguard Worker 4222*6777b538SAndroid Build Coastguard Worker /** 4223*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 4224*6777b538SAndroid Build Coastguard Worker * 4225*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 4226*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 4227*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 4228*6777b538SAndroid Build Coastguard Worker * 4229*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 4230*6777b538SAndroid Build Coastguard Worker **/ 4231*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithFloats:(const float [__nullable])values 4232*6777b538SAndroid Build Coastguard Worker forKeys:(const BOOL [__nullable])keys 4233*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 4234*6777b538SAndroid Build Coastguard Worker 4235*6777b538SAndroid Build Coastguard Worker /** 4236*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 4237*6777b538SAndroid Build Coastguard Worker * 4238*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 4239*6777b538SAndroid Build Coastguard Worker * 4240*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 4241*6777b538SAndroid Build Coastguard Worker **/ 4242*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBBoolFloatDictionary *)dictionary; 4243*6777b538SAndroid Build Coastguard Worker 4244*6777b538SAndroid Build Coastguard Worker /** 4245*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 4246*6777b538SAndroid Build Coastguard Worker * 4247*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 4248*6777b538SAndroid Build Coastguard Worker * 4249*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 4250*6777b538SAndroid Build Coastguard Worker **/ 4251*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 4252*6777b538SAndroid Build Coastguard Worker 4253*6777b538SAndroid Build Coastguard Worker /** 4254*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 4255*6777b538SAndroid Build Coastguard Worker * 4256*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 4257*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 4258*6777b538SAndroid Build Coastguard Worker * 4259*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 4260*6777b538SAndroid Build Coastguard Worker **/ 4261*6777b538SAndroid Build Coastguard Worker - (BOOL)getFloat:(nullable float *)value forKey:(BOOL)key; 4262*6777b538SAndroid Build Coastguard Worker 4263*6777b538SAndroid Build Coastguard Worker /** 4264*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 4265*6777b538SAndroid Build Coastguard Worker * 4266*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 4267*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 4268*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 4269*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 4270*6777b538SAndroid Build Coastguard Worker **/ 4271*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndFloatsUsingBlock: 4272*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(BOOL key, float value, BOOL *stop))block; 4273*6777b538SAndroid Build Coastguard Worker 4274*6777b538SAndroid Build Coastguard Worker /** 4275*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 4276*6777b538SAndroid Build Coastguard Worker * 4277*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 4278*6777b538SAndroid Build Coastguard Worker * dictionary. 4279*6777b538SAndroid Build Coastguard Worker **/ 4280*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBBoolFloatDictionary *)otherDictionary; 4281*6777b538SAndroid Build Coastguard Worker 4282*6777b538SAndroid Build Coastguard Worker /** 4283*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 4284*6777b538SAndroid Build Coastguard Worker * 4285*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 4286*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 4287*6777b538SAndroid Build Coastguard Worker **/ 4288*6777b538SAndroid Build Coastguard Worker - (void)setFloat:(float)value forKey:(BOOL)key; 4289*6777b538SAndroid Build Coastguard Worker 4290*6777b538SAndroid Build Coastguard Worker /** 4291*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 4292*6777b538SAndroid Build Coastguard Worker * 4293*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 4294*6777b538SAndroid Build Coastguard Worker **/ 4295*6777b538SAndroid Build Coastguard Worker - (void)removeFloatForKey:(BOOL)aKey; 4296*6777b538SAndroid Build Coastguard Worker 4297*6777b538SAndroid Build Coastguard Worker /** 4298*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 4299*6777b538SAndroid Build Coastguard Worker **/ 4300*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 4301*6777b538SAndroid Build Coastguard Worker 4302*6777b538SAndroid Build Coastguard Worker @end 4303*6777b538SAndroid Build Coastguard Worker 4304*6777b538SAndroid Build Coastguard Worker #pragma mark - Bool -> Double 4305*6777b538SAndroid Build Coastguard Worker 4306*6777b538SAndroid Build Coastguard Worker /** 4307*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <BOOL, double> 4308*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 4309*6777b538SAndroid Build Coastguard Worker * 4310*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 4311*6777b538SAndroid Build Coastguard Worker **/ 4312*6777b538SAndroid Build Coastguard Worker @interface GPBBoolDoubleDictionary : NSObject <NSCopying> 4313*6777b538SAndroid Build Coastguard Worker 4314*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 4315*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 4316*6777b538SAndroid Build Coastguard Worker 4317*6777b538SAndroid Build Coastguard Worker /** 4318*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 4319*6777b538SAndroid Build Coastguard Worker * 4320*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 4321*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 4322*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 4323*6777b538SAndroid Build Coastguard Worker * 4324*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 4325*6777b538SAndroid Build Coastguard Worker **/ 4326*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDoubles:(const double [__nullable])values 4327*6777b538SAndroid Build Coastguard Worker forKeys:(const BOOL [__nullable])keys 4328*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 4329*6777b538SAndroid Build Coastguard Worker 4330*6777b538SAndroid Build Coastguard Worker /** 4331*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 4332*6777b538SAndroid Build Coastguard Worker * 4333*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 4334*6777b538SAndroid Build Coastguard Worker * 4335*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 4336*6777b538SAndroid Build Coastguard Worker **/ 4337*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBBoolDoubleDictionary *)dictionary; 4338*6777b538SAndroid Build Coastguard Worker 4339*6777b538SAndroid Build Coastguard Worker /** 4340*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 4341*6777b538SAndroid Build Coastguard Worker * 4342*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 4343*6777b538SAndroid Build Coastguard Worker * 4344*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 4345*6777b538SAndroid Build Coastguard Worker **/ 4346*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 4347*6777b538SAndroid Build Coastguard Worker 4348*6777b538SAndroid Build Coastguard Worker /** 4349*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 4350*6777b538SAndroid Build Coastguard Worker * 4351*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 4352*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 4353*6777b538SAndroid Build Coastguard Worker * 4354*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 4355*6777b538SAndroid Build Coastguard Worker **/ 4356*6777b538SAndroid Build Coastguard Worker - (BOOL)getDouble:(nullable double *)value forKey:(BOOL)key; 4357*6777b538SAndroid Build Coastguard Worker 4358*6777b538SAndroid Build Coastguard Worker /** 4359*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 4360*6777b538SAndroid Build Coastguard Worker * 4361*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 4362*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 4363*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 4364*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 4365*6777b538SAndroid Build Coastguard Worker **/ 4366*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndDoublesUsingBlock: 4367*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(BOOL key, double value, BOOL *stop))block; 4368*6777b538SAndroid Build Coastguard Worker 4369*6777b538SAndroid Build Coastguard Worker /** 4370*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 4371*6777b538SAndroid Build Coastguard Worker * 4372*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 4373*6777b538SAndroid Build Coastguard Worker * dictionary. 4374*6777b538SAndroid Build Coastguard Worker **/ 4375*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBBoolDoubleDictionary *)otherDictionary; 4376*6777b538SAndroid Build Coastguard Worker 4377*6777b538SAndroid Build Coastguard Worker /** 4378*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 4379*6777b538SAndroid Build Coastguard Worker * 4380*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 4381*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 4382*6777b538SAndroid Build Coastguard Worker **/ 4383*6777b538SAndroid Build Coastguard Worker - (void)setDouble:(double)value forKey:(BOOL)key; 4384*6777b538SAndroid Build Coastguard Worker 4385*6777b538SAndroid Build Coastguard Worker /** 4386*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 4387*6777b538SAndroid Build Coastguard Worker * 4388*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 4389*6777b538SAndroid Build Coastguard Worker **/ 4390*6777b538SAndroid Build Coastguard Worker - (void)removeDoubleForKey:(BOOL)aKey; 4391*6777b538SAndroid Build Coastguard Worker 4392*6777b538SAndroid Build Coastguard Worker /** 4393*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 4394*6777b538SAndroid Build Coastguard Worker **/ 4395*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 4396*6777b538SAndroid Build Coastguard Worker 4397*6777b538SAndroid Build Coastguard Worker @end 4398*6777b538SAndroid Build Coastguard Worker 4399*6777b538SAndroid Build Coastguard Worker #pragma mark - Bool -> Enum 4400*6777b538SAndroid Build Coastguard Worker 4401*6777b538SAndroid Build Coastguard Worker /** 4402*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <BOOL, int32_t> 4403*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 4404*6777b538SAndroid Build Coastguard Worker * 4405*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 4406*6777b538SAndroid Build Coastguard Worker **/ 4407*6777b538SAndroid Build Coastguard Worker @interface GPBBoolEnumDictionary : NSObject <NSCopying> 4408*6777b538SAndroid Build Coastguard Worker 4409*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 4410*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 4411*6777b538SAndroid Build Coastguard Worker /** The validation function to check if the enums are valid. */ 4412*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 4413*6777b538SAndroid Build Coastguard Worker 4414*6777b538SAndroid Build Coastguard Worker /** 4415*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the given validation function. 4416*6777b538SAndroid Build Coastguard Worker * 4417*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 4418*6777b538SAndroid Build Coastguard Worker * 4419*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary. 4420*6777b538SAndroid Build Coastguard Worker **/ 4421*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 4422*6777b538SAndroid Build Coastguard Worker 4423*6777b538SAndroid Build Coastguard Worker /** 4424*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the entries given. 4425*6777b538SAndroid Build Coastguard Worker * 4426*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 4427*6777b538SAndroid Build Coastguard Worker * @param values The raw enum values values to be placed in the dictionary. 4428*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 4429*6777b538SAndroid Build Coastguard Worker * @param count The number of entries to store in the dictionary. 4430*6777b538SAndroid Build Coastguard Worker * 4431*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the keys and values in it. 4432*6777b538SAndroid Build Coastguard Worker **/ 4433*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 4434*6777b538SAndroid Build Coastguard Worker rawValues:(const int32_t [__nullable])values 4435*6777b538SAndroid Build Coastguard Worker forKeys:(const BOOL [__nullable])keys 4436*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 4437*6777b538SAndroid Build Coastguard Worker 4438*6777b538SAndroid Build Coastguard Worker /** 4439*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the entries from the given. 4440*6777b538SAndroid Build Coastguard Worker * dictionary. 4441*6777b538SAndroid Build Coastguard Worker * 4442*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to the dictionary. 4443*6777b538SAndroid Build Coastguard Worker * 4444*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries from the given 4445*6777b538SAndroid Build Coastguard Worker * dictionary in it. 4446*6777b538SAndroid Build Coastguard Worker **/ 4447*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBBoolEnumDictionary *)dictionary; 4448*6777b538SAndroid Build Coastguard Worker 4449*6777b538SAndroid Build Coastguard Worker /** 4450*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the given capacity. 4451*6777b538SAndroid Build Coastguard Worker * 4452*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 4453*6777b538SAndroid Build Coastguard Worker * @param numItems Capacity needed for the dictionary. 4454*6777b538SAndroid Build Coastguard Worker * 4455*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the given capacity. 4456*6777b538SAndroid Build Coastguard Worker **/ 4457*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 4458*6777b538SAndroid Build Coastguard Worker capacity:(NSUInteger)numItems; 4459*6777b538SAndroid Build Coastguard Worker 4460*6777b538SAndroid Build Coastguard Worker // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 4461*6777b538SAndroid Build Coastguard Worker // is not a valid enumerator as defined by validationFunc. If the actual value is 4462*6777b538SAndroid Build Coastguard Worker // desired, use "raw" version of the method. 4463*6777b538SAndroid Build Coastguard Worker 4464*6777b538SAndroid Build Coastguard Worker /** 4465*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 4466*6777b538SAndroid Build Coastguard Worker * 4467*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 4468*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 4469*6777b538SAndroid Build Coastguard Worker * 4470*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 4471*6777b538SAndroid Build Coastguard Worker **/ 4472*6777b538SAndroid Build Coastguard Worker - (BOOL)getEnum:(nullable int32_t *)value forKey:(BOOL)key; 4473*6777b538SAndroid Build Coastguard Worker 4474*6777b538SAndroid Build Coastguard Worker /** 4475*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 4476*6777b538SAndroid Build Coastguard Worker * 4477*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 4478*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 4479*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 4480*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 4481*6777b538SAndroid Build Coastguard Worker **/ 4482*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndEnumsUsingBlock: 4483*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(BOOL key, int32_t value, BOOL *stop))block; 4484*6777b538SAndroid Build Coastguard Worker 4485*6777b538SAndroid Build Coastguard Worker /** 4486*6777b538SAndroid Build Coastguard Worker * Gets the raw enum value for the given key. 4487*6777b538SAndroid Build Coastguard Worker * 4488*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the access of values that 4489*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 4490*6777b538SAndroid Build Coastguard Worker * 4491*6777b538SAndroid Build Coastguard Worker * @param rawValue Pointer into which the value will be set, if found. 4492*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 4493*6777b538SAndroid Build Coastguard Worker * 4494*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 4495*6777b538SAndroid Build Coastguard Worker **/ 4496*6777b538SAndroid Build Coastguard Worker - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(BOOL)key; 4497*6777b538SAndroid Build Coastguard Worker 4498*6777b538SAndroid Build Coastguard Worker /** 4499*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 4500*6777b538SAndroid Build Coastguard Worker * 4501*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the access of values that 4502*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 4503*6777b538SAndroid Build Coastguard Worker * 4504*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 4505*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 4506*6777b538SAndroid Build Coastguard Worker * **rawValue**: The value for the current entry 4507*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 4508*6777b538SAndroid Build Coastguard Worker **/ 4509*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndRawValuesUsingBlock: 4510*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(BOOL key, int32_t rawValue, BOOL *stop))block; 4511*6777b538SAndroid Build Coastguard Worker 4512*6777b538SAndroid Build Coastguard Worker /** 4513*6777b538SAndroid Build Coastguard Worker * Adds the keys and raw enum values from another dictionary. 4514*6777b538SAndroid Build Coastguard Worker * 4515*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the setting of values that 4516*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 4517*6777b538SAndroid Build Coastguard Worker * 4518*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 4519*6777b538SAndroid Build Coastguard Worker * dictionary. 4520*6777b538SAndroid Build Coastguard Worker **/ 4521*6777b538SAndroid Build Coastguard Worker - (void)addRawEntriesFromDictionary:(GPBBoolEnumDictionary *)otherDictionary; 4522*6777b538SAndroid Build Coastguard Worker 4523*6777b538SAndroid Build Coastguard Worker // If value is not a valid enumerator as defined by validationFunc, these 4524*6777b538SAndroid Build Coastguard Worker // methods will assert in debug, and will log in release and assign the value 4525*6777b538SAndroid Build Coastguard Worker // to the default value. Use the rawValue methods below to assign non enumerator 4526*6777b538SAndroid Build Coastguard Worker // values. 4527*6777b538SAndroid Build Coastguard Worker 4528*6777b538SAndroid Build Coastguard Worker /** 4529*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 4530*6777b538SAndroid Build Coastguard Worker * 4531*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 4532*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 4533*6777b538SAndroid Build Coastguard Worker **/ 4534*6777b538SAndroid Build Coastguard Worker - (void)setEnum:(int32_t)value forKey:(BOOL)key; 4535*6777b538SAndroid Build Coastguard Worker 4536*6777b538SAndroid Build Coastguard Worker /** 4537*6777b538SAndroid Build Coastguard Worker * Sets the raw enum value for the given key. 4538*6777b538SAndroid Build Coastguard Worker * 4539*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the setting of values that 4540*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 4541*6777b538SAndroid Build Coastguard Worker * 4542*6777b538SAndroid Build Coastguard Worker * @param rawValue The raw enum value to set. 4543*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the raw enum value. 4544*6777b538SAndroid Build Coastguard Worker **/ 4545*6777b538SAndroid Build Coastguard Worker - (void)setRawValue:(int32_t)rawValue forKey:(BOOL)key; 4546*6777b538SAndroid Build Coastguard Worker 4547*6777b538SAndroid Build Coastguard Worker /** 4548*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 4549*6777b538SAndroid Build Coastguard Worker * 4550*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 4551*6777b538SAndroid Build Coastguard Worker **/ 4552*6777b538SAndroid Build Coastguard Worker - (void)removeEnumForKey:(BOOL)aKey; 4553*6777b538SAndroid Build Coastguard Worker 4554*6777b538SAndroid Build Coastguard Worker /** 4555*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 4556*6777b538SAndroid Build Coastguard Worker **/ 4557*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 4558*6777b538SAndroid Build Coastguard Worker 4559*6777b538SAndroid Build Coastguard Worker @end 4560*6777b538SAndroid Build Coastguard Worker 4561*6777b538SAndroid Build Coastguard Worker #pragma mark - Bool -> Object 4562*6777b538SAndroid Build Coastguard Worker 4563*6777b538SAndroid Build Coastguard Worker /** 4564*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <BOOL, ObjectType> 4565*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 4566*6777b538SAndroid Build Coastguard Worker * 4567*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 4568*6777b538SAndroid Build Coastguard Worker **/ 4569*6777b538SAndroid Build Coastguard Worker @interface GPBBoolObjectDictionary<__covariant ObjectType> : NSObject <NSCopying> 4570*6777b538SAndroid Build Coastguard Worker 4571*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 4572*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 4573*6777b538SAndroid Build Coastguard Worker 4574*6777b538SAndroid Build Coastguard Worker /** 4575*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 4576*6777b538SAndroid Build Coastguard Worker * 4577*6777b538SAndroid Build Coastguard Worker * @param objects The values to be placed in this dictionary. 4578*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 4579*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 4580*6777b538SAndroid Build Coastguard Worker * 4581*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 4582*6777b538SAndroid Build Coastguard Worker **/ 4583*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithObjects:(const ObjectType __nonnull GPB_UNSAFE_UNRETAINED [__nullable])objects 4584*6777b538SAndroid Build Coastguard Worker forKeys:(const BOOL [__nullable])keys 4585*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 4586*6777b538SAndroid Build Coastguard Worker 4587*6777b538SAndroid Build Coastguard Worker /** 4588*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 4589*6777b538SAndroid Build Coastguard Worker * 4590*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 4591*6777b538SAndroid Build Coastguard Worker * 4592*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 4593*6777b538SAndroid Build Coastguard Worker **/ 4594*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary; 4595*6777b538SAndroid Build Coastguard Worker 4596*6777b538SAndroid Build Coastguard Worker /** 4597*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 4598*6777b538SAndroid Build Coastguard Worker * 4599*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 4600*6777b538SAndroid Build Coastguard Worker * 4601*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 4602*6777b538SAndroid Build Coastguard Worker **/ 4603*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 4604*6777b538SAndroid Build Coastguard Worker 4605*6777b538SAndroid Build Coastguard Worker /** 4606*6777b538SAndroid Build Coastguard Worker * Fetches the object stored under the given key. 4607*6777b538SAndroid Build Coastguard Worker * 4608*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 4609*6777b538SAndroid Build Coastguard Worker * 4610*6777b538SAndroid Build Coastguard Worker * @return The object if found, nil otherwise. 4611*6777b538SAndroid Build Coastguard Worker **/ 4612*6777b538SAndroid Build Coastguard Worker - (ObjectType)objectForKey:(BOOL)key; 4613*6777b538SAndroid Build Coastguard Worker 4614*6777b538SAndroid Build Coastguard Worker /** 4615*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 4616*6777b538SAndroid Build Coastguard Worker * 4617*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 4618*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 4619*6777b538SAndroid Build Coastguard Worker * **object**: The value for the current entry 4620*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 4621*6777b538SAndroid Build Coastguard Worker **/ 4622*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndObjectsUsingBlock: 4623*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(BOOL key, ObjectType object, BOOL *stop))block; 4624*6777b538SAndroid Build Coastguard Worker 4625*6777b538SAndroid Build Coastguard Worker /** 4626*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 4627*6777b538SAndroid Build Coastguard Worker * 4628*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 4629*6777b538SAndroid Build Coastguard Worker * dictionary. 4630*6777b538SAndroid Build Coastguard Worker **/ 4631*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBBoolObjectDictionary *)otherDictionary; 4632*6777b538SAndroid Build Coastguard Worker 4633*6777b538SAndroid Build Coastguard Worker /** 4634*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 4635*6777b538SAndroid Build Coastguard Worker * 4636*6777b538SAndroid Build Coastguard Worker * @param object The value to set. 4637*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 4638*6777b538SAndroid Build Coastguard Worker **/ 4639*6777b538SAndroid Build Coastguard Worker - (void)setObject:(ObjectType)object forKey:(BOOL)key; 4640*6777b538SAndroid Build Coastguard Worker 4641*6777b538SAndroid Build Coastguard Worker /** 4642*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 4643*6777b538SAndroid Build Coastguard Worker * 4644*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 4645*6777b538SAndroid Build Coastguard Worker **/ 4646*6777b538SAndroid Build Coastguard Worker - (void)removeObjectForKey:(BOOL)aKey; 4647*6777b538SAndroid Build Coastguard Worker 4648*6777b538SAndroid Build Coastguard Worker /** 4649*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 4650*6777b538SAndroid Build Coastguard Worker **/ 4651*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 4652*6777b538SAndroid Build Coastguard Worker 4653*6777b538SAndroid Build Coastguard Worker @end 4654*6777b538SAndroid Build Coastguard Worker 4655*6777b538SAndroid Build Coastguard Worker #pragma mark - String -> UInt32 4656*6777b538SAndroid Build Coastguard Worker 4657*6777b538SAndroid Build Coastguard Worker /** 4658*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <NSString, uint32_t> 4659*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 4660*6777b538SAndroid Build Coastguard Worker * 4661*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 4662*6777b538SAndroid Build Coastguard Worker **/ 4663*6777b538SAndroid Build Coastguard Worker @interface GPBStringUInt32Dictionary : NSObject <NSCopying> 4664*6777b538SAndroid Build Coastguard Worker 4665*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 4666*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 4667*6777b538SAndroid Build Coastguard Worker 4668*6777b538SAndroid Build Coastguard Worker /** 4669*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 4670*6777b538SAndroid Build Coastguard Worker * 4671*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 4672*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 4673*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 4674*6777b538SAndroid Build Coastguard Worker * 4675*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 4676*6777b538SAndroid Build Coastguard Worker **/ 4677*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithUInt32s:(const uint32_t [__nullable])values 4678*6777b538SAndroid Build Coastguard Worker forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys 4679*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 4680*6777b538SAndroid Build Coastguard Worker 4681*6777b538SAndroid Build Coastguard Worker /** 4682*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 4683*6777b538SAndroid Build Coastguard Worker * 4684*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 4685*6777b538SAndroid Build Coastguard Worker * 4686*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 4687*6777b538SAndroid Build Coastguard Worker **/ 4688*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBStringUInt32Dictionary *)dictionary; 4689*6777b538SAndroid Build Coastguard Worker 4690*6777b538SAndroid Build Coastguard Worker /** 4691*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 4692*6777b538SAndroid Build Coastguard Worker * 4693*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 4694*6777b538SAndroid Build Coastguard Worker * 4695*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 4696*6777b538SAndroid Build Coastguard Worker **/ 4697*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 4698*6777b538SAndroid Build Coastguard Worker 4699*6777b538SAndroid Build Coastguard Worker /** 4700*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 4701*6777b538SAndroid Build Coastguard Worker * 4702*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 4703*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 4704*6777b538SAndroid Build Coastguard Worker * 4705*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 4706*6777b538SAndroid Build Coastguard Worker **/ 4707*6777b538SAndroid Build Coastguard Worker - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(NSString *)key; 4708*6777b538SAndroid Build Coastguard Worker 4709*6777b538SAndroid Build Coastguard Worker /** 4710*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 4711*6777b538SAndroid Build Coastguard Worker * 4712*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 4713*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 4714*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 4715*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 4716*6777b538SAndroid Build Coastguard Worker **/ 4717*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndUInt32sUsingBlock: 4718*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(NSString *key, uint32_t value, BOOL *stop))block; 4719*6777b538SAndroid Build Coastguard Worker 4720*6777b538SAndroid Build Coastguard Worker /** 4721*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 4722*6777b538SAndroid Build Coastguard Worker * 4723*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 4724*6777b538SAndroid Build Coastguard Worker * dictionary. 4725*6777b538SAndroid Build Coastguard Worker **/ 4726*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBStringUInt32Dictionary *)otherDictionary; 4727*6777b538SAndroid Build Coastguard Worker 4728*6777b538SAndroid Build Coastguard Worker /** 4729*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 4730*6777b538SAndroid Build Coastguard Worker * 4731*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 4732*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 4733*6777b538SAndroid Build Coastguard Worker **/ 4734*6777b538SAndroid Build Coastguard Worker - (void)setUInt32:(uint32_t)value forKey:(NSString *)key; 4735*6777b538SAndroid Build Coastguard Worker 4736*6777b538SAndroid Build Coastguard Worker /** 4737*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 4738*6777b538SAndroid Build Coastguard Worker * 4739*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 4740*6777b538SAndroid Build Coastguard Worker **/ 4741*6777b538SAndroid Build Coastguard Worker - (void)removeUInt32ForKey:(NSString *)aKey; 4742*6777b538SAndroid Build Coastguard Worker 4743*6777b538SAndroid Build Coastguard Worker /** 4744*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 4745*6777b538SAndroid Build Coastguard Worker **/ 4746*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 4747*6777b538SAndroid Build Coastguard Worker 4748*6777b538SAndroid Build Coastguard Worker @end 4749*6777b538SAndroid Build Coastguard Worker 4750*6777b538SAndroid Build Coastguard Worker #pragma mark - String -> Int32 4751*6777b538SAndroid Build Coastguard Worker 4752*6777b538SAndroid Build Coastguard Worker /** 4753*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <NSString, int32_t> 4754*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 4755*6777b538SAndroid Build Coastguard Worker * 4756*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 4757*6777b538SAndroid Build Coastguard Worker **/ 4758*6777b538SAndroid Build Coastguard Worker @interface GPBStringInt32Dictionary : NSObject <NSCopying> 4759*6777b538SAndroid Build Coastguard Worker 4760*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 4761*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 4762*6777b538SAndroid Build Coastguard Worker 4763*6777b538SAndroid Build Coastguard Worker /** 4764*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 4765*6777b538SAndroid Build Coastguard Worker * 4766*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 4767*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 4768*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 4769*6777b538SAndroid Build Coastguard Worker * 4770*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 4771*6777b538SAndroid Build Coastguard Worker **/ 4772*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithInt32s:(const int32_t [__nullable])values 4773*6777b538SAndroid Build Coastguard Worker forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys 4774*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 4775*6777b538SAndroid Build Coastguard Worker 4776*6777b538SAndroid Build Coastguard Worker /** 4777*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 4778*6777b538SAndroid Build Coastguard Worker * 4779*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 4780*6777b538SAndroid Build Coastguard Worker * 4781*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 4782*6777b538SAndroid Build Coastguard Worker **/ 4783*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBStringInt32Dictionary *)dictionary; 4784*6777b538SAndroid Build Coastguard Worker 4785*6777b538SAndroid Build Coastguard Worker /** 4786*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 4787*6777b538SAndroid Build Coastguard Worker * 4788*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 4789*6777b538SAndroid Build Coastguard Worker * 4790*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 4791*6777b538SAndroid Build Coastguard Worker **/ 4792*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 4793*6777b538SAndroid Build Coastguard Worker 4794*6777b538SAndroid Build Coastguard Worker /** 4795*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 4796*6777b538SAndroid Build Coastguard Worker * 4797*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 4798*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 4799*6777b538SAndroid Build Coastguard Worker * 4800*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 4801*6777b538SAndroid Build Coastguard Worker **/ 4802*6777b538SAndroid Build Coastguard Worker - (BOOL)getInt32:(nullable int32_t *)value forKey:(NSString *)key; 4803*6777b538SAndroid Build Coastguard Worker 4804*6777b538SAndroid Build Coastguard Worker /** 4805*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 4806*6777b538SAndroid Build Coastguard Worker * 4807*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 4808*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 4809*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 4810*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 4811*6777b538SAndroid Build Coastguard Worker **/ 4812*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndInt32sUsingBlock: 4813*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(NSString *key, int32_t value, BOOL *stop))block; 4814*6777b538SAndroid Build Coastguard Worker 4815*6777b538SAndroid Build Coastguard Worker /** 4816*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 4817*6777b538SAndroid Build Coastguard Worker * 4818*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 4819*6777b538SAndroid Build Coastguard Worker * dictionary. 4820*6777b538SAndroid Build Coastguard Worker **/ 4821*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBStringInt32Dictionary *)otherDictionary; 4822*6777b538SAndroid Build Coastguard Worker 4823*6777b538SAndroid Build Coastguard Worker /** 4824*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 4825*6777b538SAndroid Build Coastguard Worker * 4826*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 4827*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 4828*6777b538SAndroid Build Coastguard Worker **/ 4829*6777b538SAndroid Build Coastguard Worker - (void)setInt32:(int32_t)value forKey:(NSString *)key; 4830*6777b538SAndroid Build Coastguard Worker 4831*6777b538SAndroid Build Coastguard Worker /** 4832*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 4833*6777b538SAndroid Build Coastguard Worker * 4834*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 4835*6777b538SAndroid Build Coastguard Worker **/ 4836*6777b538SAndroid Build Coastguard Worker - (void)removeInt32ForKey:(NSString *)aKey; 4837*6777b538SAndroid Build Coastguard Worker 4838*6777b538SAndroid Build Coastguard Worker /** 4839*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 4840*6777b538SAndroid Build Coastguard Worker **/ 4841*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 4842*6777b538SAndroid Build Coastguard Worker 4843*6777b538SAndroid Build Coastguard Worker @end 4844*6777b538SAndroid Build Coastguard Worker 4845*6777b538SAndroid Build Coastguard Worker #pragma mark - String -> UInt64 4846*6777b538SAndroid Build Coastguard Worker 4847*6777b538SAndroid Build Coastguard Worker /** 4848*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <NSString, uint64_t> 4849*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 4850*6777b538SAndroid Build Coastguard Worker * 4851*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 4852*6777b538SAndroid Build Coastguard Worker **/ 4853*6777b538SAndroid Build Coastguard Worker @interface GPBStringUInt64Dictionary : NSObject <NSCopying> 4854*6777b538SAndroid Build Coastguard Worker 4855*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 4856*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 4857*6777b538SAndroid Build Coastguard Worker 4858*6777b538SAndroid Build Coastguard Worker /** 4859*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 4860*6777b538SAndroid Build Coastguard Worker * 4861*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 4862*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 4863*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 4864*6777b538SAndroid Build Coastguard Worker * 4865*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 4866*6777b538SAndroid Build Coastguard Worker **/ 4867*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithUInt64s:(const uint64_t [__nullable])values 4868*6777b538SAndroid Build Coastguard Worker forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys 4869*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 4870*6777b538SAndroid Build Coastguard Worker 4871*6777b538SAndroid Build Coastguard Worker /** 4872*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 4873*6777b538SAndroid Build Coastguard Worker * 4874*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 4875*6777b538SAndroid Build Coastguard Worker * 4876*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 4877*6777b538SAndroid Build Coastguard Worker **/ 4878*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBStringUInt64Dictionary *)dictionary; 4879*6777b538SAndroid Build Coastguard Worker 4880*6777b538SAndroid Build Coastguard Worker /** 4881*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 4882*6777b538SAndroid Build Coastguard Worker * 4883*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 4884*6777b538SAndroid Build Coastguard Worker * 4885*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 4886*6777b538SAndroid Build Coastguard Worker **/ 4887*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 4888*6777b538SAndroid Build Coastguard Worker 4889*6777b538SAndroid Build Coastguard Worker /** 4890*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 4891*6777b538SAndroid Build Coastguard Worker * 4892*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 4893*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 4894*6777b538SAndroid Build Coastguard Worker * 4895*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 4896*6777b538SAndroid Build Coastguard Worker **/ 4897*6777b538SAndroid Build Coastguard Worker - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(NSString *)key; 4898*6777b538SAndroid Build Coastguard Worker 4899*6777b538SAndroid Build Coastguard Worker /** 4900*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 4901*6777b538SAndroid Build Coastguard Worker * 4902*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 4903*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 4904*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 4905*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 4906*6777b538SAndroid Build Coastguard Worker **/ 4907*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndUInt64sUsingBlock: 4908*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(NSString *key, uint64_t value, BOOL *stop))block; 4909*6777b538SAndroid Build Coastguard Worker 4910*6777b538SAndroid Build Coastguard Worker /** 4911*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 4912*6777b538SAndroid Build Coastguard Worker * 4913*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 4914*6777b538SAndroid Build Coastguard Worker * dictionary. 4915*6777b538SAndroid Build Coastguard Worker **/ 4916*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBStringUInt64Dictionary *)otherDictionary; 4917*6777b538SAndroid Build Coastguard Worker 4918*6777b538SAndroid Build Coastguard Worker /** 4919*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 4920*6777b538SAndroid Build Coastguard Worker * 4921*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 4922*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 4923*6777b538SAndroid Build Coastguard Worker **/ 4924*6777b538SAndroid Build Coastguard Worker - (void)setUInt64:(uint64_t)value forKey:(NSString *)key; 4925*6777b538SAndroid Build Coastguard Worker 4926*6777b538SAndroid Build Coastguard Worker /** 4927*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 4928*6777b538SAndroid Build Coastguard Worker * 4929*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 4930*6777b538SAndroid Build Coastguard Worker **/ 4931*6777b538SAndroid Build Coastguard Worker - (void)removeUInt64ForKey:(NSString *)aKey; 4932*6777b538SAndroid Build Coastguard Worker 4933*6777b538SAndroid Build Coastguard Worker /** 4934*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 4935*6777b538SAndroid Build Coastguard Worker **/ 4936*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 4937*6777b538SAndroid Build Coastguard Worker 4938*6777b538SAndroid Build Coastguard Worker @end 4939*6777b538SAndroid Build Coastguard Worker 4940*6777b538SAndroid Build Coastguard Worker #pragma mark - String -> Int64 4941*6777b538SAndroid Build Coastguard Worker 4942*6777b538SAndroid Build Coastguard Worker /** 4943*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <NSString, int64_t> 4944*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 4945*6777b538SAndroid Build Coastguard Worker * 4946*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 4947*6777b538SAndroid Build Coastguard Worker **/ 4948*6777b538SAndroid Build Coastguard Worker @interface GPBStringInt64Dictionary : NSObject <NSCopying> 4949*6777b538SAndroid Build Coastguard Worker 4950*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 4951*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 4952*6777b538SAndroid Build Coastguard Worker 4953*6777b538SAndroid Build Coastguard Worker /** 4954*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 4955*6777b538SAndroid Build Coastguard Worker * 4956*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 4957*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 4958*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 4959*6777b538SAndroid Build Coastguard Worker * 4960*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 4961*6777b538SAndroid Build Coastguard Worker **/ 4962*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithInt64s:(const int64_t [__nullable])values 4963*6777b538SAndroid Build Coastguard Worker forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys 4964*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 4965*6777b538SAndroid Build Coastguard Worker 4966*6777b538SAndroid Build Coastguard Worker /** 4967*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 4968*6777b538SAndroid Build Coastguard Worker * 4969*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 4970*6777b538SAndroid Build Coastguard Worker * 4971*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 4972*6777b538SAndroid Build Coastguard Worker **/ 4973*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBStringInt64Dictionary *)dictionary; 4974*6777b538SAndroid Build Coastguard Worker 4975*6777b538SAndroid Build Coastguard Worker /** 4976*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 4977*6777b538SAndroid Build Coastguard Worker * 4978*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 4979*6777b538SAndroid Build Coastguard Worker * 4980*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 4981*6777b538SAndroid Build Coastguard Worker **/ 4982*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 4983*6777b538SAndroid Build Coastguard Worker 4984*6777b538SAndroid Build Coastguard Worker /** 4985*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 4986*6777b538SAndroid Build Coastguard Worker * 4987*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 4988*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 4989*6777b538SAndroid Build Coastguard Worker * 4990*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 4991*6777b538SAndroid Build Coastguard Worker **/ 4992*6777b538SAndroid Build Coastguard Worker - (BOOL)getInt64:(nullable int64_t *)value forKey:(NSString *)key; 4993*6777b538SAndroid Build Coastguard Worker 4994*6777b538SAndroid Build Coastguard Worker /** 4995*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 4996*6777b538SAndroid Build Coastguard Worker * 4997*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 4998*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 4999*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 5000*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 5001*6777b538SAndroid Build Coastguard Worker **/ 5002*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndInt64sUsingBlock: 5003*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(NSString *key, int64_t value, BOOL *stop))block; 5004*6777b538SAndroid Build Coastguard Worker 5005*6777b538SAndroid Build Coastguard Worker /** 5006*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 5007*6777b538SAndroid Build Coastguard Worker * 5008*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 5009*6777b538SAndroid Build Coastguard Worker * dictionary. 5010*6777b538SAndroid Build Coastguard Worker **/ 5011*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBStringInt64Dictionary *)otherDictionary; 5012*6777b538SAndroid Build Coastguard Worker 5013*6777b538SAndroid Build Coastguard Worker /** 5014*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 5015*6777b538SAndroid Build Coastguard Worker * 5016*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 5017*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 5018*6777b538SAndroid Build Coastguard Worker **/ 5019*6777b538SAndroid Build Coastguard Worker - (void)setInt64:(int64_t)value forKey:(NSString *)key; 5020*6777b538SAndroid Build Coastguard Worker 5021*6777b538SAndroid Build Coastguard Worker /** 5022*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 5023*6777b538SAndroid Build Coastguard Worker * 5024*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 5025*6777b538SAndroid Build Coastguard Worker **/ 5026*6777b538SAndroid Build Coastguard Worker - (void)removeInt64ForKey:(NSString *)aKey; 5027*6777b538SAndroid Build Coastguard Worker 5028*6777b538SAndroid Build Coastguard Worker /** 5029*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 5030*6777b538SAndroid Build Coastguard Worker **/ 5031*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 5032*6777b538SAndroid Build Coastguard Worker 5033*6777b538SAndroid Build Coastguard Worker @end 5034*6777b538SAndroid Build Coastguard Worker 5035*6777b538SAndroid Build Coastguard Worker #pragma mark - String -> Bool 5036*6777b538SAndroid Build Coastguard Worker 5037*6777b538SAndroid Build Coastguard Worker /** 5038*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <NSString, BOOL> 5039*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 5040*6777b538SAndroid Build Coastguard Worker * 5041*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 5042*6777b538SAndroid Build Coastguard Worker **/ 5043*6777b538SAndroid Build Coastguard Worker @interface GPBStringBoolDictionary : NSObject <NSCopying> 5044*6777b538SAndroid Build Coastguard Worker 5045*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 5046*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 5047*6777b538SAndroid Build Coastguard Worker 5048*6777b538SAndroid Build Coastguard Worker /** 5049*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 5050*6777b538SAndroid Build Coastguard Worker * 5051*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 5052*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 5053*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 5054*6777b538SAndroid Build Coastguard Worker * 5055*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 5056*6777b538SAndroid Build Coastguard Worker **/ 5057*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithBools:(const BOOL [__nullable])values 5058*6777b538SAndroid Build Coastguard Worker forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys 5059*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 5060*6777b538SAndroid Build Coastguard Worker 5061*6777b538SAndroid Build Coastguard Worker /** 5062*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 5063*6777b538SAndroid Build Coastguard Worker * 5064*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 5065*6777b538SAndroid Build Coastguard Worker * 5066*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 5067*6777b538SAndroid Build Coastguard Worker **/ 5068*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBStringBoolDictionary *)dictionary; 5069*6777b538SAndroid Build Coastguard Worker 5070*6777b538SAndroid Build Coastguard Worker /** 5071*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 5072*6777b538SAndroid Build Coastguard Worker * 5073*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 5074*6777b538SAndroid Build Coastguard Worker * 5075*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 5076*6777b538SAndroid Build Coastguard Worker **/ 5077*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 5078*6777b538SAndroid Build Coastguard Worker 5079*6777b538SAndroid Build Coastguard Worker /** 5080*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 5081*6777b538SAndroid Build Coastguard Worker * 5082*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 5083*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 5084*6777b538SAndroid Build Coastguard Worker * 5085*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 5086*6777b538SAndroid Build Coastguard Worker **/ 5087*6777b538SAndroid Build Coastguard Worker - (BOOL)getBool:(nullable BOOL *)value forKey:(NSString *)key; 5088*6777b538SAndroid Build Coastguard Worker 5089*6777b538SAndroid Build Coastguard Worker /** 5090*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 5091*6777b538SAndroid Build Coastguard Worker * 5092*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 5093*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 5094*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 5095*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 5096*6777b538SAndroid Build Coastguard Worker **/ 5097*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndBoolsUsingBlock: 5098*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(NSString *key, BOOL value, BOOL *stop))block; 5099*6777b538SAndroid Build Coastguard Worker 5100*6777b538SAndroid Build Coastguard Worker /** 5101*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 5102*6777b538SAndroid Build Coastguard Worker * 5103*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 5104*6777b538SAndroid Build Coastguard Worker * dictionary. 5105*6777b538SAndroid Build Coastguard Worker **/ 5106*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBStringBoolDictionary *)otherDictionary; 5107*6777b538SAndroid Build Coastguard Worker 5108*6777b538SAndroid Build Coastguard Worker /** 5109*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 5110*6777b538SAndroid Build Coastguard Worker * 5111*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 5112*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 5113*6777b538SAndroid Build Coastguard Worker **/ 5114*6777b538SAndroid Build Coastguard Worker - (void)setBool:(BOOL)value forKey:(NSString *)key; 5115*6777b538SAndroid Build Coastguard Worker 5116*6777b538SAndroid Build Coastguard Worker /** 5117*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 5118*6777b538SAndroid Build Coastguard Worker * 5119*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 5120*6777b538SAndroid Build Coastguard Worker **/ 5121*6777b538SAndroid Build Coastguard Worker - (void)removeBoolForKey:(NSString *)aKey; 5122*6777b538SAndroid Build Coastguard Worker 5123*6777b538SAndroid Build Coastguard Worker /** 5124*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 5125*6777b538SAndroid Build Coastguard Worker **/ 5126*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 5127*6777b538SAndroid Build Coastguard Worker 5128*6777b538SAndroid Build Coastguard Worker @end 5129*6777b538SAndroid Build Coastguard Worker 5130*6777b538SAndroid Build Coastguard Worker #pragma mark - String -> Float 5131*6777b538SAndroid Build Coastguard Worker 5132*6777b538SAndroid Build Coastguard Worker /** 5133*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <NSString, float> 5134*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 5135*6777b538SAndroid Build Coastguard Worker * 5136*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 5137*6777b538SAndroid Build Coastguard Worker **/ 5138*6777b538SAndroid Build Coastguard Worker @interface GPBStringFloatDictionary : NSObject <NSCopying> 5139*6777b538SAndroid Build Coastguard Worker 5140*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 5141*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 5142*6777b538SAndroid Build Coastguard Worker 5143*6777b538SAndroid Build Coastguard Worker /** 5144*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 5145*6777b538SAndroid Build Coastguard Worker * 5146*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 5147*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 5148*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 5149*6777b538SAndroid Build Coastguard Worker * 5150*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 5151*6777b538SAndroid Build Coastguard Worker **/ 5152*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithFloats:(const float [__nullable])values 5153*6777b538SAndroid Build Coastguard Worker forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys 5154*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 5155*6777b538SAndroid Build Coastguard Worker 5156*6777b538SAndroid Build Coastguard Worker /** 5157*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 5158*6777b538SAndroid Build Coastguard Worker * 5159*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 5160*6777b538SAndroid Build Coastguard Worker * 5161*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 5162*6777b538SAndroid Build Coastguard Worker **/ 5163*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBStringFloatDictionary *)dictionary; 5164*6777b538SAndroid Build Coastguard Worker 5165*6777b538SAndroid Build Coastguard Worker /** 5166*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 5167*6777b538SAndroid Build Coastguard Worker * 5168*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 5169*6777b538SAndroid Build Coastguard Worker * 5170*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 5171*6777b538SAndroid Build Coastguard Worker **/ 5172*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 5173*6777b538SAndroid Build Coastguard Worker 5174*6777b538SAndroid Build Coastguard Worker /** 5175*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 5176*6777b538SAndroid Build Coastguard Worker * 5177*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 5178*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 5179*6777b538SAndroid Build Coastguard Worker * 5180*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 5181*6777b538SAndroid Build Coastguard Worker **/ 5182*6777b538SAndroid Build Coastguard Worker - (BOOL)getFloat:(nullable float *)value forKey:(NSString *)key; 5183*6777b538SAndroid Build Coastguard Worker 5184*6777b538SAndroid Build Coastguard Worker /** 5185*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 5186*6777b538SAndroid Build Coastguard Worker * 5187*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 5188*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 5189*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 5190*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 5191*6777b538SAndroid Build Coastguard Worker **/ 5192*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndFloatsUsingBlock: 5193*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(NSString *key, float value, BOOL *stop))block; 5194*6777b538SAndroid Build Coastguard Worker 5195*6777b538SAndroid Build Coastguard Worker /** 5196*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 5197*6777b538SAndroid Build Coastguard Worker * 5198*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 5199*6777b538SAndroid Build Coastguard Worker * dictionary. 5200*6777b538SAndroid Build Coastguard Worker **/ 5201*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBStringFloatDictionary *)otherDictionary; 5202*6777b538SAndroid Build Coastguard Worker 5203*6777b538SAndroid Build Coastguard Worker /** 5204*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 5205*6777b538SAndroid Build Coastguard Worker * 5206*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 5207*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 5208*6777b538SAndroid Build Coastguard Worker **/ 5209*6777b538SAndroid Build Coastguard Worker - (void)setFloat:(float)value forKey:(NSString *)key; 5210*6777b538SAndroid Build Coastguard Worker 5211*6777b538SAndroid Build Coastguard Worker /** 5212*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 5213*6777b538SAndroid Build Coastguard Worker * 5214*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 5215*6777b538SAndroid Build Coastguard Worker **/ 5216*6777b538SAndroid Build Coastguard Worker - (void)removeFloatForKey:(NSString *)aKey; 5217*6777b538SAndroid Build Coastguard Worker 5218*6777b538SAndroid Build Coastguard Worker /** 5219*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 5220*6777b538SAndroid Build Coastguard Worker **/ 5221*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 5222*6777b538SAndroid Build Coastguard Worker 5223*6777b538SAndroid Build Coastguard Worker @end 5224*6777b538SAndroid Build Coastguard Worker 5225*6777b538SAndroid Build Coastguard Worker #pragma mark - String -> Double 5226*6777b538SAndroid Build Coastguard Worker 5227*6777b538SAndroid Build Coastguard Worker /** 5228*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <NSString, double> 5229*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 5230*6777b538SAndroid Build Coastguard Worker * 5231*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 5232*6777b538SAndroid Build Coastguard Worker **/ 5233*6777b538SAndroid Build Coastguard Worker @interface GPBStringDoubleDictionary : NSObject <NSCopying> 5234*6777b538SAndroid Build Coastguard Worker 5235*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 5236*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 5237*6777b538SAndroid Build Coastguard Worker 5238*6777b538SAndroid Build Coastguard Worker /** 5239*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the given values and keys. 5240*6777b538SAndroid Build Coastguard Worker * 5241*6777b538SAndroid Build Coastguard Worker * @param values The values to be placed in this dictionary. 5242*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 5243*6777b538SAndroid Build Coastguard Worker * @param count The number of elements to copy into the dictionary. 5244*6777b538SAndroid Build Coastguard Worker * 5245*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with a copy of the values and keys. 5246*6777b538SAndroid Build Coastguard Worker **/ 5247*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDoubles:(const double [__nullable])values 5248*6777b538SAndroid Build Coastguard Worker forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys 5249*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 5250*6777b538SAndroid Build Coastguard Worker 5251*6777b538SAndroid Build Coastguard Worker /** 5252*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary, copying the entries from the given dictionary. 5253*6777b538SAndroid Build Coastguard Worker * 5254*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to this dictionary. 5255*6777b538SAndroid Build Coastguard Worker * 5256*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries of the given dictionary. 5257*6777b538SAndroid Build Coastguard Worker **/ 5258*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBStringDoubleDictionary *)dictionary; 5259*6777b538SAndroid Build Coastguard Worker 5260*6777b538SAndroid Build Coastguard Worker /** 5261*6777b538SAndroid Build Coastguard Worker * Initializes this dictionary with the requested capacity. 5262*6777b538SAndroid Build Coastguard Worker * 5263*6777b538SAndroid Build Coastguard Worker * @param numItems Number of items needed for this dictionary. 5264*6777b538SAndroid Build Coastguard Worker * 5265*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the requested capacity. 5266*6777b538SAndroid Build Coastguard Worker **/ 5267*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithCapacity:(NSUInteger)numItems; 5268*6777b538SAndroid Build Coastguard Worker 5269*6777b538SAndroid Build Coastguard Worker /** 5270*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 5271*6777b538SAndroid Build Coastguard Worker * 5272*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 5273*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 5274*6777b538SAndroid Build Coastguard Worker * 5275*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 5276*6777b538SAndroid Build Coastguard Worker **/ 5277*6777b538SAndroid Build Coastguard Worker - (BOOL)getDouble:(nullable double *)value forKey:(NSString *)key; 5278*6777b538SAndroid Build Coastguard Worker 5279*6777b538SAndroid Build Coastguard Worker /** 5280*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 5281*6777b538SAndroid Build Coastguard Worker * 5282*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 5283*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 5284*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 5285*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 5286*6777b538SAndroid Build Coastguard Worker **/ 5287*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndDoublesUsingBlock: 5288*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(NSString *key, double value, BOOL *stop))block; 5289*6777b538SAndroid Build Coastguard Worker 5290*6777b538SAndroid Build Coastguard Worker /** 5291*6777b538SAndroid Build Coastguard Worker * Adds the keys and values from another dictionary. 5292*6777b538SAndroid Build Coastguard Worker * 5293*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 5294*6777b538SAndroid Build Coastguard Worker * dictionary. 5295*6777b538SAndroid Build Coastguard Worker **/ 5296*6777b538SAndroid Build Coastguard Worker - (void)addEntriesFromDictionary:(GPBStringDoubleDictionary *)otherDictionary; 5297*6777b538SAndroid Build Coastguard Worker 5298*6777b538SAndroid Build Coastguard Worker /** 5299*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 5300*6777b538SAndroid Build Coastguard Worker * 5301*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 5302*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 5303*6777b538SAndroid Build Coastguard Worker **/ 5304*6777b538SAndroid Build Coastguard Worker - (void)setDouble:(double)value forKey:(NSString *)key; 5305*6777b538SAndroid Build Coastguard Worker 5306*6777b538SAndroid Build Coastguard Worker /** 5307*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 5308*6777b538SAndroid Build Coastguard Worker * 5309*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 5310*6777b538SAndroid Build Coastguard Worker **/ 5311*6777b538SAndroid Build Coastguard Worker - (void)removeDoubleForKey:(NSString *)aKey; 5312*6777b538SAndroid Build Coastguard Worker 5313*6777b538SAndroid Build Coastguard Worker /** 5314*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 5315*6777b538SAndroid Build Coastguard Worker **/ 5316*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 5317*6777b538SAndroid Build Coastguard Worker 5318*6777b538SAndroid Build Coastguard Worker @end 5319*6777b538SAndroid Build Coastguard Worker 5320*6777b538SAndroid Build Coastguard Worker #pragma mark - String -> Enum 5321*6777b538SAndroid Build Coastguard Worker 5322*6777b538SAndroid Build Coastguard Worker /** 5323*6777b538SAndroid Build Coastguard Worker * Class used for map fields of <NSString, int32_t> 5324*6777b538SAndroid Build Coastguard Worker * values. This performs better than boxing into NSNumbers in NSDictionaries. 5325*6777b538SAndroid Build Coastguard Worker * 5326*6777b538SAndroid Build Coastguard Worker * @note This class is not meant to be subclassed. 5327*6777b538SAndroid Build Coastguard Worker **/ 5328*6777b538SAndroid Build Coastguard Worker @interface GPBStringEnumDictionary : NSObject <NSCopying> 5329*6777b538SAndroid Build Coastguard Worker 5330*6777b538SAndroid Build Coastguard Worker /** Number of entries stored in this dictionary. */ 5331*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) NSUInteger count; 5332*6777b538SAndroid Build Coastguard Worker /** The validation function to check if the enums are valid. */ 5333*6777b538SAndroid Build Coastguard Worker @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 5334*6777b538SAndroid Build Coastguard Worker 5335*6777b538SAndroid Build Coastguard Worker /** 5336*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the given validation function. 5337*6777b538SAndroid Build Coastguard Worker * 5338*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 5339*6777b538SAndroid Build Coastguard Worker * 5340*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary. 5341*6777b538SAndroid Build Coastguard Worker **/ 5342*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 5343*6777b538SAndroid Build Coastguard Worker 5344*6777b538SAndroid Build Coastguard Worker /** 5345*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the entries given. 5346*6777b538SAndroid Build Coastguard Worker * 5347*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 5348*6777b538SAndroid Build Coastguard Worker * @param values The raw enum values values to be placed in the dictionary. 5349*6777b538SAndroid Build Coastguard Worker * @param keys The keys under which to store the values. 5350*6777b538SAndroid Build Coastguard Worker * @param count The number of entries to store in the dictionary. 5351*6777b538SAndroid Build Coastguard Worker * 5352*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the keys and values in it. 5353*6777b538SAndroid Build Coastguard Worker **/ 5354*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 5355*6777b538SAndroid Build Coastguard Worker rawValues:(const int32_t [__nullable])values 5356*6777b538SAndroid Build Coastguard Worker forKeys:(const NSString * __nonnull GPB_UNSAFE_UNRETAINED [__nullable])keys 5357*6777b538SAndroid Build Coastguard Worker count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 5358*6777b538SAndroid Build Coastguard Worker 5359*6777b538SAndroid Build Coastguard Worker /** 5360*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the entries from the given. 5361*6777b538SAndroid Build Coastguard Worker * dictionary. 5362*6777b538SAndroid Build Coastguard Worker * 5363*6777b538SAndroid Build Coastguard Worker * @param dictionary Dictionary containing the entries to add to the dictionary. 5364*6777b538SAndroid Build Coastguard Worker * 5365*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the entries from the given 5366*6777b538SAndroid Build Coastguard Worker * dictionary in it. 5367*6777b538SAndroid Build Coastguard Worker **/ 5368*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithDictionary:(GPBStringEnumDictionary *)dictionary; 5369*6777b538SAndroid Build Coastguard Worker 5370*6777b538SAndroid Build Coastguard Worker /** 5371*6777b538SAndroid Build Coastguard Worker * Initializes a dictionary with the given capacity. 5372*6777b538SAndroid Build Coastguard Worker * 5373*6777b538SAndroid Build Coastguard Worker * @param func The enum validation function for the dictionary. 5374*6777b538SAndroid Build Coastguard Worker * @param numItems Capacity needed for the dictionary. 5375*6777b538SAndroid Build Coastguard Worker * 5376*6777b538SAndroid Build Coastguard Worker * @return A newly initialized dictionary with the given capacity. 5377*6777b538SAndroid Build Coastguard Worker **/ 5378*6777b538SAndroid Build Coastguard Worker - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 5379*6777b538SAndroid Build Coastguard Worker capacity:(NSUInteger)numItems; 5380*6777b538SAndroid Build Coastguard Worker 5381*6777b538SAndroid Build Coastguard Worker // These will return kGPBUnrecognizedEnumeratorValue if the value for the key 5382*6777b538SAndroid Build Coastguard Worker // is not a valid enumerator as defined by validationFunc. If the actual value is 5383*6777b538SAndroid Build Coastguard Worker // desired, use "raw" version of the method. 5384*6777b538SAndroid Build Coastguard Worker 5385*6777b538SAndroid Build Coastguard Worker /** 5386*6777b538SAndroid Build Coastguard Worker * Gets the value for the given key. 5387*6777b538SAndroid Build Coastguard Worker * 5388*6777b538SAndroid Build Coastguard Worker * @param value Pointer into which the value will be set, if found. 5389*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 5390*6777b538SAndroid Build Coastguard Worker * 5391*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 5392*6777b538SAndroid Build Coastguard Worker **/ 5393*6777b538SAndroid Build Coastguard Worker - (BOOL)getEnum:(nullable int32_t *)value forKey:(NSString *)key; 5394*6777b538SAndroid Build Coastguard Worker 5395*6777b538SAndroid Build Coastguard Worker /** 5396*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 5397*6777b538SAndroid Build Coastguard Worker * 5398*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 5399*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 5400*6777b538SAndroid Build Coastguard Worker * **value**: The value for the current entry 5401*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 5402*6777b538SAndroid Build Coastguard Worker **/ 5403*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndEnumsUsingBlock: 5404*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(NSString *key, int32_t value, BOOL *stop))block; 5405*6777b538SAndroid Build Coastguard Worker 5406*6777b538SAndroid Build Coastguard Worker /** 5407*6777b538SAndroid Build Coastguard Worker * Gets the raw enum value for the given key. 5408*6777b538SAndroid Build Coastguard Worker * 5409*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the access of values that 5410*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 5411*6777b538SAndroid Build Coastguard Worker * 5412*6777b538SAndroid Build Coastguard Worker * @param rawValue Pointer into which the value will be set, if found. 5413*6777b538SAndroid Build Coastguard Worker * @param key Key under which the value is stored, if present. 5414*6777b538SAndroid Build Coastguard Worker * 5415*6777b538SAndroid Build Coastguard Worker * @return YES if the key was found and the value was copied, NO otherwise. 5416*6777b538SAndroid Build Coastguard Worker **/ 5417*6777b538SAndroid Build Coastguard Worker - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(NSString *)key; 5418*6777b538SAndroid Build Coastguard Worker 5419*6777b538SAndroid Build Coastguard Worker /** 5420*6777b538SAndroid Build Coastguard Worker * Enumerates the keys and values on this dictionary with the given block. 5421*6777b538SAndroid Build Coastguard Worker * 5422*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the access of values that 5423*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 5424*6777b538SAndroid Build Coastguard Worker * 5425*6777b538SAndroid Build Coastguard Worker * @param block The block to enumerate with. 5426*6777b538SAndroid Build Coastguard Worker * **key**: The key for the current entry. 5427*6777b538SAndroid Build Coastguard Worker * **rawValue**: The value for the current entry 5428*6777b538SAndroid Build Coastguard Worker * **stop**: A pointer to a boolean that when set stops the enumeration. 5429*6777b538SAndroid Build Coastguard Worker **/ 5430*6777b538SAndroid Build Coastguard Worker - (void)enumerateKeysAndRawValuesUsingBlock: 5431*6777b538SAndroid Build Coastguard Worker (void (NS_NOESCAPE ^)(NSString *key, int32_t rawValue, BOOL *stop))block; 5432*6777b538SAndroid Build Coastguard Worker 5433*6777b538SAndroid Build Coastguard Worker /** 5434*6777b538SAndroid Build Coastguard Worker * Adds the keys and raw enum values from another dictionary. 5435*6777b538SAndroid Build Coastguard Worker * 5436*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the setting of values that 5437*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 5438*6777b538SAndroid Build Coastguard Worker * 5439*6777b538SAndroid Build Coastguard Worker * @param otherDictionary Dictionary containing entries to be added to this 5440*6777b538SAndroid Build Coastguard Worker * dictionary. 5441*6777b538SAndroid Build Coastguard Worker **/ 5442*6777b538SAndroid Build Coastguard Worker - (void)addRawEntriesFromDictionary:(GPBStringEnumDictionary *)otherDictionary; 5443*6777b538SAndroid Build Coastguard Worker 5444*6777b538SAndroid Build Coastguard Worker // If value is not a valid enumerator as defined by validationFunc, these 5445*6777b538SAndroid Build Coastguard Worker // methods will assert in debug, and will log in release and assign the value 5446*6777b538SAndroid Build Coastguard Worker // to the default value. Use the rawValue methods below to assign non enumerator 5447*6777b538SAndroid Build Coastguard Worker // values. 5448*6777b538SAndroid Build Coastguard Worker 5449*6777b538SAndroid Build Coastguard Worker /** 5450*6777b538SAndroid Build Coastguard Worker * Sets the value for the given key. 5451*6777b538SAndroid Build Coastguard Worker * 5452*6777b538SAndroid Build Coastguard Worker * @param value The value to set. 5453*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the value. 5454*6777b538SAndroid Build Coastguard Worker **/ 5455*6777b538SAndroid Build Coastguard Worker - (void)setEnum:(int32_t)value forKey:(NSString *)key; 5456*6777b538SAndroid Build Coastguard Worker 5457*6777b538SAndroid Build Coastguard Worker /** 5458*6777b538SAndroid Build Coastguard Worker * Sets the raw enum value for the given key. 5459*6777b538SAndroid Build Coastguard Worker * 5460*6777b538SAndroid Build Coastguard Worker * @note This method bypass the validationFunc to enable the setting of values that 5461*6777b538SAndroid Build Coastguard Worker * were not known at the time the binary was compiled. 5462*6777b538SAndroid Build Coastguard Worker * 5463*6777b538SAndroid Build Coastguard Worker * @param rawValue The raw enum value to set. 5464*6777b538SAndroid Build Coastguard Worker * @param key The key under which to store the raw enum value. 5465*6777b538SAndroid Build Coastguard Worker **/ 5466*6777b538SAndroid Build Coastguard Worker - (void)setRawValue:(int32_t)rawValue forKey:(NSString *)key; 5467*6777b538SAndroid Build Coastguard Worker 5468*6777b538SAndroid Build Coastguard Worker /** 5469*6777b538SAndroid Build Coastguard Worker * Removes the entry for the given key. 5470*6777b538SAndroid Build Coastguard Worker * 5471*6777b538SAndroid Build Coastguard Worker * @param aKey Key to be removed from this dictionary. 5472*6777b538SAndroid Build Coastguard Worker **/ 5473*6777b538SAndroid Build Coastguard Worker - (void)removeEnumForKey:(NSString *)aKey; 5474*6777b538SAndroid Build Coastguard Worker 5475*6777b538SAndroid Build Coastguard Worker /** 5476*6777b538SAndroid Build Coastguard Worker * Removes all entries in this dictionary. 5477*6777b538SAndroid Build Coastguard Worker **/ 5478*6777b538SAndroid Build Coastguard Worker - (void)removeAll; 5479*6777b538SAndroid Build Coastguard Worker 5480*6777b538SAndroid Build Coastguard Worker @end 5481*6777b538SAndroid Build Coastguard Worker 5482*6777b538SAndroid Build Coastguard Worker // clang-format on 5483*6777b538SAndroid Build Coastguard Worker //%PDDM-EXPAND-END DECLARE_DICTIONARIES() 5484*6777b538SAndroid Build Coastguard Worker 5485*6777b538SAndroid Build Coastguard Worker NS_ASSUME_NONNULL_END 5486*6777b538SAndroid Build Coastguard Worker 5487*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DECLARE_DICTIONARIES() 5488*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt32, uint32_t) 5489*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int32, int32_t) 5490*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt64, uint64_t) 5491*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int64, int64_t) 5492*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_INTERFACES_FOR_POD_KEY(Bool, BOOL) 5493*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_POD_INTERFACES_FOR_KEY(String, NSString, *, OBJECT) 5494*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_INTERFACES_FOR_POD_KEY(KEY_NAME, KEY_TYPE) 5495*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, , POD) 5496*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, Object, ObjectType) 5497*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, KisP, KHELPER) 5498*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt32, uint32_t) 5499*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int32, int32_t) 5500*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt64, uint64_t) 5501*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int64, int64_t) 5502*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Bool, BOOL) 5503*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Float, float) 5504*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Double, double) 5505*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Enum, int32_t) 5506*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE) 5507*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, POD, VALUE_NAME, value) 5508*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, VALUE_NAME, VALUE_TYPE) 5509*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE, OBJECT, Object, object) 5510*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME) 5511*6777b538SAndroid Build Coastguard Worker //%/** 5512*6777b538SAndroid Build Coastguard Worker //% * Gets the value for the given key. 5513*6777b538SAndroid Build Coastguard Worker //% * 5514*6777b538SAndroid Build Coastguard Worker //% * @param value Pointer into which the value will be set, if found. 5515*6777b538SAndroid Build Coastguard Worker //% * @param key Key under which the value is stored, if present. 5516*6777b538SAndroid Build Coastguard Worker //% * 5517*6777b538SAndroid Build Coastguard Worker //% * @return YES if the key was found and the value was copied, NO otherwise. 5518*6777b538SAndroid Build Coastguard Worker //% **/ 5519*6777b538SAndroid Build Coastguard Worker //%- (BOOL)get##VNAME##:(nullable VALUE_TYPE *)value forKey:(KEY_TYPE)key; 5520*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_TYPE, VNAME) 5521*6777b538SAndroid Build Coastguard Worker //%/** 5522*6777b538SAndroid Build Coastguard Worker //% * Fetches the object stored under the given key. 5523*6777b538SAndroid Build Coastguard Worker //% * 5524*6777b538SAndroid Build Coastguard Worker //% * @param key Key under which the value is stored, if present. 5525*6777b538SAndroid Build Coastguard Worker //% * 5526*6777b538SAndroid Build Coastguard Worker //% * @return The object if found, nil otherwise. 5527*6777b538SAndroid Build Coastguard Worker //% **/ 5528*6777b538SAndroid Build Coastguard Worker //%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key; 5529*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE VALUE_FOR_KEY_Enum(KEY_TYPE, VALUE_TYPE, VNAME) 5530*6777b538SAndroid Build Coastguard Worker //%VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME) 5531*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE ARRAY_ARG_MODIFIERPOD() 5532*6777b538SAndroid Build Coastguard Worker // Nothing 5533*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE ARRAY_ARG_MODIFIEREnum() 5534*6777b538SAndroid Build Coastguard Worker // Nothing 5535*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE ARRAY_ARG_MODIFIEROBJECT() 5536*6777b538SAndroid Build Coastguard Worker //%__nonnull GPB_UNSAFE_UNRETAINED ## 5537*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_CLASS_DECLPOD(KEY_NAME, VALUE_NAME, VALUE_TYPE) 5538*6777b538SAndroid Build Coastguard Worker //%GPB##KEY_NAME##VALUE_NAME##Dictionary 5539*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_CLASS_DECLEnum(KEY_NAME, VALUE_NAME, VALUE_TYPE) 5540*6777b538SAndroid Build Coastguard Worker //%GPB##KEY_NAME##VALUE_NAME##Dictionary 5541*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_CLASS_DECLOBJECT(KEY_NAME, VALUE_NAME, VALUE_TYPE) 5542*6777b538SAndroid Build Coastguard Worker //%GPB##KEY_NAME##VALUE_NAME##Dictionary<__covariant VALUE_TYPE> 5543*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 5544*6777b538SAndroid Build Coastguard Worker //%#pragma mark - KEY_NAME -> VALUE_NAME 5545*6777b538SAndroid Build Coastguard Worker //% 5546*6777b538SAndroid Build Coastguard Worker //%/** 5547*6777b538SAndroid Build Coastguard Worker //% * Class used for map fields of <##KEY_TYPE##, ##VALUE_TYPE##> 5548*6777b538SAndroid Build Coastguard Worker //% * values. This performs better than boxing into NSNumbers in NSDictionaries. 5549*6777b538SAndroid Build Coastguard Worker //% * 5550*6777b538SAndroid Build Coastguard Worker //% * @note This class is not meant to be subclassed. 5551*6777b538SAndroid Build Coastguard Worker //% **/ 5552*6777b538SAndroid Build Coastguard Worker //%@interface DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) : NSObject <NSCopying> 5553*6777b538SAndroid Build Coastguard Worker //% 5554*6777b538SAndroid Build Coastguard Worker //%/** Number of entries stored in this dictionary. */ 5555*6777b538SAndroid Build Coastguard Worker //%@property(nonatomic, readonly) NSUInteger count; 5556*6777b538SAndroid Build Coastguard Worker //% 5557*6777b538SAndroid Build Coastguard Worker //%/** 5558*6777b538SAndroid Build Coastguard Worker //% * Initializes this dictionary, copying the given values and keys. 5559*6777b538SAndroid Build Coastguard Worker //% * 5560*6777b538SAndroid Build Coastguard Worker //% * @param ##VNAME_VAR##s The values to be placed in this dictionary. 5561*6777b538SAndroid Build Coastguard Worker //% * @param keys ##VNAME_VAR$S## The keys under which to store the values. 5562*6777b538SAndroid Build Coastguard Worker //% * @param count ##VNAME_VAR$S## The number of elements to copy into the dictionary. 5563*6777b538SAndroid Build Coastguard Worker //% * 5564*6777b538SAndroid Build Coastguard Worker //% * @return A newly initialized dictionary with a copy of the values and keys. 5565*6777b538SAndroid Build Coastguard Worker //% **/ 5566*6777b538SAndroid Build Coastguard Worker //%- (instancetype)initWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[__nullable])##VNAME_VAR##s 5567*6777b538SAndroid Build Coastguard Worker //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[__nullable])keys 5568*6777b538SAndroid Build Coastguard Worker //% ##VNAME$S## count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 5569*6777b538SAndroid Build Coastguard Worker //% 5570*6777b538SAndroid Build Coastguard Worker //%/** 5571*6777b538SAndroid Build Coastguard Worker //% * Initializes this dictionary, copying the entries from the given dictionary. 5572*6777b538SAndroid Build Coastguard Worker //% * 5573*6777b538SAndroid Build Coastguard Worker //% * @param dictionary Dictionary containing the entries to add to this dictionary. 5574*6777b538SAndroid Build Coastguard Worker //% * 5575*6777b538SAndroid Build Coastguard Worker //% * @return A newly initialized dictionary with the entries of the given dictionary. 5576*6777b538SAndroid Build Coastguard Worker //% **/ 5577*6777b538SAndroid Build Coastguard Worker //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary; 5578*6777b538SAndroid Build Coastguard Worker //% 5579*6777b538SAndroid Build Coastguard Worker //%/** 5580*6777b538SAndroid Build Coastguard Worker //% * Initializes this dictionary with the requested capacity. 5581*6777b538SAndroid Build Coastguard Worker //% * 5582*6777b538SAndroid Build Coastguard Worker //% * @param numItems Number of items needed for this dictionary. 5583*6777b538SAndroid Build Coastguard Worker //% * 5584*6777b538SAndroid Build Coastguard Worker //% * @return A newly initialized dictionary with the requested capacity. 5585*6777b538SAndroid Build Coastguard Worker //% **/ 5586*6777b538SAndroid Build Coastguard Worker //%- (instancetype)initWithCapacity:(NSUInteger)numItems; 5587*6777b538SAndroid Build Coastguard Worker //% 5588*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 5589*6777b538SAndroid Build Coastguard Worker //% 5590*6777b538SAndroid Build Coastguard Worker //%/** 5591*6777b538SAndroid Build Coastguard Worker //% * Adds the keys and values from another dictionary. 5592*6777b538SAndroid Build Coastguard Worker //% * 5593*6777b538SAndroid Build Coastguard Worker //% * @param otherDictionary Dictionary containing entries to be added to this 5594*6777b538SAndroid Build Coastguard Worker //% * dictionary. 5595*6777b538SAndroid Build Coastguard Worker //% **/ 5596*6777b538SAndroid Build Coastguard Worker //%- (void)addEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary; 5597*6777b538SAndroid Build Coastguard Worker //% 5598*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 5599*6777b538SAndroid Build Coastguard Worker //% 5600*6777b538SAndroid Build Coastguard Worker //%@end 5601*6777b538SAndroid Build Coastguard Worker //% 5602*6777b538SAndroid Build Coastguard Worker 5603*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE) 5604*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, Enum) 5605*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER) 5606*6777b538SAndroid Build Coastguard Worker //%#pragma mark - KEY_NAME -> VALUE_NAME 5607*6777b538SAndroid Build Coastguard Worker //% 5608*6777b538SAndroid Build Coastguard Worker //%/** 5609*6777b538SAndroid Build Coastguard Worker //% * Class used for map fields of <##KEY_TYPE##, ##VALUE_TYPE##> 5610*6777b538SAndroid Build Coastguard Worker //% * values. This performs better than boxing into NSNumbers in NSDictionaries. 5611*6777b538SAndroid Build Coastguard Worker //% * 5612*6777b538SAndroid Build Coastguard Worker //% * @note This class is not meant to be subclassed. 5613*6777b538SAndroid Build Coastguard Worker //% **/ 5614*6777b538SAndroid Build Coastguard Worker //%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary : NSObject <NSCopying> 5615*6777b538SAndroid Build Coastguard Worker //% 5616*6777b538SAndroid Build Coastguard Worker //%/** Number of entries stored in this dictionary. */ 5617*6777b538SAndroid Build Coastguard Worker //%@property(nonatomic, readonly) NSUInteger count; 5618*6777b538SAndroid Build Coastguard Worker //%/** The validation function to check if the enums are valid. */ 5619*6777b538SAndroid Build Coastguard Worker //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc; 5620*6777b538SAndroid Build Coastguard Worker //% 5621*6777b538SAndroid Build Coastguard Worker //%/** 5622*6777b538SAndroid Build Coastguard Worker //% * Initializes a dictionary with the given validation function. 5623*6777b538SAndroid Build Coastguard Worker //% * 5624*6777b538SAndroid Build Coastguard Worker //% * @param func The enum validation function for the dictionary. 5625*6777b538SAndroid Build Coastguard Worker //% * 5626*6777b538SAndroid Build Coastguard Worker //% * @return A newly initialized dictionary. 5627*6777b538SAndroid Build Coastguard Worker //% **/ 5628*6777b538SAndroid Build Coastguard Worker //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func; 5629*6777b538SAndroid Build Coastguard Worker //% 5630*6777b538SAndroid Build Coastguard Worker //%/** 5631*6777b538SAndroid Build Coastguard Worker //% * Initializes a dictionary with the entries given. 5632*6777b538SAndroid Build Coastguard Worker //% * 5633*6777b538SAndroid Build Coastguard Worker //% * @param func The enum validation function for the dictionary. 5634*6777b538SAndroid Build Coastguard Worker //% * @param values The raw enum values values to be placed in the dictionary. 5635*6777b538SAndroid Build Coastguard Worker //% * @param keys The keys under which to store the values. 5636*6777b538SAndroid Build Coastguard Worker //% * @param count The number of entries to store in the dictionary. 5637*6777b538SAndroid Build Coastguard Worker //% * 5638*6777b538SAndroid Build Coastguard Worker //% * @return A newly initialized dictionary with the keys and values in it. 5639*6777b538SAndroid Build Coastguard Worker //% **/ 5640*6777b538SAndroid Build Coastguard Worker //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 5641*6777b538SAndroid Build Coastguard Worker //% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[__nullable])values 5642*6777b538SAndroid Build Coastguard Worker //% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[__nullable])keys 5643*6777b538SAndroid Build Coastguard Worker //% count:(NSUInteger)count NS_DESIGNATED_INITIALIZER; 5644*6777b538SAndroid Build Coastguard Worker //% 5645*6777b538SAndroid Build Coastguard Worker //%/** 5646*6777b538SAndroid Build Coastguard Worker //% * Initializes a dictionary with the entries from the given. 5647*6777b538SAndroid Build Coastguard Worker //% * dictionary. 5648*6777b538SAndroid Build Coastguard Worker //% * 5649*6777b538SAndroid Build Coastguard Worker //% * @param dictionary Dictionary containing the entries to add to the dictionary. 5650*6777b538SAndroid Build Coastguard Worker //% * 5651*6777b538SAndroid Build Coastguard Worker //% * @return A newly initialized dictionary with the entries from the given 5652*6777b538SAndroid Build Coastguard Worker //% * dictionary in it. 5653*6777b538SAndroid Build Coastguard Worker //% **/ 5654*6777b538SAndroid Build Coastguard Worker //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary; 5655*6777b538SAndroid Build Coastguard Worker //% 5656*6777b538SAndroid Build Coastguard Worker //%/** 5657*6777b538SAndroid Build Coastguard Worker //% * Initializes a dictionary with the given capacity. 5658*6777b538SAndroid Build Coastguard Worker //% * 5659*6777b538SAndroid Build Coastguard Worker //% * @param func The enum validation function for the dictionary. 5660*6777b538SAndroid Build Coastguard Worker //% * @param numItems Capacity needed for the dictionary. 5661*6777b538SAndroid Build Coastguard Worker //% * 5662*6777b538SAndroid Build Coastguard Worker //% * @return A newly initialized dictionary with the given capacity. 5663*6777b538SAndroid Build Coastguard Worker //% **/ 5664*6777b538SAndroid Build Coastguard Worker //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func 5665*6777b538SAndroid Build Coastguard Worker //% capacity:(NSUInteger)numItems; 5666*6777b538SAndroid Build Coastguard Worker //% 5667*6777b538SAndroid Build Coastguard Worker //%// These will return kGPBUnrecognizedEnumeratorValue if the value for the key 5668*6777b538SAndroid Build Coastguard Worker //%// is not a valid enumerator as defined by validationFunc. If the actual value is 5669*6777b538SAndroid Build Coastguard Worker //%// desired, use "raw" version of the method. 5670*6777b538SAndroid Build Coastguard Worker //% 5671*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, Enum, value) 5672*6777b538SAndroid Build Coastguard Worker //% 5673*6777b538SAndroid Build Coastguard Worker //%/** 5674*6777b538SAndroid Build Coastguard Worker //% * Gets the raw enum value for the given key. 5675*6777b538SAndroid Build Coastguard Worker //% * 5676*6777b538SAndroid Build Coastguard Worker //% * @note This method bypass the validationFunc to enable the access of values that 5677*6777b538SAndroid Build Coastguard Worker //% * were not known at the time the binary was compiled. 5678*6777b538SAndroid Build Coastguard Worker //% * 5679*6777b538SAndroid Build Coastguard Worker //% * @param rawValue Pointer into which the value will be set, if found. 5680*6777b538SAndroid Build Coastguard Worker //% * @param key Key under which the value is stored, if present. 5681*6777b538SAndroid Build Coastguard Worker //% * 5682*6777b538SAndroid Build Coastguard Worker //% * @return YES if the key was found and the value was copied, NO otherwise. 5683*6777b538SAndroid Build Coastguard Worker //% **/ 5684*6777b538SAndroid Build Coastguard Worker //%- (BOOL)getRawValue:(nullable VALUE_TYPE *)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key; 5685*6777b538SAndroid Build Coastguard Worker //% 5686*6777b538SAndroid Build Coastguard Worker //%/** 5687*6777b538SAndroid Build Coastguard Worker //% * Enumerates the keys and values on this dictionary with the given block. 5688*6777b538SAndroid Build Coastguard Worker //% * 5689*6777b538SAndroid Build Coastguard Worker //% * @note This method bypass the validationFunc to enable the access of values that 5690*6777b538SAndroid Build Coastguard Worker //% * were not known at the time the binary was compiled. 5691*6777b538SAndroid Build Coastguard Worker //% * 5692*6777b538SAndroid Build Coastguard Worker //% * @param block The block to enumerate with. 5693*6777b538SAndroid Build Coastguard Worker //% * **key**: The key for the current entry. 5694*6777b538SAndroid Build Coastguard Worker //% * **rawValue**: The value for the current entry 5695*6777b538SAndroid Build Coastguard Worker //% * **stop**: A pointer to a boolean that when set stops the enumeration. 5696*6777b538SAndroid Build Coastguard Worker //% **/ 5697*6777b538SAndroid Build Coastguard Worker //%- (void)enumerateKeysAndRawValuesUsingBlock: 5698*6777b538SAndroid Build Coastguard Worker //% (void (NS_NOESCAPE ^)(KEY_TYPE KisP##key, VALUE_TYPE rawValue, BOOL *stop))block; 5699*6777b538SAndroid Build Coastguard Worker //% 5700*6777b538SAndroid Build Coastguard Worker //%/** 5701*6777b538SAndroid Build Coastguard Worker //% * Adds the keys and raw enum values from another dictionary. 5702*6777b538SAndroid Build Coastguard Worker //% * 5703*6777b538SAndroid Build Coastguard Worker //% * @note This method bypass the validationFunc to enable the setting of values that 5704*6777b538SAndroid Build Coastguard Worker //% * were not known at the time the binary was compiled. 5705*6777b538SAndroid Build Coastguard Worker //% * 5706*6777b538SAndroid Build Coastguard Worker //% * @param otherDictionary Dictionary containing entries to be added to this 5707*6777b538SAndroid Build Coastguard Worker //% * dictionary. 5708*6777b538SAndroid Build Coastguard Worker //% **/ 5709*6777b538SAndroid Build Coastguard Worker //%- (void)addRawEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary; 5710*6777b538SAndroid Build Coastguard Worker //% 5711*6777b538SAndroid Build Coastguard Worker //%// If value is not a valid enumerator as defined by validationFunc, these 5712*6777b538SAndroid Build Coastguard Worker //%// methods will assert in debug, and will log in release and assign the value 5713*6777b538SAndroid Build Coastguard Worker //%// to the default value. Use the rawValue methods below to assign non enumerator 5714*6777b538SAndroid Build Coastguard Worker //%// values. 5715*6777b538SAndroid Build Coastguard Worker //% 5716*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, Enum, value) 5717*6777b538SAndroid Build Coastguard Worker //% 5718*6777b538SAndroid Build Coastguard Worker //%@end 5719*6777b538SAndroid Build Coastguard Worker //% 5720*6777b538SAndroid Build Coastguard Worker 5721*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 5722*6777b538SAndroid Build Coastguard Worker //%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_TYPE, VNAME) 5723*6777b538SAndroid Build Coastguard Worker //% 5724*6777b538SAndroid Build Coastguard Worker //%/** 5725*6777b538SAndroid Build Coastguard Worker //% * Enumerates the keys and values on this dictionary with the given block. 5726*6777b538SAndroid Build Coastguard Worker //% * 5727*6777b538SAndroid Build Coastguard Worker //% * @param block The block to enumerate with. 5728*6777b538SAndroid Build Coastguard Worker //% * **key**: ##VNAME_VAR$S## The key for the current entry. 5729*6777b538SAndroid Build Coastguard Worker //% * **VNAME_VAR**: The value for the current entry 5730*6777b538SAndroid Build Coastguard Worker //% * **stop**: ##VNAME_VAR$S## A pointer to a boolean that when set stops the enumeration. 5731*6777b538SAndroid Build Coastguard Worker //% **/ 5732*6777b538SAndroid Build Coastguard Worker //%- (void)enumerateKeysAnd##VNAME##sUsingBlock: 5733*6777b538SAndroid Build Coastguard Worker //% (void (NS_NOESCAPE ^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME_VAR, BOOL *stop))block; 5734*6777b538SAndroid Build Coastguard Worker 5735*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR) 5736*6777b538SAndroid Build Coastguard Worker //%/** 5737*6777b538SAndroid Build Coastguard Worker //% * Sets the value for the given key. 5738*6777b538SAndroid Build Coastguard Worker //% * 5739*6777b538SAndroid Build Coastguard Worker //% * @param ##VNAME_VAR The value to set. 5740*6777b538SAndroid Build Coastguard Worker //% * @param key ##VNAME_VAR$S## The key under which to store the value. 5741*6777b538SAndroid Build Coastguard Worker //% **/ 5742*6777b538SAndroid Build Coastguard Worker //%- (void)set##VNAME##:(VALUE_TYPE)##VNAME_VAR forKey:(KEY_TYPE##KisP$S##KisP)key; 5743*6777b538SAndroid Build Coastguard Worker //%DICTIONARY_EXTRA_MUTABLE_METHODS_##VHELPER(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE) 5744*6777b538SAndroid Build Coastguard Worker //%/** 5745*6777b538SAndroid Build Coastguard Worker //% * Removes the entry for the given key. 5746*6777b538SAndroid Build Coastguard Worker //% * 5747*6777b538SAndroid Build Coastguard Worker //% * @param aKey Key to be removed from this dictionary. 5748*6777b538SAndroid Build Coastguard Worker //% **/ 5749*6777b538SAndroid Build Coastguard Worker //%- (void)remove##VNAME##ForKey:(KEY_TYPE##KisP$S##KisP)aKey; 5750*6777b538SAndroid Build Coastguard Worker //% 5751*6777b538SAndroid Build Coastguard Worker //%/** 5752*6777b538SAndroid Build Coastguard Worker //% * Removes all entries in this dictionary. 5753*6777b538SAndroid Build Coastguard Worker //% **/ 5754*6777b538SAndroid Build Coastguard Worker //%- (void)removeAll; 5755*6777b538SAndroid Build Coastguard Worker 5756*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_POD(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE) 5757*6777b538SAndroid Build Coastguard Worker // Empty 5758*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_OBJECT(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE) 5759*6777b538SAndroid Build Coastguard Worker // Empty 5760*6777b538SAndroid Build Coastguard Worker //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_Enum(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE) 5761*6777b538SAndroid Build Coastguard Worker //% 5762*6777b538SAndroid Build Coastguard Worker //%/** 5763*6777b538SAndroid Build Coastguard Worker //% * Sets the raw enum value for the given key. 5764*6777b538SAndroid Build Coastguard Worker //% * 5765*6777b538SAndroid Build Coastguard Worker //% * @note This method bypass the validationFunc to enable the setting of values that 5766*6777b538SAndroid Build Coastguard Worker //% * were not known at the time the binary was compiled. 5767*6777b538SAndroid Build Coastguard Worker //% * 5768*6777b538SAndroid Build Coastguard Worker //% * @param rawValue The raw enum value to set. 5769*6777b538SAndroid Build Coastguard Worker //% * @param key The key under which to store the raw enum value. 5770*6777b538SAndroid Build Coastguard Worker //% **/ 5771*6777b538SAndroid Build Coastguard Worker //%- (void)setRawValue:(VALUE_TYPE)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key; 5772*6777b538SAndroid Build Coastguard Worker //% 5773