GPBDictionary.h 95 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364
  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2008 Google Inc. All rights reserved.
  3. // https://developers.google.com/protocol-buffers/
  4. //
  5. // Redistribution and use in source and binary forms, with or without
  6. // modification, are permitted provided that the following conditions are
  7. // met:
  8. //
  9. // * Redistributions of source code must retain the above copyright
  10. // notice, this list of conditions and the following disclaimer.
  11. // * Redistributions in binary form must reproduce the above
  12. // copyright notice, this list of conditions and the following disclaimer
  13. // in the documentation and/or other materials provided with the
  14. // distribution.
  15. // * Neither the name of Google Inc. nor the names of its
  16. // contributors may be used to endorse or promote products derived from
  17. // this software without specific prior written permission.
  18. //
  19. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  22. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  23. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  24. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  25. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  27. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  29. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  30. #import <Foundation/Foundation.h>
  31. #import "GPBRuntimeTypes.h"
  32. // These classes are used for map fields of basic data types. They are used because
  33. // they perform better than boxing into NSNumbers in NSDictionaries.
  34. // Note: These are not meant to be subclassed.
  35. // Note on naming: for the classes holding numeric values, a more natural
  36. // naming of the method might be things like "-valueForKey:",
  37. // "-setValue:forKey:"; etc. But those selectors are also defined by Key Value
  38. // Coding (KVC) as categories on NSObject. So "overloading" the selectors with
  39. // other meanings can cause warnings (based on compiler settings), but more
  40. // importantly, some of those selector get called as KVC breaks up keypaths.
  41. // So if those selectors are used, using KVC will compile cleanly, but could
  42. // crash as it invokes those selectors with the wrong types of arguments.
  43. NS_ASSUME_NONNULL_BEGIN
  44. //%PDDM-EXPAND DECLARE_DICTIONARIES()
  45. // This block of code is generated, do not edit it directly.
  46. #pragma mark - UInt32 -> UInt32
  47. @interface GPBUInt32UInt32Dictionary : NSObject <NSCopying>
  48. @property(nonatomic, readonly) NSUInteger count;
  49. + (instancetype)dictionary;
  50. + (instancetype)dictionaryWithUInt32:(uint32_t)value
  51. forKey:(uint32_t)key;
  52. + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
  53. forKeys:(const uint32_t [])keys
  54. count:(NSUInteger)count;
  55. + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary;
  56. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  57. - (instancetype)initWithUInt32s:(const uint32_t [])values
  58. forKeys:(const uint32_t [])keys
  59. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  60. - (instancetype)initWithDictionary:(GPBUInt32UInt32Dictionary *)dictionary;
  61. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  62. // Returns YES/NO to indicate if the key was found or not, filling in the value
  63. // only when the key was found.
  64. - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint32_t)key;
  65. - (void)enumerateKeysAndUInt32sUsingBlock:
  66. (void (^)(uint32_t key, uint32_t value, BOOL *stop))block;
  67. - (void)addEntriesFromDictionary:(GPBUInt32UInt32Dictionary *)otherDictionary;
  68. - (void)setUInt32:(uint32_t)value forKey:(uint32_t)key;
  69. - (void)removeUInt32ForKey:(uint32_t)aKey;
  70. - (void)removeAll;
  71. @end
  72. #pragma mark - UInt32 -> Int32
  73. @interface GPBUInt32Int32Dictionary : NSObject <NSCopying>
  74. @property(nonatomic, readonly) NSUInteger count;
  75. + (instancetype)dictionary;
  76. + (instancetype)dictionaryWithInt32:(int32_t)value
  77. forKey:(uint32_t)key;
  78. + (instancetype)dictionaryWithInt32s:(const int32_t [])values
  79. forKeys:(const uint32_t [])keys
  80. count:(NSUInteger)count;
  81. + (instancetype)dictionaryWithDictionary:(GPBUInt32Int32Dictionary *)dictionary;
  82. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  83. - (instancetype)initWithInt32s:(const int32_t [])values
  84. forKeys:(const uint32_t [])keys
  85. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  86. - (instancetype)initWithDictionary:(GPBUInt32Int32Dictionary *)dictionary;
  87. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  88. // Returns YES/NO to indicate if the key was found or not, filling in the value
  89. // only when the key was found.
  90. - (BOOL)getInt32:(nullable int32_t *)value forKey:(uint32_t)key;
  91. - (void)enumerateKeysAndInt32sUsingBlock:
  92. (void (^)(uint32_t key, int32_t value, BOOL *stop))block;
  93. - (void)addEntriesFromDictionary:(GPBUInt32Int32Dictionary *)otherDictionary;
  94. - (void)setInt32:(int32_t)value forKey:(uint32_t)key;
  95. - (void)removeInt32ForKey:(uint32_t)aKey;
  96. - (void)removeAll;
  97. @end
  98. #pragma mark - UInt32 -> UInt64
  99. @interface GPBUInt32UInt64Dictionary : NSObject <NSCopying>
  100. @property(nonatomic, readonly) NSUInteger count;
  101. + (instancetype)dictionary;
  102. + (instancetype)dictionaryWithUInt64:(uint64_t)value
  103. forKey:(uint32_t)key;
  104. + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
  105. forKeys:(const uint32_t [])keys
  106. count:(NSUInteger)count;
  107. + (instancetype)dictionaryWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary;
  108. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  109. - (instancetype)initWithUInt64s:(const uint64_t [])values
  110. forKeys:(const uint32_t [])keys
  111. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  112. - (instancetype)initWithDictionary:(GPBUInt32UInt64Dictionary *)dictionary;
  113. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  114. // Returns YES/NO to indicate if the key was found or not, filling in the value
  115. // only when the key was found.
  116. - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint32_t)key;
  117. - (void)enumerateKeysAndUInt64sUsingBlock:
  118. (void (^)(uint32_t key, uint64_t value, BOOL *stop))block;
  119. - (void)addEntriesFromDictionary:(GPBUInt32UInt64Dictionary *)otherDictionary;
  120. - (void)setUInt64:(uint64_t)value forKey:(uint32_t)key;
  121. - (void)removeUInt64ForKey:(uint32_t)aKey;
  122. - (void)removeAll;
  123. @end
  124. #pragma mark - UInt32 -> Int64
  125. @interface GPBUInt32Int64Dictionary : NSObject <NSCopying>
  126. @property(nonatomic, readonly) NSUInteger count;
  127. + (instancetype)dictionary;
  128. + (instancetype)dictionaryWithInt64:(int64_t)value
  129. forKey:(uint32_t)key;
  130. + (instancetype)dictionaryWithInt64s:(const int64_t [])values
  131. forKeys:(const uint32_t [])keys
  132. count:(NSUInteger)count;
  133. + (instancetype)dictionaryWithDictionary:(GPBUInt32Int64Dictionary *)dictionary;
  134. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  135. - (instancetype)initWithInt64s:(const int64_t [])values
  136. forKeys:(const uint32_t [])keys
  137. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  138. - (instancetype)initWithDictionary:(GPBUInt32Int64Dictionary *)dictionary;
  139. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  140. // Returns YES/NO to indicate if the key was found or not, filling in the value
  141. // only when the key was found.
  142. - (BOOL)getInt64:(nullable int64_t *)value forKey:(uint32_t)key;
  143. - (void)enumerateKeysAndInt64sUsingBlock:
  144. (void (^)(uint32_t key, int64_t value, BOOL *stop))block;
  145. - (void)addEntriesFromDictionary:(GPBUInt32Int64Dictionary *)otherDictionary;
  146. - (void)setInt64:(int64_t)value forKey:(uint32_t)key;
  147. - (void)removeInt64ForKey:(uint32_t)aKey;
  148. - (void)removeAll;
  149. @end
  150. #pragma mark - UInt32 -> Bool
  151. @interface GPBUInt32BoolDictionary : NSObject <NSCopying>
  152. @property(nonatomic, readonly) NSUInteger count;
  153. + (instancetype)dictionary;
  154. + (instancetype)dictionaryWithBool:(BOOL)value
  155. forKey:(uint32_t)key;
  156. + (instancetype)dictionaryWithBools:(const BOOL [])values
  157. forKeys:(const uint32_t [])keys
  158. count:(NSUInteger)count;
  159. + (instancetype)dictionaryWithDictionary:(GPBUInt32BoolDictionary *)dictionary;
  160. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  161. - (instancetype)initWithBools:(const BOOL [])values
  162. forKeys:(const uint32_t [])keys
  163. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  164. - (instancetype)initWithDictionary:(GPBUInt32BoolDictionary *)dictionary;
  165. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  166. // Returns YES/NO to indicate if the key was found or not, filling in the value
  167. // only when the key was found.
  168. - (BOOL)getBool:(nullable BOOL *)value forKey:(uint32_t)key;
  169. - (void)enumerateKeysAndBoolsUsingBlock:
  170. (void (^)(uint32_t key, BOOL value, BOOL *stop))block;
  171. - (void)addEntriesFromDictionary:(GPBUInt32BoolDictionary *)otherDictionary;
  172. - (void)setBool:(BOOL)value forKey:(uint32_t)key;
  173. - (void)removeBoolForKey:(uint32_t)aKey;
  174. - (void)removeAll;
  175. @end
  176. #pragma mark - UInt32 -> Float
  177. @interface GPBUInt32FloatDictionary : NSObject <NSCopying>
  178. @property(nonatomic, readonly) NSUInteger count;
  179. + (instancetype)dictionary;
  180. + (instancetype)dictionaryWithFloat:(float)value
  181. forKey:(uint32_t)key;
  182. + (instancetype)dictionaryWithFloats:(const float [])values
  183. forKeys:(const uint32_t [])keys
  184. count:(NSUInteger)count;
  185. + (instancetype)dictionaryWithDictionary:(GPBUInt32FloatDictionary *)dictionary;
  186. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  187. - (instancetype)initWithFloats:(const float [])values
  188. forKeys:(const uint32_t [])keys
  189. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  190. - (instancetype)initWithDictionary:(GPBUInt32FloatDictionary *)dictionary;
  191. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  192. // Returns YES/NO to indicate if the key was found or not, filling in the value
  193. // only when the key was found.
  194. - (BOOL)getFloat:(nullable float *)value forKey:(uint32_t)key;
  195. - (void)enumerateKeysAndFloatsUsingBlock:
  196. (void (^)(uint32_t key, float value, BOOL *stop))block;
  197. - (void)addEntriesFromDictionary:(GPBUInt32FloatDictionary *)otherDictionary;
  198. - (void)setFloat:(float)value forKey:(uint32_t)key;
  199. - (void)removeFloatForKey:(uint32_t)aKey;
  200. - (void)removeAll;
  201. @end
  202. #pragma mark - UInt32 -> Double
  203. @interface GPBUInt32DoubleDictionary : NSObject <NSCopying>
  204. @property(nonatomic, readonly) NSUInteger count;
  205. + (instancetype)dictionary;
  206. + (instancetype)dictionaryWithDouble:(double)value
  207. forKey:(uint32_t)key;
  208. + (instancetype)dictionaryWithDoubles:(const double [])values
  209. forKeys:(const uint32_t [])keys
  210. count:(NSUInteger)count;
  211. + (instancetype)dictionaryWithDictionary:(GPBUInt32DoubleDictionary *)dictionary;
  212. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  213. - (instancetype)initWithDoubles:(const double [])values
  214. forKeys:(const uint32_t [])keys
  215. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  216. - (instancetype)initWithDictionary:(GPBUInt32DoubleDictionary *)dictionary;
  217. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  218. // Returns YES/NO to indicate if the key was found or not, filling in the value
  219. // only when the key was found.
  220. - (BOOL)getDouble:(nullable double *)value forKey:(uint32_t)key;
  221. - (void)enumerateKeysAndDoublesUsingBlock:
  222. (void (^)(uint32_t key, double value, BOOL *stop))block;
  223. - (void)addEntriesFromDictionary:(GPBUInt32DoubleDictionary *)otherDictionary;
  224. - (void)setDouble:(double)value forKey:(uint32_t)key;
  225. - (void)removeDoubleForKey:(uint32_t)aKey;
  226. - (void)removeAll;
  227. @end
  228. #pragma mark - UInt32 -> Enum
  229. @interface GPBUInt32EnumDictionary : NSObject <NSCopying>
  230. @property(nonatomic, readonly) NSUInteger count;
  231. @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
  232. + (instancetype)dictionary;
  233. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  234. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  235. rawValue:(int32_t)rawValue
  236. forKey:(uint32_t)key;
  237. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  238. rawValues:(const int32_t [])values
  239. forKeys:(const uint32_t [])keys
  240. count:(NSUInteger)count;
  241. + (instancetype)dictionaryWithDictionary:(GPBUInt32EnumDictionary *)dictionary;
  242. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  243. capacity:(NSUInteger)numItems;
  244. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  245. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  246. rawValues:(const int32_t [])values
  247. forKeys:(const uint32_t [])keys
  248. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  249. - (instancetype)initWithDictionary:(GPBUInt32EnumDictionary *)dictionary;
  250. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  251. capacity:(NSUInteger)numItems;
  252. // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
  253. // is not a valid enumerator as defined by validationFunc. If the actual value is
  254. // desired, use "raw" version of the method.
  255. // Returns YES/NO to indicate if the key was found or not, filling in the value
  256. // only when the key was found.
  257. - (BOOL)getEnum:(nullable int32_t *)value forKey:(uint32_t)key;
  258. - (void)enumerateKeysAndEnumsUsingBlock:
  259. (void (^)(uint32_t key, int32_t value, BOOL *stop))block;
  260. // These methods bypass the validationFunc to provide access to values that were not
  261. // known at the time the binary was compiled.
  262. // Returns YES/NO to indicate if the key was found or not, filling in the value
  263. // only when the key was found.
  264. - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint32_t)key;
  265. - (void)enumerateKeysAndRawValuesUsingBlock:
  266. (void (^)(uint32_t key, int32_t rawValue, BOOL *stop))block;
  267. - (void)addRawEntriesFromDictionary:(GPBUInt32EnumDictionary *)otherDictionary;
  268. // If value is not a valid enumerator as defined by validationFunc, these
  269. // methods will assert in debug, and will log in release and assign the value
  270. // to the default value. Use the rawValue methods below to assign non enumerator
  271. // values.
  272. - (void)setEnum:(int32_t)value forKey:(uint32_t)key;
  273. // This method bypass the validationFunc to provide setting of values that were not
  274. // known at the time the binary was compiled.
  275. - (void)setRawValue:(int32_t)rawValue forKey:(uint32_t)key;
  276. // No validation applies to these methods.
  277. - (void)removeEnumForKey:(uint32_t)aKey;
  278. - (void)removeAll;
  279. @end
  280. #pragma mark - UInt32 -> Object
  281. @interface GPBUInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
  282. @property(nonatomic, readonly) NSUInteger count;
  283. + (instancetype)dictionary;
  284. + (instancetype)dictionaryWithObject:(ObjectType)object
  285. forKey:(uint32_t)key;
  286. + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
  287. forKeys:(const uint32_t [])keys
  288. count:(NSUInteger)count;
  289. + (instancetype)dictionaryWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
  290. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  291. - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
  292. forKeys:(const uint32_t [])keys
  293. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  294. - (instancetype)initWithDictionary:(GPBUInt32ObjectDictionary *)dictionary;
  295. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  296. - (ObjectType)objectForKey:(uint32_t)key;
  297. - (void)enumerateKeysAndObjectsUsingBlock:
  298. (void (^)(uint32_t key, ObjectType object, BOOL *stop))block;
  299. - (void)addEntriesFromDictionary:(GPBUInt32ObjectDictionary *)otherDictionary;
  300. - (void)setObject:(ObjectType)object forKey:(uint32_t)key;
  301. - (void)removeObjectForKey:(uint32_t)aKey;
  302. - (void)removeAll;
  303. @end
  304. #pragma mark - Int32 -> UInt32
  305. @interface GPBInt32UInt32Dictionary : NSObject <NSCopying>
  306. @property(nonatomic, readonly) NSUInteger count;
  307. + (instancetype)dictionary;
  308. + (instancetype)dictionaryWithUInt32:(uint32_t)value
  309. forKey:(int32_t)key;
  310. + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
  311. forKeys:(const int32_t [])keys
  312. count:(NSUInteger)count;
  313. + (instancetype)dictionaryWithDictionary:(GPBInt32UInt32Dictionary *)dictionary;
  314. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  315. - (instancetype)initWithUInt32s:(const uint32_t [])values
  316. forKeys:(const int32_t [])keys
  317. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  318. - (instancetype)initWithDictionary:(GPBInt32UInt32Dictionary *)dictionary;
  319. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  320. // Returns YES/NO to indicate if the key was found or not, filling in the value
  321. // only when the key was found.
  322. - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int32_t)key;
  323. - (void)enumerateKeysAndUInt32sUsingBlock:
  324. (void (^)(int32_t key, uint32_t value, BOOL *stop))block;
  325. - (void)addEntriesFromDictionary:(GPBInt32UInt32Dictionary *)otherDictionary;
  326. - (void)setUInt32:(uint32_t)value forKey:(int32_t)key;
  327. - (void)removeUInt32ForKey:(int32_t)aKey;
  328. - (void)removeAll;
  329. @end
  330. #pragma mark - Int32 -> Int32
  331. @interface GPBInt32Int32Dictionary : NSObject <NSCopying>
  332. @property(nonatomic, readonly) NSUInteger count;
  333. + (instancetype)dictionary;
  334. + (instancetype)dictionaryWithInt32:(int32_t)value
  335. forKey:(int32_t)key;
  336. + (instancetype)dictionaryWithInt32s:(const int32_t [])values
  337. forKeys:(const int32_t [])keys
  338. count:(NSUInteger)count;
  339. + (instancetype)dictionaryWithDictionary:(GPBInt32Int32Dictionary *)dictionary;
  340. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  341. - (instancetype)initWithInt32s:(const int32_t [])values
  342. forKeys:(const int32_t [])keys
  343. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  344. - (instancetype)initWithDictionary:(GPBInt32Int32Dictionary *)dictionary;
  345. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  346. // Returns YES/NO to indicate if the key was found or not, filling in the value
  347. // only when the key was found.
  348. - (BOOL)getInt32:(nullable int32_t *)value forKey:(int32_t)key;
  349. - (void)enumerateKeysAndInt32sUsingBlock:
  350. (void (^)(int32_t key, int32_t value, BOOL *stop))block;
  351. - (void)addEntriesFromDictionary:(GPBInt32Int32Dictionary *)otherDictionary;
  352. - (void)setInt32:(int32_t)value forKey:(int32_t)key;
  353. - (void)removeInt32ForKey:(int32_t)aKey;
  354. - (void)removeAll;
  355. @end
  356. #pragma mark - Int32 -> UInt64
  357. @interface GPBInt32UInt64Dictionary : NSObject <NSCopying>
  358. @property(nonatomic, readonly) NSUInteger count;
  359. + (instancetype)dictionary;
  360. + (instancetype)dictionaryWithUInt64:(uint64_t)value
  361. forKey:(int32_t)key;
  362. + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
  363. forKeys:(const int32_t [])keys
  364. count:(NSUInteger)count;
  365. + (instancetype)dictionaryWithDictionary:(GPBInt32UInt64Dictionary *)dictionary;
  366. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  367. - (instancetype)initWithUInt64s:(const uint64_t [])values
  368. forKeys:(const int32_t [])keys
  369. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  370. - (instancetype)initWithDictionary:(GPBInt32UInt64Dictionary *)dictionary;
  371. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  372. // Returns YES/NO to indicate if the key was found or not, filling in the value
  373. // only when the key was found.
  374. - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int32_t)key;
  375. - (void)enumerateKeysAndUInt64sUsingBlock:
  376. (void (^)(int32_t key, uint64_t value, BOOL *stop))block;
  377. - (void)addEntriesFromDictionary:(GPBInt32UInt64Dictionary *)otherDictionary;
  378. - (void)setUInt64:(uint64_t)value forKey:(int32_t)key;
  379. - (void)removeUInt64ForKey:(int32_t)aKey;
  380. - (void)removeAll;
  381. @end
  382. #pragma mark - Int32 -> Int64
  383. @interface GPBInt32Int64Dictionary : NSObject <NSCopying>
  384. @property(nonatomic, readonly) NSUInteger count;
  385. + (instancetype)dictionary;
  386. + (instancetype)dictionaryWithInt64:(int64_t)value
  387. forKey:(int32_t)key;
  388. + (instancetype)dictionaryWithInt64s:(const int64_t [])values
  389. forKeys:(const int32_t [])keys
  390. count:(NSUInteger)count;
  391. + (instancetype)dictionaryWithDictionary:(GPBInt32Int64Dictionary *)dictionary;
  392. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  393. - (instancetype)initWithInt64s:(const int64_t [])values
  394. forKeys:(const int32_t [])keys
  395. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  396. - (instancetype)initWithDictionary:(GPBInt32Int64Dictionary *)dictionary;
  397. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  398. // Returns YES/NO to indicate if the key was found or not, filling in the value
  399. // only when the key was found.
  400. - (BOOL)getInt64:(nullable int64_t *)value forKey:(int32_t)key;
  401. - (void)enumerateKeysAndInt64sUsingBlock:
  402. (void (^)(int32_t key, int64_t value, BOOL *stop))block;
  403. - (void)addEntriesFromDictionary:(GPBInt32Int64Dictionary *)otherDictionary;
  404. - (void)setInt64:(int64_t)value forKey:(int32_t)key;
  405. - (void)removeInt64ForKey:(int32_t)aKey;
  406. - (void)removeAll;
  407. @end
  408. #pragma mark - Int32 -> Bool
  409. @interface GPBInt32BoolDictionary : NSObject <NSCopying>
  410. @property(nonatomic, readonly) NSUInteger count;
  411. + (instancetype)dictionary;
  412. + (instancetype)dictionaryWithBool:(BOOL)value
  413. forKey:(int32_t)key;
  414. + (instancetype)dictionaryWithBools:(const BOOL [])values
  415. forKeys:(const int32_t [])keys
  416. count:(NSUInteger)count;
  417. + (instancetype)dictionaryWithDictionary:(GPBInt32BoolDictionary *)dictionary;
  418. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  419. - (instancetype)initWithBools:(const BOOL [])values
  420. forKeys:(const int32_t [])keys
  421. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  422. - (instancetype)initWithDictionary:(GPBInt32BoolDictionary *)dictionary;
  423. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  424. // Returns YES/NO to indicate if the key was found or not, filling in the value
  425. // only when the key was found.
  426. - (BOOL)getBool:(nullable BOOL *)value forKey:(int32_t)key;
  427. - (void)enumerateKeysAndBoolsUsingBlock:
  428. (void (^)(int32_t key, BOOL value, BOOL *stop))block;
  429. - (void)addEntriesFromDictionary:(GPBInt32BoolDictionary *)otherDictionary;
  430. - (void)setBool:(BOOL)value forKey:(int32_t)key;
  431. - (void)removeBoolForKey:(int32_t)aKey;
  432. - (void)removeAll;
  433. @end
  434. #pragma mark - Int32 -> Float
  435. @interface GPBInt32FloatDictionary : NSObject <NSCopying>
  436. @property(nonatomic, readonly) NSUInteger count;
  437. + (instancetype)dictionary;
  438. + (instancetype)dictionaryWithFloat:(float)value
  439. forKey:(int32_t)key;
  440. + (instancetype)dictionaryWithFloats:(const float [])values
  441. forKeys:(const int32_t [])keys
  442. count:(NSUInteger)count;
  443. + (instancetype)dictionaryWithDictionary:(GPBInt32FloatDictionary *)dictionary;
  444. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  445. - (instancetype)initWithFloats:(const float [])values
  446. forKeys:(const int32_t [])keys
  447. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  448. - (instancetype)initWithDictionary:(GPBInt32FloatDictionary *)dictionary;
  449. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  450. // Returns YES/NO to indicate if the key was found or not, filling in the value
  451. // only when the key was found.
  452. - (BOOL)getFloat:(nullable float *)value forKey:(int32_t)key;
  453. - (void)enumerateKeysAndFloatsUsingBlock:
  454. (void (^)(int32_t key, float value, BOOL *stop))block;
  455. - (void)addEntriesFromDictionary:(GPBInt32FloatDictionary *)otherDictionary;
  456. - (void)setFloat:(float)value forKey:(int32_t)key;
  457. - (void)removeFloatForKey:(int32_t)aKey;
  458. - (void)removeAll;
  459. @end
  460. #pragma mark - Int32 -> Double
  461. @interface GPBInt32DoubleDictionary : NSObject <NSCopying>
  462. @property(nonatomic, readonly) NSUInteger count;
  463. + (instancetype)dictionary;
  464. + (instancetype)dictionaryWithDouble:(double)value
  465. forKey:(int32_t)key;
  466. + (instancetype)dictionaryWithDoubles:(const double [])values
  467. forKeys:(const int32_t [])keys
  468. count:(NSUInteger)count;
  469. + (instancetype)dictionaryWithDictionary:(GPBInt32DoubleDictionary *)dictionary;
  470. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  471. - (instancetype)initWithDoubles:(const double [])values
  472. forKeys:(const int32_t [])keys
  473. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  474. - (instancetype)initWithDictionary:(GPBInt32DoubleDictionary *)dictionary;
  475. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  476. // Returns YES/NO to indicate if the key was found or not, filling in the value
  477. // only when the key was found.
  478. - (BOOL)getDouble:(nullable double *)value forKey:(int32_t)key;
  479. - (void)enumerateKeysAndDoublesUsingBlock:
  480. (void (^)(int32_t key, double value, BOOL *stop))block;
  481. - (void)addEntriesFromDictionary:(GPBInt32DoubleDictionary *)otherDictionary;
  482. - (void)setDouble:(double)value forKey:(int32_t)key;
  483. - (void)removeDoubleForKey:(int32_t)aKey;
  484. - (void)removeAll;
  485. @end
  486. #pragma mark - Int32 -> Enum
  487. @interface GPBInt32EnumDictionary : NSObject <NSCopying>
  488. @property(nonatomic, readonly) NSUInteger count;
  489. @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
  490. + (instancetype)dictionary;
  491. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  492. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  493. rawValue:(int32_t)rawValue
  494. forKey:(int32_t)key;
  495. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  496. rawValues:(const int32_t [])values
  497. forKeys:(const int32_t [])keys
  498. count:(NSUInteger)count;
  499. + (instancetype)dictionaryWithDictionary:(GPBInt32EnumDictionary *)dictionary;
  500. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  501. capacity:(NSUInteger)numItems;
  502. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  503. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  504. rawValues:(const int32_t [])values
  505. forKeys:(const int32_t [])keys
  506. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  507. - (instancetype)initWithDictionary:(GPBInt32EnumDictionary *)dictionary;
  508. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  509. capacity:(NSUInteger)numItems;
  510. // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
  511. // is not a valid enumerator as defined by validationFunc. If the actual value is
  512. // desired, use "raw" version of the method.
  513. // Returns YES/NO to indicate if the key was found or not, filling in the value
  514. // only when the key was found.
  515. - (BOOL)getEnum:(nullable int32_t *)value forKey:(int32_t)key;
  516. - (void)enumerateKeysAndEnumsUsingBlock:
  517. (void (^)(int32_t key, int32_t value, BOOL *stop))block;
  518. // These methods bypass the validationFunc to provide access to values that were not
  519. // known at the time the binary was compiled.
  520. // Returns YES/NO to indicate if the key was found or not, filling in the value
  521. // only when the key was found.
  522. - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int32_t)key;
  523. - (void)enumerateKeysAndRawValuesUsingBlock:
  524. (void (^)(int32_t key, int32_t rawValue, BOOL *stop))block;
  525. - (void)addRawEntriesFromDictionary:(GPBInt32EnumDictionary *)otherDictionary;
  526. // If value is not a valid enumerator as defined by validationFunc, these
  527. // methods will assert in debug, and will log in release and assign the value
  528. // to the default value. Use the rawValue methods below to assign non enumerator
  529. // values.
  530. - (void)setEnum:(int32_t)value forKey:(int32_t)key;
  531. // This method bypass the validationFunc to provide setting of values that were not
  532. // known at the time the binary was compiled.
  533. - (void)setRawValue:(int32_t)rawValue forKey:(int32_t)key;
  534. // No validation applies to these methods.
  535. - (void)removeEnumForKey:(int32_t)aKey;
  536. - (void)removeAll;
  537. @end
  538. #pragma mark - Int32 -> Object
  539. @interface GPBInt32ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
  540. @property(nonatomic, readonly) NSUInteger count;
  541. + (instancetype)dictionary;
  542. + (instancetype)dictionaryWithObject:(ObjectType)object
  543. forKey:(int32_t)key;
  544. + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
  545. forKeys:(const int32_t [])keys
  546. count:(NSUInteger)count;
  547. + (instancetype)dictionaryWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
  548. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  549. - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
  550. forKeys:(const int32_t [])keys
  551. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  552. - (instancetype)initWithDictionary:(GPBInt32ObjectDictionary *)dictionary;
  553. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  554. - (ObjectType)objectForKey:(int32_t)key;
  555. - (void)enumerateKeysAndObjectsUsingBlock:
  556. (void (^)(int32_t key, ObjectType object, BOOL *stop))block;
  557. - (void)addEntriesFromDictionary:(GPBInt32ObjectDictionary *)otherDictionary;
  558. - (void)setObject:(ObjectType)object forKey:(int32_t)key;
  559. - (void)removeObjectForKey:(int32_t)aKey;
  560. - (void)removeAll;
  561. @end
  562. #pragma mark - UInt64 -> UInt32
  563. @interface GPBUInt64UInt32Dictionary : NSObject <NSCopying>
  564. @property(nonatomic, readonly) NSUInteger count;
  565. + (instancetype)dictionary;
  566. + (instancetype)dictionaryWithUInt32:(uint32_t)value
  567. forKey:(uint64_t)key;
  568. + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
  569. forKeys:(const uint64_t [])keys
  570. count:(NSUInteger)count;
  571. + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary;
  572. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  573. - (instancetype)initWithUInt32s:(const uint32_t [])values
  574. forKeys:(const uint64_t [])keys
  575. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  576. - (instancetype)initWithDictionary:(GPBUInt64UInt32Dictionary *)dictionary;
  577. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  578. // Returns YES/NO to indicate if the key was found or not, filling in the value
  579. // only when the key was found.
  580. - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(uint64_t)key;
  581. - (void)enumerateKeysAndUInt32sUsingBlock:
  582. (void (^)(uint64_t key, uint32_t value, BOOL *stop))block;
  583. - (void)addEntriesFromDictionary:(GPBUInt64UInt32Dictionary *)otherDictionary;
  584. - (void)setUInt32:(uint32_t)value forKey:(uint64_t)key;
  585. - (void)removeUInt32ForKey:(uint64_t)aKey;
  586. - (void)removeAll;
  587. @end
  588. #pragma mark - UInt64 -> Int32
  589. @interface GPBUInt64Int32Dictionary : NSObject <NSCopying>
  590. @property(nonatomic, readonly) NSUInteger count;
  591. + (instancetype)dictionary;
  592. + (instancetype)dictionaryWithInt32:(int32_t)value
  593. forKey:(uint64_t)key;
  594. + (instancetype)dictionaryWithInt32s:(const int32_t [])values
  595. forKeys:(const uint64_t [])keys
  596. count:(NSUInteger)count;
  597. + (instancetype)dictionaryWithDictionary:(GPBUInt64Int32Dictionary *)dictionary;
  598. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  599. - (instancetype)initWithInt32s:(const int32_t [])values
  600. forKeys:(const uint64_t [])keys
  601. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  602. - (instancetype)initWithDictionary:(GPBUInt64Int32Dictionary *)dictionary;
  603. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  604. // Returns YES/NO to indicate if the key was found or not, filling in the value
  605. // only when the key was found.
  606. - (BOOL)getInt32:(nullable int32_t *)value forKey:(uint64_t)key;
  607. - (void)enumerateKeysAndInt32sUsingBlock:
  608. (void (^)(uint64_t key, int32_t value, BOOL *stop))block;
  609. - (void)addEntriesFromDictionary:(GPBUInt64Int32Dictionary *)otherDictionary;
  610. - (void)setInt32:(int32_t)value forKey:(uint64_t)key;
  611. - (void)removeInt32ForKey:(uint64_t)aKey;
  612. - (void)removeAll;
  613. @end
  614. #pragma mark - UInt64 -> UInt64
  615. @interface GPBUInt64UInt64Dictionary : NSObject <NSCopying>
  616. @property(nonatomic, readonly) NSUInteger count;
  617. + (instancetype)dictionary;
  618. + (instancetype)dictionaryWithUInt64:(uint64_t)value
  619. forKey:(uint64_t)key;
  620. + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
  621. forKeys:(const uint64_t [])keys
  622. count:(NSUInteger)count;
  623. + (instancetype)dictionaryWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary;
  624. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  625. - (instancetype)initWithUInt64s:(const uint64_t [])values
  626. forKeys:(const uint64_t [])keys
  627. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  628. - (instancetype)initWithDictionary:(GPBUInt64UInt64Dictionary *)dictionary;
  629. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  630. // Returns YES/NO to indicate if the key was found or not, filling in the value
  631. // only when the key was found.
  632. - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(uint64_t)key;
  633. - (void)enumerateKeysAndUInt64sUsingBlock:
  634. (void (^)(uint64_t key, uint64_t value, BOOL *stop))block;
  635. - (void)addEntriesFromDictionary:(GPBUInt64UInt64Dictionary *)otherDictionary;
  636. - (void)setUInt64:(uint64_t)value forKey:(uint64_t)key;
  637. - (void)removeUInt64ForKey:(uint64_t)aKey;
  638. - (void)removeAll;
  639. @end
  640. #pragma mark - UInt64 -> Int64
  641. @interface GPBUInt64Int64Dictionary : NSObject <NSCopying>
  642. @property(nonatomic, readonly) NSUInteger count;
  643. + (instancetype)dictionary;
  644. + (instancetype)dictionaryWithInt64:(int64_t)value
  645. forKey:(uint64_t)key;
  646. + (instancetype)dictionaryWithInt64s:(const int64_t [])values
  647. forKeys:(const uint64_t [])keys
  648. count:(NSUInteger)count;
  649. + (instancetype)dictionaryWithDictionary:(GPBUInt64Int64Dictionary *)dictionary;
  650. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  651. - (instancetype)initWithInt64s:(const int64_t [])values
  652. forKeys:(const uint64_t [])keys
  653. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  654. - (instancetype)initWithDictionary:(GPBUInt64Int64Dictionary *)dictionary;
  655. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  656. // Returns YES/NO to indicate if the key was found or not, filling in the value
  657. // only when the key was found.
  658. - (BOOL)getInt64:(nullable int64_t *)value forKey:(uint64_t)key;
  659. - (void)enumerateKeysAndInt64sUsingBlock:
  660. (void (^)(uint64_t key, int64_t value, BOOL *stop))block;
  661. - (void)addEntriesFromDictionary:(GPBUInt64Int64Dictionary *)otherDictionary;
  662. - (void)setInt64:(int64_t)value forKey:(uint64_t)key;
  663. - (void)removeInt64ForKey:(uint64_t)aKey;
  664. - (void)removeAll;
  665. @end
  666. #pragma mark - UInt64 -> Bool
  667. @interface GPBUInt64BoolDictionary : NSObject <NSCopying>
  668. @property(nonatomic, readonly) NSUInteger count;
  669. + (instancetype)dictionary;
  670. + (instancetype)dictionaryWithBool:(BOOL)value
  671. forKey:(uint64_t)key;
  672. + (instancetype)dictionaryWithBools:(const BOOL [])values
  673. forKeys:(const uint64_t [])keys
  674. count:(NSUInteger)count;
  675. + (instancetype)dictionaryWithDictionary:(GPBUInt64BoolDictionary *)dictionary;
  676. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  677. - (instancetype)initWithBools:(const BOOL [])values
  678. forKeys:(const uint64_t [])keys
  679. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  680. - (instancetype)initWithDictionary:(GPBUInt64BoolDictionary *)dictionary;
  681. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  682. // Returns YES/NO to indicate if the key was found or not, filling in the value
  683. // only when the key was found.
  684. - (BOOL)getBool:(nullable BOOL *)value forKey:(uint64_t)key;
  685. - (void)enumerateKeysAndBoolsUsingBlock:
  686. (void (^)(uint64_t key, BOOL value, BOOL *stop))block;
  687. - (void)addEntriesFromDictionary:(GPBUInt64BoolDictionary *)otherDictionary;
  688. - (void)setBool:(BOOL)value forKey:(uint64_t)key;
  689. - (void)removeBoolForKey:(uint64_t)aKey;
  690. - (void)removeAll;
  691. @end
  692. #pragma mark - UInt64 -> Float
  693. @interface GPBUInt64FloatDictionary : NSObject <NSCopying>
  694. @property(nonatomic, readonly) NSUInteger count;
  695. + (instancetype)dictionary;
  696. + (instancetype)dictionaryWithFloat:(float)value
  697. forKey:(uint64_t)key;
  698. + (instancetype)dictionaryWithFloats:(const float [])values
  699. forKeys:(const uint64_t [])keys
  700. count:(NSUInteger)count;
  701. + (instancetype)dictionaryWithDictionary:(GPBUInt64FloatDictionary *)dictionary;
  702. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  703. - (instancetype)initWithFloats:(const float [])values
  704. forKeys:(const uint64_t [])keys
  705. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  706. - (instancetype)initWithDictionary:(GPBUInt64FloatDictionary *)dictionary;
  707. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  708. // Returns YES/NO to indicate if the key was found or not, filling in the value
  709. // only when the key was found.
  710. - (BOOL)getFloat:(nullable float *)value forKey:(uint64_t)key;
  711. - (void)enumerateKeysAndFloatsUsingBlock:
  712. (void (^)(uint64_t key, float value, BOOL *stop))block;
  713. - (void)addEntriesFromDictionary:(GPBUInt64FloatDictionary *)otherDictionary;
  714. - (void)setFloat:(float)value forKey:(uint64_t)key;
  715. - (void)removeFloatForKey:(uint64_t)aKey;
  716. - (void)removeAll;
  717. @end
  718. #pragma mark - UInt64 -> Double
  719. @interface GPBUInt64DoubleDictionary : NSObject <NSCopying>
  720. @property(nonatomic, readonly) NSUInteger count;
  721. + (instancetype)dictionary;
  722. + (instancetype)dictionaryWithDouble:(double)value
  723. forKey:(uint64_t)key;
  724. + (instancetype)dictionaryWithDoubles:(const double [])values
  725. forKeys:(const uint64_t [])keys
  726. count:(NSUInteger)count;
  727. + (instancetype)dictionaryWithDictionary:(GPBUInt64DoubleDictionary *)dictionary;
  728. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  729. - (instancetype)initWithDoubles:(const double [])values
  730. forKeys:(const uint64_t [])keys
  731. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  732. - (instancetype)initWithDictionary:(GPBUInt64DoubleDictionary *)dictionary;
  733. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  734. // Returns YES/NO to indicate if the key was found or not, filling in the value
  735. // only when the key was found.
  736. - (BOOL)getDouble:(nullable double *)value forKey:(uint64_t)key;
  737. - (void)enumerateKeysAndDoublesUsingBlock:
  738. (void (^)(uint64_t key, double value, BOOL *stop))block;
  739. - (void)addEntriesFromDictionary:(GPBUInt64DoubleDictionary *)otherDictionary;
  740. - (void)setDouble:(double)value forKey:(uint64_t)key;
  741. - (void)removeDoubleForKey:(uint64_t)aKey;
  742. - (void)removeAll;
  743. @end
  744. #pragma mark - UInt64 -> Enum
  745. @interface GPBUInt64EnumDictionary : NSObject <NSCopying>
  746. @property(nonatomic, readonly) NSUInteger count;
  747. @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
  748. + (instancetype)dictionary;
  749. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  750. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  751. rawValue:(int32_t)rawValue
  752. forKey:(uint64_t)key;
  753. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  754. rawValues:(const int32_t [])values
  755. forKeys:(const uint64_t [])keys
  756. count:(NSUInteger)count;
  757. + (instancetype)dictionaryWithDictionary:(GPBUInt64EnumDictionary *)dictionary;
  758. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  759. capacity:(NSUInteger)numItems;
  760. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  761. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  762. rawValues:(const int32_t [])values
  763. forKeys:(const uint64_t [])keys
  764. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  765. - (instancetype)initWithDictionary:(GPBUInt64EnumDictionary *)dictionary;
  766. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  767. capacity:(NSUInteger)numItems;
  768. // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
  769. // is not a valid enumerator as defined by validationFunc. If the actual value is
  770. // desired, use "raw" version of the method.
  771. // Returns YES/NO to indicate if the key was found or not, filling in the value
  772. // only when the key was found.
  773. - (BOOL)getEnum:(nullable int32_t *)value forKey:(uint64_t)key;
  774. - (void)enumerateKeysAndEnumsUsingBlock:
  775. (void (^)(uint64_t key, int32_t value, BOOL *stop))block;
  776. // These methods bypass the validationFunc to provide access to values that were not
  777. // known at the time the binary was compiled.
  778. // Returns YES/NO to indicate if the key was found or not, filling in the value
  779. // only when the key was found.
  780. - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(uint64_t)key;
  781. - (void)enumerateKeysAndRawValuesUsingBlock:
  782. (void (^)(uint64_t key, int32_t rawValue, BOOL *stop))block;
  783. - (void)addRawEntriesFromDictionary:(GPBUInt64EnumDictionary *)otherDictionary;
  784. // If value is not a valid enumerator as defined by validationFunc, these
  785. // methods will assert in debug, and will log in release and assign the value
  786. // to the default value. Use the rawValue methods below to assign non enumerator
  787. // values.
  788. - (void)setEnum:(int32_t)value forKey:(uint64_t)key;
  789. // This method bypass the validationFunc to provide setting of values that were not
  790. // known at the time the binary was compiled.
  791. - (void)setRawValue:(int32_t)rawValue forKey:(uint64_t)key;
  792. // No validation applies to these methods.
  793. - (void)removeEnumForKey:(uint64_t)aKey;
  794. - (void)removeAll;
  795. @end
  796. #pragma mark - UInt64 -> Object
  797. @interface GPBUInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
  798. @property(nonatomic, readonly) NSUInteger count;
  799. + (instancetype)dictionary;
  800. + (instancetype)dictionaryWithObject:(ObjectType)object
  801. forKey:(uint64_t)key;
  802. + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
  803. forKeys:(const uint64_t [])keys
  804. count:(NSUInteger)count;
  805. + (instancetype)dictionaryWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
  806. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  807. - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
  808. forKeys:(const uint64_t [])keys
  809. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  810. - (instancetype)initWithDictionary:(GPBUInt64ObjectDictionary *)dictionary;
  811. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  812. - (ObjectType)objectForKey:(uint64_t)key;
  813. - (void)enumerateKeysAndObjectsUsingBlock:
  814. (void (^)(uint64_t key, ObjectType object, BOOL *stop))block;
  815. - (void)addEntriesFromDictionary:(GPBUInt64ObjectDictionary *)otherDictionary;
  816. - (void)setObject:(ObjectType)object forKey:(uint64_t)key;
  817. - (void)removeObjectForKey:(uint64_t)aKey;
  818. - (void)removeAll;
  819. @end
  820. #pragma mark - Int64 -> UInt32
  821. @interface GPBInt64UInt32Dictionary : NSObject <NSCopying>
  822. @property(nonatomic, readonly) NSUInteger count;
  823. + (instancetype)dictionary;
  824. + (instancetype)dictionaryWithUInt32:(uint32_t)value
  825. forKey:(int64_t)key;
  826. + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
  827. forKeys:(const int64_t [])keys
  828. count:(NSUInteger)count;
  829. + (instancetype)dictionaryWithDictionary:(GPBInt64UInt32Dictionary *)dictionary;
  830. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  831. - (instancetype)initWithUInt32s:(const uint32_t [])values
  832. forKeys:(const int64_t [])keys
  833. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  834. - (instancetype)initWithDictionary:(GPBInt64UInt32Dictionary *)dictionary;
  835. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  836. // Returns YES/NO to indicate if the key was found or not, filling in the value
  837. // only when the key was found.
  838. - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(int64_t)key;
  839. - (void)enumerateKeysAndUInt32sUsingBlock:
  840. (void (^)(int64_t key, uint32_t value, BOOL *stop))block;
  841. - (void)addEntriesFromDictionary:(GPBInt64UInt32Dictionary *)otherDictionary;
  842. - (void)setUInt32:(uint32_t)value forKey:(int64_t)key;
  843. - (void)removeUInt32ForKey:(int64_t)aKey;
  844. - (void)removeAll;
  845. @end
  846. #pragma mark - Int64 -> Int32
  847. @interface GPBInt64Int32Dictionary : NSObject <NSCopying>
  848. @property(nonatomic, readonly) NSUInteger count;
  849. + (instancetype)dictionary;
  850. + (instancetype)dictionaryWithInt32:(int32_t)value
  851. forKey:(int64_t)key;
  852. + (instancetype)dictionaryWithInt32s:(const int32_t [])values
  853. forKeys:(const int64_t [])keys
  854. count:(NSUInteger)count;
  855. + (instancetype)dictionaryWithDictionary:(GPBInt64Int32Dictionary *)dictionary;
  856. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  857. - (instancetype)initWithInt32s:(const int32_t [])values
  858. forKeys:(const int64_t [])keys
  859. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  860. - (instancetype)initWithDictionary:(GPBInt64Int32Dictionary *)dictionary;
  861. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  862. // Returns YES/NO to indicate if the key was found or not, filling in the value
  863. // only when the key was found.
  864. - (BOOL)getInt32:(nullable int32_t *)value forKey:(int64_t)key;
  865. - (void)enumerateKeysAndInt32sUsingBlock:
  866. (void (^)(int64_t key, int32_t value, BOOL *stop))block;
  867. - (void)addEntriesFromDictionary:(GPBInt64Int32Dictionary *)otherDictionary;
  868. - (void)setInt32:(int32_t)value forKey:(int64_t)key;
  869. - (void)removeInt32ForKey:(int64_t)aKey;
  870. - (void)removeAll;
  871. @end
  872. #pragma mark - Int64 -> UInt64
  873. @interface GPBInt64UInt64Dictionary : NSObject <NSCopying>
  874. @property(nonatomic, readonly) NSUInteger count;
  875. + (instancetype)dictionary;
  876. + (instancetype)dictionaryWithUInt64:(uint64_t)value
  877. forKey:(int64_t)key;
  878. + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
  879. forKeys:(const int64_t [])keys
  880. count:(NSUInteger)count;
  881. + (instancetype)dictionaryWithDictionary:(GPBInt64UInt64Dictionary *)dictionary;
  882. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  883. - (instancetype)initWithUInt64s:(const uint64_t [])values
  884. forKeys:(const int64_t [])keys
  885. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  886. - (instancetype)initWithDictionary:(GPBInt64UInt64Dictionary *)dictionary;
  887. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  888. // Returns YES/NO to indicate if the key was found or not, filling in the value
  889. // only when the key was found.
  890. - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(int64_t)key;
  891. - (void)enumerateKeysAndUInt64sUsingBlock:
  892. (void (^)(int64_t key, uint64_t value, BOOL *stop))block;
  893. - (void)addEntriesFromDictionary:(GPBInt64UInt64Dictionary *)otherDictionary;
  894. - (void)setUInt64:(uint64_t)value forKey:(int64_t)key;
  895. - (void)removeUInt64ForKey:(int64_t)aKey;
  896. - (void)removeAll;
  897. @end
  898. #pragma mark - Int64 -> Int64
  899. @interface GPBInt64Int64Dictionary : NSObject <NSCopying>
  900. @property(nonatomic, readonly) NSUInteger count;
  901. + (instancetype)dictionary;
  902. + (instancetype)dictionaryWithInt64:(int64_t)value
  903. forKey:(int64_t)key;
  904. + (instancetype)dictionaryWithInt64s:(const int64_t [])values
  905. forKeys:(const int64_t [])keys
  906. count:(NSUInteger)count;
  907. + (instancetype)dictionaryWithDictionary:(GPBInt64Int64Dictionary *)dictionary;
  908. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  909. - (instancetype)initWithInt64s:(const int64_t [])values
  910. forKeys:(const int64_t [])keys
  911. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  912. - (instancetype)initWithDictionary:(GPBInt64Int64Dictionary *)dictionary;
  913. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  914. // Returns YES/NO to indicate if the key was found or not, filling in the value
  915. // only when the key was found.
  916. - (BOOL)getInt64:(nullable int64_t *)value forKey:(int64_t)key;
  917. - (void)enumerateKeysAndInt64sUsingBlock:
  918. (void (^)(int64_t key, int64_t value, BOOL *stop))block;
  919. - (void)addEntriesFromDictionary:(GPBInt64Int64Dictionary *)otherDictionary;
  920. - (void)setInt64:(int64_t)value forKey:(int64_t)key;
  921. - (void)removeInt64ForKey:(int64_t)aKey;
  922. - (void)removeAll;
  923. @end
  924. #pragma mark - Int64 -> Bool
  925. @interface GPBInt64BoolDictionary : NSObject <NSCopying>
  926. @property(nonatomic, readonly) NSUInteger count;
  927. + (instancetype)dictionary;
  928. + (instancetype)dictionaryWithBool:(BOOL)value
  929. forKey:(int64_t)key;
  930. + (instancetype)dictionaryWithBools:(const BOOL [])values
  931. forKeys:(const int64_t [])keys
  932. count:(NSUInteger)count;
  933. + (instancetype)dictionaryWithDictionary:(GPBInt64BoolDictionary *)dictionary;
  934. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  935. - (instancetype)initWithBools:(const BOOL [])values
  936. forKeys:(const int64_t [])keys
  937. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  938. - (instancetype)initWithDictionary:(GPBInt64BoolDictionary *)dictionary;
  939. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  940. // Returns YES/NO to indicate if the key was found or not, filling in the value
  941. // only when the key was found.
  942. - (BOOL)getBool:(nullable BOOL *)value forKey:(int64_t)key;
  943. - (void)enumerateKeysAndBoolsUsingBlock:
  944. (void (^)(int64_t key, BOOL value, BOOL *stop))block;
  945. - (void)addEntriesFromDictionary:(GPBInt64BoolDictionary *)otherDictionary;
  946. - (void)setBool:(BOOL)value forKey:(int64_t)key;
  947. - (void)removeBoolForKey:(int64_t)aKey;
  948. - (void)removeAll;
  949. @end
  950. #pragma mark - Int64 -> Float
  951. @interface GPBInt64FloatDictionary : NSObject <NSCopying>
  952. @property(nonatomic, readonly) NSUInteger count;
  953. + (instancetype)dictionary;
  954. + (instancetype)dictionaryWithFloat:(float)value
  955. forKey:(int64_t)key;
  956. + (instancetype)dictionaryWithFloats:(const float [])values
  957. forKeys:(const int64_t [])keys
  958. count:(NSUInteger)count;
  959. + (instancetype)dictionaryWithDictionary:(GPBInt64FloatDictionary *)dictionary;
  960. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  961. - (instancetype)initWithFloats:(const float [])values
  962. forKeys:(const int64_t [])keys
  963. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  964. - (instancetype)initWithDictionary:(GPBInt64FloatDictionary *)dictionary;
  965. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  966. // Returns YES/NO to indicate if the key was found or not, filling in the value
  967. // only when the key was found.
  968. - (BOOL)getFloat:(nullable float *)value forKey:(int64_t)key;
  969. - (void)enumerateKeysAndFloatsUsingBlock:
  970. (void (^)(int64_t key, float value, BOOL *stop))block;
  971. - (void)addEntriesFromDictionary:(GPBInt64FloatDictionary *)otherDictionary;
  972. - (void)setFloat:(float)value forKey:(int64_t)key;
  973. - (void)removeFloatForKey:(int64_t)aKey;
  974. - (void)removeAll;
  975. @end
  976. #pragma mark - Int64 -> Double
  977. @interface GPBInt64DoubleDictionary : NSObject <NSCopying>
  978. @property(nonatomic, readonly) NSUInteger count;
  979. + (instancetype)dictionary;
  980. + (instancetype)dictionaryWithDouble:(double)value
  981. forKey:(int64_t)key;
  982. + (instancetype)dictionaryWithDoubles:(const double [])values
  983. forKeys:(const int64_t [])keys
  984. count:(NSUInteger)count;
  985. + (instancetype)dictionaryWithDictionary:(GPBInt64DoubleDictionary *)dictionary;
  986. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  987. - (instancetype)initWithDoubles:(const double [])values
  988. forKeys:(const int64_t [])keys
  989. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  990. - (instancetype)initWithDictionary:(GPBInt64DoubleDictionary *)dictionary;
  991. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  992. // Returns YES/NO to indicate if the key was found or not, filling in the value
  993. // only when the key was found.
  994. - (BOOL)getDouble:(nullable double *)value forKey:(int64_t)key;
  995. - (void)enumerateKeysAndDoublesUsingBlock:
  996. (void (^)(int64_t key, double value, BOOL *stop))block;
  997. - (void)addEntriesFromDictionary:(GPBInt64DoubleDictionary *)otherDictionary;
  998. - (void)setDouble:(double)value forKey:(int64_t)key;
  999. - (void)removeDoubleForKey:(int64_t)aKey;
  1000. - (void)removeAll;
  1001. @end
  1002. #pragma mark - Int64 -> Enum
  1003. @interface GPBInt64EnumDictionary : NSObject <NSCopying>
  1004. @property(nonatomic, readonly) NSUInteger count;
  1005. @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
  1006. + (instancetype)dictionary;
  1007. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  1008. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1009. rawValue:(int32_t)rawValue
  1010. forKey:(int64_t)key;
  1011. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1012. rawValues:(const int32_t [])values
  1013. forKeys:(const int64_t [])keys
  1014. count:(NSUInteger)count;
  1015. + (instancetype)dictionaryWithDictionary:(GPBInt64EnumDictionary *)dictionary;
  1016. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1017. capacity:(NSUInteger)numItems;
  1018. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  1019. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1020. rawValues:(const int32_t [])values
  1021. forKeys:(const int64_t [])keys
  1022. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1023. - (instancetype)initWithDictionary:(GPBInt64EnumDictionary *)dictionary;
  1024. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1025. capacity:(NSUInteger)numItems;
  1026. // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
  1027. // is not a valid enumerator as defined by validationFunc. If the actual value is
  1028. // desired, use "raw" version of the method.
  1029. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1030. // only when the key was found.
  1031. - (BOOL)getEnum:(nullable int32_t *)value forKey:(int64_t)key;
  1032. - (void)enumerateKeysAndEnumsUsingBlock:
  1033. (void (^)(int64_t key, int32_t value, BOOL *stop))block;
  1034. // These methods bypass the validationFunc to provide access to values that were not
  1035. // known at the time the binary was compiled.
  1036. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1037. // only when the key was found.
  1038. - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(int64_t)key;
  1039. - (void)enumerateKeysAndRawValuesUsingBlock:
  1040. (void (^)(int64_t key, int32_t rawValue, BOOL *stop))block;
  1041. - (void)addRawEntriesFromDictionary:(GPBInt64EnumDictionary *)otherDictionary;
  1042. // If value is not a valid enumerator as defined by validationFunc, these
  1043. // methods will assert in debug, and will log in release and assign the value
  1044. // to the default value. Use the rawValue methods below to assign non enumerator
  1045. // values.
  1046. - (void)setEnum:(int32_t)value forKey:(int64_t)key;
  1047. // This method bypass the validationFunc to provide setting of values that were not
  1048. // known at the time the binary was compiled.
  1049. - (void)setRawValue:(int32_t)rawValue forKey:(int64_t)key;
  1050. // No validation applies to these methods.
  1051. - (void)removeEnumForKey:(int64_t)aKey;
  1052. - (void)removeAll;
  1053. @end
  1054. #pragma mark - Int64 -> Object
  1055. @interface GPBInt64ObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
  1056. @property(nonatomic, readonly) NSUInteger count;
  1057. + (instancetype)dictionary;
  1058. + (instancetype)dictionaryWithObject:(ObjectType)object
  1059. forKey:(int64_t)key;
  1060. + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
  1061. forKeys:(const int64_t [])keys
  1062. count:(NSUInteger)count;
  1063. + (instancetype)dictionaryWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
  1064. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1065. - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
  1066. forKeys:(const int64_t [])keys
  1067. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1068. - (instancetype)initWithDictionary:(GPBInt64ObjectDictionary *)dictionary;
  1069. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1070. - (ObjectType)objectForKey:(int64_t)key;
  1071. - (void)enumerateKeysAndObjectsUsingBlock:
  1072. (void (^)(int64_t key, ObjectType object, BOOL *stop))block;
  1073. - (void)addEntriesFromDictionary:(GPBInt64ObjectDictionary *)otherDictionary;
  1074. - (void)setObject:(ObjectType)object forKey:(int64_t)key;
  1075. - (void)removeObjectForKey:(int64_t)aKey;
  1076. - (void)removeAll;
  1077. @end
  1078. #pragma mark - Bool -> UInt32
  1079. @interface GPBBoolUInt32Dictionary : NSObject <NSCopying>
  1080. @property(nonatomic, readonly) NSUInteger count;
  1081. + (instancetype)dictionary;
  1082. + (instancetype)dictionaryWithUInt32:(uint32_t)value
  1083. forKey:(BOOL)key;
  1084. + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
  1085. forKeys:(const BOOL [])keys
  1086. count:(NSUInteger)count;
  1087. + (instancetype)dictionaryWithDictionary:(GPBBoolUInt32Dictionary *)dictionary;
  1088. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1089. - (instancetype)initWithUInt32s:(const uint32_t [])values
  1090. forKeys:(const BOOL [])keys
  1091. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1092. - (instancetype)initWithDictionary:(GPBBoolUInt32Dictionary *)dictionary;
  1093. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1094. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1095. // only when the key was found.
  1096. - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(BOOL)key;
  1097. - (void)enumerateKeysAndUInt32sUsingBlock:
  1098. (void (^)(BOOL key, uint32_t value, BOOL *stop))block;
  1099. - (void)addEntriesFromDictionary:(GPBBoolUInt32Dictionary *)otherDictionary;
  1100. - (void)setUInt32:(uint32_t)value forKey:(BOOL)key;
  1101. - (void)removeUInt32ForKey:(BOOL)aKey;
  1102. - (void)removeAll;
  1103. @end
  1104. #pragma mark - Bool -> Int32
  1105. @interface GPBBoolInt32Dictionary : NSObject <NSCopying>
  1106. @property(nonatomic, readonly) NSUInteger count;
  1107. + (instancetype)dictionary;
  1108. + (instancetype)dictionaryWithInt32:(int32_t)value
  1109. forKey:(BOOL)key;
  1110. + (instancetype)dictionaryWithInt32s:(const int32_t [])values
  1111. forKeys:(const BOOL [])keys
  1112. count:(NSUInteger)count;
  1113. + (instancetype)dictionaryWithDictionary:(GPBBoolInt32Dictionary *)dictionary;
  1114. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1115. - (instancetype)initWithInt32s:(const int32_t [])values
  1116. forKeys:(const BOOL [])keys
  1117. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1118. - (instancetype)initWithDictionary:(GPBBoolInt32Dictionary *)dictionary;
  1119. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1120. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1121. // only when the key was found.
  1122. - (BOOL)getInt32:(nullable int32_t *)value forKey:(BOOL)key;
  1123. - (void)enumerateKeysAndInt32sUsingBlock:
  1124. (void (^)(BOOL key, int32_t value, BOOL *stop))block;
  1125. - (void)addEntriesFromDictionary:(GPBBoolInt32Dictionary *)otherDictionary;
  1126. - (void)setInt32:(int32_t)value forKey:(BOOL)key;
  1127. - (void)removeInt32ForKey:(BOOL)aKey;
  1128. - (void)removeAll;
  1129. @end
  1130. #pragma mark - Bool -> UInt64
  1131. @interface GPBBoolUInt64Dictionary : NSObject <NSCopying>
  1132. @property(nonatomic, readonly) NSUInteger count;
  1133. + (instancetype)dictionary;
  1134. + (instancetype)dictionaryWithUInt64:(uint64_t)value
  1135. forKey:(BOOL)key;
  1136. + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
  1137. forKeys:(const BOOL [])keys
  1138. count:(NSUInteger)count;
  1139. + (instancetype)dictionaryWithDictionary:(GPBBoolUInt64Dictionary *)dictionary;
  1140. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1141. - (instancetype)initWithUInt64s:(const uint64_t [])values
  1142. forKeys:(const BOOL [])keys
  1143. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1144. - (instancetype)initWithDictionary:(GPBBoolUInt64Dictionary *)dictionary;
  1145. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1146. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1147. // only when the key was found.
  1148. - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(BOOL)key;
  1149. - (void)enumerateKeysAndUInt64sUsingBlock:
  1150. (void (^)(BOOL key, uint64_t value, BOOL *stop))block;
  1151. - (void)addEntriesFromDictionary:(GPBBoolUInt64Dictionary *)otherDictionary;
  1152. - (void)setUInt64:(uint64_t)value forKey:(BOOL)key;
  1153. - (void)removeUInt64ForKey:(BOOL)aKey;
  1154. - (void)removeAll;
  1155. @end
  1156. #pragma mark - Bool -> Int64
  1157. @interface GPBBoolInt64Dictionary : NSObject <NSCopying>
  1158. @property(nonatomic, readonly) NSUInteger count;
  1159. + (instancetype)dictionary;
  1160. + (instancetype)dictionaryWithInt64:(int64_t)value
  1161. forKey:(BOOL)key;
  1162. + (instancetype)dictionaryWithInt64s:(const int64_t [])values
  1163. forKeys:(const BOOL [])keys
  1164. count:(NSUInteger)count;
  1165. + (instancetype)dictionaryWithDictionary:(GPBBoolInt64Dictionary *)dictionary;
  1166. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1167. - (instancetype)initWithInt64s:(const int64_t [])values
  1168. forKeys:(const BOOL [])keys
  1169. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1170. - (instancetype)initWithDictionary:(GPBBoolInt64Dictionary *)dictionary;
  1171. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1172. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1173. // only when the key was found.
  1174. - (BOOL)getInt64:(nullable int64_t *)value forKey:(BOOL)key;
  1175. - (void)enumerateKeysAndInt64sUsingBlock:
  1176. (void (^)(BOOL key, int64_t value, BOOL *stop))block;
  1177. - (void)addEntriesFromDictionary:(GPBBoolInt64Dictionary *)otherDictionary;
  1178. - (void)setInt64:(int64_t)value forKey:(BOOL)key;
  1179. - (void)removeInt64ForKey:(BOOL)aKey;
  1180. - (void)removeAll;
  1181. @end
  1182. #pragma mark - Bool -> Bool
  1183. @interface GPBBoolBoolDictionary : NSObject <NSCopying>
  1184. @property(nonatomic, readonly) NSUInteger count;
  1185. + (instancetype)dictionary;
  1186. + (instancetype)dictionaryWithBool:(BOOL)value
  1187. forKey:(BOOL)key;
  1188. + (instancetype)dictionaryWithBools:(const BOOL [])values
  1189. forKeys:(const BOOL [])keys
  1190. count:(NSUInteger)count;
  1191. + (instancetype)dictionaryWithDictionary:(GPBBoolBoolDictionary *)dictionary;
  1192. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1193. - (instancetype)initWithBools:(const BOOL [])values
  1194. forKeys:(const BOOL [])keys
  1195. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1196. - (instancetype)initWithDictionary:(GPBBoolBoolDictionary *)dictionary;
  1197. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1198. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1199. // only when the key was found.
  1200. - (BOOL)getBool:(nullable BOOL *)value forKey:(BOOL)key;
  1201. - (void)enumerateKeysAndBoolsUsingBlock:
  1202. (void (^)(BOOL key, BOOL value, BOOL *stop))block;
  1203. - (void)addEntriesFromDictionary:(GPBBoolBoolDictionary *)otherDictionary;
  1204. - (void)setBool:(BOOL)value forKey:(BOOL)key;
  1205. - (void)removeBoolForKey:(BOOL)aKey;
  1206. - (void)removeAll;
  1207. @end
  1208. #pragma mark - Bool -> Float
  1209. @interface GPBBoolFloatDictionary : NSObject <NSCopying>
  1210. @property(nonatomic, readonly) NSUInteger count;
  1211. + (instancetype)dictionary;
  1212. + (instancetype)dictionaryWithFloat:(float)value
  1213. forKey:(BOOL)key;
  1214. + (instancetype)dictionaryWithFloats:(const float [])values
  1215. forKeys:(const BOOL [])keys
  1216. count:(NSUInteger)count;
  1217. + (instancetype)dictionaryWithDictionary:(GPBBoolFloatDictionary *)dictionary;
  1218. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1219. - (instancetype)initWithFloats:(const float [])values
  1220. forKeys:(const BOOL [])keys
  1221. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1222. - (instancetype)initWithDictionary:(GPBBoolFloatDictionary *)dictionary;
  1223. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1224. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1225. // only when the key was found.
  1226. - (BOOL)getFloat:(nullable float *)value forKey:(BOOL)key;
  1227. - (void)enumerateKeysAndFloatsUsingBlock:
  1228. (void (^)(BOOL key, float value, BOOL *stop))block;
  1229. - (void)addEntriesFromDictionary:(GPBBoolFloatDictionary *)otherDictionary;
  1230. - (void)setFloat:(float)value forKey:(BOOL)key;
  1231. - (void)removeFloatForKey:(BOOL)aKey;
  1232. - (void)removeAll;
  1233. @end
  1234. #pragma mark - Bool -> Double
  1235. @interface GPBBoolDoubleDictionary : NSObject <NSCopying>
  1236. @property(nonatomic, readonly) NSUInteger count;
  1237. + (instancetype)dictionary;
  1238. + (instancetype)dictionaryWithDouble:(double)value
  1239. forKey:(BOOL)key;
  1240. + (instancetype)dictionaryWithDoubles:(const double [])values
  1241. forKeys:(const BOOL [])keys
  1242. count:(NSUInteger)count;
  1243. + (instancetype)dictionaryWithDictionary:(GPBBoolDoubleDictionary *)dictionary;
  1244. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1245. - (instancetype)initWithDoubles:(const double [])values
  1246. forKeys:(const BOOL [])keys
  1247. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1248. - (instancetype)initWithDictionary:(GPBBoolDoubleDictionary *)dictionary;
  1249. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1250. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1251. // only when the key was found.
  1252. - (BOOL)getDouble:(nullable double *)value forKey:(BOOL)key;
  1253. - (void)enumerateKeysAndDoublesUsingBlock:
  1254. (void (^)(BOOL key, double value, BOOL *stop))block;
  1255. - (void)addEntriesFromDictionary:(GPBBoolDoubleDictionary *)otherDictionary;
  1256. - (void)setDouble:(double)value forKey:(BOOL)key;
  1257. - (void)removeDoubleForKey:(BOOL)aKey;
  1258. - (void)removeAll;
  1259. @end
  1260. #pragma mark - Bool -> Enum
  1261. @interface GPBBoolEnumDictionary : NSObject <NSCopying>
  1262. @property(nonatomic, readonly) NSUInteger count;
  1263. @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
  1264. + (instancetype)dictionary;
  1265. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  1266. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1267. rawValue:(int32_t)rawValue
  1268. forKey:(BOOL)key;
  1269. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1270. rawValues:(const int32_t [])values
  1271. forKeys:(const BOOL [])keys
  1272. count:(NSUInteger)count;
  1273. + (instancetype)dictionaryWithDictionary:(GPBBoolEnumDictionary *)dictionary;
  1274. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1275. capacity:(NSUInteger)numItems;
  1276. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  1277. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1278. rawValues:(const int32_t [])values
  1279. forKeys:(const BOOL [])keys
  1280. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1281. - (instancetype)initWithDictionary:(GPBBoolEnumDictionary *)dictionary;
  1282. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1283. capacity:(NSUInteger)numItems;
  1284. // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
  1285. // is not a valid enumerator as defined by validationFunc. If the actual value is
  1286. // desired, use "raw" version of the method.
  1287. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1288. // only when the key was found.
  1289. - (BOOL)getEnum:(nullable int32_t *)value forKey:(BOOL)key;
  1290. - (void)enumerateKeysAndEnumsUsingBlock:
  1291. (void (^)(BOOL key, int32_t value, BOOL *stop))block;
  1292. // These methods bypass the validationFunc to provide access to values that were not
  1293. // known at the time the binary was compiled.
  1294. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1295. // only when the key was found.
  1296. - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(BOOL)key;
  1297. - (void)enumerateKeysAndRawValuesUsingBlock:
  1298. (void (^)(BOOL key, int32_t rawValue, BOOL *stop))block;
  1299. - (void)addRawEntriesFromDictionary:(GPBBoolEnumDictionary *)otherDictionary;
  1300. // If value is not a valid enumerator as defined by validationFunc, these
  1301. // methods will assert in debug, and will log in release and assign the value
  1302. // to the default value. Use the rawValue methods below to assign non enumerator
  1303. // values.
  1304. - (void)setEnum:(int32_t)value forKey:(BOOL)key;
  1305. // This method bypass the validationFunc to provide setting of values that were not
  1306. // known at the time the binary was compiled.
  1307. - (void)setRawValue:(int32_t)rawValue forKey:(BOOL)key;
  1308. // No validation applies to these methods.
  1309. - (void)removeEnumForKey:(BOOL)aKey;
  1310. - (void)removeAll;
  1311. @end
  1312. #pragma mark - Bool -> Object
  1313. @interface GPBBoolObjectDictionary<__covariant ObjectType> : NSObject <NSCopying>
  1314. @property(nonatomic, readonly) NSUInteger count;
  1315. + (instancetype)dictionary;
  1316. + (instancetype)dictionaryWithObject:(ObjectType)object
  1317. forKey:(BOOL)key;
  1318. + (instancetype)dictionaryWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
  1319. forKeys:(const BOOL [])keys
  1320. count:(NSUInteger)count;
  1321. + (instancetype)dictionaryWithDictionary:(GPBBoolObjectDictionary *)dictionary;
  1322. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1323. - (instancetype)initWithObjects:(const ObjectType GPB_UNSAFE_UNRETAINED [])objects
  1324. forKeys:(const BOOL [])keys
  1325. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1326. - (instancetype)initWithDictionary:(GPBBoolObjectDictionary *)dictionary;
  1327. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1328. - (ObjectType)objectForKey:(BOOL)key;
  1329. - (void)enumerateKeysAndObjectsUsingBlock:
  1330. (void (^)(BOOL key, ObjectType object, BOOL *stop))block;
  1331. - (void)addEntriesFromDictionary:(GPBBoolObjectDictionary *)otherDictionary;
  1332. - (void)setObject:(ObjectType)object forKey:(BOOL)key;
  1333. - (void)removeObjectForKey:(BOOL)aKey;
  1334. - (void)removeAll;
  1335. @end
  1336. #pragma mark - String -> UInt32
  1337. @interface GPBStringUInt32Dictionary : NSObject <NSCopying>
  1338. @property(nonatomic, readonly) NSUInteger count;
  1339. + (instancetype)dictionary;
  1340. + (instancetype)dictionaryWithUInt32:(uint32_t)value
  1341. forKey:(NSString *)key;
  1342. + (instancetype)dictionaryWithUInt32s:(const uint32_t [])values
  1343. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1344. count:(NSUInteger)count;
  1345. + (instancetype)dictionaryWithDictionary:(GPBStringUInt32Dictionary *)dictionary;
  1346. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1347. - (instancetype)initWithUInt32s:(const uint32_t [])values
  1348. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1349. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1350. - (instancetype)initWithDictionary:(GPBStringUInt32Dictionary *)dictionary;
  1351. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1352. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1353. // only when the key was found.
  1354. - (BOOL)getUInt32:(nullable uint32_t *)value forKey:(NSString *)key;
  1355. - (void)enumerateKeysAndUInt32sUsingBlock:
  1356. (void (^)(NSString *key, uint32_t value, BOOL *stop))block;
  1357. - (void)addEntriesFromDictionary:(GPBStringUInt32Dictionary *)otherDictionary;
  1358. - (void)setUInt32:(uint32_t)value forKey:(NSString *)key;
  1359. - (void)removeUInt32ForKey:(NSString *)aKey;
  1360. - (void)removeAll;
  1361. @end
  1362. #pragma mark - String -> Int32
  1363. @interface GPBStringInt32Dictionary : NSObject <NSCopying>
  1364. @property(nonatomic, readonly) NSUInteger count;
  1365. + (instancetype)dictionary;
  1366. + (instancetype)dictionaryWithInt32:(int32_t)value
  1367. forKey:(NSString *)key;
  1368. + (instancetype)dictionaryWithInt32s:(const int32_t [])values
  1369. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1370. count:(NSUInteger)count;
  1371. + (instancetype)dictionaryWithDictionary:(GPBStringInt32Dictionary *)dictionary;
  1372. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1373. - (instancetype)initWithInt32s:(const int32_t [])values
  1374. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1375. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1376. - (instancetype)initWithDictionary:(GPBStringInt32Dictionary *)dictionary;
  1377. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1378. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1379. // only when the key was found.
  1380. - (BOOL)getInt32:(nullable int32_t *)value forKey:(NSString *)key;
  1381. - (void)enumerateKeysAndInt32sUsingBlock:
  1382. (void (^)(NSString *key, int32_t value, BOOL *stop))block;
  1383. - (void)addEntriesFromDictionary:(GPBStringInt32Dictionary *)otherDictionary;
  1384. - (void)setInt32:(int32_t)value forKey:(NSString *)key;
  1385. - (void)removeInt32ForKey:(NSString *)aKey;
  1386. - (void)removeAll;
  1387. @end
  1388. #pragma mark - String -> UInt64
  1389. @interface GPBStringUInt64Dictionary : NSObject <NSCopying>
  1390. @property(nonatomic, readonly) NSUInteger count;
  1391. + (instancetype)dictionary;
  1392. + (instancetype)dictionaryWithUInt64:(uint64_t)value
  1393. forKey:(NSString *)key;
  1394. + (instancetype)dictionaryWithUInt64s:(const uint64_t [])values
  1395. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1396. count:(NSUInteger)count;
  1397. + (instancetype)dictionaryWithDictionary:(GPBStringUInt64Dictionary *)dictionary;
  1398. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1399. - (instancetype)initWithUInt64s:(const uint64_t [])values
  1400. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1401. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1402. - (instancetype)initWithDictionary:(GPBStringUInt64Dictionary *)dictionary;
  1403. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1404. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1405. // only when the key was found.
  1406. - (BOOL)getUInt64:(nullable uint64_t *)value forKey:(NSString *)key;
  1407. - (void)enumerateKeysAndUInt64sUsingBlock:
  1408. (void (^)(NSString *key, uint64_t value, BOOL *stop))block;
  1409. - (void)addEntriesFromDictionary:(GPBStringUInt64Dictionary *)otherDictionary;
  1410. - (void)setUInt64:(uint64_t)value forKey:(NSString *)key;
  1411. - (void)removeUInt64ForKey:(NSString *)aKey;
  1412. - (void)removeAll;
  1413. @end
  1414. #pragma mark - String -> Int64
  1415. @interface GPBStringInt64Dictionary : NSObject <NSCopying>
  1416. @property(nonatomic, readonly) NSUInteger count;
  1417. + (instancetype)dictionary;
  1418. + (instancetype)dictionaryWithInt64:(int64_t)value
  1419. forKey:(NSString *)key;
  1420. + (instancetype)dictionaryWithInt64s:(const int64_t [])values
  1421. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1422. count:(NSUInteger)count;
  1423. + (instancetype)dictionaryWithDictionary:(GPBStringInt64Dictionary *)dictionary;
  1424. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1425. - (instancetype)initWithInt64s:(const int64_t [])values
  1426. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1427. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1428. - (instancetype)initWithDictionary:(GPBStringInt64Dictionary *)dictionary;
  1429. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1430. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1431. // only when the key was found.
  1432. - (BOOL)getInt64:(nullable int64_t *)value forKey:(NSString *)key;
  1433. - (void)enumerateKeysAndInt64sUsingBlock:
  1434. (void (^)(NSString *key, int64_t value, BOOL *stop))block;
  1435. - (void)addEntriesFromDictionary:(GPBStringInt64Dictionary *)otherDictionary;
  1436. - (void)setInt64:(int64_t)value forKey:(NSString *)key;
  1437. - (void)removeInt64ForKey:(NSString *)aKey;
  1438. - (void)removeAll;
  1439. @end
  1440. #pragma mark - String -> Bool
  1441. @interface GPBStringBoolDictionary : NSObject <NSCopying>
  1442. @property(nonatomic, readonly) NSUInteger count;
  1443. + (instancetype)dictionary;
  1444. + (instancetype)dictionaryWithBool:(BOOL)value
  1445. forKey:(NSString *)key;
  1446. + (instancetype)dictionaryWithBools:(const BOOL [])values
  1447. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1448. count:(NSUInteger)count;
  1449. + (instancetype)dictionaryWithDictionary:(GPBStringBoolDictionary *)dictionary;
  1450. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1451. - (instancetype)initWithBools:(const BOOL [])values
  1452. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1453. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1454. - (instancetype)initWithDictionary:(GPBStringBoolDictionary *)dictionary;
  1455. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1456. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1457. // only when the key was found.
  1458. - (BOOL)getBool:(nullable BOOL *)value forKey:(NSString *)key;
  1459. - (void)enumerateKeysAndBoolsUsingBlock:
  1460. (void (^)(NSString *key, BOOL value, BOOL *stop))block;
  1461. - (void)addEntriesFromDictionary:(GPBStringBoolDictionary *)otherDictionary;
  1462. - (void)setBool:(BOOL)value forKey:(NSString *)key;
  1463. - (void)removeBoolForKey:(NSString *)aKey;
  1464. - (void)removeAll;
  1465. @end
  1466. #pragma mark - String -> Float
  1467. @interface GPBStringFloatDictionary : NSObject <NSCopying>
  1468. @property(nonatomic, readonly) NSUInteger count;
  1469. + (instancetype)dictionary;
  1470. + (instancetype)dictionaryWithFloat:(float)value
  1471. forKey:(NSString *)key;
  1472. + (instancetype)dictionaryWithFloats:(const float [])values
  1473. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1474. count:(NSUInteger)count;
  1475. + (instancetype)dictionaryWithDictionary:(GPBStringFloatDictionary *)dictionary;
  1476. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1477. - (instancetype)initWithFloats:(const float [])values
  1478. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1479. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1480. - (instancetype)initWithDictionary:(GPBStringFloatDictionary *)dictionary;
  1481. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1482. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1483. // only when the key was found.
  1484. - (BOOL)getFloat:(nullable float *)value forKey:(NSString *)key;
  1485. - (void)enumerateKeysAndFloatsUsingBlock:
  1486. (void (^)(NSString *key, float value, BOOL *stop))block;
  1487. - (void)addEntriesFromDictionary:(GPBStringFloatDictionary *)otherDictionary;
  1488. - (void)setFloat:(float)value forKey:(NSString *)key;
  1489. - (void)removeFloatForKey:(NSString *)aKey;
  1490. - (void)removeAll;
  1491. @end
  1492. #pragma mark - String -> Double
  1493. @interface GPBStringDoubleDictionary : NSObject <NSCopying>
  1494. @property(nonatomic, readonly) NSUInteger count;
  1495. + (instancetype)dictionary;
  1496. + (instancetype)dictionaryWithDouble:(double)value
  1497. forKey:(NSString *)key;
  1498. + (instancetype)dictionaryWithDoubles:(const double [])values
  1499. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1500. count:(NSUInteger)count;
  1501. + (instancetype)dictionaryWithDictionary:(GPBStringDoubleDictionary *)dictionary;
  1502. + (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1503. - (instancetype)initWithDoubles:(const double [])values
  1504. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1505. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1506. - (instancetype)initWithDictionary:(GPBStringDoubleDictionary *)dictionary;
  1507. - (instancetype)initWithCapacity:(NSUInteger)numItems;
  1508. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1509. // only when the key was found.
  1510. - (BOOL)getDouble:(nullable double *)value forKey:(NSString *)key;
  1511. - (void)enumerateKeysAndDoublesUsingBlock:
  1512. (void (^)(NSString *key, double value, BOOL *stop))block;
  1513. - (void)addEntriesFromDictionary:(GPBStringDoubleDictionary *)otherDictionary;
  1514. - (void)setDouble:(double)value forKey:(NSString *)key;
  1515. - (void)removeDoubleForKey:(NSString *)aKey;
  1516. - (void)removeAll;
  1517. @end
  1518. #pragma mark - String -> Enum
  1519. @interface GPBStringEnumDictionary : NSObject <NSCopying>
  1520. @property(nonatomic, readonly) NSUInteger count;
  1521. @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
  1522. + (instancetype)dictionary;
  1523. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  1524. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1525. rawValue:(int32_t)rawValue
  1526. forKey:(NSString *)key;
  1527. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1528. rawValues:(const int32_t [])values
  1529. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1530. count:(NSUInteger)count;
  1531. + (instancetype)dictionaryWithDictionary:(GPBStringEnumDictionary *)dictionary;
  1532. + (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1533. capacity:(NSUInteger)numItems;
  1534. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  1535. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1536. rawValues:(const int32_t [])values
  1537. forKeys:(const NSString * GPB_UNSAFE_UNRETAINED [])keys
  1538. count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1539. - (instancetype)initWithDictionary:(GPBStringEnumDictionary *)dictionary;
  1540. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1541. capacity:(NSUInteger)numItems;
  1542. // These will return kGPBUnrecognizedEnumeratorValue if the value for the key
  1543. // is not a valid enumerator as defined by validationFunc. If the actual value is
  1544. // desired, use "raw" version of the method.
  1545. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1546. // only when the key was found.
  1547. - (BOOL)getEnum:(nullable int32_t *)value forKey:(NSString *)key;
  1548. - (void)enumerateKeysAndEnumsUsingBlock:
  1549. (void (^)(NSString *key, int32_t value, BOOL *stop))block;
  1550. // These methods bypass the validationFunc to provide access to values that were not
  1551. // known at the time the binary was compiled.
  1552. // Returns YES/NO to indicate if the key was found or not, filling in the value
  1553. // only when the key was found.
  1554. - (BOOL)getRawValue:(nullable int32_t *)rawValue forKey:(NSString *)key;
  1555. - (void)enumerateKeysAndRawValuesUsingBlock:
  1556. (void (^)(NSString *key, int32_t rawValue, BOOL *stop))block;
  1557. - (void)addRawEntriesFromDictionary:(GPBStringEnumDictionary *)otherDictionary;
  1558. // If value is not a valid enumerator as defined by validationFunc, these
  1559. // methods will assert in debug, and will log in release and assign the value
  1560. // to the default value. Use the rawValue methods below to assign non enumerator
  1561. // values.
  1562. - (void)setEnum:(int32_t)value forKey:(NSString *)key;
  1563. // This method bypass the validationFunc to provide setting of values that were not
  1564. // known at the time the binary was compiled.
  1565. - (void)setRawValue:(int32_t)rawValue forKey:(NSString *)key;
  1566. // No validation applies to these methods.
  1567. - (void)removeEnumForKey:(NSString *)aKey;
  1568. - (void)removeAll;
  1569. @end
  1570. //%PDDM-EXPAND-END DECLARE_DICTIONARIES()
  1571. NS_ASSUME_NONNULL_END
  1572. //%PDDM-DEFINE DECLARE_DICTIONARIES()
  1573. //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt32, uint32_t)
  1574. //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int32, int32_t)
  1575. //%DICTIONARY_INTERFACES_FOR_POD_KEY(UInt64, uint64_t)
  1576. //%DICTIONARY_INTERFACES_FOR_POD_KEY(Int64, int64_t)
  1577. //%DICTIONARY_INTERFACES_FOR_POD_KEY(Bool, BOOL)
  1578. //%DICTIONARY_POD_INTERFACES_FOR_KEY(String, NSString, *, OBJECT)
  1579. //%PDDM-DEFINE DICTIONARY_INTERFACES_FOR_POD_KEY(KEY_NAME, KEY_TYPE)
  1580. //%DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, , POD)
  1581. //%DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, Object, ObjectType)
  1582. //%PDDM-DEFINE DICTIONARY_POD_INTERFACES_FOR_KEY(KEY_NAME, KEY_TYPE, KisP, KHELPER)
  1583. //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt32, uint32_t)
  1584. //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int32, int32_t)
  1585. //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, UInt64, uint64_t)
  1586. //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Int64, int64_t)
  1587. //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Bool, BOOL)
  1588. //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Float, float)
  1589. //%DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Double, double)
  1590. //%DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, Enum, int32_t)
  1591. //%PDDM-DEFINE DICTIONARY_KEY_TO_POD_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE)
  1592. //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, POD, VALUE_NAME, value)
  1593. //%PDDM-DEFINE DICTIONARY_POD_KEY_TO_OBJECT_INTERFACE(KEY_NAME, KEY_TYPE, VALUE_NAME, VALUE_TYPE)
  1594. //%DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, , POD, VALUE_NAME, VALUE_TYPE, OBJECT, Object, object)
  1595. //%PDDM-DEFINE VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME)
  1596. //%// Returns YES/NO to indicate if the key was found or not, filling in the value
  1597. //%// only when the key was found.
  1598. //%- (BOOL)get##VNAME##:(nullable VALUE_TYPE *)value forKey:(KEY_TYPE)key;
  1599. //%PDDM-DEFINE VALUE_FOR_KEY_OBJECT(KEY_TYPE, VALUE_TYPE, VNAME)
  1600. //%- (VALUE_TYPE)objectForKey:(KEY_TYPE)key;
  1601. //%PDDM-DEFINE VALUE_FOR_KEY_Enum(KEY_TYPE, VALUE_TYPE, VNAME)
  1602. //%VALUE_FOR_KEY_POD(KEY_TYPE, VALUE_TYPE, VNAME)
  1603. //%PDDM-DEFINE ARRAY_ARG_MODIFIERPOD()
  1604. // Nothing
  1605. //%PDDM-DEFINE ARRAY_ARG_MODIFIEREnum()
  1606. // Nothing
  1607. //%PDDM-DEFINE ARRAY_ARG_MODIFIEROBJECT()
  1608. //%GPB_UNSAFE_UNRETAINED ##
  1609. //%PDDM-DEFINE DICTIONARY_CLASS_DECLPOD(KEY_NAME, VALUE_NAME, VALUE_TYPE)
  1610. //%GPB##KEY_NAME##VALUE_NAME##Dictionary
  1611. //%PDDM-DEFINE DICTIONARY_CLASS_DECLEnum(KEY_NAME, VALUE_NAME, VALUE_TYPE)
  1612. //%GPB##KEY_NAME##VALUE_NAME##Dictionary
  1613. //%PDDM-DEFINE DICTIONARY_CLASS_DECLOBJECT(KEY_NAME, VALUE_NAME, VALUE_TYPE)
  1614. //%GPB##KEY_NAME##VALUE_NAME##Dictionary<__covariant VALUE_TYPE>
  1615. //%PDDM-DEFINE DICTIONARY_COMMON_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
  1616. //%#pragma mark - KEY_NAME -> VALUE_NAME
  1617. //%
  1618. //%@interface DICTIONARY_CLASS_DECL##VHELPER(KEY_NAME, VALUE_NAME, VALUE_TYPE) : NSObject <NSCopying>
  1619. //%
  1620. //%@property(nonatomic, readonly) NSUInteger count;
  1621. //%
  1622. //%+ (instancetype)dictionary;
  1623. //%+ (instancetype)dictionaryWith##VNAME##:(VALUE_TYPE)##VNAME_VAR
  1624. //% ##VNAME$S## forKey:(KEY_TYPE##KisP$S##KisP)key;
  1625. //%+ (instancetype)dictionaryWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])##VNAME_VAR##s
  1626. //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
  1627. //% ##VNAME$S## count:(NSUInteger)count;
  1628. //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
  1629. //%+ (instancetype)dictionaryWithCapacity:(NSUInteger)numItems;
  1630. //%
  1631. //%- (instancetype)initWith##VNAME##s:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])##VNAME_VAR##s
  1632. //% ##VNAME$S## forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
  1633. //% ##VNAME$S## count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1634. //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
  1635. //%- (instancetype)initWithCapacity:(NSUInteger)numItems;
  1636. //%
  1637. //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
  1638. //%
  1639. //%- (void)addEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary;
  1640. //%
  1641. //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
  1642. //%
  1643. //%@end
  1644. //%
  1645. //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE)
  1646. //%DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, Enum)
  1647. //%PDDM-DEFINE DICTIONARY_KEY_TO_ENUM_INTERFACE2(KEY_NAME, KEY_TYPE, KisP, KHELPER, VALUE_NAME, VALUE_TYPE, VHELPER)
  1648. //%#pragma mark - KEY_NAME -> VALUE_NAME
  1649. //%
  1650. //%@interface GPB##KEY_NAME##VALUE_NAME##Dictionary : NSObject <NSCopying>
  1651. //%
  1652. //%@property(nonatomic, readonly) NSUInteger count;
  1653. //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
  1654. //%
  1655. //%+ (instancetype)dictionary;
  1656. //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  1657. //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1658. //% rawValue:(VALUE_TYPE)rawValue
  1659. //% forKey:(KEY_TYPE##KisP$S##KisP)key;
  1660. //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1661. //% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])values
  1662. //% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
  1663. //% count:(NSUInteger)count;
  1664. //%+ (instancetype)dictionaryWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
  1665. //%+ (instancetype)dictionaryWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1666. //% capacity:(NSUInteger)numItems;
  1667. //%
  1668. //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  1669. //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1670. //% rawValues:(const VALUE_TYPE ARRAY_ARG_MODIFIER##VHELPER()[])values
  1671. //% forKeys:(const KEY_TYPE##KisP$S##KisP ARRAY_ARG_MODIFIER##KHELPER()[])keys
  1672. //% count:(NSUInteger)count NS_DESIGNATED_INITIALIZER;
  1673. //%- (instancetype)initWithDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)dictionary;
  1674. //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1675. //% capacity:(NSUInteger)numItems;
  1676. //%
  1677. //%// These will return kGPBUnrecognizedEnumeratorValue if the value for the key
  1678. //%// is not a valid enumerator as defined by validationFunc. If the actual value is
  1679. //%// desired, use "raw" version of the method.
  1680. //%
  1681. //%DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, Enum, value)
  1682. //%
  1683. //%// These methods bypass the validationFunc to provide access to values that were not
  1684. //%// known at the time the binary was compiled.
  1685. //%
  1686. //%// Returns YES/NO to indicate if the key was found or not, filling in the value
  1687. //%// only when the key was found.
  1688. //%- (BOOL)getRawValue:(nullable VALUE_TYPE *)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key;
  1689. //%
  1690. //%- (void)enumerateKeysAndRawValuesUsingBlock:
  1691. //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE rawValue, BOOL *stop))block;
  1692. //%
  1693. //%- (void)addRawEntriesFromDictionary:(GPB##KEY_NAME##VALUE_NAME##Dictionary *)otherDictionary;
  1694. //%
  1695. //%// If value is not a valid enumerator as defined by validationFunc, these
  1696. //%// methods will assert in debug, and will log in release and assign the value
  1697. //%// to the default value. Use the rawValue methods below to assign non enumerator
  1698. //%// values.
  1699. //%
  1700. //%DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, Enum, value)
  1701. //%
  1702. //%@end
  1703. //%
  1704. //%PDDM-DEFINE DICTIONARY_IMMUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
  1705. //%VALUE_FOR_KEY_##VHELPER(KEY_TYPE##KisP$S##KisP, VALUE_TYPE, VNAME)
  1706. //%
  1707. //%- (void)enumerateKeysAnd##VNAME##sUsingBlock:
  1708. //% (void (^)(KEY_TYPE KisP##key, VALUE_TYPE VNAME_VAR, BOOL *stop))block;
  1709. //%PDDM-DEFINE DICTIONARY_MUTABLE_INTERFACE(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE, VHELPER, VNAME, VNAME_VAR)
  1710. //%- (void)set##VNAME##:(VALUE_TYPE)##VNAME_VAR forKey:(KEY_TYPE##KisP$S##KisP)key;
  1711. //%DICTIONARY_EXTRA_MUTABLE_METHODS_##VHELPER(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
  1712. //%- (void)remove##VNAME##ForKey:(KEY_TYPE##KisP$S##KisP)aKey;
  1713. //%- (void)removeAll;
  1714. //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_POD(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
  1715. // Empty
  1716. //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_OBJECT(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
  1717. // Empty
  1718. //%PDDM-DEFINE DICTIONARY_EXTRA_MUTABLE_METHODS_Enum(KEY_NAME, KEY_TYPE, KisP, VALUE_NAME, VALUE_TYPE)
  1719. //%
  1720. //%// This method bypass the validationFunc to provide setting of values that were not
  1721. //%// known at the time the binary was compiled.
  1722. //%- (void)setRawValue:(VALUE_TYPE)rawValue forKey:(KEY_TYPE##KisP$S##KisP)key;
  1723. //%
  1724. //%// No validation applies to these methods.
  1725. //%