Masterarbeit Richard Stern. Flutter App, sich mit einem Bluetooth-Gerät verbindet und Berührungen auf einem Sensor visualisiert.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GPBArray.h 59KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967
  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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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 (^)(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. //%