GPBArray.h 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969
  1. // Protocol Buffers - Google's data interchange format
  2. // Copyright 2015 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. NS_ASSUME_NONNULL_BEGIN
  33. //%PDDM-EXPAND DECLARE_ARRAYS()
  34. // This block of code is generated, do not edit it directly.
  35. // clang-format off
  36. #pragma mark - Int32
  37. /**
  38. * Class used for repeated fields of int32_t values. This performs better than
  39. * boxing into NSNumbers in NSArrays.
  40. *
  41. * @note This class is not meant to be subclassed.
  42. **/
  43. @interface GPBInt32Array : NSObject <NSCopying>
  44. /** The number of elements contained in the array. */
  45. @property(nonatomic, readonly) NSUInteger count;
  46. /**
  47. * @return A newly instanced and empty GPBInt32Array.
  48. **/
  49. + (instancetype)array;
  50. /**
  51. * Creates and initializes a GPBInt32Array with the single element given.
  52. *
  53. * @param value The value to be placed in the array.
  54. *
  55. * @return A newly instanced GPBInt32Array with value in it.
  56. **/
  57. + (instancetype)arrayWithValue:(int32_t)value;
  58. /**
  59. * Creates and initializes a GPBInt32Array with the contents of the given
  60. * array.
  61. *
  62. * @param array Array with the contents to be put into the new array.
  63. *
  64. * @return A newly instanced GPBInt32Array with the contents of array.
  65. **/
  66. + (instancetype)arrayWithValueArray:(GPBInt32Array *)array;
  67. /**
  68. * Creates and initializes a GPBInt32Array with the given capacity.
  69. *
  70. * @param count The capacity needed for the array.
  71. *
  72. * @return A newly instanced GPBInt32Array with a capacity of count.
  73. **/
  74. + (instancetype)arrayWithCapacity:(NSUInteger)count;
  75. /**
  76. * @return A newly initialized and empty GPBInt32Array.
  77. **/
  78. - (instancetype)init NS_DESIGNATED_INITIALIZER;
  79. /**
  80. * Initializes the array, copying the given values.
  81. *
  82. * @param values An array with the values to put inside this array.
  83. * @param count The number of elements to copy into the array.
  84. *
  85. * @return A newly initialized GPBInt32Array with a copy of the values.
  86. **/
  87. - (instancetype)initWithValues:(const int32_t [__nullable])values
  88. count:(NSUInteger)count;
  89. /**
  90. * Initializes the array, copying the given values.
  91. *
  92. * @param array An array with the values to put inside this array.
  93. *
  94. * @return A newly initialized GPBInt32Array with a copy of the values.
  95. **/
  96. - (instancetype)initWithValueArray:(GPBInt32Array *)array;
  97. /**
  98. * Initializes the array with the given capacity.
  99. *
  100. * @param count The capacity needed for the array.
  101. *
  102. * @return A newly initialized GPBInt32Array with a capacity of count.
  103. **/
  104. - (instancetype)initWithCapacity:(NSUInteger)count;
  105. /**
  106. * Gets the value at the given index.
  107. *
  108. * @param index The index of the value to get.
  109. *
  110. * @return The value at the given index.
  111. **/
  112. - (int32_t)valueAtIndex:(NSUInteger)index;
  113. /**
  114. * Enumerates the values on this array with the given block.
  115. *
  116. * @param block The block to enumerate with.
  117. * **value**: The current value being enumerated.
  118. * **idx**: The index of the current value.
  119. * **stop**: A pointer to a boolean that when set stops the enumeration.
  120. **/
  121. - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
  122. /**
  123. * Enumerates the values on this array with the given block.
  124. *
  125. * @param opts Options to control the enumeration.
  126. * @param block The block to enumerate with.
  127. * **value**: The current value being enumerated.
  128. * **idx**: The index of the current value.
  129. * **stop**: A pointer to a boolean that when set stops the enumeration.
  130. **/
  131. - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
  132. usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
  133. /**
  134. * Adds a value to this array.
  135. *
  136. * @param value The value to add to this array.
  137. **/
  138. - (void)addValue:(int32_t)value;
  139. /**
  140. * Adds values to this array.
  141. *
  142. * @param values The values to add to this array.
  143. * @param count The number of elements to add.
  144. **/
  145. - (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
  146. /**
  147. * Adds the values from the given array to this array.
  148. *
  149. * @param array The array containing the elements to add to this array.
  150. **/
  151. - (void)addValuesFromArray:(GPBInt32Array *)array;
  152. /**
  153. * Inserts a value into the given position.
  154. *
  155. * @param value The value to add to this array.
  156. * @param index The index into which to insert the value.
  157. **/
  158. - (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
  159. /**
  160. * Replaces the value at the given index with the given value.
  161. *
  162. * @param index The index for which to replace the value.
  163. * @param value The value to replace with.
  164. **/
  165. - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
  166. /**
  167. * Removes the value at the given index.
  168. *
  169. * @param index The index of the value to remove.
  170. **/
  171. - (void)removeValueAtIndex:(NSUInteger)index;
  172. /**
  173. * Removes all the values from this array.
  174. **/
  175. - (void)removeAll;
  176. /**
  177. * Exchanges the values between the given indexes.
  178. *
  179. * @param idx1 The index of the first element to exchange.
  180. * @param idx2 The index of the second element to exchange.
  181. **/
  182. - (void)exchangeValueAtIndex:(NSUInteger)idx1
  183. withValueAtIndex:(NSUInteger)idx2;
  184. @end
  185. #pragma mark - UInt32
  186. /**
  187. * Class used for repeated fields of uint32_t values. This performs better than
  188. * boxing into NSNumbers in NSArrays.
  189. *
  190. * @note This class is not meant to be subclassed.
  191. **/
  192. @interface GPBUInt32Array : NSObject <NSCopying>
  193. /** The number of elements contained in the array. */
  194. @property(nonatomic, readonly) NSUInteger count;
  195. /**
  196. * @return A newly instanced and empty GPBUInt32Array.
  197. **/
  198. + (instancetype)array;
  199. /**
  200. * Creates and initializes a GPBUInt32Array with the single element given.
  201. *
  202. * @param value The value to be placed in the array.
  203. *
  204. * @return A newly instanced GPBUInt32Array with value in it.
  205. **/
  206. + (instancetype)arrayWithValue:(uint32_t)value;
  207. /**
  208. * Creates and initializes a GPBUInt32Array with the contents of the given
  209. * array.
  210. *
  211. * @param array Array with the contents to be put into the new array.
  212. *
  213. * @return A newly instanced GPBUInt32Array with the contents of array.
  214. **/
  215. + (instancetype)arrayWithValueArray:(GPBUInt32Array *)array;
  216. /**
  217. * Creates and initializes a GPBUInt32Array with the given capacity.
  218. *
  219. * @param count The capacity needed for the array.
  220. *
  221. * @return A newly instanced GPBUInt32Array with a capacity of count.
  222. **/
  223. + (instancetype)arrayWithCapacity:(NSUInteger)count;
  224. /**
  225. * @return A newly initialized and empty GPBUInt32Array.
  226. **/
  227. - (instancetype)init NS_DESIGNATED_INITIALIZER;
  228. /**
  229. * Initializes the array, copying the given values.
  230. *
  231. * @param values An array with the values to put inside this array.
  232. * @param count The number of elements to copy into the array.
  233. *
  234. * @return A newly initialized GPBUInt32Array with a copy of the values.
  235. **/
  236. - (instancetype)initWithValues:(const uint32_t [__nullable])values
  237. count:(NSUInteger)count;
  238. /**
  239. * Initializes the array, copying the given values.
  240. *
  241. * @param array An array with the values to put inside this array.
  242. *
  243. * @return A newly initialized GPBUInt32Array with a copy of the values.
  244. **/
  245. - (instancetype)initWithValueArray:(GPBUInt32Array *)array;
  246. /**
  247. * Initializes the array with the given capacity.
  248. *
  249. * @param count The capacity needed for the array.
  250. *
  251. * @return A newly initialized GPBUInt32Array with a capacity of count.
  252. **/
  253. - (instancetype)initWithCapacity:(NSUInteger)count;
  254. /**
  255. * Gets the value at the given index.
  256. *
  257. * @param index The index of the value to get.
  258. *
  259. * @return The value at the given index.
  260. **/
  261. - (uint32_t)valueAtIndex:(NSUInteger)index;
  262. /**
  263. * Enumerates the values on this array with the given block.
  264. *
  265. * @param block The block to enumerate with.
  266. * **value**: The current value being enumerated.
  267. * **idx**: The index of the current value.
  268. * **stop**: A pointer to a boolean that when set stops the enumeration.
  269. **/
  270. - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
  271. /**
  272. * Enumerates the values on this array with the given block.
  273. *
  274. * @param opts Options to control the enumeration.
  275. * @param block The block to enumerate with.
  276. * **value**: The current value being enumerated.
  277. * **idx**: The index of the current value.
  278. * **stop**: A pointer to a boolean that when set stops the enumeration.
  279. **/
  280. - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
  281. usingBlock:(void (NS_NOESCAPE ^)(uint32_t value, NSUInteger idx, BOOL *stop))block;
  282. /**
  283. * Adds a value to this array.
  284. *
  285. * @param value The value to add to this array.
  286. **/
  287. - (void)addValue:(uint32_t)value;
  288. /**
  289. * Adds values to this array.
  290. *
  291. * @param values The values to add to this array.
  292. * @param count The number of elements to add.
  293. **/
  294. - (void)addValues:(const uint32_t [__nullable])values count:(NSUInteger)count;
  295. /**
  296. * Adds the values from the given array to this array.
  297. *
  298. * @param array The array containing the elements to add to this array.
  299. **/
  300. - (void)addValuesFromArray:(GPBUInt32Array *)array;
  301. /**
  302. * Inserts a value into the given position.
  303. *
  304. * @param value The value to add to this array.
  305. * @param index The index into which to insert the value.
  306. **/
  307. - (void)insertValue:(uint32_t)value atIndex:(NSUInteger)index;
  308. /**
  309. * Replaces the value at the given index with the given value.
  310. *
  311. * @param index The index for which to replace the value.
  312. * @param value The value to replace with.
  313. **/
  314. - (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint32_t)value;
  315. /**
  316. * Removes the value at the given index.
  317. *
  318. * @param index The index of the value to remove.
  319. **/
  320. - (void)removeValueAtIndex:(NSUInteger)index;
  321. /**
  322. * Removes all the values from this array.
  323. **/
  324. - (void)removeAll;
  325. /**
  326. * Exchanges the values between the given indexes.
  327. *
  328. * @param idx1 The index of the first element to exchange.
  329. * @param idx2 The index of the second element to exchange.
  330. **/
  331. - (void)exchangeValueAtIndex:(NSUInteger)idx1
  332. withValueAtIndex:(NSUInteger)idx2;
  333. @end
  334. #pragma mark - Int64
  335. /**
  336. * Class used for repeated fields of int64_t values. This performs better than
  337. * boxing into NSNumbers in NSArrays.
  338. *
  339. * @note This class is not meant to be subclassed.
  340. **/
  341. @interface GPBInt64Array : NSObject <NSCopying>
  342. /** The number of elements contained in the array. */
  343. @property(nonatomic, readonly) NSUInteger count;
  344. /**
  345. * @return A newly instanced and empty GPBInt64Array.
  346. **/
  347. + (instancetype)array;
  348. /**
  349. * Creates and initializes a GPBInt64Array with the single element given.
  350. *
  351. * @param value The value to be placed in the array.
  352. *
  353. * @return A newly instanced GPBInt64Array with value in it.
  354. **/
  355. + (instancetype)arrayWithValue:(int64_t)value;
  356. /**
  357. * Creates and initializes a GPBInt64Array with the contents of the given
  358. * array.
  359. *
  360. * @param array Array with the contents to be put into the new array.
  361. *
  362. * @return A newly instanced GPBInt64Array with the contents of array.
  363. **/
  364. + (instancetype)arrayWithValueArray:(GPBInt64Array *)array;
  365. /**
  366. * Creates and initializes a GPBInt64Array with the given capacity.
  367. *
  368. * @param count The capacity needed for the array.
  369. *
  370. * @return A newly instanced GPBInt64Array with a capacity of count.
  371. **/
  372. + (instancetype)arrayWithCapacity:(NSUInteger)count;
  373. /**
  374. * @return A newly initialized and empty GPBInt64Array.
  375. **/
  376. - (instancetype)init NS_DESIGNATED_INITIALIZER;
  377. /**
  378. * Initializes the array, copying the given values.
  379. *
  380. * @param values An array with the values to put inside this array.
  381. * @param count The number of elements to copy into the array.
  382. *
  383. * @return A newly initialized GPBInt64Array with a copy of the values.
  384. **/
  385. - (instancetype)initWithValues:(const int64_t [__nullable])values
  386. count:(NSUInteger)count;
  387. /**
  388. * Initializes the array, copying the given values.
  389. *
  390. * @param array An array with the values to put inside this array.
  391. *
  392. * @return A newly initialized GPBInt64Array with a copy of the values.
  393. **/
  394. - (instancetype)initWithValueArray:(GPBInt64Array *)array;
  395. /**
  396. * Initializes the array with the given capacity.
  397. *
  398. * @param count The capacity needed for the array.
  399. *
  400. * @return A newly initialized GPBInt64Array with a capacity of count.
  401. **/
  402. - (instancetype)initWithCapacity:(NSUInteger)count;
  403. /**
  404. * Gets the value at the given index.
  405. *
  406. * @param index The index of the value to get.
  407. *
  408. * @return The value at the given index.
  409. **/
  410. - (int64_t)valueAtIndex:(NSUInteger)index;
  411. /**
  412. * Enumerates the values on this array with the given block.
  413. *
  414. * @param block The block to enumerate with.
  415. * **value**: The current value being enumerated.
  416. * **idx**: The index of the current value.
  417. * **stop**: A pointer to a boolean that when set stops the enumeration.
  418. **/
  419. - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block;
  420. /**
  421. * Enumerates the values on this array with the given block.
  422. *
  423. * @param opts Options to control the enumeration.
  424. * @param block The block to enumerate with.
  425. * **value**: The current value being enumerated.
  426. * **idx**: The index of the current value.
  427. * **stop**: A pointer to a boolean that when set stops the enumeration.
  428. **/
  429. - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
  430. usingBlock:(void (NS_NOESCAPE ^)(int64_t value, NSUInteger idx, BOOL *stop))block;
  431. /**
  432. * Adds a value to this array.
  433. *
  434. * @param value The value to add to this array.
  435. **/
  436. - (void)addValue:(int64_t)value;
  437. /**
  438. * Adds values to this array.
  439. *
  440. * @param values The values to add to this array.
  441. * @param count The number of elements to add.
  442. **/
  443. - (void)addValues:(const int64_t [__nullable])values count:(NSUInteger)count;
  444. /**
  445. * Adds the values from the given array to this array.
  446. *
  447. * @param array The array containing the elements to add to this array.
  448. **/
  449. - (void)addValuesFromArray:(GPBInt64Array *)array;
  450. /**
  451. * Inserts a value into the given position.
  452. *
  453. * @param value The value to add to this array.
  454. * @param index The index into which to insert the value.
  455. **/
  456. - (void)insertValue:(int64_t)value atIndex:(NSUInteger)index;
  457. /**
  458. * Replaces the value at the given index with the given value.
  459. *
  460. * @param index The index for which to replace the value.
  461. * @param value The value to replace with.
  462. **/
  463. - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int64_t)value;
  464. /**
  465. * Removes the value at the given index.
  466. *
  467. * @param index The index of the value to remove.
  468. **/
  469. - (void)removeValueAtIndex:(NSUInteger)index;
  470. /**
  471. * Removes all the values from this array.
  472. **/
  473. - (void)removeAll;
  474. /**
  475. * Exchanges the values between the given indexes.
  476. *
  477. * @param idx1 The index of the first element to exchange.
  478. * @param idx2 The index of the second element to exchange.
  479. **/
  480. - (void)exchangeValueAtIndex:(NSUInteger)idx1
  481. withValueAtIndex:(NSUInteger)idx2;
  482. @end
  483. #pragma mark - UInt64
  484. /**
  485. * Class used for repeated fields of uint64_t values. This performs better than
  486. * boxing into NSNumbers in NSArrays.
  487. *
  488. * @note This class is not meant to be subclassed.
  489. **/
  490. @interface GPBUInt64Array : NSObject <NSCopying>
  491. /** The number of elements contained in the array. */
  492. @property(nonatomic, readonly) NSUInteger count;
  493. /**
  494. * @return A newly instanced and empty GPBUInt64Array.
  495. **/
  496. + (instancetype)array;
  497. /**
  498. * Creates and initializes a GPBUInt64Array with the single element given.
  499. *
  500. * @param value The value to be placed in the array.
  501. *
  502. * @return A newly instanced GPBUInt64Array with value in it.
  503. **/
  504. + (instancetype)arrayWithValue:(uint64_t)value;
  505. /**
  506. * Creates and initializes a GPBUInt64Array with the contents of the given
  507. * array.
  508. *
  509. * @param array Array with the contents to be put into the new array.
  510. *
  511. * @return A newly instanced GPBUInt64Array with the contents of array.
  512. **/
  513. + (instancetype)arrayWithValueArray:(GPBUInt64Array *)array;
  514. /**
  515. * Creates and initializes a GPBUInt64Array with the given capacity.
  516. *
  517. * @param count The capacity needed for the array.
  518. *
  519. * @return A newly instanced GPBUInt64Array with a capacity of count.
  520. **/
  521. + (instancetype)arrayWithCapacity:(NSUInteger)count;
  522. /**
  523. * @return A newly initialized and empty GPBUInt64Array.
  524. **/
  525. - (instancetype)init NS_DESIGNATED_INITIALIZER;
  526. /**
  527. * Initializes the array, copying the given values.
  528. *
  529. * @param values An array with the values to put inside this array.
  530. * @param count The number of elements to copy into the array.
  531. *
  532. * @return A newly initialized GPBUInt64Array with a copy of the values.
  533. **/
  534. - (instancetype)initWithValues:(const uint64_t [__nullable])values
  535. count:(NSUInteger)count;
  536. /**
  537. * Initializes the array, copying the given values.
  538. *
  539. * @param array An array with the values to put inside this array.
  540. *
  541. * @return A newly initialized GPBUInt64Array with a copy of the values.
  542. **/
  543. - (instancetype)initWithValueArray:(GPBUInt64Array *)array;
  544. /**
  545. * Initializes the array with the given capacity.
  546. *
  547. * @param count The capacity needed for the array.
  548. *
  549. * @return A newly initialized GPBUInt64Array with a capacity of count.
  550. **/
  551. - (instancetype)initWithCapacity:(NSUInteger)count;
  552. /**
  553. * Gets the value at the given index.
  554. *
  555. * @param index The index of the value to get.
  556. *
  557. * @return The value at the given index.
  558. **/
  559. - (uint64_t)valueAtIndex:(NSUInteger)index;
  560. /**
  561. * Enumerates the values on this array with the given block.
  562. *
  563. * @param block The block to enumerate with.
  564. * **value**: The current value being enumerated.
  565. * **idx**: The index of the current value.
  566. * **stop**: A pointer to a boolean that when set stops the enumeration.
  567. **/
  568. - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
  569. /**
  570. * Enumerates the values on this array with the given block.
  571. *
  572. * @param opts Options to control the enumeration.
  573. * @param block The block to enumerate with.
  574. * **value**: The current value being enumerated.
  575. * **idx**: The index of the current value.
  576. * **stop**: A pointer to a boolean that when set stops the enumeration.
  577. **/
  578. - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
  579. usingBlock:(void (NS_NOESCAPE ^)(uint64_t value, NSUInteger idx, BOOL *stop))block;
  580. /**
  581. * Adds a value to this array.
  582. *
  583. * @param value The value to add to this array.
  584. **/
  585. - (void)addValue:(uint64_t)value;
  586. /**
  587. * Adds values to this array.
  588. *
  589. * @param values The values to add to this array.
  590. * @param count The number of elements to add.
  591. **/
  592. - (void)addValues:(const uint64_t [__nullable])values count:(NSUInteger)count;
  593. /**
  594. * Adds the values from the given array to this array.
  595. *
  596. * @param array The array containing the elements to add to this array.
  597. **/
  598. - (void)addValuesFromArray:(GPBUInt64Array *)array;
  599. /**
  600. * Inserts a value into the given position.
  601. *
  602. * @param value The value to add to this array.
  603. * @param index The index into which to insert the value.
  604. **/
  605. - (void)insertValue:(uint64_t)value atIndex:(NSUInteger)index;
  606. /**
  607. * Replaces the value at the given index with the given value.
  608. *
  609. * @param index The index for which to replace the value.
  610. * @param value The value to replace with.
  611. **/
  612. - (void)replaceValueAtIndex:(NSUInteger)index withValue:(uint64_t)value;
  613. /**
  614. * Removes the value at the given index.
  615. *
  616. * @param index The index of the value to remove.
  617. **/
  618. - (void)removeValueAtIndex:(NSUInteger)index;
  619. /**
  620. * Removes all the values from this array.
  621. **/
  622. - (void)removeAll;
  623. /**
  624. * Exchanges the values between the given indexes.
  625. *
  626. * @param idx1 The index of the first element to exchange.
  627. * @param idx2 The index of the second element to exchange.
  628. **/
  629. - (void)exchangeValueAtIndex:(NSUInteger)idx1
  630. withValueAtIndex:(NSUInteger)idx2;
  631. @end
  632. #pragma mark - Float
  633. /**
  634. * Class used for repeated fields of float values. This performs better than
  635. * boxing into NSNumbers in NSArrays.
  636. *
  637. * @note This class is not meant to be subclassed.
  638. **/
  639. @interface GPBFloatArray : NSObject <NSCopying>
  640. /** The number of elements contained in the array. */
  641. @property(nonatomic, readonly) NSUInteger count;
  642. /**
  643. * @return A newly instanced and empty GPBFloatArray.
  644. **/
  645. + (instancetype)array;
  646. /**
  647. * Creates and initializes a GPBFloatArray with the single element given.
  648. *
  649. * @param value The value to be placed in the array.
  650. *
  651. * @return A newly instanced GPBFloatArray with value in it.
  652. **/
  653. + (instancetype)arrayWithValue:(float)value;
  654. /**
  655. * Creates and initializes a GPBFloatArray with the contents of the given
  656. * array.
  657. *
  658. * @param array Array with the contents to be put into the new array.
  659. *
  660. * @return A newly instanced GPBFloatArray with the contents of array.
  661. **/
  662. + (instancetype)arrayWithValueArray:(GPBFloatArray *)array;
  663. /**
  664. * Creates and initializes a GPBFloatArray with the given capacity.
  665. *
  666. * @param count The capacity needed for the array.
  667. *
  668. * @return A newly instanced GPBFloatArray with a capacity of count.
  669. **/
  670. + (instancetype)arrayWithCapacity:(NSUInteger)count;
  671. /**
  672. * @return A newly initialized and empty GPBFloatArray.
  673. **/
  674. - (instancetype)init NS_DESIGNATED_INITIALIZER;
  675. /**
  676. * Initializes the array, copying the given values.
  677. *
  678. * @param values An array with the values to put inside this array.
  679. * @param count The number of elements to copy into the array.
  680. *
  681. * @return A newly initialized GPBFloatArray with a copy of the values.
  682. **/
  683. - (instancetype)initWithValues:(const float [__nullable])values
  684. count:(NSUInteger)count;
  685. /**
  686. * Initializes the array, copying the given values.
  687. *
  688. * @param array An array with the values to put inside this array.
  689. *
  690. * @return A newly initialized GPBFloatArray with a copy of the values.
  691. **/
  692. - (instancetype)initWithValueArray:(GPBFloatArray *)array;
  693. /**
  694. * Initializes the array with the given capacity.
  695. *
  696. * @param count The capacity needed for the array.
  697. *
  698. * @return A newly initialized GPBFloatArray with a capacity of count.
  699. **/
  700. - (instancetype)initWithCapacity:(NSUInteger)count;
  701. /**
  702. * Gets the value at the given index.
  703. *
  704. * @param index The index of the value to get.
  705. *
  706. * @return The value at the given index.
  707. **/
  708. - (float)valueAtIndex:(NSUInteger)index;
  709. /**
  710. * Enumerates the values on this array with the given block.
  711. *
  712. * @param block The block to enumerate with.
  713. * **value**: The current value being enumerated.
  714. * **idx**: The index of the current value.
  715. * **stop**: A pointer to a boolean that when set stops the enumeration.
  716. **/
  717. - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
  718. /**
  719. * Enumerates the values on this array with the given block.
  720. *
  721. * @param opts Options to control the enumeration.
  722. * @param block The block to enumerate with.
  723. * **value**: The current value being enumerated.
  724. * **idx**: The index of the current value.
  725. * **stop**: A pointer to a boolean that when set stops the enumeration.
  726. **/
  727. - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
  728. usingBlock:(void (NS_NOESCAPE ^)(float value, NSUInteger idx, BOOL *stop))block;
  729. /**
  730. * Adds a value to this array.
  731. *
  732. * @param value The value to add to this array.
  733. **/
  734. - (void)addValue:(float)value;
  735. /**
  736. * Adds values to this array.
  737. *
  738. * @param values The values to add to this array.
  739. * @param count The number of elements to add.
  740. **/
  741. - (void)addValues:(const float [__nullable])values count:(NSUInteger)count;
  742. /**
  743. * Adds the values from the given array to this array.
  744. *
  745. * @param array The array containing the elements to add to this array.
  746. **/
  747. - (void)addValuesFromArray:(GPBFloatArray *)array;
  748. /**
  749. * Inserts a value into the given position.
  750. *
  751. * @param value The value to add to this array.
  752. * @param index The index into which to insert the value.
  753. **/
  754. - (void)insertValue:(float)value atIndex:(NSUInteger)index;
  755. /**
  756. * Replaces the value at the given index with the given value.
  757. *
  758. * @param index The index for which to replace the value.
  759. * @param value The value to replace with.
  760. **/
  761. - (void)replaceValueAtIndex:(NSUInteger)index withValue:(float)value;
  762. /**
  763. * Removes the value at the given index.
  764. *
  765. * @param index The index of the value to remove.
  766. **/
  767. - (void)removeValueAtIndex:(NSUInteger)index;
  768. /**
  769. * Removes all the values from this array.
  770. **/
  771. - (void)removeAll;
  772. /**
  773. * Exchanges the values between the given indexes.
  774. *
  775. * @param idx1 The index of the first element to exchange.
  776. * @param idx2 The index of the second element to exchange.
  777. **/
  778. - (void)exchangeValueAtIndex:(NSUInteger)idx1
  779. withValueAtIndex:(NSUInteger)idx2;
  780. @end
  781. #pragma mark - Double
  782. /**
  783. * Class used for repeated fields of double values. This performs better than
  784. * boxing into NSNumbers in NSArrays.
  785. *
  786. * @note This class is not meant to be subclassed.
  787. **/
  788. @interface GPBDoubleArray : NSObject <NSCopying>
  789. /** The number of elements contained in the array. */
  790. @property(nonatomic, readonly) NSUInteger count;
  791. /**
  792. * @return A newly instanced and empty GPBDoubleArray.
  793. **/
  794. + (instancetype)array;
  795. /**
  796. * Creates and initializes a GPBDoubleArray with the single element given.
  797. *
  798. * @param value The value to be placed in the array.
  799. *
  800. * @return A newly instanced GPBDoubleArray with value in it.
  801. **/
  802. + (instancetype)arrayWithValue:(double)value;
  803. /**
  804. * Creates and initializes a GPBDoubleArray with the contents of the given
  805. * array.
  806. *
  807. * @param array Array with the contents to be put into the new array.
  808. *
  809. * @return A newly instanced GPBDoubleArray with the contents of array.
  810. **/
  811. + (instancetype)arrayWithValueArray:(GPBDoubleArray *)array;
  812. /**
  813. * Creates and initializes a GPBDoubleArray with the given capacity.
  814. *
  815. * @param count The capacity needed for the array.
  816. *
  817. * @return A newly instanced GPBDoubleArray with a capacity of count.
  818. **/
  819. + (instancetype)arrayWithCapacity:(NSUInteger)count;
  820. /**
  821. * @return A newly initialized and empty GPBDoubleArray.
  822. **/
  823. - (instancetype)init NS_DESIGNATED_INITIALIZER;
  824. /**
  825. * Initializes the array, copying the given values.
  826. *
  827. * @param values An array with the values to put inside this array.
  828. * @param count The number of elements to copy into the array.
  829. *
  830. * @return A newly initialized GPBDoubleArray with a copy of the values.
  831. **/
  832. - (instancetype)initWithValues:(const double [__nullable])values
  833. count:(NSUInteger)count;
  834. /**
  835. * Initializes the array, copying the given values.
  836. *
  837. * @param array An array with the values to put inside this array.
  838. *
  839. * @return A newly initialized GPBDoubleArray with a copy of the values.
  840. **/
  841. - (instancetype)initWithValueArray:(GPBDoubleArray *)array;
  842. /**
  843. * Initializes the array with the given capacity.
  844. *
  845. * @param count The capacity needed for the array.
  846. *
  847. * @return A newly initialized GPBDoubleArray with a capacity of count.
  848. **/
  849. - (instancetype)initWithCapacity:(NSUInteger)count;
  850. /**
  851. * Gets the value at the given index.
  852. *
  853. * @param index The index of the value to get.
  854. *
  855. * @return The value at the given index.
  856. **/
  857. - (double)valueAtIndex:(NSUInteger)index;
  858. /**
  859. * Enumerates the values on this array with the given block.
  860. *
  861. * @param block The block to enumerate with.
  862. * **value**: The current value being enumerated.
  863. * **idx**: The index of the current value.
  864. * **stop**: A pointer to a boolean that when set stops the enumeration.
  865. **/
  866. - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
  867. /**
  868. * Enumerates the values on this array with the given block.
  869. *
  870. * @param opts Options to control the enumeration.
  871. * @param block The block to enumerate with.
  872. * **value**: The current value being enumerated.
  873. * **idx**: The index of the current value.
  874. * **stop**: A pointer to a boolean that when set stops the enumeration.
  875. **/
  876. - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
  877. usingBlock:(void (NS_NOESCAPE ^)(double value, NSUInteger idx, BOOL *stop))block;
  878. /**
  879. * Adds a value to this array.
  880. *
  881. * @param value The value to add to this array.
  882. **/
  883. - (void)addValue:(double)value;
  884. /**
  885. * Adds values to this array.
  886. *
  887. * @param values The values to add to this array.
  888. * @param count The number of elements to add.
  889. **/
  890. - (void)addValues:(const double [__nullable])values count:(NSUInteger)count;
  891. /**
  892. * Adds the values from the given array to this array.
  893. *
  894. * @param array The array containing the elements to add to this array.
  895. **/
  896. - (void)addValuesFromArray:(GPBDoubleArray *)array;
  897. /**
  898. * Inserts a value into the given position.
  899. *
  900. * @param value The value to add to this array.
  901. * @param index The index into which to insert the value.
  902. **/
  903. - (void)insertValue:(double)value atIndex:(NSUInteger)index;
  904. /**
  905. * Replaces the value at the given index with the given value.
  906. *
  907. * @param index The index for which to replace the value.
  908. * @param value The value to replace with.
  909. **/
  910. - (void)replaceValueAtIndex:(NSUInteger)index withValue:(double)value;
  911. /**
  912. * Removes the value at the given index.
  913. *
  914. * @param index The index of the value to remove.
  915. **/
  916. - (void)removeValueAtIndex:(NSUInteger)index;
  917. /**
  918. * Removes all the values from this array.
  919. **/
  920. - (void)removeAll;
  921. /**
  922. * Exchanges the values between the given indexes.
  923. *
  924. * @param idx1 The index of the first element to exchange.
  925. * @param idx2 The index of the second element to exchange.
  926. **/
  927. - (void)exchangeValueAtIndex:(NSUInteger)idx1
  928. withValueAtIndex:(NSUInteger)idx2;
  929. @end
  930. #pragma mark - Bool
  931. /**
  932. * Class used for repeated fields of BOOL values. This performs better than
  933. * boxing into NSNumbers in NSArrays.
  934. *
  935. * @note This class is not meant to be subclassed.
  936. **/
  937. @interface GPBBoolArray : NSObject <NSCopying>
  938. /** The number of elements contained in the array. */
  939. @property(nonatomic, readonly) NSUInteger count;
  940. /**
  941. * @return A newly instanced and empty GPBBoolArray.
  942. **/
  943. + (instancetype)array;
  944. /**
  945. * Creates and initializes a GPBBoolArray with the single element given.
  946. *
  947. * @param value The value to be placed in the array.
  948. *
  949. * @return A newly instanced GPBBoolArray with value in it.
  950. **/
  951. + (instancetype)arrayWithValue:(BOOL)value;
  952. /**
  953. * Creates and initializes a GPBBoolArray with the contents of the given
  954. * array.
  955. *
  956. * @param array Array with the contents to be put into the new array.
  957. *
  958. * @return A newly instanced GPBBoolArray with the contents of array.
  959. **/
  960. + (instancetype)arrayWithValueArray:(GPBBoolArray *)array;
  961. /**
  962. * Creates and initializes a GPBBoolArray with the given capacity.
  963. *
  964. * @param count The capacity needed for the array.
  965. *
  966. * @return A newly instanced GPBBoolArray with a capacity of count.
  967. **/
  968. + (instancetype)arrayWithCapacity:(NSUInteger)count;
  969. /**
  970. * @return A newly initialized and empty GPBBoolArray.
  971. **/
  972. - (instancetype)init NS_DESIGNATED_INITIALIZER;
  973. /**
  974. * Initializes the array, copying the given values.
  975. *
  976. * @param values An array with the values to put inside this array.
  977. * @param count The number of elements to copy into the array.
  978. *
  979. * @return A newly initialized GPBBoolArray with a copy of the values.
  980. **/
  981. - (instancetype)initWithValues:(const BOOL [__nullable])values
  982. count:(NSUInteger)count;
  983. /**
  984. * Initializes the array, copying the given values.
  985. *
  986. * @param array An array with the values to put inside this array.
  987. *
  988. * @return A newly initialized GPBBoolArray with a copy of the values.
  989. **/
  990. - (instancetype)initWithValueArray:(GPBBoolArray *)array;
  991. /**
  992. * Initializes the array with the given capacity.
  993. *
  994. * @param count The capacity needed for the array.
  995. *
  996. * @return A newly initialized GPBBoolArray with a capacity of count.
  997. **/
  998. - (instancetype)initWithCapacity:(NSUInteger)count;
  999. /**
  1000. * Gets the value at the given index.
  1001. *
  1002. * @param index The index of the value to get.
  1003. *
  1004. * @return The value at the given index.
  1005. **/
  1006. - (BOOL)valueAtIndex:(NSUInteger)index;
  1007. /**
  1008. * Enumerates the values on this array with the given block.
  1009. *
  1010. * @param block The block to enumerate with.
  1011. * **value**: The current value being enumerated.
  1012. * **idx**: The index of the current value.
  1013. * **stop**: A pointer to a boolean that when set stops the enumeration.
  1014. **/
  1015. - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
  1016. /**
  1017. * Enumerates the values on this array with the given block.
  1018. *
  1019. * @param opts Options to control the enumeration.
  1020. * @param block The block to enumerate with.
  1021. * **value**: The current value being enumerated.
  1022. * **idx**: The index of the current value.
  1023. * **stop**: A pointer to a boolean that when set stops the enumeration.
  1024. **/
  1025. - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
  1026. usingBlock:(void (NS_NOESCAPE ^)(BOOL value, NSUInteger idx, BOOL *stop))block;
  1027. /**
  1028. * Adds a value to this array.
  1029. *
  1030. * @param value The value to add to this array.
  1031. **/
  1032. - (void)addValue:(BOOL)value;
  1033. /**
  1034. * Adds values to this array.
  1035. *
  1036. * @param values The values to add to this array.
  1037. * @param count The number of elements to add.
  1038. **/
  1039. - (void)addValues:(const BOOL [__nullable])values count:(NSUInteger)count;
  1040. /**
  1041. * Adds the values from the given array to this array.
  1042. *
  1043. * @param array The array containing the elements to add to this array.
  1044. **/
  1045. - (void)addValuesFromArray:(GPBBoolArray *)array;
  1046. /**
  1047. * Inserts a value into the given position.
  1048. *
  1049. * @param value The value to add to this array.
  1050. * @param index The index into which to insert the value.
  1051. **/
  1052. - (void)insertValue:(BOOL)value atIndex:(NSUInteger)index;
  1053. /**
  1054. * Replaces the value at the given index with the given value.
  1055. *
  1056. * @param index The index for which to replace the value.
  1057. * @param value The value to replace with.
  1058. **/
  1059. - (void)replaceValueAtIndex:(NSUInteger)index withValue:(BOOL)value;
  1060. /**
  1061. * Removes the value at the given index.
  1062. *
  1063. * @param index The index of the value to remove.
  1064. **/
  1065. - (void)removeValueAtIndex:(NSUInteger)index;
  1066. /**
  1067. * Removes all the values from this array.
  1068. **/
  1069. - (void)removeAll;
  1070. /**
  1071. * Exchanges the values between the given indexes.
  1072. *
  1073. * @param idx1 The index of the first element to exchange.
  1074. * @param idx2 The index of the second element to exchange.
  1075. **/
  1076. - (void)exchangeValueAtIndex:(NSUInteger)idx1
  1077. withValueAtIndex:(NSUInteger)idx2;
  1078. @end
  1079. #pragma mark - Enum
  1080. /**
  1081. * This class is used for repeated fields of int32_t values. This performs
  1082. * better than boxing into NSNumbers in NSArrays.
  1083. *
  1084. * @note This class is not meant to be subclassed.
  1085. **/
  1086. @interface GPBEnumArray : NSObject <NSCopying>
  1087. /** The number of elements contained in the array. */
  1088. @property(nonatomic, readonly) NSUInteger count;
  1089. /** The validation function to check if the enums are valid. */
  1090. @property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
  1091. /**
  1092. * @return A newly instanced and empty GPBEnumArray.
  1093. **/
  1094. + (instancetype)array;
  1095. /**
  1096. * Creates and initializes a GPBEnumArray with the enum validation function
  1097. * given.
  1098. *
  1099. * @param func The enum validation function for the array.
  1100. *
  1101. * @return A newly instanced GPBEnumArray.
  1102. **/
  1103. + (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  1104. /**
  1105. * Creates and initializes a GPBEnumArray with the enum validation function
  1106. * given and the single raw value given.
  1107. *
  1108. * @param func The enum validation function for the array.
  1109. * @param value The raw value to add to this array.
  1110. *
  1111. * @return A newly instanced GPBEnumArray.
  1112. **/
  1113. + (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1114. rawValue:(int32_t)value;
  1115. /**
  1116. * Creates and initializes a GPBEnumArray that adds the elements from the
  1117. * given array.
  1118. *
  1119. * @param array Array containing the values to add to the new array.
  1120. *
  1121. * @return A newly instanced GPBEnumArray.
  1122. **/
  1123. + (instancetype)arrayWithValueArray:(GPBEnumArray *)array;
  1124. /**
  1125. * Creates and initializes a GPBEnumArray with the given enum validation
  1126. * function and with the givencapacity.
  1127. *
  1128. * @param func The enum validation function for the array.
  1129. * @param count The capacity needed for the array.
  1130. *
  1131. * @return A newly instanced GPBEnumArray with a capacity of count.
  1132. **/
  1133. + (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1134. capacity:(NSUInteger)count;
  1135. /**
  1136. * Initializes the array with the given enum validation function.
  1137. *
  1138. * @param func The enum validation function for the array.
  1139. *
  1140. * @return A newly initialized GPBEnumArray with a copy of the values.
  1141. **/
  1142. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1143. NS_DESIGNATED_INITIALIZER;
  1144. /**
  1145. * Initializes the array, copying the given values.
  1146. *
  1147. * @param func The enum validation function for the array.
  1148. * @param values An array with the values to put inside this array.
  1149. * @param count The number of elements to copy into the array.
  1150. *
  1151. * @return A newly initialized GPBEnumArray with a copy of the values.
  1152. **/
  1153. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1154. rawValues:(const int32_t [__nullable])values
  1155. count:(NSUInteger)count;
  1156. /**
  1157. * Initializes the array, copying the given values.
  1158. *
  1159. * @param array An array with the values to put inside this array.
  1160. *
  1161. * @return A newly initialized GPBEnumArray with a copy of the values.
  1162. **/
  1163. - (instancetype)initWithValueArray:(GPBEnumArray *)array;
  1164. /**
  1165. * Initializes the array with the given capacity.
  1166. *
  1167. * @param func The enum validation function for the array.
  1168. * @param count The capacity needed for the array.
  1169. *
  1170. * @return A newly initialized GPBEnumArray with a capacity of count.
  1171. **/
  1172. - (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1173. capacity:(NSUInteger)count;
  1174. // These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
  1175. // valid enumerator as defined by validationFunc. If the actual value is
  1176. // desired, use "raw" version of the method.
  1177. /**
  1178. * Gets the value at the given index.
  1179. *
  1180. * @param index The index of the value to get.
  1181. *
  1182. * @return The value at the given index.
  1183. **/
  1184. - (int32_t)valueAtIndex:(NSUInteger)index;
  1185. /**
  1186. * Enumerates the values on this array with the given block.
  1187. *
  1188. * @param block The block to enumerate with.
  1189. * **value**: The current value being enumerated.
  1190. * **idx**: The index of the current value.
  1191. * **stop**: A pointer to a boolean that when set stops the enumeration.
  1192. **/
  1193. - (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
  1194. /**
  1195. * Enumerates the values on this array with the given block.
  1196. *
  1197. * @param opts Options to control the enumeration.
  1198. * @param block The block to enumerate with.
  1199. * **value**: The current value being enumerated.
  1200. * **idx**: The index of the current value.
  1201. * **stop**: A pointer to a boolean that when set stops the enumeration.
  1202. **/
  1203. - (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
  1204. usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
  1205. // These methods bypass the validationFunc to provide access to values that were not
  1206. // known at the time the binary was compiled.
  1207. /**
  1208. * Gets the raw enum value at the given index.
  1209. *
  1210. * @param index The index of the raw enum value to get.
  1211. *
  1212. * @return The raw enum value at the given index.
  1213. **/
  1214. - (int32_t)rawValueAtIndex:(NSUInteger)index;
  1215. /**
  1216. * Enumerates the values on this array with the given block.
  1217. *
  1218. * @param block The block to enumerate with.
  1219. * **value**: The current value being enumerated.
  1220. * **idx**: The index of the current value.
  1221. * **stop**: A pointer to a boolean that when set stops the enumeration.
  1222. **/
  1223. - (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
  1224. /**
  1225. * Enumerates the values on this array with the given block.
  1226. *
  1227. * @param opts Options to control the enumeration.
  1228. * @param block The block to enumerate with.
  1229. * **value**: The current value being enumerated.
  1230. * **idx**: The index of the current value.
  1231. * **stop**: A pointer to a boolean that when set stops the enumeration.
  1232. **/
  1233. - (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
  1234. usingBlock:(void (NS_NOESCAPE ^)(int32_t value, NSUInteger idx, BOOL *stop))block;
  1235. // If value is not a valid enumerator as defined by validationFunc, these
  1236. // methods will assert in debug, and will log in release and assign the value
  1237. // to the default value. Use the rawValue methods below to assign non enumerator
  1238. // values.
  1239. /**
  1240. * Adds a value to this array.
  1241. *
  1242. * @param value The value to add to this array.
  1243. **/
  1244. - (void)addValue:(int32_t)value;
  1245. /**
  1246. * Adds values to this array.
  1247. *
  1248. * @param values The values to add to this array.
  1249. * @param count The number of elements to add.
  1250. **/
  1251. - (void)addValues:(const int32_t [__nullable])values count:(NSUInteger)count;
  1252. /**
  1253. * Inserts a value into the given position.
  1254. *
  1255. * @param value The value to add to this array.
  1256. * @param index The index into which to insert the value.
  1257. **/
  1258. - (void)insertValue:(int32_t)value atIndex:(NSUInteger)index;
  1259. /**
  1260. * Replaces the value at the given index with the given value.
  1261. *
  1262. * @param index The index for which to replace the value.
  1263. * @param value The value to replace with.
  1264. **/
  1265. - (void)replaceValueAtIndex:(NSUInteger)index withValue:(int32_t)value;
  1266. // These methods bypass the validationFunc to provide setting of values that were not
  1267. // known at the time the binary was compiled.
  1268. /**
  1269. * Adds a raw enum value to this array.
  1270. *
  1271. * @note This method bypass the validationFunc to enable the setting of values that
  1272. * were not known at the time the binary was compiled.
  1273. *
  1274. * @param value The raw enum value to add to the array.
  1275. **/
  1276. - (void)addRawValue:(int32_t)value;
  1277. /**
  1278. * Adds raw enum values to this array.
  1279. *
  1280. * @note This method bypass the validationFunc to enable the setting of values that
  1281. * were not known at the time the binary was compiled.
  1282. *
  1283. * @param array Array containing the raw enum values to add to this array.
  1284. **/
  1285. - (void)addRawValuesFromArray:(GPBEnumArray *)array;
  1286. /**
  1287. * Adds raw enum values to this array.
  1288. *
  1289. * @note This method bypass the validationFunc to enable the setting of values that
  1290. * were not known at the time the binary was compiled.
  1291. *
  1292. * @param values Array containing the raw enum values to add to this array.
  1293. * @param count The number of raw values to add.
  1294. **/
  1295. - (void)addRawValues:(const int32_t [__nullable])values count:(NSUInteger)count;
  1296. /**
  1297. * Inserts a raw enum value at the given index.
  1298. *
  1299. * @note This method bypass the validationFunc to enable the setting of values that
  1300. * were not known at the time the binary was compiled.
  1301. *
  1302. * @param value Raw enum value to add.
  1303. * @param index The index into which to insert the value.
  1304. **/
  1305. - (void)insertRawValue:(int32_t)value atIndex:(NSUInteger)index;
  1306. /**
  1307. * Replaces the raw enum value at the given index with the given value.
  1308. *
  1309. * @note This method bypass the validationFunc to enable the setting of values that
  1310. * were not known at the time the binary was compiled.
  1311. *
  1312. * @param index The index for which to replace the value.
  1313. * @param value The raw enum value to replace with.
  1314. **/
  1315. - (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(int32_t)value;
  1316. // No validation applies to these methods.
  1317. /**
  1318. * Removes the value at the given index.
  1319. *
  1320. * @param index The index of the value to remove.
  1321. **/
  1322. - (void)removeValueAtIndex:(NSUInteger)index;
  1323. /**
  1324. * Removes all the values from this array.
  1325. **/
  1326. - (void)removeAll;
  1327. /**
  1328. * Exchanges the values between the given indexes.
  1329. *
  1330. * @param idx1 The index of the first element to exchange.
  1331. * @param idx2 The index of the second element to exchange.
  1332. **/
  1333. - (void)exchangeValueAtIndex:(NSUInteger)idx1
  1334. withValueAtIndex:(NSUInteger)idx2;
  1335. @end
  1336. // clang-format on
  1337. //%PDDM-EXPAND-END DECLARE_ARRAYS()
  1338. NS_ASSUME_NONNULL_END
  1339. //%PDDM-DEFINE DECLARE_ARRAYS()
  1340. //%ARRAY_INTERFACE_SIMPLE(Int32, int32_t)
  1341. //%ARRAY_INTERFACE_SIMPLE(UInt32, uint32_t)
  1342. //%ARRAY_INTERFACE_SIMPLE(Int64, int64_t)
  1343. //%ARRAY_INTERFACE_SIMPLE(UInt64, uint64_t)
  1344. //%ARRAY_INTERFACE_SIMPLE(Float, float)
  1345. //%ARRAY_INTERFACE_SIMPLE(Double, double)
  1346. //%ARRAY_INTERFACE_SIMPLE(Bool, BOOL)
  1347. //%ARRAY_INTERFACE_ENUM(Enum, int32_t)
  1348. //
  1349. // The common case (everything but Enum)
  1350. //
  1351. //%PDDM-DEFINE ARRAY_INTERFACE_SIMPLE(NAME, TYPE)
  1352. //%#pragma mark - NAME
  1353. //%
  1354. //%/**
  1355. //% * Class used for repeated fields of ##TYPE## values. This performs better than
  1356. //% * boxing into NSNumbers in NSArrays.
  1357. //% *
  1358. //% * @note This class is not meant to be subclassed.
  1359. //% **/
  1360. //%@interface GPB##NAME##Array : NSObject <NSCopying>
  1361. //%
  1362. //%/** The number of elements contained in the array. */
  1363. //%@property(nonatomic, readonly) NSUInteger count;
  1364. //%
  1365. //%/**
  1366. //% * @return A newly instanced and empty GPB##NAME##Array.
  1367. //% **/
  1368. //%+ (instancetype)array;
  1369. //%
  1370. //%/**
  1371. //% * Creates and initializes a GPB##NAME##Array with the single element given.
  1372. //% *
  1373. //% * @param value The value to be placed in the array.
  1374. //% *
  1375. //% * @return A newly instanced GPB##NAME##Array with value in it.
  1376. //% **/
  1377. //%+ (instancetype)arrayWithValue:(TYPE)value;
  1378. //%
  1379. //%/**
  1380. //% * Creates and initializes a GPB##NAME##Array with the contents of the given
  1381. //% * array.
  1382. //% *
  1383. //% * @param array Array with the contents to be put into the new array.
  1384. //% *
  1385. //% * @return A newly instanced GPB##NAME##Array with the contents of array.
  1386. //% **/
  1387. //%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
  1388. //%
  1389. //%/**
  1390. //% * Creates and initializes a GPB##NAME##Array with the given capacity.
  1391. //% *
  1392. //% * @param count The capacity needed for the array.
  1393. //% *
  1394. //% * @return A newly instanced GPB##NAME##Array with a capacity of count.
  1395. //% **/
  1396. //%+ (instancetype)arrayWithCapacity:(NSUInteger)count;
  1397. //%
  1398. //%/**
  1399. //% * @return A newly initialized and empty GPB##NAME##Array.
  1400. //% **/
  1401. //%- (instancetype)init NS_DESIGNATED_INITIALIZER;
  1402. //%
  1403. //%/**
  1404. //% * Initializes the array, copying the given values.
  1405. //% *
  1406. //% * @param values An array with the values to put inside this array.
  1407. //% * @param count The number of elements to copy into the array.
  1408. //% *
  1409. //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
  1410. //% **/
  1411. //%- (instancetype)initWithValues:(const TYPE [__nullable])values
  1412. //% count:(NSUInteger)count;
  1413. //%
  1414. //%/**
  1415. //% * Initializes the array, copying the given values.
  1416. //% *
  1417. //% * @param array An array with the values to put inside this array.
  1418. //% *
  1419. //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
  1420. //% **/
  1421. //%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
  1422. //%
  1423. //%/**
  1424. //% * Initializes the array with the given capacity.
  1425. //% *
  1426. //% * @param count The capacity needed for the array.
  1427. //% *
  1428. //% * @return A newly initialized GPB##NAME##Array with a capacity of count.
  1429. //% **/
  1430. //%- (instancetype)initWithCapacity:(NSUInteger)count;
  1431. //%
  1432. //%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, Basic)
  1433. //%
  1434. //%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, Basic)
  1435. //%
  1436. //%@end
  1437. //%
  1438. //
  1439. // Macros specific to Enums (to tweak their interface).
  1440. //
  1441. //%PDDM-DEFINE ARRAY_INTERFACE_ENUM(NAME, TYPE)
  1442. //%#pragma mark - NAME
  1443. //%
  1444. //%/**
  1445. //% * This class is used for repeated fields of ##TYPE## values. This performs
  1446. //% * better than boxing into NSNumbers in NSArrays.
  1447. //% *
  1448. //% * @note This class is not meant to be subclassed.
  1449. //% **/
  1450. //%@interface GPB##NAME##Array : NSObject <NSCopying>
  1451. //%
  1452. //%/** The number of elements contained in the array. */
  1453. //%@property(nonatomic, readonly) NSUInteger count;
  1454. //%/** The validation function to check if the enums are valid. */
  1455. //%@property(nonatomic, readonly) GPBEnumValidationFunc validationFunc;
  1456. //%
  1457. //%/**
  1458. //% * @return A newly instanced and empty GPB##NAME##Array.
  1459. //% **/
  1460. //%+ (instancetype)array;
  1461. //%
  1462. //%/**
  1463. //% * Creates and initializes a GPB##NAME##Array with the enum validation function
  1464. //% * given.
  1465. //% *
  1466. //% * @param func The enum validation function for the array.
  1467. //% *
  1468. //% * @return A newly instanced GPB##NAME##Array.
  1469. //% **/
  1470. //%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func;
  1471. //%
  1472. //%/**
  1473. //% * Creates and initializes a GPB##NAME##Array with the enum validation function
  1474. //% * given and the single raw value given.
  1475. //% *
  1476. //% * @param func The enum validation function for the array.
  1477. //% * @param value The raw value to add to this array.
  1478. //% *
  1479. //% * @return A newly instanced GPB##NAME##Array.
  1480. //% **/
  1481. //%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1482. //% rawValue:(TYPE)value;
  1483. //%
  1484. //%/**
  1485. //% * Creates and initializes a GPB##NAME##Array that adds the elements from the
  1486. //% * given array.
  1487. //% *
  1488. //% * @param array Array containing the values to add to the new array.
  1489. //% *
  1490. //% * @return A newly instanced GPB##NAME##Array.
  1491. //% **/
  1492. //%+ (instancetype)arrayWithValueArray:(GPB##NAME##Array *)array;
  1493. //%
  1494. //%/**
  1495. //% * Creates and initializes a GPB##NAME##Array with the given enum validation
  1496. //% * function and with the givencapacity.
  1497. //% *
  1498. //% * @param func The enum validation function for the array.
  1499. //% * @param count The capacity needed for the array.
  1500. //% *
  1501. //% * @return A newly instanced GPB##NAME##Array with a capacity of count.
  1502. //% **/
  1503. //%+ (instancetype)arrayWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1504. //% capacity:(NSUInteger)count;
  1505. //%
  1506. //%/**
  1507. //% * Initializes the array with the given enum validation function.
  1508. //% *
  1509. //% * @param func The enum validation function for the array.
  1510. //% *
  1511. //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
  1512. //% **/
  1513. //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1514. //% NS_DESIGNATED_INITIALIZER;
  1515. //%
  1516. //%/**
  1517. //% * Initializes the array, copying the given values.
  1518. //% *
  1519. //% * @param func The enum validation function for the array.
  1520. //% * @param values An array with the values to put inside this array.
  1521. //% * @param count The number of elements to copy into the array.
  1522. //% *
  1523. //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
  1524. //% **/
  1525. //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1526. //% rawValues:(const TYPE [__nullable])values
  1527. //% count:(NSUInteger)count;
  1528. //%
  1529. //%/**
  1530. //% * Initializes the array, copying the given values.
  1531. //% *
  1532. //% * @param array An array with the values to put inside this array.
  1533. //% *
  1534. //% * @return A newly initialized GPB##NAME##Array with a copy of the values.
  1535. //% **/
  1536. //%- (instancetype)initWithValueArray:(GPB##NAME##Array *)array;
  1537. //%
  1538. //%/**
  1539. //% * Initializes the array with the given capacity.
  1540. //% *
  1541. //% * @param func The enum validation function for the array.
  1542. //% * @param count The capacity needed for the array.
  1543. //% *
  1544. //% * @return A newly initialized GPB##NAME##Array with a capacity of count.
  1545. //% **/
  1546. //%- (instancetype)initWithValidationFunction:(nullable GPBEnumValidationFunc)func
  1547. //% capacity:(NSUInteger)count;
  1548. //%
  1549. //%// These will return kGPBUnrecognizedEnumeratorValue if the value at index is not a
  1550. //%// valid enumerator as defined by validationFunc. If the actual value is
  1551. //%// desired, use "raw" version of the method.
  1552. //%
  1553. //%ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, NAME)
  1554. //%
  1555. //%// These methods bypass the validationFunc to provide access to values that were not
  1556. //%// known at the time the binary was compiled.
  1557. //%
  1558. //%/**
  1559. //% * Gets the raw enum value at the given index.
  1560. //% *
  1561. //% * @param index The index of the raw enum value to get.
  1562. //% *
  1563. //% * @return The raw enum value at the given index.
  1564. //% **/
  1565. //%- (TYPE)rawValueAtIndex:(NSUInteger)index;
  1566. //%
  1567. //%/**
  1568. //% * Enumerates the values on this array with the given block.
  1569. //% *
  1570. //% * @param block The block to enumerate with.
  1571. //% * **value**: The current value being enumerated.
  1572. //% * **idx**: The index of the current value.
  1573. //% * **stop**: A pointer to a boolean that when set stops the enumeration.
  1574. //% **/
  1575. //%- (void)enumerateRawValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
  1576. //%
  1577. //%/**
  1578. //% * Enumerates the values on this array with the given block.
  1579. //% *
  1580. //% * @param opts Options to control the enumeration.
  1581. //% * @param block The block to enumerate with.
  1582. //% * **value**: The current value being enumerated.
  1583. //% * **idx**: The index of the current value.
  1584. //% * **stop**: A pointer to a boolean that when set stops the enumeration.
  1585. //% **/
  1586. //%- (void)enumerateRawValuesWithOptions:(NSEnumerationOptions)opts
  1587. //% usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
  1588. //%
  1589. //%// If value is not a valid enumerator as defined by validationFunc, these
  1590. //%// methods will assert in debug, and will log in release and assign the value
  1591. //%// to the default value. Use the rawValue methods below to assign non enumerator
  1592. //%// values.
  1593. //%
  1594. //%ARRAY_MUTABLE_INTERFACE(NAME, TYPE, NAME)
  1595. //%
  1596. //%@end
  1597. //%
  1598. //%PDDM-DEFINE ARRAY_IMMUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
  1599. //%/**
  1600. //% * Gets the value at the given index.
  1601. //% *
  1602. //% * @param index The index of the value to get.
  1603. //% *
  1604. //% * @return The value at the given index.
  1605. //% **/
  1606. //%- (TYPE)valueAtIndex:(NSUInteger)index;
  1607. //%
  1608. //%/**
  1609. //% * Enumerates the values on this array with the given block.
  1610. //% *
  1611. //% * @param block The block to enumerate with.
  1612. //% * **value**: The current value being enumerated.
  1613. //% * **idx**: The index of the current value.
  1614. //% * **stop**: A pointer to a boolean that when set stops the enumeration.
  1615. //% **/
  1616. //%- (void)enumerateValuesWithBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
  1617. //%
  1618. //%/**
  1619. //% * Enumerates the values on this array with the given block.
  1620. //% *
  1621. //% * @param opts Options to control the enumeration.
  1622. //% * @param block The block to enumerate with.
  1623. //% * **value**: The current value being enumerated.
  1624. //% * **idx**: The index of the current value.
  1625. //% * **stop**: A pointer to a boolean that when set stops the enumeration.
  1626. //% **/
  1627. //%- (void)enumerateValuesWithOptions:(NSEnumerationOptions)opts
  1628. //% usingBlock:(void (NS_NOESCAPE ^)(TYPE value, NSUInteger idx, BOOL *stop))block;
  1629. //%PDDM-DEFINE ARRAY_MUTABLE_INTERFACE(NAME, TYPE, HELPER_NAME)
  1630. //%/**
  1631. //% * Adds a value to this array.
  1632. //% *
  1633. //% * @param value The value to add to this array.
  1634. //% **/
  1635. //%- (void)addValue:(TYPE)value;
  1636. //%
  1637. //%/**
  1638. //% * Adds values to this array.
  1639. //% *
  1640. //% * @param values The values to add to this array.
  1641. //% * @param count The number of elements to add.
  1642. //% **/
  1643. //%- (void)addValues:(const TYPE [__nullable])values count:(NSUInteger)count;
  1644. //%
  1645. //%ARRAY_EXTRA_MUTABLE_METHODS1_##HELPER_NAME(NAME, TYPE)
  1646. //%/**
  1647. //% * Inserts a value into the given position.
  1648. //% *
  1649. //% * @param value The value to add to this array.
  1650. //% * @param index The index into which to insert the value.
  1651. //% **/
  1652. //%- (void)insertValue:(TYPE)value atIndex:(NSUInteger)index;
  1653. //%
  1654. //%/**
  1655. //% * Replaces the value at the given index with the given value.
  1656. //% *
  1657. //% * @param index The index for which to replace the value.
  1658. //% * @param value The value to replace with.
  1659. //% **/
  1660. //%- (void)replaceValueAtIndex:(NSUInteger)index withValue:(TYPE)value;
  1661. //%ARRAY_EXTRA_MUTABLE_METHODS2_##HELPER_NAME(NAME, TYPE)
  1662. //%/**
  1663. //% * Removes the value at the given index.
  1664. //% *
  1665. //% * @param index The index of the value to remove.
  1666. //% **/
  1667. //%- (void)removeValueAtIndex:(NSUInteger)index;
  1668. //%
  1669. //%/**
  1670. //% * Removes all the values from this array.
  1671. //% **/
  1672. //%- (void)removeAll;
  1673. //%
  1674. //%/**
  1675. //% * Exchanges the values between the given indexes.
  1676. //% *
  1677. //% * @param idx1 The index of the first element to exchange.
  1678. //% * @param idx2 The index of the second element to exchange.
  1679. //% **/
  1680. //%- (void)exchangeValueAtIndex:(NSUInteger)idx1
  1681. //% withValueAtIndex:(NSUInteger)idx2;
  1682. //
  1683. // These are hooks invoked by the above to do insert as needed.
  1684. //
  1685. //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Basic(NAME, TYPE)
  1686. //%/**
  1687. //% * Adds the values from the given array to this array.
  1688. //% *
  1689. //% * @param array The array containing the elements to add to this array.
  1690. //% **/
  1691. //%- (void)addValuesFromArray:(GPB##NAME##Array *)array;
  1692. //%
  1693. //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Basic(NAME, TYPE)
  1694. // Empty
  1695. //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS1_Enum(NAME, TYPE)
  1696. // Empty
  1697. //%PDDM-DEFINE ARRAY_EXTRA_MUTABLE_METHODS2_Enum(NAME, TYPE)
  1698. //%
  1699. //%// These methods bypass the validationFunc to provide setting of values that were not
  1700. //%// known at the time the binary was compiled.
  1701. //%
  1702. //%/**
  1703. //% * Adds a raw enum value to this array.
  1704. //% *
  1705. //% * @note This method bypass the validationFunc to enable the setting of values that
  1706. //% * were not known at the time the binary was compiled.
  1707. //% *
  1708. //% * @param value The raw enum value to add to the array.
  1709. //% **/
  1710. //%- (void)addRawValue:(TYPE)value;
  1711. //%
  1712. //%/**
  1713. //% * Adds raw enum values to this array.
  1714. //% *
  1715. //% * @note This method bypass the validationFunc to enable the setting of values that
  1716. //% * were not known at the time the binary was compiled.
  1717. //% *
  1718. //% * @param array Array containing the raw enum values to add to this array.
  1719. //% **/
  1720. //%- (void)addRawValuesFromArray:(GPB##NAME##Array *)array;
  1721. //%
  1722. //%/**
  1723. //% * Adds raw enum values to this array.
  1724. //% *
  1725. //% * @note This method bypass the validationFunc to enable the setting of values that
  1726. //% * were not known at the time the binary was compiled.
  1727. //% *
  1728. //% * @param values Array containing the raw enum values to add to this array.
  1729. //% * @param count The number of raw values to add.
  1730. //% **/
  1731. //%- (void)addRawValues:(const TYPE [__nullable])values count:(NSUInteger)count;
  1732. //%
  1733. //%/**
  1734. //% * Inserts a raw enum value at the given index.
  1735. //% *
  1736. //% * @note This method bypass the validationFunc to enable the setting of values that
  1737. //% * were not known at the time the binary was compiled.
  1738. //% *
  1739. //% * @param value Raw enum value to add.
  1740. //% * @param index The index into which to insert the value.
  1741. //% **/
  1742. //%- (void)insertRawValue:(TYPE)value atIndex:(NSUInteger)index;
  1743. //%
  1744. //%/**
  1745. //% * Replaces the raw enum value at the given index with the given value.
  1746. //% *
  1747. //% * @note This method bypass the validationFunc to enable the setting of values that
  1748. //% * were not known at the time the binary was compiled.
  1749. //% *
  1750. //% * @param index The index for which to replace the value.
  1751. //% * @param value The raw enum value to replace with.
  1752. //% **/
  1753. //%- (void)replaceValueAtIndex:(NSUInteger)index withRawValue:(TYPE)value;
  1754. //%
  1755. //%// No validation applies to these methods.
  1756. //%