unittest_mset.pb.swift 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  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_mset.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. // Author: kenton@google.com (Kenton Varda)
  17. // Based on original Protocol Buffers design by
  18. // Sanjay Ghemawat, Jeff Dean, and others.
  19. //
  20. // This file is similar to unittest_mset_wire_format.proto, but does not
  21. // have a TestMessageSet, so it can be downgraded to proto1.
  22. import Foundation
  23. import SwiftProtobuf
  24. // If the compiler emits an error on this type, it is because this file
  25. // was generated by a version of the `protoc` Swift plug-in that is
  26. // incompatible with the version of SwiftProtobuf to which you are linking.
  27. // Please ensure that you are building against the same version of the API
  28. // that was used to generate this file.
  29. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  30. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  31. typealias Version = _2
  32. }
  33. struct Proto2Unittest_TestMessageSetContainer: Sendable {
  34. // SwiftProtobuf.Message conformance is added in an extension below. See the
  35. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  36. // methods supported on all messages.
  37. var messageSet: Proto2WireformatUnittest_TestMessageSet {
  38. get {return _messageSet ?? Proto2WireformatUnittest_TestMessageSet()}
  39. set {_messageSet = newValue}
  40. }
  41. /// Returns true if `messageSet` has been explicitly set.
  42. var hasMessageSet: Bool {return self._messageSet != nil}
  43. /// Clears the value of `messageSet`. Subsequent reads from it will return its default value.
  44. mutating func clearMessageSet() {self._messageSet = nil}
  45. var unknownFields = SwiftProtobuf.UnknownStorage()
  46. init() {}
  47. fileprivate var _messageSet: Proto2WireformatUnittest_TestMessageSet? = nil
  48. }
  49. struct Proto2Unittest_NestedTestMessageSetContainer: @unchecked Sendable {
  50. // SwiftProtobuf.Message conformance is added in an extension below. See the
  51. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  52. // methods supported on all messages.
  53. var container: Proto2Unittest_TestMessageSetContainer {
  54. get {return _storage._container ?? Proto2Unittest_TestMessageSetContainer()}
  55. set {_uniqueStorage()._container = newValue}
  56. }
  57. /// Returns true if `container` has been explicitly set.
  58. var hasContainer: Bool {return _storage._container != nil}
  59. /// Clears the value of `container`. Subsequent reads from it will return its default value.
  60. mutating func clearContainer() {_uniqueStorage()._container = nil}
  61. var child: Proto2Unittest_NestedTestMessageSetContainer {
  62. get {return _storage._child ?? Proto2Unittest_NestedTestMessageSetContainer()}
  63. set {_uniqueStorage()._child = newValue}
  64. }
  65. /// Returns true if `child` has been explicitly set.
  66. var hasChild: Bool {return _storage._child != nil}
  67. /// Clears the value of `child`. Subsequent reads from it will return its default value.
  68. mutating func clearChild() {_uniqueStorage()._child = nil}
  69. var lazyChild: Proto2Unittest_NestedTestMessageSetContainer {
  70. get {return _storage._lazyChild ?? Proto2Unittest_NestedTestMessageSetContainer()}
  71. set {_uniqueStorage()._lazyChild = newValue}
  72. }
  73. /// Returns true if `lazyChild` has been explicitly set.
  74. var hasLazyChild: Bool {return _storage._lazyChild != nil}
  75. /// Clears the value of `lazyChild`. Subsequent reads from it will return its default value.
  76. mutating func clearLazyChild() {_uniqueStorage()._lazyChild = nil}
  77. var unknownFields = SwiftProtobuf.UnknownStorage()
  78. init() {}
  79. fileprivate var _storage = _StorageClass.defaultInstance
  80. }
  81. struct Proto2Unittest_NestedTestInt: @unchecked Sendable {
  82. // SwiftProtobuf.Message conformance is added in an extension below. See the
  83. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  84. // methods supported on all messages.
  85. var a: UInt32 {
  86. get {return _storage._a ?? 0}
  87. set {_uniqueStorage()._a = newValue}
  88. }
  89. /// Returns true if `a` has been explicitly set.
  90. var hasA: Bool {return _storage._a != nil}
  91. /// Clears the value of `a`. Subsequent reads from it will return its default value.
  92. mutating func clearA() {_uniqueStorage()._a = nil}
  93. var b: Int32 {
  94. get {return _storage._b ?? 0}
  95. set {_uniqueStorage()._b = newValue}
  96. }
  97. /// Returns true if `b` has been explicitly set.
  98. var hasB: Bool {return _storage._b != nil}
  99. /// Clears the value of `b`. Subsequent reads from it will return its default value.
  100. mutating func clearB() {_uniqueStorage()._b = nil}
  101. var child: Proto2Unittest_NestedTestInt {
  102. get {return _storage._child ?? Proto2Unittest_NestedTestInt()}
  103. set {_uniqueStorage()._child = newValue}
  104. }
  105. /// Returns true if `child` has been explicitly set.
  106. var hasChild: Bool {return _storage._child != nil}
  107. /// Clears the value of `child`. Subsequent reads from it will return its default value.
  108. mutating func clearChild() {_uniqueStorage()._child = nil}
  109. var unknownFields = SwiftProtobuf.UnknownStorage()
  110. init() {}
  111. fileprivate var _storage = _StorageClass.defaultInstance
  112. }
  113. struct Proto2Unittest_TestMessageSetExtension1: Sendable {
  114. // SwiftProtobuf.Message conformance is added in an extension below. See the
  115. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  116. // methods supported on all messages.
  117. var i: Int32 {
  118. get {return _i ?? 0}
  119. set {_i = newValue}
  120. }
  121. /// Returns true if `i` has been explicitly set.
  122. var hasI: Bool {return self._i != nil}
  123. /// Clears the value of `i`. Subsequent reads from it will return its default value.
  124. mutating func clearI() {self._i = nil}
  125. var recursive: Proto2WireformatUnittest_TestMessageSet {
  126. get {return _recursive ?? Proto2WireformatUnittest_TestMessageSet()}
  127. set {_recursive = newValue}
  128. }
  129. /// Returns true if `recursive` has been explicitly set.
  130. var hasRecursive: Bool {return self._recursive != nil}
  131. /// Clears the value of `recursive`. Subsequent reads from it will return its default value.
  132. mutating func clearRecursive() {self._recursive = nil}
  133. var testAliasing: String {
  134. get {return _testAliasing ?? String()}
  135. set {_testAliasing = newValue}
  136. }
  137. /// Returns true if `testAliasing` has been explicitly set.
  138. var hasTestAliasing: Bool {return self._testAliasing != nil}
  139. /// Clears the value of `testAliasing`. Subsequent reads from it will return its default value.
  140. mutating func clearTestAliasing() {self._testAliasing = nil}
  141. var unknownFields = SwiftProtobuf.UnknownStorage()
  142. init() {}
  143. fileprivate var _i: Int32? = nil
  144. fileprivate var _recursive: Proto2WireformatUnittest_TestMessageSet? = nil
  145. fileprivate var _testAliasing: String? = nil
  146. }
  147. struct Proto2Unittest_TestMessageSetExtension2: Sendable {
  148. // SwiftProtobuf.Message conformance is added in an extension below. See the
  149. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  150. // methods supported on all messages.
  151. var str: String {
  152. get {return _str ?? String()}
  153. set {_str = newValue}
  154. }
  155. /// Returns true if `str` has been explicitly set.
  156. var hasStr: Bool {return self._str != nil}
  157. /// Clears the value of `str`. Subsequent reads from it will return its default value.
  158. mutating func clearStr() {self._str = nil}
  159. var unknownFields = SwiftProtobuf.UnknownStorage()
  160. init() {}
  161. fileprivate var _str: String? = nil
  162. }
  163. struct Proto2Unittest_TestMessageSetExtension3: Sendable {
  164. // SwiftProtobuf.Message conformance is added in an extension below. See the
  165. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  166. // methods supported on all messages.
  167. var msg: Proto2Unittest_NestedTestInt {
  168. get {return _msg ?? Proto2Unittest_NestedTestInt()}
  169. set {_msg = newValue}
  170. }
  171. /// Returns true if `msg` has been explicitly set.
  172. var hasMsg: Bool {return self._msg != nil}
  173. /// Clears the value of `msg`. Subsequent reads from it will return its default value.
  174. mutating func clearMsg() {self._msg = nil}
  175. var requiredInt: Int32 {
  176. get {return _requiredInt ?? 0}
  177. set {_requiredInt = newValue}
  178. }
  179. /// Returns true if `requiredInt` has been explicitly set.
  180. var hasRequiredInt: Bool {return self._requiredInt != nil}
  181. /// Clears the value of `requiredInt`. Subsequent reads from it will return its default value.
  182. mutating func clearRequiredInt() {self._requiredInt = nil}
  183. var unknownFields = SwiftProtobuf.UnknownStorage()
  184. init() {}
  185. fileprivate var _msg: Proto2Unittest_NestedTestInt? = nil
  186. fileprivate var _requiredInt: Int32? = nil
  187. }
  188. /// MessageSet wire format is equivalent to this.
  189. struct Proto2Unittest_RawMessageSet: Sendable {
  190. // SwiftProtobuf.Message conformance is added in an extension below. See the
  191. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  192. // methods supported on all messages.
  193. var item: [Proto2Unittest_RawMessageSet.Item] = []
  194. var unknownFields = SwiftProtobuf.UnknownStorage()
  195. struct Item: @unchecked Sendable {
  196. // SwiftProtobuf.Message conformance is added in an extension below. See the
  197. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  198. // methods supported on all messages.
  199. var typeID: Int32 {
  200. get {return _typeID ?? 0}
  201. set {_typeID = newValue}
  202. }
  203. /// Returns true if `typeID` has been explicitly set.
  204. var hasTypeID: Bool {return self._typeID != nil}
  205. /// Clears the value of `typeID`. Subsequent reads from it will return its default value.
  206. mutating func clearTypeID() {self._typeID = nil}
  207. var message: Data {
  208. get {return _message ?? Data()}
  209. set {_message = newValue}
  210. }
  211. /// Returns true if `message` has been explicitly set.
  212. var hasMessage: Bool {return self._message != nil}
  213. /// Clears the value of `message`. Subsequent reads from it will return its default value.
  214. mutating func clearMessage() {self._message = nil}
  215. var unknownFields = SwiftProtobuf.UnknownStorage()
  216. init() {}
  217. fileprivate var _typeID: Int32? = nil
  218. fileprivate var _message: Data? = nil
  219. }
  220. init() {}
  221. }
  222. // MARK: - Extension support defined in unittest_mset.proto.
  223. // MARK: - Extension Properties
  224. // Swift Extensions on the extended Messages to add easy access to the declared
  225. // extension fields. The names are based on the extension field name from the proto
  226. // declaration. To avoid naming collisions, the names are prefixed with the name of
  227. // the scope where the extend directive occurs.
  228. extension Proto2WireformatUnittest_TestMessageSet {
  229. var Proto2Unittest_TestMessageSetExtension1_messageSetExtension: Proto2Unittest_TestMessageSetExtension1 {
  230. get {return getExtensionValue(ext: Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension) ?? Proto2Unittest_TestMessageSetExtension1()}
  231. set {setExtensionValue(ext: Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension, value: newValue)}
  232. }
  233. /// Returns true if extension `Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension`
  234. /// has been explicitly set.
  235. var hasProto2Unittest_TestMessageSetExtension1_messageSetExtension: Bool {
  236. return hasExtensionValue(ext: Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension)
  237. }
  238. /// Clears the value of extension `Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension`.
  239. /// Subsequent reads from it will return its default value.
  240. mutating func clearProto2Unittest_TestMessageSetExtension1_messageSetExtension() {
  241. clearExtensionValue(ext: Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension)
  242. }
  243. var Proto2Unittest_TestMessageSetExtension2_messageSetExtension: Proto2Unittest_TestMessageSetExtension2 {
  244. get {return getExtensionValue(ext: Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension) ?? Proto2Unittest_TestMessageSetExtension2()}
  245. set {setExtensionValue(ext: Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension, value: newValue)}
  246. }
  247. /// Returns true if extension `Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension`
  248. /// has been explicitly set.
  249. var hasProto2Unittest_TestMessageSetExtension2_messageSetExtension: Bool {
  250. return hasExtensionValue(ext: Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension)
  251. }
  252. /// Clears the value of extension `Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension`.
  253. /// Subsequent reads from it will return its default value.
  254. mutating func clearProto2Unittest_TestMessageSetExtension2_messageSetExtension() {
  255. clearExtensionValue(ext: Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension)
  256. }
  257. var Proto2Unittest_TestMessageSetExtension3_messageSetExtension: Proto2Unittest_TestMessageSetExtension3 {
  258. get {return getExtensionValue(ext: Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension) ?? Proto2Unittest_TestMessageSetExtension3()}
  259. set {setExtensionValue(ext: Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension, value: newValue)}
  260. }
  261. /// Returns true if extension `Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension`
  262. /// has been explicitly set.
  263. var hasProto2Unittest_TestMessageSetExtension3_messageSetExtension: Bool {
  264. return hasExtensionValue(ext: Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension)
  265. }
  266. /// Clears the value of extension `Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension`.
  267. /// Subsequent reads from it will return its default value.
  268. mutating func clearProto2Unittest_TestMessageSetExtension3_messageSetExtension() {
  269. clearExtensionValue(ext: Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension)
  270. }
  271. }
  272. // MARK: - File's ExtensionMap: Proto2Unittest_UnittestMset_Extensions
  273. /// A `SwiftProtobuf.SimpleExtensionMap` that includes all of the extensions defined by
  274. /// this .proto file. It can be used any place an `SwiftProtobuf.ExtensionMap` is needed
  275. /// in parsing, or it can be combined with other `SwiftProtobuf.SimpleExtensionMap`s to create
  276. /// a larger `SwiftProtobuf.SimpleExtensionMap`.
  277. let Proto2Unittest_UnittestMset_Extensions: SwiftProtobuf.SimpleExtensionMap = [
  278. Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension,
  279. Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension,
  280. Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension
  281. ]
  282. // Extension Objects - The only reason these might be needed is when manually
  283. // constructing a `SimpleExtensionMap`, otherwise, use the above _Extension Properties_
  284. // accessors for the extension fields on the messages directly.
  285. extension Proto2Unittest_TestMessageSetExtension1 {
  286. enum Extensions {
  287. static let message_set_extension = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalMessageExtensionField<Proto2Unittest_TestMessageSetExtension1>, Proto2WireformatUnittest_TestMessageSet>(
  288. _protobuf_fieldNumber: 1545008,
  289. fieldName: "proto2_unittest.TestMessageSetExtension1"
  290. )
  291. }
  292. }
  293. extension Proto2Unittest_TestMessageSetExtension2 {
  294. enum Extensions {
  295. static let message_set_extension = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalMessageExtensionField<Proto2Unittest_TestMessageSetExtension2>, Proto2WireformatUnittest_TestMessageSet>(
  296. _protobuf_fieldNumber: 1547769,
  297. fieldName: "proto2_unittest.TestMessageSetExtension2"
  298. )
  299. }
  300. }
  301. extension Proto2Unittest_TestMessageSetExtension3 {
  302. enum Extensions {
  303. static let message_set_extension = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalMessageExtensionField<Proto2Unittest_TestMessageSetExtension3>, Proto2WireformatUnittest_TestMessageSet>(
  304. _protobuf_fieldNumber: 195273129,
  305. fieldName: "proto2_unittest.TestMessageSetExtension3"
  306. )
  307. }
  308. }
  309. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  310. fileprivate let _protobuf_package = "proto2_unittest"
  311. extension Proto2Unittest_TestMessageSetContainer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  312. static let protoMessageName: String = _protobuf_package + ".TestMessageSetContainer"
  313. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  314. 1: .standard(proto: "message_set"),
  315. ]
  316. public var isInitialized: Bool {
  317. if let v = self._messageSet, !v.isInitialized {return false}
  318. return true
  319. }
  320. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  321. while let fieldNumber = try decoder.nextFieldNumber() {
  322. // The use of inline closures is to circumvent an issue where the compiler
  323. // allocates stack space for every case branch when no optimizations are
  324. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  325. switch fieldNumber {
  326. case 1: try { try decoder.decodeSingularMessageField(value: &self._messageSet) }()
  327. default: break
  328. }
  329. }
  330. }
  331. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  332. // The use of inline closures is to circumvent an issue where the compiler
  333. // allocates stack space for every if/case branch local when no optimizations
  334. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  335. // https://github.com/apple/swift-protobuf/issues/1182
  336. try { if let v = self._messageSet {
  337. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  338. } }()
  339. try unknownFields.traverse(visitor: &visitor)
  340. }
  341. static func ==(lhs: Proto2Unittest_TestMessageSetContainer, rhs: Proto2Unittest_TestMessageSetContainer) -> Bool {
  342. if lhs._messageSet != rhs._messageSet {return false}
  343. if lhs.unknownFields != rhs.unknownFields {return false}
  344. return true
  345. }
  346. }
  347. extension Proto2Unittest_NestedTestMessageSetContainer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  348. static let protoMessageName: String = _protobuf_package + ".NestedTestMessageSetContainer"
  349. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  350. 1: .same(proto: "container"),
  351. 2: .same(proto: "child"),
  352. 3: .standard(proto: "lazy_child"),
  353. ]
  354. fileprivate class _StorageClass {
  355. var _container: Proto2Unittest_TestMessageSetContainer? = nil
  356. var _child: Proto2Unittest_NestedTestMessageSetContainer? = nil
  357. var _lazyChild: Proto2Unittest_NestedTestMessageSetContainer? = nil
  358. // This property is used as the initial default value for new instances of the type.
  359. // The type itself is protecting the reference to its storage via CoW semantics.
  360. // This will force a copy to be made of this reference when the first mutation occurs;
  361. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  362. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  363. private init() {}
  364. init(copying source: _StorageClass) {
  365. _container = source._container
  366. _child = source._child
  367. _lazyChild = source._lazyChild
  368. }
  369. }
  370. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  371. if !isKnownUniquelyReferenced(&_storage) {
  372. _storage = _StorageClass(copying: _storage)
  373. }
  374. return _storage
  375. }
  376. public var isInitialized: Bool {
  377. return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  378. if let v = _storage._container, !v.isInitialized {return false}
  379. if let v = _storage._child, !v.isInitialized {return false}
  380. if let v = _storage._lazyChild, !v.isInitialized {return false}
  381. return true
  382. }
  383. }
  384. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  385. _ = _uniqueStorage()
  386. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  387. while let fieldNumber = try decoder.nextFieldNumber() {
  388. // The use of inline closures is to circumvent an issue where the compiler
  389. // allocates stack space for every case branch when no optimizations are
  390. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  391. switch fieldNumber {
  392. case 1: try { try decoder.decodeSingularMessageField(value: &_storage._container) }()
  393. case 2: try { try decoder.decodeSingularMessageField(value: &_storage._child) }()
  394. case 3: try { try decoder.decodeSingularMessageField(value: &_storage._lazyChild) }()
  395. default: break
  396. }
  397. }
  398. }
  399. }
  400. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  401. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  402. // The use of inline closures is to circumvent an issue where the compiler
  403. // allocates stack space for every if/case branch local when no optimizations
  404. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  405. // https://github.com/apple/swift-protobuf/issues/1182
  406. try { if let v = _storage._container {
  407. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  408. } }()
  409. try { if let v = _storage._child {
  410. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  411. } }()
  412. try { if let v = _storage._lazyChild {
  413. try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
  414. } }()
  415. }
  416. try unknownFields.traverse(visitor: &visitor)
  417. }
  418. static func ==(lhs: Proto2Unittest_NestedTestMessageSetContainer, rhs: Proto2Unittest_NestedTestMessageSetContainer) -> Bool {
  419. if lhs._storage !== rhs._storage {
  420. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  421. let _storage = _args.0
  422. let rhs_storage = _args.1
  423. if _storage._container != rhs_storage._container {return false}
  424. if _storage._child != rhs_storage._child {return false}
  425. if _storage._lazyChild != rhs_storage._lazyChild {return false}
  426. return true
  427. }
  428. if !storagesAreEqual {return false}
  429. }
  430. if lhs.unknownFields != rhs.unknownFields {return false}
  431. return true
  432. }
  433. }
  434. extension Proto2Unittest_NestedTestInt: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  435. static let protoMessageName: String = _protobuf_package + ".NestedTestInt"
  436. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  437. 1: .same(proto: "a"),
  438. 3: .same(proto: "b"),
  439. 2: .same(proto: "child"),
  440. ]
  441. fileprivate class _StorageClass {
  442. var _a: UInt32? = nil
  443. var _b: Int32? = nil
  444. var _child: Proto2Unittest_NestedTestInt? = nil
  445. // This property is used as the initial default value for new instances of the type.
  446. // The type itself is protecting the reference to its storage via CoW semantics.
  447. // This will force a copy to be made of this reference when the first mutation occurs;
  448. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  449. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  450. private init() {}
  451. init(copying source: _StorageClass) {
  452. _a = source._a
  453. _b = source._b
  454. _child = source._child
  455. }
  456. }
  457. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  458. if !isKnownUniquelyReferenced(&_storage) {
  459. _storage = _StorageClass(copying: _storage)
  460. }
  461. return _storage
  462. }
  463. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  464. _ = _uniqueStorage()
  465. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  466. while let fieldNumber = try decoder.nextFieldNumber() {
  467. // The use of inline closures is to circumvent an issue where the compiler
  468. // allocates stack space for every case branch when no optimizations are
  469. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  470. switch fieldNumber {
  471. case 1: try { try decoder.decodeSingularFixed32Field(value: &_storage._a) }()
  472. case 2: try { try decoder.decodeSingularMessageField(value: &_storage._child) }()
  473. case 3: try { try decoder.decodeSingularInt32Field(value: &_storage._b) }()
  474. default: break
  475. }
  476. }
  477. }
  478. }
  479. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  480. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  481. // The use of inline closures is to circumvent an issue where the compiler
  482. // allocates stack space for every if/case branch local when no optimizations
  483. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  484. // https://github.com/apple/swift-protobuf/issues/1182
  485. try { if let v = _storage._a {
  486. try visitor.visitSingularFixed32Field(value: v, fieldNumber: 1)
  487. } }()
  488. try { if let v = _storage._child {
  489. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  490. } }()
  491. try { if let v = _storage._b {
  492. try visitor.visitSingularInt32Field(value: v, fieldNumber: 3)
  493. } }()
  494. }
  495. try unknownFields.traverse(visitor: &visitor)
  496. }
  497. static func ==(lhs: Proto2Unittest_NestedTestInt, rhs: Proto2Unittest_NestedTestInt) -> Bool {
  498. if lhs._storage !== rhs._storage {
  499. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  500. let _storage = _args.0
  501. let rhs_storage = _args.1
  502. if _storage._a != rhs_storage._a {return false}
  503. if _storage._b != rhs_storage._b {return false}
  504. if _storage._child != rhs_storage._child {return false}
  505. return true
  506. }
  507. if !storagesAreEqual {return false}
  508. }
  509. if lhs.unknownFields != rhs.unknownFields {return false}
  510. return true
  511. }
  512. }
  513. extension Proto2Unittest_TestMessageSetExtension1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  514. static let protoMessageName: String = _protobuf_package + ".TestMessageSetExtension1"
  515. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  516. 15: .same(proto: "i"),
  517. 16: .same(proto: "recursive"),
  518. 17: .standard(proto: "test_aliasing"),
  519. ]
  520. public var isInitialized: Bool {
  521. if let v = self._recursive, !v.isInitialized {return false}
  522. return true
  523. }
  524. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  525. while let fieldNumber = try decoder.nextFieldNumber() {
  526. // The use of inline closures is to circumvent an issue where the compiler
  527. // allocates stack space for every case branch when no optimizations are
  528. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  529. switch fieldNumber {
  530. case 15: try { try decoder.decodeSingularInt32Field(value: &self._i) }()
  531. case 16: try { try decoder.decodeSingularMessageField(value: &self._recursive) }()
  532. case 17: try { try decoder.decodeSingularStringField(value: &self._testAliasing) }()
  533. default: break
  534. }
  535. }
  536. }
  537. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  538. // The use of inline closures is to circumvent an issue where the compiler
  539. // allocates stack space for every if/case branch local when no optimizations
  540. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  541. // https://github.com/apple/swift-protobuf/issues/1182
  542. try { if let v = self._i {
  543. try visitor.visitSingularInt32Field(value: v, fieldNumber: 15)
  544. } }()
  545. try { if let v = self._recursive {
  546. try visitor.visitSingularMessageField(value: v, fieldNumber: 16)
  547. } }()
  548. try { if let v = self._testAliasing {
  549. try visitor.visitSingularStringField(value: v, fieldNumber: 17)
  550. } }()
  551. try unknownFields.traverse(visitor: &visitor)
  552. }
  553. static func ==(lhs: Proto2Unittest_TestMessageSetExtension1, rhs: Proto2Unittest_TestMessageSetExtension1) -> Bool {
  554. if lhs._i != rhs._i {return false}
  555. if lhs._recursive != rhs._recursive {return false}
  556. if lhs._testAliasing != rhs._testAliasing {return false}
  557. if lhs.unknownFields != rhs.unknownFields {return false}
  558. return true
  559. }
  560. }
  561. extension Proto2Unittest_TestMessageSetExtension2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  562. static let protoMessageName: String = _protobuf_package + ".TestMessageSetExtension2"
  563. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  564. 25: .same(proto: "str"),
  565. ]
  566. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  567. while let fieldNumber = try decoder.nextFieldNumber() {
  568. // The use of inline closures is to circumvent an issue where the compiler
  569. // allocates stack space for every case branch when no optimizations are
  570. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  571. switch fieldNumber {
  572. case 25: try { try decoder.decodeSingularStringField(value: &self._str) }()
  573. default: break
  574. }
  575. }
  576. }
  577. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  578. // The use of inline closures is to circumvent an issue where the compiler
  579. // allocates stack space for every if/case branch local when no optimizations
  580. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  581. // https://github.com/apple/swift-protobuf/issues/1182
  582. try { if let v = self._str {
  583. try visitor.visitSingularStringField(value: v, fieldNumber: 25)
  584. } }()
  585. try unknownFields.traverse(visitor: &visitor)
  586. }
  587. static func ==(lhs: Proto2Unittest_TestMessageSetExtension2, rhs: Proto2Unittest_TestMessageSetExtension2) -> Bool {
  588. if lhs._str != rhs._str {return false}
  589. if lhs.unknownFields != rhs.unknownFields {return false}
  590. return true
  591. }
  592. }
  593. extension Proto2Unittest_TestMessageSetExtension3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  594. static let protoMessageName: String = _protobuf_package + ".TestMessageSetExtension3"
  595. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  596. 35: .same(proto: "msg"),
  597. 36: .standard(proto: "required_int"),
  598. ]
  599. public var isInitialized: Bool {
  600. if self._requiredInt == nil {return false}
  601. return true
  602. }
  603. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  604. while let fieldNumber = try decoder.nextFieldNumber() {
  605. // The use of inline closures is to circumvent an issue where the compiler
  606. // allocates stack space for every case branch when no optimizations are
  607. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  608. switch fieldNumber {
  609. case 35: try { try decoder.decodeSingularMessageField(value: &self._msg) }()
  610. case 36: try { try decoder.decodeSingularInt32Field(value: &self._requiredInt) }()
  611. default: break
  612. }
  613. }
  614. }
  615. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  616. // The use of inline closures is to circumvent an issue where the compiler
  617. // allocates stack space for every if/case branch local when no optimizations
  618. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  619. // https://github.com/apple/swift-protobuf/issues/1182
  620. try { if let v = self._msg {
  621. try visitor.visitSingularMessageField(value: v, fieldNumber: 35)
  622. } }()
  623. try { if let v = self._requiredInt {
  624. try visitor.visitSingularInt32Field(value: v, fieldNumber: 36)
  625. } }()
  626. try unknownFields.traverse(visitor: &visitor)
  627. }
  628. static func ==(lhs: Proto2Unittest_TestMessageSetExtension3, rhs: Proto2Unittest_TestMessageSetExtension3) -> Bool {
  629. if lhs._msg != rhs._msg {return false}
  630. if lhs._requiredInt != rhs._requiredInt {return false}
  631. if lhs.unknownFields != rhs.unknownFields {return false}
  632. return true
  633. }
  634. }
  635. extension Proto2Unittest_RawMessageSet: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  636. static let protoMessageName: String = _protobuf_package + ".RawMessageSet"
  637. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  638. 1: .same(proto: "item"),
  639. 1: .unique(proto: "Item", json: "item"),
  640. ]
  641. public var isInitialized: Bool {
  642. if !SwiftProtobuf.Internal.areAllInitialized(self.item) {return false}
  643. return true
  644. }
  645. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  646. while let fieldNumber = try decoder.nextFieldNumber() {
  647. // The use of inline closures is to circumvent an issue where the compiler
  648. // allocates stack space for every case branch when no optimizations are
  649. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  650. switch fieldNumber {
  651. case 1: try { try decoder.decodeRepeatedGroupField(value: &self.item) }()
  652. default: break
  653. }
  654. }
  655. }
  656. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  657. if !self.item.isEmpty {
  658. try visitor.visitRepeatedGroupField(value: self.item, fieldNumber: 1)
  659. }
  660. try unknownFields.traverse(visitor: &visitor)
  661. }
  662. static func ==(lhs: Proto2Unittest_RawMessageSet, rhs: Proto2Unittest_RawMessageSet) -> Bool {
  663. if lhs.item != rhs.item {return false}
  664. if lhs.unknownFields != rhs.unknownFields {return false}
  665. return true
  666. }
  667. }
  668. extension Proto2Unittest_RawMessageSet.Item: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  669. static let protoMessageName: String = Proto2Unittest_RawMessageSet.protoMessageName + ".Item"
  670. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  671. 2: .standard(proto: "type_id"),
  672. 3: .same(proto: "message"),
  673. ]
  674. public var isInitialized: Bool {
  675. if self._typeID == nil {return false}
  676. if self._message == nil {return false}
  677. return true
  678. }
  679. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  680. while let fieldNumber = try decoder.nextFieldNumber() {
  681. // The use of inline closures is to circumvent an issue where the compiler
  682. // allocates stack space for every case branch when no optimizations are
  683. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  684. switch fieldNumber {
  685. case 2: try { try decoder.decodeSingularInt32Field(value: &self._typeID) }()
  686. case 3: try { try decoder.decodeSingularBytesField(value: &self._message) }()
  687. default: break
  688. }
  689. }
  690. }
  691. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  692. // The use of inline closures is to circumvent an issue where the compiler
  693. // allocates stack space for every if/case branch local when no optimizations
  694. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  695. // https://github.com/apple/swift-protobuf/issues/1182
  696. try { if let v = self._typeID {
  697. try visitor.visitSingularInt32Field(value: v, fieldNumber: 2)
  698. } }()
  699. try { if let v = self._message {
  700. try visitor.visitSingularBytesField(value: v, fieldNumber: 3)
  701. } }()
  702. try unknownFields.traverse(visitor: &visitor)
  703. }
  704. static func ==(lhs: Proto2Unittest_RawMessageSet.Item, rhs: Proto2Unittest_RawMessageSet.Item) -> Bool {
  705. if lhs._typeID != rhs._typeID {return false}
  706. if lhs._message != rhs._message {return false}
  707. if lhs.unknownFields != rhs.unknownFields {return false}
  708. return true
  709. }
  710. }