unittest_proto3.pb.swift 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613
  1. // DO NOT EDIT.
  2. // swift-format-ignore-file
  3. // swiftlint:disable all
  4. //
  5. // Generated by the Swift generator plugin for the protocol buffer compiler.
  6. // Source: unittest_proto3.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Protocol Buffers - Google's data interchange format
  11. // Copyright 2008 Google Inc. All rights reserved.
  12. // https://developers.google.com/protocol-buffers/
  13. //
  14. // Redistribution and use in source and binary forms, with or without
  15. // modification, are permitted provided that the following conditions are
  16. // met:
  17. //
  18. // * Redistributions of source code must retain the above copyright
  19. // notice, this list of conditions and the following disclaimer.
  20. // * Redistributions in binary form must reproduce the above
  21. // copyright notice, this list of conditions and the following disclaimer
  22. // in the documentation and/or other materials provided with the
  23. // distribution.
  24. // * Neither the name of Google Inc. nor the names of its
  25. // contributors may be used to endorse or promote products derived from
  26. // this software without specific prior written permission.
  27. //
  28. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  29. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  30. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  31. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  32. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  33. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  34. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  35. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  36. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  38. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. import Foundation
  40. import SwiftProtobuf
  41. // If the compiler emits an error on this type, it is because this file
  42. // was generated by a version of the `protoc` Swift plug-in that is
  43. // incompatible with the version of SwiftProtobuf to which you are linking.
  44. // Please ensure that you are building against the same version of the API
  45. // that was used to generate this file.
  46. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  47. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  48. typealias Version = _2
  49. }
  50. enum SwiftProtoTesting_Proto3_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
  51. typealias RawValue = Int
  52. case foreignZero // = 0
  53. case foreignFoo // = 4
  54. case foreignBar // = 5
  55. case foreignBaz // = 6
  56. case UNRECOGNIZED(Int)
  57. init() {
  58. self = .foreignZero
  59. }
  60. init?(rawValue: Int) {
  61. switch rawValue {
  62. case 0: self = .foreignZero
  63. case 4: self = .foreignFoo
  64. case 5: self = .foreignBar
  65. case 6: self = .foreignBaz
  66. default: self = .UNRECOGNIZED(rawValue)
  67. }
  68. }
  69. var rawValue: Int {
  70. switch self {
  71. case .foreignZero: return 0
  72. case .foreignFoo: return 4
  73. case .foreignBar: return 5
  74. case .foreignBaz: return 6
  75. case .UNRECOGNIZED(let i): return i
  76. }
  77. }
  78. // The compiler won't synthesize support with the UNRECOGNIZED case.
  79. static let allCases: [SwiftProtoTesting_Proto3_ForeignEnum] = [
  80. .foreignZero,
  81. .foreignFoo,
  82. .foreignBar,
  83. .foreignBaz,
  84. ]
  85. }
  86. /// This proto includes every type of field in both singular and repeated
  87. /// forms.
  88. struct SwiftProtoTesting_Proto3_TestAllTypes: @unchecked Sendable {
  89. // SwiftProtobuf.Message conformance is added in an extension below. See the
  90. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  91. // methods supported on all messages.
  92. /// Singular
  93. var optionalInt32: Int32 {
  94. get {return _storage._optionalInt32}
  95. set {_uniqueStorage()._optionalInt32 = newValue}
  96. }
  97. var optionalInt64: Int64 {
  98. get {return _storage._optionalInt64}
  99. set {_uniqueStorage()._optionalInt64 = newValue}
  100. }
  101. var optionalUint32: UInt32 {
  102. get {return _storage._optionalUint32}
  103. set {_uniqueStorage()._optionalUint32 = newValue}
  104. }
  105. var optionalUint64: UInt64 {
  106. get {return _storage._optionalUint64}
  107. set {_uniqueStorage()._optionalUint64 = newValue}
  108. }
  109. var optionalSint32: Int32 {
  110. get {return _storage._optionalSint32}
  111. set {_uniqueStorage()._optionalSint32 = newValue}
  112. }
  113. var optionalSint64: Int64 {
  114. get {return _storage._optionalSint64}
  115. set {_uniqueStorage()._optionalSint64 = newValue}
  116. }
  117. var optionalFixed32: UInt32 {
  118. get {return _storage._optionalFixed32}
  119. set {_uniqueStorage()._optionalFixed32 = newValue}
  120. }
  121. var optionalFixed64: UInt64 {
  122. get {return _storage._optionalFixed64}
  123. set {_uniqueStorage()._optionalFixed64 = newValue}
  124. }
  125. var optionalSfixed32: Int32 {
  126. get {return _storage._optionalSfixed32}
  127. set {_uniqueStorage()._optionalSfixed32 = newValue}
  128. }
  129. var optionalSfixed64: Int64 {
  130. get {return _storage._optionalSfixed64}
  131. set {_uniqueStorage()._optionalSfixed64 = newValue}
  132. }
  133. var optionalFloat: Float {
  134. get {return _storage._optionalFloat}
  135. set {_uniqueStorage()._optionalFloat = newValue}
  136. }
  137. var optionalDouble: Double {
  138. get {return _storage._optionalDouble}
  139. set {_uniqueStorage()._optionalDouble = newValue}
  140. }
  141. var optionalBool: Bool {
  142. get {return _storage._optionalBool}
  143. set {_uniqueStorage()._optionalBool = newValue}
  144. }
  145. var optionalString: String {
  146. get {return _storage._optionalString}
  147. set {_uniqueStorage()._optionalString = newValue}
  148. }
  149. var optionalBytes: Data {
  150. get {return _storage._optionalBytes}
  151. set {_uniqueStorage()._optionalBytes = newValue}
  152. }
  153. var optionalNestedMessage: SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage {
  154. get {return _storage._optionalNestedMessage ?? SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage()}
  155. set {_uniqueStorage()._optionalNestedMessage = newValue}
  156. }
  157. /// Returns true if `optionalNestedMessage` has been explicitly set.
  158. var hasOptionalNestedMessage: Bool {return _storage._optionalNestedMessage != nil}
  159. /// Clears the value of `optionalNestedMessage`. Subsequent reads from it will return its default value.
  160. mutating func clearOptionalNestedMessage() {_uniqueStorage()._optionalNestedMessage = nil}
  161. var optionalForeignMessage: SwiftProtoTesting_Proto3_ForeignMessage {
  162. get {return _storage._optionalForeignMessage ?? SwiftProtoTesting_Proto3_ForeignMessage()}
  163. set {_uniqueStorage()._optionalForeignMessage = newValue}
  164. }
  165. /// Returns true if `optionalForeignMessage` has been explicitly set.
  166. var hasOptionalForeignMessage: Bool {return _storage._optionalForeignMessage != nil}
  167. /// Clears the value of `optionalForeignMessage`. Subsequent reads from it will return its default value.
  168. mutating func clearOptionalForeignMessage() {_uniqueStorage()._optionalForeignMessage = nil}
  169. var optionalImportMessage: SwiftProtoTesting_Import_ImportMessage {
  170. get {return _storage._optionalImportMessage ?? SwiftProtoTesting_Import_ImportMessage()}
  171. set {_uniqueStorage()._optionalImportMessage = newValue}
  172. }
  173. /// Returns true if `optionalImportMessage` has been explicitly set.
  174. var hasOptionalImportMessage: Bool {return _storage._optionalImportMessage != nil}
  175. /// Clears the value of `optionalImportMessage`. Subsequent reads from it will return its default value.
  176. mutating func clearOptionalImportMessage() {_uniqueStorage()._optionalImportMessage = nil}
  177. var optionalNestedEnum: SwiftProtoTesting_Proto3_TestAllTypes.NestedEnum {
  178. get {return _storage._optionalNestedEnum}
  179. set {_uniqueStorage()._optionalNestedEnum = newValue}
  180. }
  181. var optionalForeignEnum: SwiftProtoTesting_Proto3_ForeignEnum {
  182. get {return _storage._optionalForeignEnum}
  183. set {_uniqueStorage()._optionalForeignEnum = newValue}
  184. }
  185. var optionalStringPiece: String {
  186. get {return _storage._optionalStringPiece}
  187. set {_uniqueStorage()._optionalStringPiece = newValue}
  188. }
  189. var optionalCord: String {
  190. get {return _storage._optionalCord}
  191. set {_uniqueStorage()._optionalCord = newValue}
  192. }
  193. /// Defined in unittest_import_public.proto
  194. var optionalPublicImportMessage: SwiftProtoTesting_Import_PublicImportMessage {
  195. get {return _storage._optionalPublicImportMessage ?? SwiftProtoTesting_Import_PublicImportMessage()}
  196. set {_uniqueStorage()._optionalPublicImportMessage = newValue}
  197. }
  198. /// Returns true if `optionalPublicImportMessage` has been explicitly set.
  199. var hasOptionalPublicImportMessage: Bool {return _storage._optionalPublicImportMessage != nil}
  200. /// Clears the value of `optionalPublicImportMessage`. Subsequent reads from it will return its default value.
  201. mutating func clearOptionalPublicImportMessage() {_uniqueStorage()._optionalPublicImportMessage = nil}
  202. var optionalLazyMessage: SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage {
  203. get {return _storage._optionalLazyMessage ?? SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage()}
  204. set {_uniqueStorage()._optionalLazyMessage = newValue}
  205. }
  206. /// Returns true if `optionalLazyMessage` has been explicitly set.
  207. var hasOptionalLazyMessage: Bool {return _storage._optionalLazyMessage != nil}
  208. /// Clears the value of `optionalLazyMessage`. Subsequent reads from it will return its default value.
  209. mutating func clearOptionalLazyMessage() {_uniqueStorage()._optionalLazyMessage = nil}
  210. var optionalUnverifiedLazyMessage: SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage {
  211. get {return _storage._optionalUnverifiedLazyMessage ?? SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage()}
  212. set {_uniqueStorage()._optionalUnverifiedLazyMessage = newValue}
  213. }
  214. /// Returns true if `optionalUnverifiedLazyMessage` has been explicitly set.
  215. var hasOptionalUnverifiedLazyMessage: Bool {return _storage._optionalUnverifiedLazyMessage != nil}
  216. /// Clears the value of `optionalUnverifiedLazyMessage`. Subsequent reads from it will return its default value.
  217. mutating func clearOptionalUnverifiedLazyMessage() {_uniqueStorage()._optionalUnverifiedLazyMessage = nil}
  218. var optionalLazyImportMessage: SwiftProtoTesting_Import_ImportMessage {
  219. get {return _storage._optionalLazyImportMessage ?? SwiftProtoTesting_Import_ImportMessage()}
  220. set {_uniqueStorage()._optionalLazyImportMessage = newValue}
  221. }
  222. /// Returns true if `optionalLazyImportMessage` has been explicitly set.
  223. var hasOptionalLazyImportMessage: Bool {return _storage._optionalLazyImportMessage != nil}
  224. /// Clears the value of `optionalLazyImportMessage`. Subsequent reads from it will return its default value.
  225. mutating func clearOptionalLazyImportMessage() {_uniqueStorage()._optionalLazyImportMessage = nil}
  226. /// Repeated
  227. var repeatedInt32: [Int32] {
  228. get {return _storage._repeatedInt32}
  229. set {_uniqueStorage()._repeatedInt32 = newValue}
  230. }
  231. var repeatedInt64: [Int64] {
  232. get {return _storage._repeatedInt64}
  233. set {_uniqueStorage()._repeatedInt64 = newValue}
  234. }
  235. var repeatedUint32: [UInt32] {
  236. get {return _storage._repeatedUint32}
  237. set {_uniqueStorage()._repeatedUint32 = newValue}
  238. }
  239. var repeatedUint64: [UInt64] {
  240. get {return _storage._repeatedUint64}
  241. set {_uniqueStorage()._repeatedUint64 = newValue}
  242. }
  243. var repeatedSint32: [Int32] {
  244. get {return _storage._repeatedSint32}
  245. set {_uniqueStorage()._repeatedSint32 = newValue}
  246. }
  247. var repeatedSint64: [Int64] {
  248. get {return _storage._repeatedSint64}
  249. set {_uniqueStorage()._repeatedSint64 = newValue}
  250. }
  251. var repeatedFixed32: [UInt32] {
  252. get {return _storage._repeatedFixed32}
  253. set {_uniqueStorage()._repeatedFixed32 = newValue}
  254. }
  255. var repeatedFixed64: [UInt64] {
  256. get {return _storage._repeatedFixed64}
  257. set {_uniqueStorage()._repeatedFixed64 = newValue}
  258. }
  259. var repeatedSfixed32: [Int32] {
  260. get {return _storage._repeatedSfixed32}
  261. set {_uniqueStorage()._repeatedSfixed32 = newValue}
  262. }
  263. var repeatedSfixed64: [Int64] {
  264. get {return _storage._repeatedSfixed64}
  265. set {_uniqueStorage()._repeatedSfixed64 = newValue}
  266. }
  267. var repeatedFloat: [Float] {
  268. get {return _storage._repeatedFloat}
  269. set {_uniqueStorage()._repeatedFloat = newValue}
  270. }
  271. var repeatedDouble: [Double] {
  272. get {return _storage._repeatedDouble}
  273. set {_uniqueStorage()._repeatedDouble = newValue}
  274. }
  275. var repeatedBool: [Bool] {
  276. get {return _storage._repeatedBool}
  277. set {_uniqueStorage()._repeatedBool = newValue}
  278. }
  279. var repeatedString: [String] {
  280. get {return _storage._repeatedString}
  281. set {_uniqueStorage()._repeatedString = newValue}
  282. }
  283. var repeatedBytes: [Data] {
  284. get {return _storage._repeatedBytes}
  285. set {_uniqueStorage()._repeatedBytes = newValue}
  286. }
  287. var repeatedNestedMessage: [SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage] {
  288. get {return _storage._repeatedNestedMessage}
  289. set {_uniqueStorage()._repeatedNestedMessage = newValue}
  290. }
  291. var repeatedForeignMessage: [SwiftProtoTesting_Proto3_ForeignMessage] {
  292. get {return _storage._repeatedForeignMessage}
  293. set {_uniqueStorage()._repeatedForeignMessage = newValue}
  294. }
  295. var repeatedImportMessage: [SwiftProtoTesting_Import_ImportMessage] {
  296. get {return _storage._repeatedImportMessage}
  297. set {_uniqueStorage()._repeatedImportMessage = newValue}
  298. }
  299. var repeatedNestedEnum: [SwiftProtoTesting_Proto3_TestAllTypes.NestedEnum] {
  300. get {return _storage._repeatedNestedEnum}
  301. set {_uniqueStorage()._repeatedNestedEnum = newValue}
  302. }
  303. var repeatedForeignEnum: [SwiftProtoTesting_Proto3_ForeignEnum] {
  304. get {return _storage._repeatedForeignEnum}
  305. set {_uniqueStorage()._repeatedForeignEnum = newValue}
  306. }
  307. var repeatedStringPiece: [String] {
  308. get {return _storage._repeatedStringPiece}
  309. set {_uniqueStorage()._repeatedStringPiece = newValue}
  310. }
  311. var repeatedCord: [String] {
  312. get {return _storage._repeatedCord}
  313. set {_uniqueStorage()._repeatedCord = newValue}
  314. }
  315. var repeatedLazyMessage: [SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage] {
  316. get {return _storage._repeatedLazyMessage}
  317. set {_uniqueStorage()._repeatedLazyMessage = newValue}
  318. }
  319. var oneofField: OneOf_OneofField? {
  320. get {return _storage._oneofField}
  321. set {_uniqueStorage()._oneofField = newValue}
  322. }
  323. var oneofUint32: UInt32 {
  324. get {
  325. if case .oneofUint32(let v)? = _storage._oneofField {return v}
  326. return 0
  327. }
  328. set {_uniqueStorage()._oneofField = .oneofUint32(newValue)}
  329. }
  330. var oneofNestedMessage: SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage {
  331. get {
  332. if case .oneofNestedMessage(let v)? = _storage._oneofField {return v}
  333. return SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage()
  334. }
  335. set {_uniqueStorage()._oneofField = .oneofNestedMessage(newValue)}
  336. }
  337. var oneofString: String {
  338. get {
  339. if case .oneofString(let v)? = _storage._oneofField {return v}
  340. return String()
  341. }
  342. set {_uniqueStorage()._oneofField = .oneofString(newValue)}
  343. }
  344. var oneofBytes: Data {
  345. get {
  346. if case .oneofBytes(let v)? = _storage._oneofField {return v}
  347. return Data()
  348. }
  349. set {_uniqueStorage()._oneofField = .oneofBytes(newValue)}
  350. }
  351. var unknownFields = SwiftProtobuf.UnknownStorage()
  352. enum OneOf_OneofField: Equatable, @unchecked Sendable {
  353. case oneofUint32(UInt32)
  354. case oneofNestedMessage(SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage)
  355. case oneofString(String)
  356. case oneofBytes(Data)
  357. }
  358. enum NestedEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
  359. typealias RawValue = Int
  360. case zero // = 0
  361. case foo // = 1
  362. case bar // = 2
  363. case baz // = 3
  364. /// Intentionally negative.
  365. case neg // = -1
  366. case UNRECOGNIZED(Int)
  367. init() {
  368. self = .zero
  369. }
  370. init?(rawValue: Int) {
  371. switch rawValue {
  372. case -1: self = .neg
  373. case 0: self = .zero
  374. case 1: self = .foo
  375. case 2: self = .bar
  376. case 3: self = .baz
  377. default: self = .UNRECOGNIZED(rawValue)
  378. }
  379. }
  380. var rawValue: Int {
  381. switch self {
  382. case .neg: return -1
  383. case .zero: return 0
  384. case .foo: return 1
  385. case .bar: return 2
  386. case .baz: return 3
  387. case .UNRECOGNIZED(let i): return i
  388. }
  389. }
  390. // The compiler won't synthesize support with the UNRECOGNIZED case.
  391. static let allCases: [SwiftProtoTesting_Proto3_TestAllTypes.NestedEnum] = [
  392. .zero,
  393. .foo,
  394. .bar,
  395. .baz,
  396. .neg,
  397. ]
  398. }
  399. struct NestedMessage: Sendable {
  400. // SwiftProtobuf.Message conformance is added in an extension below. See the
  401. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  402. // methods supported on all messages.
  403. /// The field name "b" fails to compile in proto1 because it conflicts with
  404. /// a local variable named "b" in one of the generated methods. Doh.
  405. /// This file needs to compile in proto1 to test backwards-compatibility.
  406. var bb: Int32 = 0
  407. var unknownFields = SwiftProtobuf.UnknownStorage()
  408. init() {}
  409. }
  410. init() {}
  411. fileprivate var _storage = _StorageClass.defaultInstance
  412. }
  413. struct SwiftProtoTesting_Proto3_TestPackedTypes: Sendable {
  414. // SwiftProtobuf.Message conformance is added in an extension below. See the
  415. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  416. // methods supported on all messages.
  417. var packedInt32: [Int32] = []
  418. var packedInt64: [Int64] = []
  419. var packedUint32: [UInt32] = []
  420. var packedUint64: [UInt64] = []
  421. var packedSint32: [Int32] = []
  422. var packedSint64: [Int64] = []
  423. var packedFixed32: [UInt32] = []
  424. var packedFixed64: [UInt64] = []
  425. var packedSfixed32: [Int32] = []
  426. var packedSfixed64: [Int64] = []
  427. var packedFloat: [Float] = []
  428. var packedDouble: [Double] = []
  429. var packedBool: [Bool] = []
  430. var packedEnum: [SwiftProtoTesting_Proto3_ForeignEnum] = []
  431. var unknownFields = SwiftProtobuf.UnknownStorage()
  432. init() {}
  433. }
  434. /// Explicitly set packed to false
  435. struct SwiftProtoTesting_Proto3_TestUnpackedTypes: Sendable {
  436. // SwiftProtobuf.Message conformance is added in an extension below. See the
  437. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  438. // methods supported on all messages.
  439. var repeatedInt32: [Int32] = []
  440. var repeatedInt64: [Int64] = []
  441. var repeatedUint32: [UInt32] = []
  442. var repeatedUint64: [UInt64] = []
  443. var repeatedSint32: [Int32] = []
  444. var repeatedSint64: [Int64] = []
  445. var repeatedFixed32: [UInt32] = []
  446. var repeatedFixed64: [UInt64] = []
  447. var repeatedSfixed32: [Int32] = []
  448. var repeatedSfixed64: [Int64] = []
  449. var repeatedFloat: [Float] = []
  450. var repeatedDouble: [Double] = []
  451. var repeatedBool: [Bool] = []
  452. var repeatedNestedEnum: [SwiftProtoTesting_Proto3_TestAllTypes.NestedEnum] = []
  453. var unknownFields = SwiftProtobuf.UnknownStorage()
  454. init() {}
  455. }
  456. /// This proto includes a recursively nested message.
  457. struct SwiftProtoTesting_Proto3_NestedTestAllTypes: @unchecked Sendable {
  458. // SwiftProtobuf.Message conformance is added in an extension below. See the
  459. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  460. // methods supported on all messages.
  461. var child: SwiftProtoTesting_Proto3_NestedTestAllTypes {
  462. get {return _storage._child ?? SwiftProtoTesting_Proto3_NestedTestAllTypes()}
  463. set {_uniqueStorage()._child = newValue}
  464. }
  465. /// Returns true if `child` has been explicitly set.
  466. var hasChild: Bool {return _storage._child != nil}
  467. /// Clears the value of `child`. Subsequent reads from it will return its default value.
  468. mutating func clearChild() {_uniqueStorage()._child = nil}
  469. var payload: SwiftProtoTesting_Proto3_TestAllTypes {
  470. get {return _storage._payload ?? SwiftProtoTesting_Proto3_TestAllTypes()}
  471. set {_uniqueStorage()._payload = newValue}
  472. }
  473. /// Returns true if `payload` has been explicitly set.
  474. var hasPayload: Bool {return _storage._payload != nil}
  475. /// Clears the value of `payload`. Subsequent reads from it will return its default value.
  476. mutating func clearPayload() {_uniqueStorage()._payload = nil}
  477. var unknownFields = SwiftProtobuf.UnknownStorage()
  478. init() {}
  479. fileprivate var _storage = _StorageClass.defaultInstance
  480. }
  481. /// Define these after TestAllTypes to make sure the compiler can handle
  482. /// that.
  483. struct SwiftProtoTesting_Proto3_ForeignMessage: Sendable {
  484. // SwiftProtobuf.Message conformance is added in an extension below. See the
  485. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  486. // methods supported on all messages.
  487. var c: Int32 = 0
  488. var unknownFields = SwiftProtobuf.UnknownStorage()
  489. init() {}
  490. }
  491. /// TestEmptyMessage is used to test behavior of unknown fields.
  492. struct SwiftProtoTesting_Proto3_TestEmptyMessage: Sendable {
  493. // SwiftProtobuf.Message conformance is added in an extension below. See the
  494. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  495. // methods supported on all messages.
  496. var unknownFields = SwiftProtobuf.UnknownStorage()
  497. init() {}
  498. }
  499. /// Test a proto3 defined message with a proto2 as a field that has required fields.
  500. struct SwiftProtoTesting_Proto3_TestProto2Required: Sendable {
  501. // SwiftProtobuf.Message conformance is added in an extension below. See the
  502. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  503. // methods supported on all messages.
  504. var proto2: SwiftProtoTesting_TestRequired {
  505. get {return _proto2 ?? SwiftProtoTesting_TestRequired()}
  506. set {_proto2 = newValue}
  507. }
  508. /// Returns true if `proto2` has been explicitly set.
  509. var hasProto2: Bool {return self._proto2 != nil}
  510. /// Clears the value of `proto2`. Subsequent reads from it will return its default value.
  511. mutating func clearProto2() {self._proto2 = nil}
  512. var unknownFields = SwiftProtobuf.UnknownStorage()
  513. init() {}
  514. fileprivate var _proto2: SwiftProtoTesting_TestRequired? = nil
  515. }
  516. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  517. fileprivate let _protobuf_package = "swift_proto_testing.proto3"
  518. extension SwiftProtoTesting_Proto3_ForeignEnum: SwiftProtobuf._ProtoNameProviding {
  519. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  520. 0: .same(proto: "FOREIGN_ZERO"),
  521. 4: .same(proto: "FOREIGN_FOO"),
  522. 5: .same(proto: "FOREIGN_BAR"),
  523. 6: .same(proto: "FOREIGN_BAZ"),
  524. ]
  525. }
  526. extension SwiftProtoTesting_Proto3_TestAllTypes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  527. static let protoMessageName: String = _protobuf_package + ".TestAllTypes"
  528. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  529. 1: .standard(proto: "optional_int32"),
  530. 2: .standard(proto: "optional_int64"),
  531. 3: .standard(proto: "optional_uint32"),
  532. 4: .standard(proto: "optional_uint64"),
  533. 5: .standard(proto: "optional_sint32"),
  534. 6: .standard(proto: "optional_sint64"),
  535. 7: .standard(proto: "optional_fixed32"),
  536. 8: .standard(proto: "optional_fixed64"),
  537. 9: .standard(proto: "optional_sfixed32"),
  538. 10: .standard(proto: "optional_sfixed64"),
  539. 11: .standard(proto: "optional_float"),
  540. 12: .standard(proto: "optional_double"),
  541. 13: .standard(proto: "optional_bool"),
  542. 14: .standard(proto: "optional_string"),
  543. 15: .standard(proto: "optional_bytes"),
  544. 18: .standard(proto: "optional_nested_message"),
  545. 19: .standard(proto: "optional_foreign_message"),
  546. 20: .standard(proto: "optional_import_message"),
  547. 21: .standard(proto: "optional_nested_enum"),
  548. 22: .standard(proto: "optional_foreign_enum"),
  549. 24: .standard(proto: "optional_string_piece"),
  550. 25: .standard(proto: "optional_cord"),
  551. 26: .standard(proto: "optional_public_import_message"),
  552. 27: .standard(proto: "optional_lazy_message"),
  553. 28: .standard(proto: "optional_unverified_lazy_message"),
  554. 115: .standard(proto: "optional_lazy_import_message"),
  555. 31: .standard(proto: "repeated_int32"),
  556. 32: .standard(proto: "repeated_int64"),
  557. 33: .standard(proto: "repeated_uint32"),
  558. 34: .standard(proto: "repeated_uint64"),
  559. 35: .standard(proto: "repeated_sint32"),
  560. 36: .standard(proto: "repeated_sint64"),
  561. 37: .standard(proto: "repeated_fixed32"),
  562. 38: .standard(proto: "repeated_fixed64"),
  563. 39: .standard(proto: "repeated_sfixed32"),
  564. 40: .standard(proto: "repeated_sfixed64"),
  565. 41: .standard(proto: "repeated_float"),
  566. 42: .standard(proto: "repeated_double"),
  567. 43: .standard(proto: "repeated_bool"),
  568. 44: .standard(proto: "repeated_string"),
  569. 45: .standard(proto: "repeated_bytes"),
  570. 48: .standard(proto: "repeated_nested_message"),
  571. 49: .standard(proto: "repeated_foreign_message"),
  572. 50: .standard(proto: "repeated_import_message"),
  573. 51: .standard(proto: "repeated_nested_enum"),
  574. 52: .standard(proto: "repeated_foreign_enum"),
  575. 54: .standard(proto: "repeated_string_piece"),
  576. 55: .standard(proto: "repeated_cord"),
  577. 57: .standard(proto: "repeated_lazy_message"),
  578. 111: .standard(proto: "oneof_uint32"),
  579. 112: .standard(proto: "oneof_nested_message"),
  580. 113: .standard(proto: "oneof_string"),
  581. 114: .standard(proto: "oneof_bytes"),
  582. ]
  583. fileprivate class _StorageClass {
  584. var _optionalInt32: Int32 = 0
  585. var _optionalInt64: Int64 = 0
  586. var _optionalUint32: UInt32 = 0
  587. var _optionalUint64: UInt64 = 0
  588. var _optionalSint32: Int32 = 0
  589. var _optionalSint64: Int64 = 0
  590. var _optionalFixed32: UInt32 = 0
  591. var _optionalFixed64: UInt64 = 0
  592. var _optionalSfixed32: Int32 = 0
  593. var _optionalSfixed64: Int64 = 0
  594. var _optionalFloat: Float = 0
  595. var _optionalDouble: Double = 0
  596. var _optionalBool: Bool = false
  597. var _optionalString: String = String()
  598. var _optionalBytes: Data = Data()
  599. var _optionalNestedMessage: SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage? = nil
  600. var _optionalForeignMessage: SwiftProtoTesting_Proto3_ForeignMessage? = nil
  601. var _optionalImportMessage: SwiftProtoTesting_Import_ImportMessage? = nil
  602. var _optionalNestedEnum: SwiftProtoTesting_Proto3_TestAllTypes.NestedEnum = .zero
  603. var _optionalForeignEnum: SwiftProtoTesting_Proto3_ForeignEnum = .foreignZero
  604. var _optionalStringPiece: String = String()
  605. var _optionalCord: String = String()
  606. var _optionalPublicImportMessage: SwiftProtoTesting_Import_PublicImportMessage? = nil
  607. var _optionalLazyMessage: SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage? = nil
  608. var _optionalUnverifiedLazyMessage: SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage? = nil
  609. var _optionalLazyImportMessage: SwiftProtoTesting_Import_ImportMessage? = nil
  610. var _repeatedInt32: [Int32] = []
  611. var _repeatedInt64: [Int64] = []
  612. var _repeatedUint32: [UInt32] = []
  613. var _repeatedUint64: [UInt64] = []
  614. var _repeatedSint32: [Int32] = []
  615. var _repeatedSint64: [Int64] = []
  616. var _repeatedFixed32: [UInt32] = []
  617. var _repeatedFixed64: [UInt64] = []
  618. var _repeatedSfixed32: [Int32] = []
  619. var _repeatedSfixed64: [Int64] = []
  620. var _repeatedFloat: [Float] = []
  621. var _repeatedDouble: [Double] = []
  622. var _repeatedBool: [Bool] = []
  623. var _repeatedString: [String] = []
  624. var _repeatedBytes: [Data] = []
  625. var _repeatedNestedMessage: [SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage] = []
  626. var _repeatedForeignMessage: [SwiftProtoTesting_Proto3_ForeignMessage] = []
  627. var _repeatedImportMessage: [SwiftProtoTesting_Import_ImportMessage] = []
  628. var _repeatedNestedEnum: [SwiftProtoTesting_Proto3_TestAllTypes.NestedEnum] = []
  629. var _repeatedForeignEnum: [SwiftProtoTesting_Proto3_ForeignEnum] = []
  630. var _repeatedStringPiece: [String] = []
  631. var _repeatedCord: [String] = []
  632. var _repeatedLazyMessage: [SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage] = []
  633. var _oneofField: SwiftProtoTesting_Proto3_TestAllTypes.OneOf_OneofField?
  634. // This property is used as the initial default value for new instances of the type.
  635. // The type itself is protecting the reference to its storage via CoW semantics.
  636. // This will force a copy to be made of this reference when the first mutation occurs;
  637. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  638. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  639. private init() {}
  640. init(copying source: _StorageClass) {
  641. _optionalInt32 = source._optionalInt32
  642. _optionalInt64 = source._optionalInt64
  643. _optionalUint32 = source._optionalUint32
  644. _optionalUint64 = source._optionalUint64
  645. _optionalSint32 = source._optionalSint32
  646. _optionalSint64 = source._optionalSint64
  647. _optionalFixed32 = source._optionalFixed32
  648. _optionalFixed64 = source._optionalFixed64
  649. _optionalSfixed32 = source._optionalSfixed32
  650. _optionalSfixed64 = source._optionalSfixed64
  651. _optionalFloat = source._optionalFloat
  652. _optionalDouble = source._optionalDouble
  653. _optionalBool = source._optionalBool
  654. _optionalString = source._optionalString
  655. _optionalBytes = source._optionalBytes
  656. _optionalNestedMessage = source._optionalNestedMessage
  657. _optionalForeignMessage = source._optionalForeignMessage
  658. _optionalImportMessage = source._optionalImportMessage
  659. _optionalNestedEnum = source._optionalNestedEnum
  660. _optionalForeignEnum = source._optionalForeignEnum
  661. _optionalStringPiece = source._optionalStringPiece
  662. _optionalCord = source._optionalCord
  663. _optionalPublicImportMessage = source._optionalPublicImportMessage
  664. _optionalLazyMessage = source._optionalLazyMessage
  665. _optionalUnverifiedLazyMessage = source._optionalUnverifiedLazyMessage
  666. _optionalLazyImportMessage = source._optionalLazyImportMessage
  667. _repeatedInt32 = source._repeatedInt32
  668. _repeatedInt64 = source._repeatedInt64
  669. _repeatedUint32 = source._repeatedUint32
  670. _repeatedUint64 = source._repeatedUint64
  671. _repeatedSint32 = source._repeatedSint32
  672. _repeatedSint64 = source._repeatedSint64
  673. _repeatedFixed32 = source._repeatedFixed32
  674. _repeatedFixed64 = source._repeatedFixed64
  675. _repeatedSfixed32 = source._repeatedSfixed32
  676. _repeatedSfixed64 = source._repeatedSfixed64
  677. _repeatedFloat = source._repeatedFloat
  678. _repeatedDouble = source._repeatedDouble
  679. _repeatedBool = source._repeatedBool
  680. _repeatedString = source._repeatedString
  681. _repeatedBytes = source._repeatedBytes
  682. _repeatedNestedMessage = source._repeatedNestedMessage
  683. _repeatedForeignMessage = source._repeatedForeignMessage
  684. _repeatedImportMessage = source._repeatedImportMessage
  685. _repeatedNestedEnum = source._repeatedNestedEnum
  686. _repeatedForeignEnum = source._repeatedForeignEnum
  687. _repeatedStringPiece = source._repeatedStringPiece
  688. _repeatedCord = source._repeatedCord
  689. _repeatedLazyMessage = source._repeatedLazyMessage
  690. _oneofField = source._oneofField
  691. }
  692. }
  693. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  694. if !isKnownUniquelyReferenced(&_storage) {
  695. _storage = _StorageClass(copying: _storage)
  696. }
  697. return _storage
  698. }
  699. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  700. _ = _uniqueStorage()
  701. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  702. while let fieldNumber = try decoder.nextFieldNumber() {
  703. // The use of inline closures is to circumvent an issue where the compiler
  704. // allocates stack space for every case branch when no optimizations are
  705. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  706. switch fieldNumber {
  707. case 1: try { try decoder.decodeSingularInt32Field(value: &_storage._optionalInt32) }()
  708. case 2: try { try decoder.decodeSingularInt64Field(value: &_storage._optionalInt64) }()
  709. case 3: try { try decoder.decodeSingularUInt32Field(value: &_storage._optionalUint32) }()
  710. case 4: try { try decoder.decodeSingularUInt64Field(value: &_storage._optionalUint64) }()
  711. case 5: try { try decoder.decodeSingularSInt32Field(value: &_storage._optionalSint32) }()
  712. case 6: try { try decoder.decodeSingularSInt64Field(value: &_storage._optionalSint64) }()
  713. case 7: try { try decoder.decodeSingularFixed32Field(value: &_storage._optionalFixed32) }()
  714. case 8: try { try decoder.decodeSingularFixed64Field(value: &_storage._optionalFixed64) }()
  715. case 9: try { try decoder.decodeSingularSFixed32Field(value: &_storage._optionalSfixed32) }()
  716. case 10: try { try decoder.decodeSingularSFixed64Field(value: &_storage._optionalSfixed64) }()
  717. case 11: try { try decoder.decodeSingularFloatField(value: &_storage._optionalFloat) }()
  718. case 12: try { try decoder.decodeSingularDoubleField(value: &_storage._optionalDouble) }()
  719. case 13: try { try decoder.decodeSingularBoolField(value: &_storage._optionalBool) }()
  720. case 14: try { try decoder.decodeSingularStringField(value: &_storage._optionalString) }()
  721. case 15: try { try decoder.decodeSingularBytesField(value: &_storage._optionalBytes) }()
  722. case 18: try { try decoder.decodeSingularMessageField(value: &_storage._optionalNestedMessage) }()
  723. case 19: try { try decoder.decodeSingularMessageField(value: &_storage._optionalForeignMessage) }()
  724. case 20: try { try decoder.decodeSingularMessageField(value: &_storage._optionalImportMessage) }()
  725. case 21: try { try decoder.decodeSingularEnumField(value: &_storage._optionalNestedEnum) }()
  726. case 22: try { try decoder.decodeSingularEnumField(value: &_storage._optionalForeignEnum) }()
  727. case 24: try { try decoder.decodeSingularStringField(value: &_storage._optionalStringPiece) }()
  728. case 25: try { try decoder.decodeSingularStringField(value: &_storage._optionalCord) }()
  729. case 26: try { try decoder.decodeSingularMessageField(value: &_storage._optionalPublicImportMessage) }()
  730. case 27: try { try decoder.decodeSingularMessageField(value: &_storage._optionalLazyMessage) }()
  731. case 28: try { try decoder.decodeSingularMessageField(value: &_storage._optionalUnverifiedLazyMessage) }()
  732. case 31: try { try decoder.decodeRepeatedInt32Field(value: &_storage._repeatedInt32) }()
  733. case 32: try { try decoder.decodeRepeatedInt64Field(value: &_storage._repeatedInt64) }()
  734. case 33: try { try decoder.decodeRepeatedUInt32Field(value: &_storage._repeatedUint32) }()
  735. case 34: try { try decoder.decodeRepeatedUInt64Field(value: &_storage._repeatedUint64) }()
  736. case 35: try { try decoder.decodeRepeatedSInt32Field(value: &_storage._repeatedSint32) }()
  737. case 36: try { try decoder.decodeRepeatedSInt64Field(value: &_storage._repeatedSint64) }()
  738. case 37: try { try decoder.decodeRepeatedFixed32Field(value: &_storage._repeatedFixed32) }()
  739. case 38: try { try decoder.decodeRepeatedFixed64Field(value: &_storage._repeatedFixed64) }()
  740. case 39: try { try decoder.decodeRepeatedSFixed32Field(value: &_storage._repeatedSfixed32) }()
  741. case 40: try { try decoder.decodeRepeatedSFixed64Field(value: &_storage._repeatedSfixed64) }()
  742. case 41: try { try decoder.decodeRepeatedFloatField(value: &_storage._repeatedFloat) }()
  743. case 42: try { try decoder.decodeRepeatedDoubleField(value: &_storage._repeatedDouble) }()
  744. case 43: try { try decoder.decodeRepeatedBoolField(value: &_storage._repeatedBool) }()
  745. case 44: try { try decoder.decodeRepeatedStringField(value: &_storage._repeatedString) }()
  746. case 45: try { try decoder.decodeRepeatedBytesField(value: &_storage._repeatedBytes) }()
  747. case 48: try { try decoder.decodeRepeatedMessageField(value: &_storage._repeatedNestedMessage) }()
  748. case 49: try { try decoder.decodeRepeatedMessageField(value: &_storage._repeatedForeignMessage) }()
  749. case 50: try { try decoder.decodeRepeatedMessageField(value: &_storage._repeatedImportMessage) }()
  750. case 51: try { try decoder.decodeRepeatedEnumField(value: &_storage._repeatedNestedEnum) }()
  751. case 52: try { try decoder.decodeRepeatedEnumField(value: &_storage._repeatedForeignEnum) }()
  752. case 54: try { try decoder.decodeRepeatedStringField(value: &_storage._repeatedStringPiece) }()
  753. case 55: try { try decoder.decodeRepeatedStringField(value: &_storage._repeatedCord) }()
  754. case 57: try { try decoder.decodeRepeatedMessageField(value: &_storage._repeatedLazyMessage) }()
  755. case 111: try {
  756. var v: UInt32?
  757. try decoder.decodeSingularUInt32Field(value: &v)
  758. if let v = v {
  759. if _storage._oneofField != nil {try decoder.handleConflictingOneOf()}
  760. _storage._oneofField = .oneofUint32(v)
  761. }
  762. }()
  763. case 112: try {
  764. var v: SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage?
  765. var hadOneofValue = false
  766. if let current = _storage._oneofField {
  767. hadOneofValue = true
  768. if case .oneofNestedMessage(let m) = current {v = m}
  769. }
  770. try decoder.decodeSingularMessageField(value: &v)
  771. if let v = v {
  772. if hadOneofValue {try decoder.handleConflictingOneOf()}
  773. _storage._oneofField = .oneofNestedMessage(v)
  774. }
  775. }()
  776. case 113: try {
  777. var v: String?
  778. try decoder.decodeSingularStringField(value: &v)
  779. if let v = v {
  780. if _storage._oneofField != nil {try decoder.handleConflictingOneOf()}
  781. _storage._oneofField = .oneofString(v)
  782. }
  783. }()
  784. case 114: try {
  785. var v: Data?
  786. try decoder.decodeSingularBytesField(value: &v)
  787. if let v = v {
  788. if _storage._oneofField != nil {try decoder.handleConflictingOneOf()}
  789. _storage._oneofField = .oneofBytes(v)
  790. }
  791. }()
  792. case 115: try { try decoder.decodeSingularMessageField(value: &_storage._optionalLazyImportMessage) }()
  793. default: break
  794. }
  795. }
  796. }
  797. }
  798. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  799. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  800. // The use of inline closures is to circumvent an issue where the compiler
  801. // allocates stack space for every if/case branch local when no optimizations
  802. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  803. // https://github.com/apple/swift-protobuf/issues/1182
  804. if _storage._optionalInt32 != 0 {
  805. try visitor.visitSingularInt32Field(value: _storage._optionalInt32, fieldNumber: 1)
  806. }
  807. if _storage._optionalInt64 != 0 {
  808. try visitor.visitSingularInt64Field(value: _storage._optionalInt64, fieldNumber: 2)
  809. }
  810. if _storage._optionalUint32 != 0 {
  811. try visitor.visitSingularUInt32Field(value: _storage._optionalUint32, fieldNumber: 3)
  812. }
  813. if _storage._optionalUint64 != 0 {
  814. try visitor.visitSingularUInt64Field(value: _storage._optionalUint64, fieldNumber: 4)
  815. }
  816. if _storage._optionalSint32 != 0 {
  817. try visitor.visitSingularSInt32Field(value: _storage._optionalSint32, fieldNumber: 5)
  818. }
  819. if _storage._optionalSint64 != 0 {
  820. try visitor.visitSingularSInt64Field(value: _storage._optionalSint64, fieldNumber: 6)
  821. }
  822. if _storage._optionalFixed32 != 0 {
  823. try visitor.visitSingularFixed32Field(value: _storage._optionalFixed32, fieldNumber: 7)
  824. }
  825. if _storage._optionalFixed64 != 0 {
  826. try visitor.visitSingularFixed64Field(value: _storage._optionalFixed64, fieldNumber: 8)
  827. }
  828. if _storage._optionalSfixed32 != 0 {
  829. try visitor.visitSingularSFixed32Field(value: _storage._optionalSfixed32, fieldNumber: 9)
  830. }
  831. if _storage._optionalSfixed64 != 0 {
  832. try visitor.visitSingularSFixed64Field(value: _storage._optionalSfixed64, fieldNumber: 10)
  833. }
  834. if _storage._optionalFloat.bitPattern != 0 {
  835. try visitor.visitSingularFloatField(value: _storage._optionalFloat, fieldNumber: 11)
  836. }
  837. if _storage._optionalDouble.bitPattern != 0 {
  838. try visitor.visitSingularDoubleField(value: _storage._optionalDouble, fieldNumber: 12)
  839. }
  840. if _storage._optionalBool != false {
  841. try visitor.visitSingularBoolField(value: _storage._optionalBool, fieldNumber: 13)
  842. }
  843. if !_storage._optionalString.isEmpty {
  844. try visitor.visitSingularStringField(value: _storage._optionalString, fieldNumber: 14)
  845. }
  846. if !_storage._optionalBytes.isEmpty {
  847. try visitor.visitSingularBytesField(value: _storage._optionalBytes, fieldNumber: 15)
  848. }
  849. try { if let v = _storage._optionalNestedMessage {
  850. try visitor.visitSingularMessageField(value: v, fieldNumber: 18)
  851. } }()
  852. try { if let v = _storage._optionalForeignMessage {
  853. try visitor.visitSingularMessageField(value: v, fieldNumber: 19)
  854. } }()
  855. try { if let v = _storage._optionalImportMessage {
  856. try visitor.visitSingularMessageField(value: v, fieldNumber: 20)
  857. } }()
  858. if _storage._optionalNestedEnum != .zero {
  859. try visitor.visitSingularEnumField(value: _storage._optionalNestedEnum, fieldNumber: 21)
  860. }
  861. if _storage._optionalForeignEnum != .foreignZero {
  862. try visitor.visitSingularEnumField(value: _storage._optionalForeignEnum, fieldNumber: 22)
  863. }
  864. if !_storage._optionalStringPiece.isEmpty {
  865. try visitor.visitSingularStringField(value: _storage._optionalStringPiece, fieldNumber: 24)
  866. }
  867. if !_storage._optionalCord.isEmpty {
  868. try visitor.visitSingularStringField(value: _storage._optionalCord, fieldNumber: 25)
  869. }
  870. try { if let v = _storage._optionalPublicImportMessage {
  871. try visitor.visitSingularMessageField(value: v, fieldNumber: 26)
  872. } }()
  873. try { if let v = _storage._optionalLazyMessage {
  874. try visitor.visitSingularMessageField(value: v, fieldNumber: 27)
  875. } }()
  876. try { if let v = _storage._optionalUnverifiedLazyMessage {
  877. try visitor.visitSingularMessageField(value: v, fieldNumber: 28)
  878. } }()
  879. if !_storage._repeatedInt32.isEmpty {
  880. try visitor.visitPackedInt32Field(value: _storage._repeatedInt32, fieldNumber: 31)
  881. }
  882. if !_storage._repeatedInt64.isEmpty {
  883. try visitor.visitPackedInt64Field(value: _storage._repeatedInt64, fieldNumber: 32)
  884. }
  885. if !_storage._repeatedUint32.isEmpty {
  886. try visitor.visitPackedUInt32Field(value: _storage._repeatedUint32, fieldNumber: 33)
  887. }
  888. if !_storage._repeatedUint64.isEmpty {
  889. try visitor.visitPackedUInt64Field(value: _storage._repeatedUint64, fieldNumber: 34)
  890. }
  891. if !_storage._repeatedSint32.isEmpty {
  892. try visitor.visitPackedSInt32Field(value: _storage._repeatedSint32, fieldNumber: 35)
  893. }
  894. if !_storage._repeatedSint64.isEmpty {
  895. try visitor.visitPackedSInt64Field(value: _storage._repeatedSint64, fieldNumber: 36)
  896. }
  897. if !_storage._repeatedFixed32.isEmpty {
  898. try visitor.visitPackedFixed32Field(value: _storage._repeatedFixed32, fieldNumber: 37)
  899. }
  900. if !_storage._repeatedFixed64.isEmpty {
  901. try visitor.visitPackedFixed64Field(value: _storage._repeatedFixed64, fieldNumber: 38)
  902. }
  903. if !_storage._repeatedSfixed32.isEmpty {
  904. try visitor.visitPackedSFixed32Field(value: _storage._repeatedSfixed32, fieldNumber: 39)
  905. }
  906. if !_storage._repeatedSfixed64.isEmpty {
  907. try visitor.visitPackedSFixed64Field(value: _storage._repeatedSfixed64, fieldNumber: 40)
  908. }
  909. if !_storage._repeatedFloat.isEmpty {
  910. try visitor.visitPackedFloatField(value: _storage._repeatedFloat, fieldNumber: 41)
  911. }
  912. if !_storage._repeatedDouble.isEmpty {
  913. try visitor.visitPackedDoubleField(value: _storage._repeatedDouble, fieldNumber: 42)
  914. }
  915. if !_storage._repeatedBool.isEmpty {
  916. try visitor.visitPackedBoolField(value: _storage._repeatedBool, fieldNumber: 43)
  917. }
  918. if !_storage._repeatedString.isEmpty {
  919. try visitor.visitRepeatedStringField(value: _storage._repeatedString, fieldNumber: 44)
  920. }
  921. if !_storage._repeatedBytes.isEmpty {
  922. try visitor.visitRepeatedBytesField(value: _storage._repeatedBytes, fieldNumber: 45)
  923. }
  924. if !_storage._repeatedNestedMessage.isEmpty {
  925. try visitor.visitRepeatedMessageField(value: _storage._repeatedNestedMessage, fieldNumber: 48)
  926. }
  927. if !_storage._repeatedForeignMessage.isEmpty {
  928. try visitor.visitRepeatedMessageField(value: _storage._repeatedForeignMessage, fieldNumber: 49)
  929. }
  930. if !_storage._repeatedImportMessage.isEmpty {
  931. try visitor.visitRepeatedMessageField(value: _storage._repeatedImportMessage, fieldNumber: 50)
  932. }
  933. if !_storage._repeatedNestedEnum.isEmpty {
  934. try visitor.visitPackedEnumField(value: _storage._repeatedNestedEnum, fieldNumber: 51)
  935. }
  936. if !_storage._repeatedForeignEnum.isEmpty {
  937. try visitor.visitPackedEnumField(value: _storage._repeatedForeignEnum, fieldNumber: 52)
  938. }
  939. if !_storage._repeatedStringPiece.isEmpty {
  940. try visitor.visitRepeatedStringField(value: _storage._repeatedStringPiece, fieldNumber: 54)
  941. }
  942. if !_storage._repeatedCord.isEmpty {
  943. try visitor.visitRepeatedStringField(value: _storage._repeatedCord, fieldNumber: 55)
  944. }
  945. if !_storage._repeatedLazyMessage.isEmpty {
  946. try visitor.visitRepeatedMessageField(value: _storage._repeatedLazyMessage, fieldNumber: 57)
  947. }
  948. switch _storage._oneofField {
  949. case .oneofUint32?: try {
  950. guard case .oneofUint32(let v)? = _storage._oneofField else { preconditionFailure() }
  951. try visitor.visitSingularUInt32Field(value: v, fieldNumber: 111)
  952. }()
  953. case .oneofNestedMessage?: try {
  954. guard case .oneofNestedMessage(let v)? = _storage._oneofField else { preconditionFailure() }
  955. try visitor.visitSingularMessageField(value: v, fieldNumber: 112)
  956. }()
  957. case .oneofString?: try {
  958. guard case .oneofString(let v)? = _storage._oneofField else { preconditionFailure() }
  959. try visitor.visitSingularStringField(value: v, fieldNumber: 113)
  960. }()
  961. case .oneofBytes?: try {
  962. guard case .oneofBytes(let v)? = _storage._oneofField else { preconditionFailure() }
  963. try visitor.visitSingularBytesField(value: v, fieldNumber: 114)
  964. }()
  965. case nil: break
  966. }
  967. try { if let v = _storage._optionalLazyImportMessage {
  968. try visitor.visitSingularMessageField(value: v, fieldNumber: 115)
  969. } }()
  970. }
  971. try unknownFields.traverse(visitor: &visitor)
  972. }
  973. static func ==(lhs: SwiftProtoTesting_Proto3_TestAllTypes, rhs: SwiftProtoTesting_Proto3_TestAllTypes) -> Bool {
  974. if lhs._storage !== rhs._storage {
  975. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  976. let _storage = _args.0
  977. let rhs_storage = _args.1
  978. if _storage._optionalInt32 != rhs_storage._optionalInt32 {return false}
  979. if _storage._optionalInt64 != rhs_storage._optionalInt64 {return false}
  980. if _storage._optionalUint32 != rhs_storage._optionalUint32 {return false}
  981. if _storage._optionalUint64 != rhs_storage._optionalUint64 {return false}
  982. if _storage._optionalSint32 != rhs_storage._optionalSint32 {return false}
  983. if _storage._optionalSint64 != rhs_storage._optionalSint64 {return false}
  984. if _storage._optionalFixed32 != rhs_storage._optionalFixed32 {return false}
  985. if _storage._optionalFixed64 != rhs_storage._optionalFixed64 {return false}
  986. if _storage._optionalSfixed32 != rhs_storage._optionalSfixed32 {return false}
  987. if _storage._optionalSfixed64 != rhs_storage._optionalSfixed64 {return false}
  988. if _storage._optionalFloat != rhs_storage._optionalFloat {return false}
  989. if _storage._optionalDouble != rhs_storage._optionalDouble {return false}
  990. if _storage._optionalBool != rhs_storage._optionalBool {return false}
  991. if _storage._optionalString != rhs_storage._optionalString {return false}
  992. if _storage._optionalBytes != rhs_storage._optionalBytes {return false}
  993. if _storage._optionalNestedMessage != rhs_storage._optionalNestedMessage {return false}
  994. if _storage._optionalForeignMessage != rhs_storage._optionalForeignMessage {return false}
  995. if _storage._optionalImportMessage != rhs_storage._optionalImportMessage {return false}
  996. if _storage._optionalNestedEnum != rhs_storage._optionalNestedEnum {return false}
  997. if _storage._optionalForeignEnum != rhs_storage._optionalForeignEnum {return false}
  998. if _storage._optionalStringPiece != rhs_storage._optionalStringPiece {return false}
  999. if _storage._optionalCord != rhs_storage._optionalCord {return false}
  1000. if _storage._optionalPublicImportMessage != rhs_storage._optionalPublicImportMessage {return false}
  1001. if _storage._optionalLazyMessage != rhs_storage._optionalLazyMessage {return false}
  1002. if _storage._optionalUnverifiedLazyMessage != rhs_storage._optionalUnverifiedLazyMessage {return false}
  1003. if _storage._optionalLazyImportMessage != rhs_storage._optionalLazyImportMessage {return false}
  1004. if _storage._repeatedInt32 != rhs_storage._repeatedInt32 {return false}
  1005. if _storage._repeatedInt64 != rhs_storage._repeatedInt64 {return false}
  1006. if _storage._repeatedUint32 != rhs_storage._repeatedUint32 {return false}
  1007. if _storage._repeatedUint64 != rhs_storage._repeatedUint64 {return false}
  1008. if _storage._repeatedSint32 != rhs_storage._repeatedSint32 {return false}
  1009. if _storage._repeatedSint64 != rhs_storage._repeatedSint64 {return false}
  1010. if _storage._repeatedFixed32 != rhs_storage._repeatedFixed32 {return false}
  1011. if _storage._repeatedFixed64 != rhs_storage._repeatedFixed64 {return false}
  1012. if _storage._repeatedSfixed32 != rhs_storage._repeatedSfixed32 {return false}
  1013. if _storage._repeatedSfixed64 != rhs_storage._repeatedSfixed64 {return false}
  1014. if _storage._repeatedFloat != rhs_storage._repeatedFloat {return false}
  1015. if _storage._repeatedDouble != rhs_storage._repeatedDouble {return false}
  1016. if _storage._repeatedBool != rhs_storage._repeatedBool {return false}
  1017. if _storage._repeatedString != rhs_storage._repeatedString {return false}
  1018. if _storage._repeatedBytes != rhs_storage._repeatedBytes {return false}
  1019. if _storage._repeatedNestedMessage != rhs_storage._repeatedNestedMessage {return false}
  1020. if _storage._repeatedForeignMessage != rhs_storage._repeatedForeignMessage {return false}
  1021. if _storage._repeatedImportMessage != rhs_storage._repeatedImportMessage {return false}
  1022. if _storage._repeatedNestedEnum != rhs_storage._repeatedNestedEnum {return false}
  1023. if _storage._repeatedForeignEnum != rhs_storage._repeatedForeignEnum {return false}
  1024. if _storage._repeatedStringPiece != rhs_storage._repeatedStringPiece {return false}
  1025. if _storage._repeatedCord != rhs_storage._repeatedCord {return false}
  1026. if _storage._repeatedLazyMessage != rhs_storage._repeatedLazyMessage {return false}
  1027. if _storage._oneofField != rhs_storage._oneofField {return false}
  1028. return true
  1029. }
  1030. if !storagesAreEqual {return false}
  1031. }
  1032. if lhs.unknownFields != rhs.unknownFields {return false}
  1033. return true
  1034. }
  1035. }
  1036. extension SwiftProtoTesting_Proto3_TestAllTypes.NestedEnum: SwiftProtobuf._ProtoNameProviding {
  1037. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1038. -1: .same(proto: "NEG"),
  1039. 0: .same(proto: "ZERO"),
  1040. 1: .same(proto: "FOO"),
  1041. 2: .same(proto: "BAR"),
  1042. 3: .same(proto: "BAZ"),
  1043. ]
  1044. }
  1045. extension SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1046. static let protoMessageName: String = SwiftProtoTesting_Proto3_TestAllTypes.protoMessageName + ".NestedMessage"
  1047. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1048. 1: .same(proto: "bb"),
  1049. ]
  1050. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1051. while let fieldNumber = try decoder.nextFieldNumber() {
  1052. // The use of inline closures is to circumvent an issue where the compiler
  1053. // allocates stack space for every case branch when no optimizations are
  1054. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  1055. switch fieldNumber {
  1056. case 1: try { try decoder.decodeSingularInt32Field(value: &self.bb) }()
  1057. default: break
  1058. }
  1059. }
  1060. }
  1061. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1062. if self.bb != 0 {
  1063. try visitor.visitSingularInt32Field(value: self.bb, fieldNumber: 1)
  1064. }
  1065. try unknownFields.traverse(visitor: &visitor)
  1066. }
  1067. static func ==(lhs: SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage, rhs: SwiftProtoTesting_Proto3_TestAllTypes.NestedMessage) -> Bool {
  1068. if lhs.bb != rhs.bb {return false}
  1069. if lhs.unknownFields != rhs.unknownFields {return false}
  1070. return true
  1071. }
  1072. }
  1073. extension SwiftProtoTesting_Proto3_TestPackedTypes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1074. static let protoMessageName: String = _protobuf_package + ".TestPackedTypes"
  1075. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1076. 90: .standard(proto: "packed_int32"),
  1077. 91: .standard(proto: "packed_int64"),
  1078. 92: .standard(proto: "packed_uint32"),
  1079. 93: .standard(proto: "packed_uint64"),
  1080. 94: .standard(proto: "packed_sint32"),
  1081. 95: .standard(proto: "packed_sint64"),
  1082. 96: .standard(proto: "packed_fixed32"),
  1083. 97: .standard(proto: "packed_fixed64"),
  1084. 98: .standard(proto: "packed_sfixed32"),
  1085. 99: .standard(proto: "packed_sfixed64"),
  1086. 100: .standard(proto: "packed_float"),
  1087. 101: .standard(proto: "packed_double"),
  1088. 102: .standard(proto: "packed_bool"),
  1089. 103: .standard(proto: "packed_enum"),
  1090. ]
  1091. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1092. while let fieldNumber = try decoder.nextFieldNumber() {
  1093. // The use of inline closures is to circumvent an issue where the compiler
  1094. // allocates stack space for every case branch when no optimizations are
  1095. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  1096. switch fieldNumber {
  1097. case 90: try { try decoder.decodeRepeatedInt32Field(value: &self.packedInt32) }()
  1098. case 91: try { try decoder.decodeRepeatedInt64Field(value: &self.packedInt64) }()
  1099. case 92: try { try decoder.decodeRepeatedUInt32Field(value: &self.packedUint32) }()
  1100. case 93: try { try decoder.decodeRepeatedUInt64Field(value: &self.packedUint64) }()
  1101. case 94: try { try decoder.decodeRepeatedSInt32Field(value: &self.packedSint32) }()
  1102. case 95: try { try decoder.decodeRepeatedSInt64Field(value: &self.packedSint64) }()
  1103. case 96: try { try decoder.decodeRepeatedFixed32Field(value: &self.packedFixed32) }()
  1104. case 97: try { try decoder.decodeRepeatedFixed64Field(value: &self.packedFixed64) }()
  1105. case 98: try { try decoder.decodeRepeatedSFixed32Field(value: &self.packedSfixed32) }()
  1106. case 99: try { try decoder.decodeRepeatedSFixed64Field(value: &self.packedSfixed64) }()
  1107. case 100: try { try decoder.decodeRepeatedFloatField(value: &self.packedFloat) }()
  1108. case 101: try { try decoder.decodeRepeatedDoubleField(value: &self.packedDouble) }()
  1109. case 102: try { try decoder.decodeRepeatedBoolField(value: &self.packedBool) }()
  1110. case 103: try { try decoder.decodeRepeatedEnumField(value: &self.packedEnum) }()
  1111. default: break
  1112. }
  1113. }
  1114. }
  1115. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1116. if !self.packedInt32.isEmpty {
  1117. try visitor.visitPackedInt32Field(value: self.packedInt32, fieldNumber: 90)
  1118. }
  1119. if !self.packedInt64.isEmpty {
  1120. try visitor.visitPackedInt64Field(value: self.packedInt64, fieldNumber: 91)
  1121. }
  1122. if !self.packedUint32.isEmpty {
  1123. try visitor.visitPackedUInt32Field(value: self.packedUint32, fieldNumber: 92)
  1124. }
  1125. if !self.packedUint64.isEmpty {
  1126. try visitor.visitPackedUInt64Field(value: self.packedUint64, fieldNumber: 93)
  1127. }
  1128. if !self.packedSint32.isEmpty {
  1129. try visitor.visitPackedSInt32Field(value: self.packedSint32, fieldNumber: 94)
  1130. }
  1131. if !self.packedSint64.isEmpty {
  1132. try visitor.visitPackedSInt64Field(value: self.packedSint64, fieldNumber: 95)
  1133. }
  1134. if !self.packedFixed32.isEmpty {
  1135. try visitor.visitPackedFixed32Field(value: self.packedFixed32, fieldNumber: 96)
  1136. }
  1137. if !self.packedFixed64.isEmpty {
  1138. try visitor.visitPackedFixed64Field(value: self.packedFixed64, fieldNumber: 97)
  1139. }
  1140. if !self.packedSfixed32.isEmpty {
  1141. try visitor.visitPackedSFixed32Field(value: self.packedSfixed32, fieldNumber: 98)
  1142. }
  1143. if !self.packedSfixed64.isEmpty {
  1144. try visitor.visitPackedSFixed64Field(value: self.packedSfixed64, fieldNumber: 99)
  1145. }
  1146. if !self.packedFloat.isEmpty {
  1147. try visitor.visitPackedFloatField(value: self.packedFloat, fieldNumber: 100)
  1148. }
  1149. if !self.packedDouble.isEmpty {
  1150. try visitor.visitPackedDoubleField(value: self.packedDouble, fieldNumber: 101)
  1151. }
  1152. if !self.packedBool.isEmpty {
  1153. try visitor.visitPackedBoolField(value: self.packedBool, fieldNumber: 102)
  1154. }
  1155. if !self.packedEnum.isEmpty {
  1156. try visitor.visitPackedEnumField(value: self.packedEnum, fieldNumber: 103)
  1157. }
  1158. try unknownFields.traverse(visitor: &visitor)
  1159. }
  1160. static func ==(lhs: SwiftProtoTesting_Proto3_TestPackedTypes, rhs: SwiftProtoTesting_Proto3_TestPackedTypes) -> Bool {
  1161. if lhs.packedInt32 != rhs.packedInt32 {return false}
  1162. if lhs.packedInt64 != rhs.packedInt64 {return false}
  1163. if lhs.packedUint32 != rhs.packedUint32 {return false}
  1164. if lhs.packedUint64 != rhs.packedUint64 {return false}
  1165. if lhs.packedSint32 != rhs.packedSint32 {return false}
  1166. if lhs.packedSint64 != rhs.packedSint64 {return false}
  1167. if lhs.packedFixed32 != rhs.packedFixed32 {return false}
  1168. if lhs.packedFixed64 != rhs.packedFixed64 {return false}
  1169. if lhs.packedSfixed32 != rhs.packedSfixed32 {return false}
  1170. if lhs.packedSfixed64 != rhs.packedSfixed64 {return false}
  1171. if lhs.packedFloat != rhs.packedFloat {return false}
  1172. if lhs.packedDouble != rhs.packedDouble {return false}
  1173. if lhs.packedBool != rhs.packedBool {return false}
  1174. if lhs.packedEnum != rhs.packedEnum {return false}
  1175. if lhs.unknownFields != rhs.unknownFields {return false}
  1176. return true
  1177. }
  1178. }
  1179. extension SwiftProtoTesting_Proto3_TestUnpackedTypes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1180. static let protoMessageName: String = _protobuf_package + ".TestUnpackedTypes"
  1181. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1182. 1: .standard(proto: "repeated_int32"),
  1183. 2: .standard(proto: "repeated_int64"),
  1184. 3: .standard(proto: "repeated_uint32"),
  1185. 4: .standard(proto: "repeated_uint64"),
  1186. 5: .standard(proto: "repeated_sint32"),
  1187. 6: .standard(proto: "repeated_sint64"),
  1188. 7: .standard(proto: "repeated_fixed32"),
  1189. 8: .standard(proto: "repeated_fixed64"),
  1190. 9: .standard(proto: "repeated_sfixed32"),
  1191. 10: .standard(proto: "repeated_sfixed64"),
  1192. 11: .standard(proto: "repeated_float"),
  1193. 12: .standard(proto: "repeated_double"),
  1194. 13: .standard(proto: "repeated_bool"),
  1195. 14: .standard(proto: "repeated_nested_enum"),
  1196. ]
  1197. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1198. while let fieldNumber = try decoder.nextFieldNumber() {
  1199. // The use of inline closures is to circumvent an issue where the compiler
  1200. // allocates stack space for every case branch when no optimizations are
  1201. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  1202. switch fieldNumber {
  1203. case 1: try { try decoder.decodeRepeatedInt32Field(value: &self.repeatedInt32) }()
  1204. case 2: try { try decoder.decodeRepeatedInt64Field(value: &self.repeatedInt64) }()
  1205. case 3: try { try decoder.decodeRepeatedUInt32Field(value: &self.repeatedUint32) }()
  1206. case 4: try { try decoder.decodeRepeatedUInt64Field(value: &self.repeatedUint64) }()
  1207. case 5: try { try decoder.decodeRepeatedSInt32Field(value: &self.repeatedSint32) }()
  1208. case 6: try { try decoder.decodeRepeatedSInt64Field(value: &self.repeatedSint64) }()
  1209. case 7: try { try decoder.decodeRepeatedFixed32Field(value: &self.repeatedFixed32) }()
  1210. case 8: try { try decoder.decodeRepeatedFixed64Field(value: &self.repeatedFixed64) }()
  1211. case 9: try { try decoder.decodeRepeatedSFixed32Field(value: &self.repeatedSfixed32) }()
  1212. case 10: try { try decoder.decodeRepeatedSFixed64Field(value: &self.repeatedSfixed64) }()
  1213. case 11: try { try decoder.decodeRepeatedFloatField(value: &self.repeatedFloat) }()
  1214. case 12: try { try decoder.decodeRepeatedDoubleField(value: &self.repeatedDouble) }()
  1215. case 13: try { try decoder.decodeRepeatedBoolField(value: &self.repeatedBool) }()
  1216. case 14: try { try decoder.decodeRepeatedEnumField(value: &self.repeatedNestedEnum) }()
  1217. default: break
  1218. }
  1219. }
  1220. }
  1221. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1222. if !self.repeatedInt32.isEmpty {
  1223. try visitor.visitRepeatedInt32Field(value: self.repeatedInt32, fieldNumber: 1)
  1224. }
  1225. if !self.repeatedInt64.isEmpty {
  1226. try visitor.visitRepeatedInt64Field(value: self.repeatedInt64, fieldNumber: 2)
  1227. }
  1228. if !self.repeatedUint32.isEmpty {
  1229. try visitor.visitRepeatedUInt32Field(value: self.repeatedUint32, fieldNumber: 3)
  1230. }
  1231. if !self.repeatedUint64.isEmpty {
  1232. try visitor.visitRepeatedUInt64Field(value: self.repeatedUint64, fieldNumber: 4)
  1233. }
  1234. if !self.repeatedSint32.isEmpty {
  1235. try visitor.visitRepeatedSInt32Field(value: self.repeatedSint32, fieldNumber: 5)
  1236. }
  1237. if !self.repeatedSint64.isEmpty {
  1238. try visitor.visitRepeatedSInt64Field(value: self.repeatedSint64, fieldNumber: 6)
  1239. }
  1240. if !self.repeatedFixed32.isEmpty {
  1241. try visitor.visitRepeatedFixed32Field(value: self.repeatedFixed32, fieldNumber: 7)
  1242. }
  1243. if !self.repeatedFixed64.isEmpty {
  1244. try visitor.visitRepeatedFixed64Field(value: self.repeatedFixed64, fieldNumber: 8)
  1245. }
  1246. if !self.repeatedSfixed32.isEmpty {
  1247. try visitor.visitRepeatedSFixed32Field(value: self.repeatedSfixed32, fieldNumber: 9)
  1248. }
  1249. if !self.repeatedSfixed64.isEmpty {
  1250. try visitor.visitRepeatedSFixed64Field(value: self.repeatedSfixed64, fieldNumber: 10)
  1251. }
  1252. if !self.repeatedFloat.isEmpty {
  1253. try visitor.visitRepeatedFloatField(value: self.repeatedFloat, fieldNumber: 11)
  1254. }
  1255. if !self.repeatedDouble.isEmpty {
  1256. try visitor.visitRepeatedDoubleField(value: self.repeatedDouble, fieldNumber: 12)
  1257. }
  1258. if !self.repeatedBool.isEmpty {
  1259. try visitor.visitRepeatedBoolField(value: self.repeatedBool, fieldNumber: 13)
  1260. }
  1261. if !self.repeatedNestedEnum.isEmpty {
  1262. try visitor.visitRepeatedEnumField(value: self.repeatedNestedEnum, fieldNumber: 14)
  1263. }
  1264. try unknownFields.traverse(visitor: &visitor)
  1265. }
  1266. static func ==(lhs: SwiftProtoTesting_Proto3_TestUnpackedTypes, rhs: SwiftProtoTesting_Proto3_TestUnpackedTypes) -> Bool {
  1267. if lhs.repeatedInt32 != rhs.repeatedInt32 {return false}
  1268. if lhs.repeatedInt64 != rhs.repeatedInt64 {return false}
  1269. if lhs.repeatedUint32 != rhs.repeatedUint32 {return false}
  1270. if lhs.repeatedUint64 != rhs.repeatedUint64 {return false}
  1271. if lhs.repeatedSint32 != rhs.repeatedSint32 {return false}
  1272. if lhs.repeatedSint64 != rhs.repeatedSint64 {return false}
  1273. if lhs.repeatedFixed32 != rhs.repeatedFixed32 {return false}
  1274. if lhs.repeatedFixed64 != rhs.repeatedFixed64 {return false}
  1275. if lhs.repeatedSfixed32 != rhs.repeatedSfixed32 {return false}
  1276. if lhs.repeatedSfixed64 != rhs.repeatedSfixed64 {return false}
  1277. if lhs.repeatedFloat != rhs.repeatedFloat {return false}
  1278. if lhs.repeatedDouble != rhs.repeatedDouble {return false}
  1279. if lhs.repeatedBool != rhs.repeatedBool {return false}
  1280. if lhs.repeatedNestedEnum != rhs.repeatedNestedEnum {return false}
  1281. if lhs.unknownFields != rhs.unknownFields {return false}
  1282. return true
  1283. }
  1284. }
  1285. extension SwiftProtoTesting_Proto3_NestedTestAllTypes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1286. static let protoMessageName: String = _protobuf_package + ".NestedTestAllTypes"
  1287. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1288. 1: .same(proto: "child"),
  1289. 2: .same(proto: "payload"),
  1290. ]
  1291. fileprivate class _StorageClass {
  1292. var _child: SwiftProtoTesting_Proto3_NestedTestAllTypes? = nil
  1293. var _payload: SwiftProtoTesting_Proto3_TestAllTypes? = nil
  1294. // This property is used as the initial default value for new instances of the type.
  1295. // The type itself is protecting the reference to its storage via CoW semantics.
  1296. // This will force a copy to be made of this reference when the first mutation occurs;
  1297. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  1298. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  1299. private init() {}
  1300. init(copying source: _StorageClass) {
  1301. _child = source._child
  1302. _payload = source._payload
  1303. }
  1304. }
  1305. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  1306. if !isKnownUniquelyReferenced(&_storage) {
  1307. _storage = _StorageClass(copying: _storage)
  1308. }
  1309. return _storage
  1310. }
  1311. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1312. _ = _uniqueStorage()
  1313. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  1314. while let fieldNumber = try decoder.nextFieldNumber() {
  1315. // The use of inline closures is to circumvent an issue where the compiler
  1316. // allocates stack space for every case branch when no optimizations are
  1317. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  1318. switch fieldNumber {
  1319. case 1: try { try decoder.decodeSingularMessageField(value: &_storage._child) }()
  1320. case 2: try { try decoder.decodeSingularMessageField(value: &_storage._payload) }()
  1321. default: break
  1322. }
  1323. }
  1324. }
  1325. }
  1326. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1327. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  1328. // The use of inline closures is to circumvent an issue where the compiler
  1329. // allocates stack space for every if/case branch local when no optimizations
  1330. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  1331. // https://github.com/apple/swift-protobuf/issues/1182
  1332. try { if let v = _storage._child {
  1333. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  1334. } }()
  1335. try { if let v = _storage._payload {
  1336. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  1337. } }()
  1338. }
  1339. try unknownFields.traverse(visitor: &visitor)
  1340. }
  1341. static func ==(lhs: SwiftProtoTesting_Proto3_NestedTestAllTypes, rhs: SwiftProtoTesting_Proto3_NestedTestAllTypes) -> Bool {
  1342. if lhs._storage !== rhs._storage {
  1343. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  1344. let _storage = _args.0
  1345. let rhs_storage = _args.1
  1346. if _storage._child != rhs_storage._child {return false}
  1347. if _storage._payload != rhs_storage._payload {return false}
  1348. return true
  1349. }
  1350. if !storagesAreEqual {return false}
  1351. }
  1352. if lhs.unknownFields != rhs.unknownFields {return false}
  1353. return true
  1354. }
  1355. }
  1356. extension SwiftProtoTesting_Proto3_ForeignMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1357. static let protoMessageName: String = _protobuf_package + ".ForeignMessage"
  1358. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1359. 1: .same(proto: "c"),
  1360. ]
  1361. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1362. while let fieldNumber = try decoder.nextFieldNumber() {
  1363. // The use of inline closures is to circumvent an issue where the compiler
  1364. // allocates stack space for every case branch when no optimizations are
  1365. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  1366. switch fieldNumber {
  1367. case 1: try { try decoder.decodeSingularInt32Field(value: &self.c) }()
  1368. default: break
  1369. }
  1370. }
  1371. }
  1372. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1373. if self.c != 0 {
  1374. try visitor.visitSingularInt32Field(value: self.c, fieldNumber: 1)
  1375. }
  1376. try unknownFields.traverse(visitor: &visitor)
  1377. }
  1378. static func ==(lhs: SwiftProtoTesting_Proto3_ForeignMessage, rhs: SwiftProtoTesting_Proto3_ForeignMessage) -> Bool {
  1379. if lhs.c != rhs.c {return false}
  1380. if lhs.unknownFields != rhs.unknownFields {return false}
  1381. return true
  1382. }
  1383. }
  1384. extension SwiftProtoTesting_Proto3_TestEmptyMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1385. static let protoMessageName: String = _protobuf_package + ".TestEmptyMessage"
  1386. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  1387. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1388. // Load everything into unknown fields
  1389. while try decoder.nextFieldNumber() != nil {}
  1390. }
  1391. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1392. try unknownFields.traverse(visitor: &visitor)
  1393. }
  1394. static func ==(lhs: SwiftProtoTesting_Proto3_TestEmptyMessage, rhs: SwiftProtoTesting_Proto3_TestEmptyMessage) -> Bool {
  1395. if lhs.unknownFields != rhs.unknownFields {return false}
  1396. return true
  1397. }
  1398. }
  1399. extension SwiftProtoTesting_Proto3_TestProto2Required: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1400. static let protoMessageName: String = _protobuf_package + ".TestProto2Required"
  1401. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1402. 1: .same(proto: "proto2"),
  1403. ]
  1404. public var isInitialized: Bool {
  1405. if let v = self._proto2, !v.isInitialized {return false}
  1406. return true
  1407. }
  1408. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1409. while let fieldNumber = try decoder.nextFieldNumber() {
  1410. // The use of inline closures is to circumvent an issue where the compiler
  1411. // allocates stack space for every case branch when no optimizations are
  1412. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  1413. switch fieldNumber {
  1414. case 1: try { try decoder.decodeSingularMessageField(value: &self._proto2) }()
  1415. default: break
  1416. }
  1417. }
  1418. }
  1419. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1420. // The use of inline closures is to circumvent an issue where the compiler
  1421. // allocates stack space for every if/case branch local when no optimizations
  1422. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  1423. // https://github.com/apple/swift-protobuf/issues/1182
  1424. try { if let v = self._proto2 {
  1425. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  1426. } }()
  1427. try unknownFields.traverse(visitor: &visitor)
  1428. }
  1429. static func ==(lhs: SwiftProtoTesting_Proto3_TestProto2Required, rhs: SwiftProtoTesting_Proto3_TestProto2Required) -> Bool {
  1430. if lhs._proto2 != rhs._proto2 {return false}
  1431. if lhs.unknownFields != rhs.unknownFields {return false}
  1432. return true
  1433. }
  1434. }