unittest_no_field_presence.pb.swift 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214
  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: google/protobuf/unittest_no_field_presence.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. //
  13. // Use of this source code is governed by a BSD-style
  14. // license that can be found in the LICENSE file or at
  15. // https://developers.google.com/open-source/licenses/bsd
  16. // A proto file used to test a message type with no explicit field presence.
  17. import Foundation
  18. import SwiftProtobuf
  19. // If the compiler emits an error on this type, it is because this file
  20. // was generated by a version of the `protoc` Swift plug-in that is
  21. // incompatible with the version of SwiftProtobuf to which you are linking.
  22. // Please ensure that you are building against the same version of the API
  23. // that was used to generate this file.
  24. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  25. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  26. typealias Version = _2
  27. }
  28. enum Proto2NofieldpresenceUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
  29. typealias RawValue = Int
  30. case foreignFoo // = 0
  31. case foreignBar // = 1
  32. case foreignBaz // = 2
  33. case UNRECOGNIZED(Int)
  34. init() {
  35. self = .foreignFoo
  36. }
  37. init?(rawValue: Int) {
  38. switch rawValue {
  39. case 0: self = .foreignFoo
  40. case 1: self = .foreignBar
  41. case 2: self = .foreignBaz
  42. default: self = .UNRECOGNIZED(rawValue)
  43. }
  44. }
  45. var rawValue: Int {
  46. switch self {
  47. case .foreignFoo: return 0
  48. case .foreignBar: return 1
  49. case .foreignBaz: return 2
  50. case .UNRECOGNIZED(let i): return i
  51. }
  52. }
  53. // The compiler won't synthesize support with the UNRECOGNIZED case.
  54. static let allCases: [Proto2NofieldpresenceUnittest_ForeignEnum] = [
  55. .foreignFoo,
  56. .foreignBar,
  57. .foreignBaz,
  58. ]
  59. }
  60. /// This proto includes every type of field in both singular and repeated
  61. /// forms.
  62. struct Proto2NofieldpresenceUnittest_TestAllTypes: @unchecked Sendable {
  63. // SwiftProtobuf.Message conformance is added in an extension below. See the
  64. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  65. // methods supported on all messages.
  66. /// Singular
  67. /// TODO: remove 'optional' labels as soon as CL 69188077 is LGTM'd to make
  68. /// 'optional' optional.
  69. var optionalInt32: Int32 {
  70. get {return _storage._optionalInt32}
  71. set {_uniqueStorage()._optionalInt32 = newValue}
  72. }
  73. var optionalInt64: Int64 {
  74. get {return _storage._optionalInt64}
  75. set {_uniqueStorage()._optionalInt64 = newValue}
  76. }
  77. var optionalUint32: UInt32 {
  78. get {return _storage._optionalUint32}
  79. set {_uniqueStorage()._optionalUint32 = newValue}
  80. }
  81. var optionalUint64: UInt64 {
  82. get {return _storage._optionalUint64}
  83. set {_uniqueStorage()._optionalUint64 = newValue}
  84. }
  85. var optionalSint32: Int32 {
  86. get {return _storage._optionalSint32}
  87. set {_uniqueStorage()._optionalSint32 = newValue}
  88. }
  89. var optionalSint64: Int64 {
  90. get {return _storage._optionalSint64}
  91. set {_uniqueStorage()._optionalSint64 = newValue}
  92. }
  93. var optionalFixed32: UInt32 {
  94. get {return _storage._optionalFixed32}
  95. set {_uniqueStorage()._optionalFixed32 = newValue}
  96. }
  97. var optionalFixed64: UInt64 {
  98. get {return _storage._optionalFixed64}
  99. set {_uniqueStorage()._optionalFixed64 = newValue}
  100. }
  101. var optionalSfixed32: Int32 {
  102. get {return _storage._optionalSfixed32}
  103. set {_uniqueStorage()._optionalSfixed32 = newValue}
  104. }
  105. var optionalSfixed64: Int64 {
  106. get {return _storage._optionalSfixed64}
  107. set {_uniqueStorage()._optionalSfixed64 = newValue}
  108. }
  109. var optionalFloat: Float {
  110. get {return _storage._optionalFloat}
  111. set {_uniqueStorage()._optionalFloat = newValue}
  112. }
  113. var optionalDouble: Double {
  114. get {return _storage._optionalDouble}
  115. set {_uniqueStorage()._optionalDouble = newValue}
  116. }
  117. var optionalBool: Bool {
  118. get {return _storage._optionalBool}
  119. set {_uniqueStorage()._optionalBool = newValue}
  120. }
  121. var optionalString: String {
  122. get {return _storage._optionalString}
  123. set {_uniqueStorage()._optionalString = newValue}
  124. }
  125. var optionalBytes: Data {
  126. get {return _storage._optionalBytes}
  127. set {_uniqueStorage()._optionalBytes = newValue}
  128. }
  129. var optionalNestedMessage: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage {
  130. get {return _storage._optionalNestedMessage ?? Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage()}
  131. set {_uniqueStorage()._optionalNestedMessage = newValue}
  132. }
  133. /// Returns true if `optionalNestedMessage` has been explicitly set.
  134. var hasOptionalNestedMessage: Bool {return _storage._optionalNestedMessage != nil}
  135. /// Clears the value of `optionalNestedMessage`. Subsequent reads from it will return its default value.
  136. mutating func clearOptionalNestedMessage() {_uniqueStorage()._optionalNestedMessage = nil}
  137. var optionalForeignMessage: Proto2NofieldpresenceUnittest_ForeignMessage {
  138. get {return _storage._optionalForeignMessage ?? Proto2NofieldpresenceUnittest_ForeignMessage()}
  139. set {_uniqueStorage()._optionalForeignMessage = newValue}
  140. }
  141. /// Returns true if `optionalForeignMessage` has been explicitly set.
  142. var hasOptionalForeignMessage: Bool {return _storage._optionalForeignMessage != nil}
  143. /// Clears the value of `optionalForeignMessage`. Subsequent reads from it will return its default value.
  144. mutating func clearOptionalForeignMessage() {_uniqueStorage()._optionalForeignMessage = nil}
  145. var optionalProto2Message: Proto2Unittest_TestAllTypes {
  146. get {return _storage._optionalProto2Message ?? Proto2Unittest_TestAllTypes()}
  147. set {_uniqueStorage()._optionalProto2Message = newValue}
  148. }
  149. /// Returns true if `optionalProto2Message` has been explicitly set.
  150. var hasOptionalProto2Message: Bool {return _storage._optionalProto2Message != nil}
  151. /// Clears the value of `optionalProto2Message`. Subsequent reads from it will return its default value.
  152. mutating func clearOptionalProto2Message() {_uniqueStorage()._optionalProto2Message = nil}
  153. var optionalNestedEnum: Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum {
  154. get {return _storage._optionalNestedEnum}
  155. set {_uniqueStorage()._optionalNestedEnum = newValue}
  156. }
  157. /// N.B.: proto2-enum-type fields not allowed, because their default values
  158. /// might not be zero.
  159. /// optional proto2_unittest.ForeignEnum optional_proto2_enum =
  160. /// 23;
  161. var optionalForeignEnum: Proto2NofieldpresenceUnittest_ForeignEnum {
  162. get {return _storage._optionalForeignEnum}
  163. set {_uniqueStorage()._optionalForeignEnum = newValue}
  164. }
  165. var optionalStringPiece: String {
  166. get {return _storage._optionalStringPiece}
  167. set {_uniqueStorage()._optionalStringPiece = newValue}
  168. }
  169. var optionalCord: String {
  170. get {return _storage._optionalCord}
  171. set {_uniqueStorage()._optionalCord = newValue}
  172. }
  173. var optionalLazyMessage: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage {
  174. get {return _storage._optionalLazyMessage ?? Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage()}
  175. set {_uniqueStorage()._optionalLazyMessage = newValue}
  176. }
  177. /// Returns true if `optionalLazyMessage` has been explicitly set.
  178. var hasOptionalLazyMessage: Bool {return _storage._optionalLazyMessage != nil}
  179. /// Clears the value of `optionalLazyMessage`. Subsequent reads from it will return its default value.
  180. mutating func clearOptionalLazyMessage() {_uniqueStorage()._optionalLazyMessage = nil}
  181. /// Repeated
  182. var repeatedInt32: [Int32] {
  183. get {return _storage._repeatedInt32}
  184. set {_uniqueStorage()._repeatedInt32 = newValue}
  185. }
  186. var repeatedInt64: [Int64] {
  187. get {return _storage._repeatedInt64}
  188. set {_uniqueStorage()._repeatedInt64 = newValue}
  189. }
  190. var repeatedUint32: [UInt32] {
  191. get {return _storage._repeatedUint32}
  192. set {_uniqueStorage()._repeatedUint32 = newValue}
  193. }
  194. var repeatedUint64: [UInt64] {
  195. get {return _storage._repeatedUint64}
  196. set {_uniqueStorage()._repeatedUint64 = newValue}
  197. }
  198. var repeatedSint32: [Int32] {
  199. get {return _storage._repeatedSint32}
  200. set {_uniqueStorage()._repeatedSint32 = newValue}
  201. }
  202. var repeatedSint64: [Int64] {
  203. get {return _storage._repeatedSint64}
  204. set {_uniqueStorage()._repeatedSint64 = newValue}
  205. }
  206. var repeatedFixed32: [UInt32] {
  207. get {return _storage._repeatedFixed32}
  208. set {_uniqueStorage()._repeatedFixed32 = newValue}
  209. }
  210. var repeatedFixed64: [UInt64] {
  211. get {return _storage._repeatedFixed64}
  212. set {_uniqueStorage()._repeatedFixed64 = newValue}
  213. }
  214. var repeatedSfixed32: [Int32] {
  215. get {return _storage._repeatedSfixed32}
  216. set {_uniqueStorage()._repeatedSfixed32 = newValue}
  217. }
  218. var repeatedSfixed64: [Int64] {
  219. get {return _storage._repeatedSfixed64}
  220. set {_uniqueStorage()._repeatedSfixed64 = newValue}
  221. }
  222. var repeatedFloat: [Float] {
  223. get {return _storage._repeatedFloat}
  224. set {_uniqueStorage()._repeatedFloat = newValue}
  225. }
  226. var repeatedDouble: [Double] {
  227. get {return _storage._repeatedDouble}
  228. set {_uniqueStorage()._repeatedDouble = newValue}
  229. }
  230. var repeatedBool: [Bool] {
  231. get {return _storage._repeatedBool}
  232. set {_uniqueStorage()._repeatedBool = newValue}
  233. }
  234. var repeatedString: [String] {
  235. get {return _storage._repeatedString}
  236. set {_uniqueStorage()._repeatedString = newValue}
  237. }
  238. var repeatedBytes: [Data] {
  239. get {return _storage._repeatedBytes}
  240. set {_uniqueStorage()._repeatedBytes = newValue}
  241. }
  242. var repeatedNestedMessage: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage] {
  243. get {return _storage._repeatedNestedMessage}
  244. set {_uniqueStorage()._repeatedNestedMessage = newValue}
  245. }
  246. var repeatedForeignMessage: [Proto2NofieldpresenceUnittest_ForeignMessage] {
  247. get {return _storage._repeatedForeignMessage}
  248. set {_uniqueStorage()._repeatedForeignMessage = newValue}
  249. }
  250. var repeatedProto2Message: [Proto2Unittest_TestAllTypes] {
  251. get {return _storage._repeatedProto2Message}
  252. set {_uniqueStorage()._repeatedProto2Message = newValue}
  253. }
  254. var repeatedNestedEnum: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum] {
  255. get {return _storage._repeatedNestedEnum}
  256. set {_uniqueStorage()._repeatedNestedEnum = newValue}
  257. }
  258. var repeatedForeignEnum: [Proto2NofieldpresenceUnittest_ForeignEnum] {
  259. get {return _storage._repeatedForeignEnum}
  260. set {_uniqueStorage()._repeatedForeignEnum = newValue}
  261. }
  262. var repeatedStringPiece: [String] {
  263. get {return _storage._repeatedStringPiece}
  264. set {_uniqueStorage()._repeatedStringPiece = newValue}
  265. }
  266. var repeatedCord: [String] {
  267. get {return _storage._repeatedCord}
  268. set {_uniqueStorage()._repeatedCord = newValue}
  269. }
  270. var repeatedLazyMessage: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage] {
  271. get {return _storage._repeatedLazyMessage}
  272. set {_uniqueStorage()._repeatedLazyMessage = newValue}
  273. }
  274. var oneofField: OneOf_OneofField? {
  275. get {return _storage._oneofField}
  276. set {_uniqueStorage()._oneofField = newValue}
  277. }
  278. var oneofUint32: UInt32 {
  279. get {
  280. if case .oneofUint32(let v)? = _storage._oneofField {return v}
  281. return 0
  282. }
  283. set {_uniqueStorage()._oneofField = .oneofUint32(newValue)}
  284. }
  285. var oneofNestedMessage: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage {
  286. get {
  287. if case .oneofNestedMessage(let v)? = _storage._oneofField {return v}
  288. return Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage()
  289. }
  290. set {_uniqueStorage()._oneofField = .oneofNestedMessage(newValue)}
  291. }
  292. var oneofString: String {
  293. get {
  294. if case .oneofString(let v)? = _storage._oneofField {return v}
  295. return String()
  296. }
  297. set {_uniqueStorage()._oneofField = .oneofString(newValue)}
  298. }
  299. var oneofEnum: Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum {
  300. get {
  301. if case .oneofEnum(let v)? = _storage._oneofField {return v}
  302. return .foo
  303. }
  304. set {_uniqueStorage()._oneofField = .oneofEnum(newValue)}
  305. }
  306. var unknownFields = SwiftProtobuf.UnknownStorage()
  307. enum OneOf_OneofField: Equatable, Sendable {
  308. case oneofUint32(UInt32)
  309. case oneofNestedMessage(Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage)
  310. case oneofString(String)
  311. case oneofEnum(Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum)
  312. }
  313. enum NestedEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
  314. typealias RawValue = Int
  315. case foo // = 0
  316. case bar // = 1
  317. case baz // = 2
  318. case UNRECOGNIZED(Int)
  319. init() {
  320. self = .foo
  321. }
  322. init?(rawValue: Int) {
  323. switch rawValue {
  324. case 0: self = .foo
  325. case 1: self = .bar
  326. case 2: self = .baz
  327. default: self = .UNRECOGNIZED(rawValue)
  328. }
  329. }
  330. var rawValue: Int {
  331. switch self {
  332. case .foo: return 0
  333. case .bar: return 1
  334. case .baz: return 2
  335. case .UNRECOGNIZED(let i): return i
  336. }
  337. }
  338. // The compiler won't synthesize support with the UNRECOGNIZED case.
  339. static let allCases: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum] = [
  340. .foo,
  341. .bar,
  342. .baz,
  343. ]
  344. }
  345. struct NestedMessage: Sendable {
  346. // SwiftProtobuf.Message conformance is added in an extension below. See the
  347. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  348. // methods supported on all messages.
  349. var bb: Int32 = 0
  350. var unknownFields = SwiftProtobuf.UnknownStorage()
  351. init() {}
  352. }
  353. init() {}
  354. fileprivate var _storage = _StorageClass.defaultInstance
  355. }
  356. struct Proto2NofieldpresenceUnittest_TestAllMapTypes: Sendable {
  357. // SwiftProtobuf.Message conformance is added in an extension below. See the
  358. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  359. // methods supported on all messages.
  360. var mapInt32Bytes: Dictionary<Int32,Data> = [:]
  361. var mapInt32ForeignEnum: Dictionary<Int32,Proto2NofieldpresenceUnittest_ForeignEnum> = [:]
  362. var mapInt32ForeignMessage: Dictionary<Int32,Proto2NofieldpresenceUnittest_ForeignMessage> = [:]
  363. var mapInt32ExplicitForeignMessage: Dictionary<Int32,Proto2NofieldpresenceUnittest_ExplicitForeignMessage> = [:]
  364. var unknownFields = SwiftProtobuf.UnknownStorage()
  365. init() {}
  366. }
  367. struct Proto2NofieldpresenceUnittest_TestProto2Required: Sendable {
  368. // SwiftProtobuf.Message conformance is added in an extension below. See the
  369. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  370. // methods supported on all messages.
  371. var proto2: Proto2Unittest_TestRequired {
  372. get {return _proto2 ?? Proto2Unittest_TestRequired()}
  373. set {_proto2 = newValue}
  374. }
  375. /// Returns true if `proto2` has been explicitly set.
  376. var hasProto2: Bool {return self._proto2 != nil}
  377. /// Clears the value of `proto2`. Subsequent reads from it will return its default value.
  378. mutating func clearProto2() {self._proto2 = nil}
  379. var unknownFields = SwiftProtobuf.UnknownStorage()
  380. init() {}
  381. fileprivate var _proto2: Proto2Unittest_TestRequired? = nil
  382. }
  383. /// Define these after TestAllTypes to make sure the compiler can handle
  384. /// that.
  385. struct Proto2NofieldpresenceUnittest_ForeignMessage: Sendable {
  386. // SwiftProtobuf.Message conformance is added in an extension below. See the
  387. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  388. // methods supported on all messages.
  389. var c: Int32 = 0
  390. var unknownFields = SwiftProtobuf.UnknownStorage()
  391. init() {}
  392. }
  393. /// Same as ForeignMessage, but all fields have explicit presence.
  394. /// It can be useful for testing explicit-implicit presence interop behaviour.
  395. struct Proto2NofieldpresenceUnittest_ExplicitForeignMessage: Sendable {
  396. // SwiftProtobuf.Message conformance is added in an extension below. See the
  397. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  398. // methods supported on all messages.
  399. var c: Int32 {
  400. get {return _c ?? 0}
  401. set {_c = newValue}
  402. }
  403. /// Returns true if `c` has been explicitly set.
  404. var hasC: Bool {return self._c != nil}
  405. /// Clears the value of `c`. Subsequent reads from it will return its default value.
  406. mutating func clearC() {self._c = nil}
  407. var unknownFields = SwiftProtobuf.UnknownStorage()
  408. init() {}
  409. fileprivate var _c: Int32? = nil
  410. }
  411. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  412. fileprivate let _protobuf_package = "proto2_nofieldpresence_unittest"
  413. extension Proto2NofieldpresenceUnittest_ForeignEnum: SwiftProtobuf._ProtoNameProviding {
  414. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  415. 0: .same(proto: "FOREIGN_FOO"),
  416. 1: .same(proto: "FOREIGN_BAR"),
  417. 2: .same(proto: "FOREIGN_BAZ"),
  418. ]
  419. }
  420. extension Proto2NofieldpresenceUnittest_TestAllTypes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  421. static let protoMessageName: String = _protobuf_package + ".TestAllTypes"
  422. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  423. 1: .standard(proto: "optional_int32"),
  424. 2: .standard(proto: "optional_int64"),
  425. 3: .standard(proto: "optional_uint32"),
  426. 4: .standard(proto: "optional_uint64"),
  427. 5: .standard(proto: "optional_sint32"),
  428. 6: .standard(proto: "optional_sint64"),
  429. 7: .standard(proto: "optional_fixed32"),
  430. 8: .standard(proto: "optional_fixed64"),
  431. 9: .standard(proto: "optional_sfixed32"),
  432. 10: .standard(proto: "optional_sfixed64"),
  433. 11: .standard(proto: "optional_float"),
  434. 12: .standard(proto: "optional_double"),
  435. 13: .standard(proto: "optional_bool"),
  436. 14: .standard(proto: "optional_string"),
  437. 15: .standard(proto: "optional_bytes"),
  438. 18: .standard(proto: "optional_nested_message"),
  439. 19: .standard(proto: "optional_foreign_message"),
  440. 20: .standard(proto: "optional_proto2_message"),
  441. 21: .standard(proto: "optional_nested_enum"),
  442. 22: .standard(proto: "optional_foreign_enum"),
  443. 24: .standard(proto: "optional_string_piece"),
  444. 25: .standard(proto: "optional_cord"),
  445. 30: .standard(proto: "optional_lazy_message"),
  446. 31: .standard(proto: "repeated_int32"),
  447. 32: .standard(proto: "repeated_int64"),
  448. 33: .standard(proto: "repeated_uint32"),
  449. 34: .standard(proto: "repeated_uint64"),
  450. 35: .standard(proto: "repeated_sint32"),
  451. 36: .standard(proto: "repeated_sint64"),
  452. 37: .standard(proto: "repeated_fixed32"),
  453. 38: .standard(proto: "repeated_fixed64"),
  454. 39: .standard(proto: "repeated_sfixed32"),
  455. 40: .standard(proto: "repeated_sfixed64"),
  456. 41: .standard(proto: "repeated_float"),
  457. 42: .standard(proto: "repeated_double"),
  458. 43: .standard(proto: "repeated_bool"),
  459. 44: .standard(proto: "repeated_string"),
  460. 45: .standard(proto: "repeated_bytes"),
  461. 48: .standard(proto: "repeated_nested_message"),
  462. 49: .standard(proto: "repeated_foreign_message"),
  463. 50: .standard(proto: "repeated_proto2_message"),
  464. 51: .standard(proto: "repeated_nested_enum"),
  465. 52: .standard(proto: "repeated_foreign_enum"),
  466. 54: .standard(proto: "repeated_string_piece"),
  467. 55: .standard(proto: "repeated_cord"),
  468. 57: .standard(proto: "repeated_lazy_message"),
  469. 111: .standard(proto: "oneof_uint32"),
  470. 112: .standard(proto: "oneof_nested_message"),
  471. 113: .standard(proto: "oneof_string"),
  472. 114: .standard(proto: "oneof_enum"),
  473. ]
  474. fileprivate class _StorageClass {
  475. var _optionalInt32: Int32 = 0
  476. var _optionalInt64: Int64 = 0
  477. var _optionalUint32: UInt32 = 0
  478. var _optionalUint64: UInt64 = 0
  479. var _optionalSint32: Int32 = 0
  480. var _optionalSint64: Int64 = 0
  481. var _optionalFixed32: UInt32 = 0
  482. var _optionalFixed64: UInt64 = 0
  483. var _optionalSfixed32: Int32 = 0
  484. var _optionalSfixed64: Int64 = 0
  485. var _optionalFloat: Float = 0
  486. var _optionalDouble: Double = 0
  487. var _optionalBool: Bool = false
  488. var _optionalString: String = String()
  489. var _optionalBytes: Data = Data()
  490. var _optionalNestedMessage: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage? = nil
  491. var _optionalForeignMessage: Proto2NofieldpresenceUnittest_ForeignMessage? = nil
  492. var _optionalProto2Message: Proto2Unittest_TestAllTypes? = nil
  493. var _optionalNestedEnum: Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum = .foo
  494. var _optionalForeignEnum: Proto2NofieldpresenceUnittest_ForeignEnum = .foreignFoo
  495. var _optionalStringPiece: String = String()
  496. var _optionalCord: String = String()
  497. var _optionalLazyMessage: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage? = nil
  498. var _repeatedInt32: [Int32] = []
  499. var _repeatedInt64: [Int64] = []
  500. var _repeatedUint32: [UInt32] = []
  501. var _repeatedUint64: [UInt64] = []
  502. var _repeatedSint32: [Int32] = []
  503. var _repeatedSint64: [Int64] = []
  504. var _repeatedFixed32: [UInt32] = []
  505. var _repeatedFixed64: [UInt64] = []
  506. var _repeatedSfixed32: [Int32] = []
  507. var _repeatedSfixed64: [Int64] = []
  508. var _repeatedFloat: [Float] = []
  509. var _repeatedDouble: [Double] = []
  510. var _repeatedBool: [Bool] = []
  511. var _repeatedString: [String] = []
  512. var _repeatedBytes: [Data] = []
  513. var _repeatedNestedMessage: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage] = []
  514. var _repeatedForeignMessage: [Proto2NofieldpresenceUnittest_ForeignMessage] = []
  515. var _repeatedProto2Message: [Proto2Unittest_TestAllTypes] = []
  516. var _repeatedNestedEnum: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum] = []
  517. var _repeatedForeignEnum: [Proto2NofieldpresenceUnittest_ForeignEnum] = []
  518. var _repeatedStringPiece: [String] = []
  519. var _repeatedCord: [String] = []
  520. var _repeatedLazyMessage: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage] = []
  521. var _oneofField: Proto2NofieldpresenceUnittest_TestAllTypes.OneOf_OneofField?
  522. // This property is used as the initial default value for new instances of the type.
  523. // The type itself is protecting the reference to its storage via CoW semantics.
  524. // This will force a copy to be made of this reference when the first mutation occurs;
  525. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  526. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  527. private init() {}
  528. init(copying source: _StorageClass) {
  529. _optionalInt32 = source._optionalInt32
  530. _optionalInt64 = source._optionalInt64
  531. _optionalUint32 = source._optionalUint32
  532. _optionalUint64 = source._optionalUint64
  533. _optionalSint32 = source._optionalSint32
  534. _optionalSint64 = source._optionalSint64
  535. _optionalFixed32 = source._optionalFixed32
  536. _optionalFixed64 = source._optionalFixed64
  537. _optionalSfixed32 = source._optionalSfixed32
  538. _optionalSfixed64 = source._optionalSfixed64
  539. _optionalFloat = source._optionalFloat
  540. _optionalDouble = source._optionalDouble
  541. _optionalBool = source._optionalBool
  542. _optionalString = source._optionalString
  543. _optionalBytes = source._optionalBytes
  544. _optionalNestedMessage = source._optionalNestedMessage
  545. _optionalForeignMessage = source._optionalForeignMessage
  546. _optionalProto2Message = source._optionalProto2Message
  547. _optionalNestedEnum = source._optionalNestedEnum
  548. _optionalForeignEnum = source._optionalForeignEnum
  549. _optionalStringPiece = source._optionalStringPiece
  550. _optionalCord = source._optionalCord
  551. _optionalLazyMessage = source._optionalLazyMessage
  552. _repeatedInt32 = source._repeatedInt32
  553. _repeatedInt64 = source._repeatedInt64
  554. _repeatedUint32 = source._repeatedUint32
  555. _repeatedUint64 = source._repeatedUint64
  556. _repeatedSint32 = source._repeatedSint32
  557. _repeatedSint64 = source._repeatedSint64
  558. _repeatedFixed32 = source._repeatedFixed32
  559. _repeatedFixed64 = source._repeatedFixed64
  560. _repeatedSfixed32 = source._repeatedSfixed32
  561. _repeatedSfixed64 = source._repeatedSfixed64
  562. _repeatedFloat = source._repeatedFloat
  563. _repeatedDouble = source._repeatedDouble
  564. _repeatedBool = source._repeatedBool
  565. _repeatedString = source._repeatedString
  566. _repeatedBytes = source._repeatedBytes
  567. _repeatedNestedMessage = source._repeatedNestedMessage
  568. _repeatedForeignMessage = source._repeatedForeignMessage
  569. _repeatedProto2Message = source._repeatedProto2Message
  570. _repeatedNestedEnum = source._repeatedNestedEnum
  571. _repeatedForeignEnum = source._repeatedForeignEnum
  572. _repeatedStringPiece = source._repeatedStringPiece
  573. _repeatedCord = source._repeatedCord
  574. _repeatedLazyMessage = source._repeatedLazyMessage
  575. _oneofField = source._oneofField
  576. }
  577. }
  578. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  579. if !isKnownUniquelyReferenced(&_storage) {
  580. _storage = _StorageClass(copying: _storage)
  581. }
  582. return _storage
  583. }
  584. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  585. _ = _uniqueStorage()
  586. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  587. while let fieldNumber = try decoder.nextFieldNumber() {
  588. // The use of inline closures is to circumvent an issue where the compiler
  589. // allocates stack space for every case branch when no optimizations are
  590. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  591. switch fieldNumber {
  592. case 1: try { try decoder.decodeSingularInt32Field(value: &_storage._optionalInt32) }()
  593. case 2: try { try decoder.decodeSingularInt64Field(value: &_storage._optionalInt64) }()
  594. case 3: try { try decoder.decodeSingularUInt32Field(value: &_storage._optionalUint32) }()
  595. case 4: try { try decoder.decodeSingularUInt64Field(value: &_storage._optionalUint64) }()
  596. case 5: try { try decoder.decodeSingularSInt32Field(value: &_storage._optionalSint32) }()
  597. case 6: try { try decoder.decodeSingularSInt64Field(value: &_storage._optionalSint64) }()
  598. case 7: try { try decoder.decodeSingularFixed32Field(value: &_storage._optionalFixed32) }()
  599. case 8: try { try decoder.decodeSingularFixed64Field(value: &_storage._optionalFixed64) }()
  600. case 9: try { try decoder.decodeSingularSFixed32Field(value: &_storage._optionalSfixed32) }()
  601. case 10: try { try decoder.decodeSingularSFixed64Field(value: &_storage._optionalSfixed64) }()
  602. case 11: try { try decoder.decodeSingularFloatField(value: &_storage._optionalFloat) }()
  603. case 12: try { try decoder.decodeSingularDoubleField(value: &_storage._optionalDouble) }()
  604. case 13: try { try decoder.decodeSingularBoolField(value: &_storage._optionalBool) }()
  605. case 14: try { try decoder.decodeSingularStringField(value: &_storage._optionalString) }()
  606. case 15: try { try decoder.decodeSingularBytesField(value: &_storage._optionalBytes) }()
  607. case 18: try { try decoder.decodeSingularMessageField(value: &_storage._optionalNestedMessage) }()
  608. case 19: try { try decoder.decodeSingularMessageField(value: &_storage._optionalForeignMessage) }()
  609. case 20: try { try decoder.decodeSingularMessageField(value: &_storage._optionalProto2Message) }()
  610. case 21: try { try decoder.decodeSingularEnumField(value: &_storage._optionalNestedEnum) }()
  611. case 22: try { try decoder.decodeSingularEnumField(value: &_storage._optionalForeignEnum) }()
  612. case 24: try { try decoder.decodeSingularStringField(value: &_storage._optionalStringPiece) }()
  613. case 25: try { try decoder.decodeSingularStringField(value: &_storage._optionalCord) }()
  614. case 30: try { try decoder.decodeSingularMessageField(value: &_storage._optionalLazyMessage) }()
  615. case 31: try { try decoder.decodeRepeatedInt32Field(value: &_storage._repeatedInt32) }()
  616. case 32: try { try decoder.decodeRepeatedInt64Field(value: &_storage._repeatedInt64) }()
  617. case 33: try { try decoder.decodeRepeatedUInt32Field(value: &_storage._repeatedUint32) }()
  618. case 34: try { try decoder.decodeRepeatedUInt64Field(value: &_storage._repeatedUint64) }()
  619. case 35: try { try decoder.decodeRepeatedSInt32Field(value: &_storage._repeatedSint32) }()
  620. case 36: try { try decoder.decodeRepeatedSInt64Field(value: &_storage._repeatedSint64) }()
  621. case 37: try { try decoder.decodeRepeatedFixed32Field(value: &_storage._repeatedFixed32) }()
  622. case 38: try { try decoder.decodeRepeatedFixed64Field(value: &_storage._repeatedFixed64) }()
  623. case 39: try { try decoder.decodeRepeatedSFixed32Field(value: &_storage._repeatedSfixed32) }()
  624. case 40: try { try decoder.decodeRepeatedSFixed64Field(value: &_storage._repeatedSfixed64) }()
  625. case 41: try { try decoder.decodeRepeatedFloatField(value: &_storage._repeatedFloat) }()
  626. case 42: try { try decoder.decodeRepeatedDoubleField(value: &_storage._repeatedDouble) }()
  627. case 43: try { try decoder.decodeRepeatedBoolField(value: &_storage._repeatedBool) }()
  628. case 44: try { try decoder.decodeRepeatedStringField(value: &_storage._repeatedString) }()
  629. case 45: try { try decoder.decodeRepeatedBytesField(value: &_storage._repeatedBytes) }()
  630. case 48: try { try decoder.decodeRepeatedMessageField(value: &_storage._repeatedNestedMessage) }()
  631. case 49: try { try decoder.decodeRepeatedMessageField(value: &_storage._repeatedForeignMessage) }()
  632. case 50: try { try decoder.decodeRepeatedMessageField(value: &_storage._repeatedProto2Message) }()
  633. case 51: try { try decoder.decodeRepeatedEnumField(value: &_storage._repeatedNestedEnum) }()
  634. case 52: try { try decoder.decodeRepeatedEnumField(value: &_storage._repeatedForeignEnum) }()
  635. case 54: try { try decoder.decodeRepeatedStringField(value: &_storage._repeatedStringPiece) }()
  636. case 55: try { try decoder.decodeRepeatedStringField(value: &_storage._repeatedCord) }()
  637. case 57: try { try decoder.decodeRepeatedMessageField(value: &_storage._repeatedLazyMessage) }()
  638. case 111: try {
  639. var v: UInt32?
  640. try decoder.decodeSingularUInt32Field(value: &v)
  641. if let v = v {
  642. if _storage._oneofField != nil {try decoder.handleConflictingOneOf()}
  643. _storage._oneofField = .oneofUint32(v)
  644. }
  645. }()
  646. case 112: try {
  647. var v: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage?
  648. var hadOneofValue = false
  649. if let current = _storage._oneofField {
  650. hadOneofValue = true
  651. if case .oneofNestedMessage(let m) = current {v = m}
  652. }
  653. try decoder.decodeSingularMessageField(value: &v)
  654. if let v = v {
  655. if hadOneofValue {try decoder.handleConflictingOneOf()}
  656. _storage._oneofField = .oneofNestedMessage(v)
  657. }
  658. }()
  659. case 113: try {
  660. var v: String?
  661. try decoder.decodeSingularStringField(value: &v)
  662. if let v = v {
  663. if _storage._oneofField != nil {try decoder.handleConflictingOneOf()}
  664. _storage._oneofField = .oneofString(v)
  665. }
  666. }()
  667. case 114: try {
  668. var v: Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum?
  669. try decoder.decodeSingularEnumField(value: &v)
  670. if let v = v {
  671. if _storage._oneofField != nil {try decoder.handleConflictingOneOf()}
  672. _storage._oneofField = .oneofEnum(v)
  673. }
  674. }()
  675. default: break
  676. }
  677. }
  678. }
  679. }
  680. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  681. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  682. // The use of inline closures is to circumvent an issue where the compiler
  683. // allocates stack space for every if/case branch local when no optimizations
  684. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  685. // https://github.com/apple/swift-protobuf/issues/1182
  686. if _storage._optionalInt32 != 0 {
  687. try visitor.visitSingularInt32Field(value: _storage._optionalInt32, fieldNumber: 1)
  688. }
  689. if _storage._optionalInt64 != 0 {
  690. try visitor.visitSingularInt64Field(value: _storage._optionalInt64, fieldNumber: 2)
  691. }
  692. if _storage._optionalUint32 != 0 {
  693. try visitor.visitSingularUInt32Field(value: _storage._optionalUint32, fieldNumber: 3)
  694. }
  695. if _storage._optionalUint64 != 0 {
  696. try visitor.visitSingularUInt64Field(value: _storage._optionalUint64, fieldNumber: 4)
  697. }
  698. if _storage._optionalSint32 != 0 {
  699. try visitor.visitSingularSInt32Field(value: _storage._optionalSint32, fieldNumber: 5)
  700. }
  701. if _storage._optionalSint64 != 0 {
  702. try visitor.visitSingularSInt64Field(value: _storage._optionalSint64, fieldNumber: 6)
  703. }
  704. if _storage._optionalFixed32 != 0 {
  705. try visitor.visitSingularFixed32Field(value: _storage._optionalFixed32, fieldNumber: 7)
  706. }
  707. if _storage._optionalFixed64 != 0 {
  708. try visitor.visitSingularFixed64Field(value: _storage._optionalFixed64, fieldNumber: 8)
  709. }
  710. if _storage._optionalSfixed32 != 0 {
  711. try visitor.visitSingularSFixed32Field(value: _storage._optionalSfixed32, fieldNumber: 9)
  712. }
  713. if _storage._optionalSfixed64 != 0 {
  714. try visitor.visitSingularSFixed64Field(value: _storage._optionalSfixed64, fieldNumber: 10)
  715. }
  716. if _storage._optionalFloat.bitPattern != 0 {
  717. try visitor.visitSingularFloatField(value: _storage._optionalFloat, fieldNumber: 11)
  718. }
  719. if _storage._optionalDouble.bitPattern != 0 {
  720. try visitor.visitSingularDoubleField(value: _storage._optionalDouble, fieldNumber: 12)
  721. }
  722. if _storage._optionalBool != false {
  723. try visitor.visitSingularBoolField(value: _storage._optionalBool, fieldNumber: 13)
  724. }
  725. if !_storage._optionalString.isEmpty {
  726. try visitor.visitSingularStringField(value: _storage._optionalString, fieldNumber: 14)
  727. }
  728. if !_storage._optionalBytes.isEmpty {
  729. try visitor.visitSingularBytesField(value: _storage._optionalBytes, fieldNumber: 15)
  730. }
  731. try { if let v = _storage._optionalNestedMessage {
  732. try visitor.visitSingularMessageField(value: v, fieldNumber: 18)
  733. } }()
  734. try { if let v = _storage._optionalForeignMessage {
  735. try visitor.visitSingularMessageField(value: v, fieldNumber: 19)
  736. } }()
  737. try { if let v = _storage._optionalProto2Message {
  738. try visitor.visitSingularMessageField(value: v, fieldNumber: 20)
  739. } }()
  740. if _storage._optionalNestedEnum != .foo {
  741. try visitor.visitSingularEnumField(value: _storage._optionalNestedEnum, fieldNumber: 21)
  742. }
  743. if _storage._optionalForeignEnum != .foreignFoo {
  744. try visitor.visitSingularEnumField(value: _storage._optionalForeignEnum, fieldNumber: 22)
  745. }
  746. if !_storage._optionalStringPiece.isEmpty {
  747. try visitor.visitSingularStringField(value: _storage._optionalStringPiece, fieldNumber: 24)
  748. }
  749. if !_storage._optionalCord.isEmpty {
  750. try visitor.visitSingularStringField(value: _storage._optionalCord, fieldNumber: 25)
  751. }
  752. try { if let v = _storage._optionalLazyMessage {
  753. try visitor.visitSingularMessageField(value: v, fieldNumber: 30)
  754. } }()
  755. if !_storage._repeatedInt32.isEmpty {
  756. try visitor.visitPackedInt32Field(value: _storage._repeatedInt32, fieldNumber: 31)
  757. }
  758. if !_storage._repeatedInt64.isEmpty {
  759. try visitor.visitPackedInt64Field(value: _storage._repeatedInt64, fieldNumber: 32)
  760. }
  761. if !_storage._repeatedUint32.isEmpty {
  762. try visitor.visitPackedUInt32Field(value: _storage._repeatedUint32, fieldNumber: 33)
  763. }
  764. if !_storage._repeatedUint64.isEmpty {
  765. try visitor.visitPackedUInt64Field(value: _storage._repeatedUint64, fieldNumber: 34)
  766. }
  767. if !_storage._repeatedSint32.isEmpty {
  768. try visitor.visitPackedSInt32Field(value: _storage._repeatedSint32, fieldNumber: 35)
  769. }
  770. if !_storage._repeatedSint64.isEmpty {
  771. try visitor.visitPackedSInt64Field(value: _storage._repeatedSint64, fieldNumber: 36)
  772. }
  773. if !_storage._repeatedFixed32.isEmpty {
  774. try visitor.visitPackedFixed32Field(value: _storage._repeatedFixed32, fieldNumber: 37)
  775. }
  776. if !_storage._repeatedFixed64.isEmpty {
  777. try visitor.visitPackedFixed64Field(value: _storage._repeatedFixed64, fieldNumber: 38)
  778. }
  779. if !_storage._repeatedSfixed32.isEmpty {
  780. try visitor.visitPackedSFixed32Field(value: _storage._repeatedSfixed32, fieldNumber: 39)
  781. }
  782. if !_storage._repeatedSfixed64.isEmpty {
  783. try visitor.visitPackedSFixed64Field(value: _storage._repeatedSfixed64, fieldNumber: 40)
  784. }
  785. if !_storage._repeatedFloat.isEmpty {
  786. try visitor.visitPackedFloatField(value: _storage._repeatedFloat, fieldNumber: 41)
  787. }
  788. if !_storage._repeatedDouble.isEmpty {
  789. try visitor.visitPackedDoubleField(value: _storage._repeatedDouble, fieldNumber: 42)
  790. }
  791. if !_storage._repeatedBool.isEmpty {
  792. try visitor.visitPackedBoolField(value: _storage._repeatedBool, fieldNumber: 43)
  793. }
  794. if !_storage._repeatedString.isEmpty {
  795. try visitor.visitRepeatedStringField(value: _storage._repeatedString, fieldNumber: 44)
  796. }
  797. if !_storage._repeatedBytes.isEmpty {
  798. try visitor.visitRepeatedBytesField(value: _storage._repeatedBytes, fieldNumber: 45)
  799. }
  800. if !_storage._repeatedNestedMessage.isEmpty {
  801. try visitor.visitRepeatedMessageField(value: _storage._repeatedNestedMessage, fieldNumber: 48)
  802. }
  803. if !_storage._repeatedForeignMessage.isEmpty {
  804. try visitor.visitRepeatedMessageField(value: _storage._repeatedForeignMessage, fieldNumber: 49)
  805. }
  806. if !_storage._repeatedProto2Message.isEmpty {
  807. try visitor.visitRepeatedMessageField(value: _storage._repeatedProto2Message, fieldNumber: 50)
  808. }
  809. if !_storage._repeatedNestedEnum.isEmpty {
  810. try visitor.visitPackedEnumField(value: _storage._repeatedNestedEnum, fieldNumber: 51)
  811. }
  812. if !_storage._repeatedForeignEnum.isEmpty {
  813. try visitor.visitPackedEnumField(value: _storage._repeatedForeignEnum, fieldNumber: 52)
  814. }
  815. if !_storage._repeatedStringPiece.isEmpty {
  816. try visitor.visitRepeatedStringField(value: _storage._repeatedStringPiece, fieldNumber: 54)
  817. }
  818. if !_storage._repeatedCord.isEmpty {
  819. try visitor.visitRepeatedStringField(value: _storage._repeatedCord, fieldNumber: 55)
  820. }
  821. if !_storage._repeatedLazyMessage.isEmpty {
  822. try visitor.visitRepeatedMessageField(value: _storage._repeatedLazyMessage, fieldNumber: 57)
  823. }
  824. switch _storage._oneofField {
  825. case .oneofUint32?: try {
  826. guard case .oneofUint32(let v)? = _storage._oneofField else { preconditionFailure() }
  827. try visitor.visitSingularUInt32Field(value: v, fieldNumber: 111)
  828. }()
  829. case .oneofNestedMessage?: try {
  830. guard case .oneofNestedMessage(let v)? = _storage._oneofField else { preconditionFailure() }
  831. try visitor.visitSingularMessageField(value: v, fieldNumber: 112)
  832. }()
  833. case .oneofString?: try {
  834. guard case .oneofString(let v)? = _storage._oneofField else { preconditionFailure() }
  835. try visitor.visitSingularStringField(value: v, fieldNumber: 113)
  836. }()
  837. case .oneofEnum?: try {
  838. guard case .oneofEnum(let v)? = _storage._oneofField else { preconditionFailure() }
  839. try visitor.visitSingularEnumField(value: v, fieldNumber: 114)
  840. }()
  841. case nil: break
  842. }
  843. }
  844. try unknownFields.traverse(visitor: &visitor)
  845. }
  846. static func ==(lhs: Proto2NofieldpresenceUnittest_TestAllTypes, rhs: Proto2NofieldpresenceUnittest_TestAllTypes) -> Bool {
  847. if lhs._storage !== rhs._storage {
  848. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  849. let _storage = _args.0
  850. let rhs_storage = _args.1
  851. if _storage._optionalInt32 != rhs_storage._optionalInt32 {return false}
  852. if _storage._optionalInt64 != rhs_storage._optionalInt64 {return false}
  853. if _storage._optionalUint32 != rhs_storage._optionalUint32 {return false}
  854. if _storage._optionalUint64 != rhs_storage._optionalUint64 {return false}
  855. if _storage._optionalSint32 != rhs_storage._optionalSint32 {return false}
  856. if _storage._optionalSint64 != rhs_storage._optionalSint64 {return false}
  857. if _storage._optionalFixed32 != rhs_storage._optionalFixed32 {return false}
  858. if _storage._optionalFixed64 != rhs_storage._optionalFixed64 {return false}
  859. if _storage._optionalSfixed32 != rhs_storage._optionalSfixed32 {return false}
  860. if _storage._optionalSfixed64 != rhs_storage._optionalSfixed64 {return false}
  861. if _storage._optionalFloat != rhs_storage._optionalFloat {return false}
  862. if _storage._optionalDouble != rhs_storage._optionalDouble {return false}
  863. if _storage._optionalBool != rhs_storage._optionalBool {return false}
  864. if _storage._optionalString != rhs_storage._optionalString {return false}
  865. if _storage._optionalBytes != rhs_storage._optionalBytes {return false}
  866. if _storage._optionalNestedMessage != rhs_storage._optionalNestedMessage {return false}
  867. if _storage._optionalForeignMessage != rhs_storage._optionalForeignMessage {return false}
  868. if _storage._optionalProto2Message != rhs_storage._optionalProto2Message {return false}
  869. if _storage._optionalNestedEnum != rhs_storage._optionalNestedEnum {return false}
  870. if _storage._optionalForeignEnum != rhs_storage._optionalForeignEnum {return false}
  871. if _storage._optionalStringPiece != rhs_storage._optionalStringPiece {return false}
  872. if _storage._optionalCord != rhs_storage._optionalCord {return false}
  873. if _storage._optionalLazyMessage != rhs_storage._optionalLazyMessage {return false}
  874. if _storage._repeatedInt32 != rhs_storage._repeatedInt32 {return false}
  875. if _storage._repeatedInt64 != rhs_storage._repeatedInt64 {return false}
  876. if _storage._repeatedUint32 != rhs_storage._repeatedUint32 {return false}
  877. if _storage._repeatedUint64 != rhs_storage._repeatedUint64 {return false}
  878. if _storage._repeatedSint32 != rhs_storage._repeatedSint32 {return false}
  879. if _storage._repeatedSint64 != rhs_storage._repeatedSint64 {return false}
  880. if _storage._repeatedFixed32 != rhs_storage._repeatedFixed32 {return false}
  881. if _storage._repeatedFixed64 != rhs_storage._repeatedFixed64 {return false}
  882. if _storage._repeatedSfixed32 != rhs_storage._repeatedSfixed32 {return false}
  883. if _storage._repeatedSfixed64 != rhs_storage._repeatedSfixed64 {return false}
  884. if _storage._repeatedFloat != rhs_storage._repeatedFloat {return false}
  885. if _storage._repeatedDouble != rhs_storage._repeatedDouble {return false}
  886. if _storage._repeatedBool != rhs_storage._repeatedBool {return false}
  887. if _storage._repeatedString != rhs_storage._repeatedString {return false}
  888. if _storage._repeatedBytes != rhs_storage._repeatedBytes {return false}
  889. if _storage._repeatedNestedMessage != rhs_storage._repeatedNestedMessage {return false}
  890. if _storage._repeatedForeignMessage != rhs_storage._repeatedForeignMessage {return false}
  891. if _storage._repeatedProto2Message != rhs_storage._repeatedProto2Message {return false}
  892. if _storage._repeatedNestedEnum != rhs_storage._repeatedNestedEnum {return false}
  893. if _storage._repeatedForeignEnum != rhs_storage._repeatedForeignEnum {return false}
  894. if _storage._repeatedStringPiece != rhs_storage._repeatedStringPiece {return false}
  895. if _storage._repeatedCord != rhs_storage._repeatedCord {return false}
  896. if _storage._repeatedLazyMessage != rhs_storage._repeatedLazyMessage {return false}
  897. if _storage._oneofField != rhs_storage._oneofField {return false}
  898. return true
  899. }
  900. if !storagesAreEqual {return false}
  901. }
  902. if lhs.unknownFields != rhs.unknownFields {return false}
  903. return true
  904. }
  905. }
  906. extension Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum: SwiftProtobuf._ProtoNameProviding {
  907. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  908. 0: .same(proto: "FOO"),
  909. 1: .same(proto: "BAR"),
  910. 2: .same(proto: "BAZ"),
  911. ]
  912. }
  913. extension Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  914. static let protoMessageName: String = Proto2NofieldpresenceUnittest_TestAllTypes.protoMessageName + ".NestedMessage"
  915. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  916. 1: .same(proto: "bb"),
  917. ]
  918. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  919. while let fieldNumber = try decoder.nextFieldNumber() {
  920. // The use of inline closures is to circumvent an issue where the compiler
  921. // allocates stack space for every case branch when no optimizations are
  922. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  923. switch fieldNumber {
  924. case 1: try { try decoder.decodeSingularInt32Field(value: &self.bb) }()
  925. default: break
  926. }
  927. }
  928. }
  929. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  930. if self.bb != 0 {
  931. try visitor.visitSingularInt32Field(value: self.bb, fieldNumber: 1)
  932. }
  933. try unknownFields.traverse(visitor: &visitor)
  934. }
  935. static func ==(lhs: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage, rhs: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage) -> Bool {
  936. if lhs.bb != rhs.bb {return false}
  937. if lhs.unknownFields != rhs.unknownFields {return false}
  938. return true
  939. }
  940. }
  941. extension Proto2NofieldpresenceUnittest_TestAllMapTypes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  942. static let protoMessageName: String = _protobuf_package + ".TestAllMapTypes"
  943. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  944. 1: .standard(proto: "map_int32_bytes"),
  945. 2: .standard(proto: "map_int32_foreign_enum"),
  946. 3: .standard(proto: "map_int32_foreign_message"),
  947. 4: .standard(proto: "map_int32_explicit_foreign_message"),
  948. ]
  949. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  950. while let fieldNumber = try decoder.nextFieldNumber() {
  951. // The use of inline closures is to circumvent an issue where the compiler
  952. // allocates stack space for every case branch when no optimizations are
  953. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  954. switch fieldNumber {
  955. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufBytes>.self, value: &self.mapInt32Bytes) }()
  956. case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufEnumMap<SwiftProtobuf.ProtobufInt32,Proto2NofieldpresenceUnittest_ForeignEnum>.self, value: &self.mapInt32ForeignEnum) }()
  957. case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2NofieldpresenceUnittest_ForeignMessage>.self, value: &self.mapInt32ForeignMessage) }()
  958. case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2NofieldpresenceUnittest_ExplicitForeignMessage>.self, value: &self.mapInt32ExplicitForeignMessage) }()
  959. default: break
  960. }
  961. }
  962. }
  963. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  964. if !self.mapInt32Bytes.isEmpty {
  965. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufBytes>.self, value: self.mapInt32Bytes, fieldNumber: 1)
  966. }
  967. if !self.mapInt32ForeignEnum.isEmpty {
  968. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufEnumMap<SwiftProtobuf.ProtobufInt32,Proto2NofieldpresenceUnittest_ForeignEnum>.self, value: self.mapInt32ForeignEnum, fieldNumber: 2)
  969. }
  970. if !self.mapInt32ForeignMessage.isEmpty {
  971. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2NofieldpresenceUnittest_ForeignMessage>.self, value: self.mapInt32ForeignMessage, fieldNumber: 3)
  972. }
  973. if !self.mapInt32ExplicitForeignMessage.isEmpty {
  974. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2NofieldpresenceUnittest_ExplicitForeignMessage>.self, value: self.mapInt32ExplicitForeignMessage, fieldNumber: 4)
  975. }
  976. try unknownFields.traverse(visitor: &visitor)
  977. }
  978. static func ==(lhs: Proto2NofieldpresenceUnittest_TestAllMapTypes, rhs: Proto2NofieldpresenceUnittest_TestAllMapTypes) -> Bool {
  979. if lhs.mapInt32Bytes != rhs.mapInt32Bytes {return false}
  980. if lhs.mapInt32ForeignEnum != rhs.mapInt32ForeignEnum {return false}
  981. if lhs.mapInt32ForeignMessage != rhs.mapInt32ForeignMessage {return false}
  982. if lhs.mapInt32ExplicitForeignMessage != rhs.mapInt32ExplicitForeignMessage {return false}
  983. if lhs.unknownFields != rhs.unknownFields {return false}
  984. return true
  985. }
  986. }
  987. extension Proto2NofieldpresenceUnittest_TestProto2Required: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  988. static let protoMessageName: String = _protobuf_package + ".TestProto2Required"
  989. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  990. 1: .same(proto: "proto2"),
  991. ]
  992. public var isInitialized: Bool {
  993. if let v = self._proto2, !v.isInitialized {return false}
  994. return true
  995. }
  996. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  997. while let fieldNumber = try decoder.nextFieldNumber() {
  998. // The use of inline closures is to circumvent an issue where the compiler
  999. // allocates stack space for every case branch when no optimizations are
  1000. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  1001. switch fieldNumber {
  1002. case 1: try { try decoder.decodeSingularMessageField(value: &self._proto2) }()
  1003. default: break
  1004. }
  1005. }
  1006. }
  1007. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1008. // The use of inline closures is to circumvent an issue where the compiler
  1009. // allocates stack space for every if/case branch local when no optimizations
  1010. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  1011. // https://github.com/apple/swift-protobuf/issues/1182
  1012. try { if let v = self._proto2 {
  1013. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  1014. } }()
  1015. try unknownFields.traverse(visitor: &visitor)
  1016. }
  1017. static func ==(lhs: Proto2NofieldpresenceUnittest_TestProto2Required, rhs: Proto2NofieldpresenceUnittest_TestProto2Required) -> Bool {
  1018. if lhs._proto2 != rhs._proto2 {return false}
  1019. if lhs.unknownFields != rhs.unknownFields {return false}
  1020. return true
  1021. }
  1022. }
  1023. extension Proto2NofieldpresenceUnittest_ForeignMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1024. static let protoMessageName: String = _protobuf_package + ".ForeignMessage"
  1025. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1026. 1: .same(proto: "c"),
  1027. ]
  1028. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1029. while let fieldNumber = try decoder.nextFieldNumber() {
  1030. // The use of inline closures is to circumvent an issue where the compiler
  1031. // allocates stack space for every case branch when no optimizations are
  1032. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  1033. switch fieldNumber {
  1034. case 1: try { try decoder.decodeSingularInt32Field(value: &self.c) }()
  1035. default: break
  1036. }
  1037. }
  1038. }
  1039. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1040. if self.c != 0 {
  1041. try visitor.visitSingularInt32Field(value: self.c, fieldNumber: 1)
  1042. }
  1043. try unknownFields.traverse(visitor: &visitor)
  1044. }
  1045. static func ==(lhs: Proto2NofieldpresenceUnittest_ForeignMessage, rhs: Proto2NofieldpresenceUnittest_ForeignMessage) -> Bool {
  1046. if lhs.c != rhs.c {return false}
  1047. if lhs.unknownFields != rhs.unknownFields {return false}
  1048. return true
  1049. }
  1050. }
  1051. extension Proto2NofieldpresenceUnittest_ExplicitForeignMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1052. static let protoMessageName: String = _protobuf_package + ".ExplicitForeignMessage"
  1053. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1054. 1: .same(proto: "c"),
  1055. ]
  1056. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1057. while let fieldNumber = try decoder.nextFieldNumber() {
  1058. // The use of inline closures is to circumvent an issue where the compiler
  1059. // allocates stack space for every case branch when no optimizations are
  1060. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  1061. switch fieldNumber {
  1062. case 1: try { try decoder.decodeSingularInt32Field(value: &self._c) }()
  1063. default: break
  1064. }
  1065. }
  1066. }
  1067. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1068. // The use of inline closures is to circumvent an issue where the compiler
  1069. // allocates stack space for every if/case branch local when no optimizations
  1070. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  1071. // https://github.com/apple/swift-protobuf/issues/1182
  1072. try { if let v = self._c {
  1073. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  1074. } }()
  1075. try unknownFields.traverse(visitor: &visitor)
  1076. }
  1077. static func ==(lhs: Proto2NofieldpresenceUnittest_ExplicitForeignMessage, rhs: Proto2NofieldpresenceUnittest_ExplicitForeignMessage) -> Bool {
  1078. if lhs._c != rhs._c {return false}
  1079. if lhs.unknownFields != rhs.unknownFields {return false}
  1080. return true
  1081. }
  1082. }