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