GPBArray.h 59 KB

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