GPBArray.h 59 KB

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