unittest_swift_extension.pb.swift 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724
  1. // DO NOT EDIT.
  2. // swift-format-ignore-file
  3. // swiftlint:disable all
  4. //
  5. // Generated by the Swift generator plugin for the protocol buffer compiler.
  6. // Source: unittest_swift_extension.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Protos/unittest_swift_extension.proto - test proto
  11. //
  12. // This source file is part of the Swift.org open source project
  13. //
  14. // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
  15. // Licensed under Apache License v2.0 with Runtime Library Exception
  16. //
  17. // See http://swift.org/LICENSE.txt for license information
  18. // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
  19. //
  20. // -----------------------------------------------------------------------------
  21. ///
  22. /// Test handling of extensions to deeply nested messages.
  23. ///
  24. // -----------------------------------------------------------------------------
  25. import SwiftProtobuf
  26. // If the compiler emits an error on this type, it is because this file
  27. // was generated by a version of the `protoc` Swift plug-in that is
  28. // incompatible with the version of SwiftProtobuf to which you are linking.
  29. // Please ensure that you are building against the same version of the API
  30. // that was used to generate this file.
  31. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  32. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  33. typealias Version = _2
  34. }
  35. struct SwiftProtoTesting_Extend_Foo: Sendable {
  36. // SwiftProtobuf.Message conformance is added in an extension below. See the
  37. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  38. // methods supported on all messages.
  39. var unknownFields = SwiftProtobuf.UnknownStorage()
  40. struct Bar: Sendable {
  41. // SwiftProtobuf.Message conformance is added in an extension below. See the
  42. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  43. // methods supported on all messages.
  44. var unknownFields = SwiftProtobuf.UnknownStorage()
  45. struct Baz: SwiftProtobuf.ExtensibleMessage, Sendable {
  46. // SwiftProtobuf.Message conformance is added in an extension below. See the
  47. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  48. // methods supported on all messages.
  49. var a: Int32 {
  50. get {return _a ?? 0}
  51. set {_a = newValue}
  52. }
  53. /// Returns true if `a` has been explicitly set.
  54. var hasA: Bool {return self._a != nil}
  55. /// Clears the value of `a`. Subsequent reads from it will return its default value.
  56. mutating func clearA() {self._a = nil}
  57. var unknownFields = SwiftProtobuf.UnknownStorage()
  58. init() {}
  59. var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet()
  60. fileprivate var _a: Int32? = nil
  61. }
  62. init() {}
  63. }
  64. init() {}
  65. }
  66. struct SwiftProtoTesting_Extend_C: Sendable {
  67. // SwiftProtobuf.Message conformance is added in an extension below. See the
  68. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  69. // methods supported on all messages.
  70. /// extensions 10 to 20;
  71. var c: Int64 {
  72. get {return _c ?? 0}
  73. set {_c = newValue}
  74. }
  75. /// Returns true if `c` has been explicitly set.
  76. var hasC: Bool {return self._c != nil}
  77. /// Clears the value of `c`. Subsequent reads from it will return its default value.
  78. mutating func clearC() {self._c = nil}
  79. var unknownFields = SwiftProtobuf.UnknownStorage()
  80. init() {}
  81. fileprivate var _c: Int64? = nil
  82. }
  83. struct SwiftProtoTesting_Extend_Msg1: SwiftProtobuf.ExtensibleMessage, Sendable {
  84. // SwiftProtobuf.Message conformance is added in an extension below. See the
  85. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  86. // methods supported on all messages.
  87. var unknownFields = SwiftProtobuf.UnknownStorage()
  88. init() {}
  89. var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet()
  90. }
  91. struct SwiftProtoTesting_Extend_Msg2: SwiftProtobuf.ExtensibleMessage, Sendable {
  92. // SwiftProtobuf.Message conformance is added in an extension below. See the
  93. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  94. // methods supported on all messages.
  95. var unknownFields = SwiftProtobuf.UnknownStorage()
  96. init() {}
  97. var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet()
  98. }
  99. struct SwiftProtoTesting_Extend_MsgNoStorage: SwiftProtobuf.ExtensibleMessage, Sendable {
  100. // SwiftProtobuf.Message conformance is added in an extension below. See the
  101. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  102. // methods supported on all messages.
  103. var x: Int32 {
  104. get {return _x ?? 0}
  105. set {_x = newValue}
  106. }
  107. /// Returns true if `x` has been explicitly set.
  108. var hasX: Bool {return self._x != nil}
  109. /// Clears the value of `x`. Subsequent reads from it will return its default value.
  110. mutating func clearX() {self._x = nil}
  111. var unknownFields = SwiftProtobuf.UnknownStorage()
  112. init() {}
  113. var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet()
  114. fileprivate var _x: Int32? = nil
  115. }
  116. struct SwiftProtoTesting_Extend_MsgUsesStorage: SwiftProtobuf.ExtensibleMessage, @unchecked Sendable {
  117. // SwiftProtobuf.Message conformance is added in an extension below. See the
  118. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  119. // methods supported on all messages.
  120. var x: Int32 {
  121. get {return _storage._x ?? 0}
  122. set {_uniqueStorage()._x = newValue}
  123. }
  124. /// Returns true if `x` has been explicitly set.
  125. var hasX: Bool {return _storage._x != nil}
  126. /// Clears the value of `x`. Subsequent reads from it will return its default value.
  127. mutating func clearX() {_uniqueStorage()._x = nil}
  128. /// Recursive class (i.e. - can build a graph), forces _StorageClass.
  129. var y: SwiftProtoTesting_Extend_MsgUsesStorage {
  130. get {return _storage._y ?? SwiftProtoTesting_Extend_MsgUsesStorage()}
  131. set {_uniqueStorage()._y = newValue}
  132. }
  133. /// Returns true if `y` has been explicitly set.
  134. var hasY: Bool {return _storage._y != nil}
  135. /// Clears the value of `y`. Subsequent reads from it will return its default value.
  136. mutating func clearY() {_uniqueStorage()._y = nil}
  137. var unknownFields = SwiftProtobuf.UnknownStorage()
  138. init() {}
  139. var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet()
  140. fileprivate var _storage = _StorageClass.defaultInstance
  141. }
  142. // MARK: - Extension support defined in unittest_swift_extension.proto.
  143. // MARK: - Extension Properties
  144. // Swift Extensions on the extended Messages to add easy access to the declared
  145. // extension fields. The names are based on the extension field name from the proto
  146. // declaration. To avoid naming collisions, the names are prefixed with the name of
  147. // the scope where the extend directive occurs.
  148. extension SwiftProtoTesting_Extend_Foo.Bar.Baz {
  149. var SwiftProtoTesting_Extend_b: String {
  150. get {return getExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_b) ?? String()}
  151. set {setExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_b, value: newValue)}
  152. }
  153. /// Returns true if extension `SwiftProtoTesting_Extend_Extensions_b`
  154. /// has been explicitly set.
  155. var hasSwiftProtoTesting_Extend_b: Bool {
  156. return hasExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_b)
  157. }
  158. /// Clears the value of extension `SwiftProtoTesting_Extend_Extensions_b`.
  159. /// Subsequent reads from it will return its default value.
  160. mutating func clearSwiftProtoTesting_Extend_b() {
  161. clearExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_b)
  162. }
  163. var SwiftProtoTesting_Extend_c: SwiftProtoTesting_Extend_C {
  164. get {return getExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_C) ?? SwiftProtoTesting_Extend_C()}
  165. set {setExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_C, value: newValue)}
  166. }
  167. /// Returns true if extension `SwiftProtoTesting_Extend_Extensions_C`
  168. /// has been explicitly set.
  169. var hasSwiftProtoTesting_Extend_c: Bool {
  170. return hasExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_C)
  171. }
  172. /// Clears the value of extension `SwiftProtoTesting_Extend_Extensions_C`.
  173. /// Subsequent reads from it will return its default value.
  174. mutating func clearSwiftProtoTesting_Extend_c() {
  175. clearExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_C)
  176. }
  177. }
  178. extension SwiftProtoTesting_Extend_Msg1 {
  179. var SwiftProtoTesting_Extend_aB: Int32 {
  180. get {return getExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_a_b) ?? 0}
  181. set {setExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_a_b, value: newValue)}
  182. }
  183. /// Returns true if extension `SwiftProtoTesting_Extend_Extensions_a_b`
  184. /// has been explicitly set.
  185. var hasSwiftProtoTesting_Extend_aB: Bool {
  186. return hasExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_a_b)
  187. }
  188. /// Clears the value of extension `SwiftProtoTesting_Extend_Extensions_a_b`.
  189. /// Subsequent reads from it will return its default value.
  190. mutating func clearSwiftProtoTesting_Extend_aB() {
  191. clearExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_a_b)
  192. }
  193. var SwiftProtoTesting_Extend_m2: SwiftProtoTesting_Extend_Msg2 {
  194. get {return getExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_m2) ?? SwiftProtoTesting_Extend_Msg2()}
  195. set {setExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_m2, value: newValue)}
  196. }
  197. /// Returns true if extension `SwiftProtoTesting_Extend_Extensions_m2`
  198. /// has been explicitly set.
  199. var hasSwiftProtoTesting_Extend_m2: Bool {
  200. return hasExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_m2)
  201. }
  202. /// Clears the value of extension `SwiftProtoTesting_Extend_Extensions_m2`.
  203. /// Subsequent reads from it will return its default value.
  204. mutating func clearSwiftProtoTesting_Extend_m2() {
  205. clearExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_m2)
  206. }
  207. }
  208. extension SwiftProtoTesting_Extend_Msg2 {
  209. var SwiftProtoTesting_Extend_aB: Int32 {
  210. get {return getExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_aB) ?? 0}
  211. set {setExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_aB, value: newValue)}
  212. }
  213. /// Returns true if extension `SwiftProtoTesting_Extend_Extensions_aB`
  214. /// has been explicitly set.
  215. var hasSwiftProtoTesting_Extend_aB: Bool {
  216. return hasExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_aB)
  217. }
  218. /// Clears the value of extension `SwiftProtoTesting_Extend_Extensions_aB`.
  219. /// Subsequent reads from it will return its default value.
  220. mutating func clearSwiftProtoTesting_Extend_aB() {
  221. clearExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_aB)
  222. }
  223. }
  224. extension SwiftProtoTesting_Extend_MsgNoStorage {
  225. var SwiftProtoTesting_Extend_extA: Int32 {
  226. get {return getExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_a) ?? 0}
  227. set {setExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_a, value: newValue)}
  228. }
  229. /// Returns true if extension `SwiftProtoTesting_Extend_Extensions_ext_a`
  230. /// has been explicitly set.
  231. var hasSwiftProtoTesting_Extend_extA: Bool {
  232. return hasExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_a)
  233. }
  234. /// Clears the value of extension `SwiftProtoTesting_Extend_Extensions_ext_a`.
  235. /// Subsequent reads from it will return its default value.
  236. mutating func clearSwiftProtoTesting_Extend_extA() {
  237. clearExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_a)
  238. }
  239. var SwiftProtoTesting_Extend_extB: Int32 {
  240. get {return getExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_b) ?? 0}
  241. set {setExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_b, value: newValue)}
  242. }
  243. /// Returns true if extension `SwiftProtoTesting_Extend_Extensions_ext_b`
  244. /// has been explicitly set.
  245. var hasSwiftProtoTesting_Extend_extB: Bool {
  246. return hasExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_b)
  247. }
  248. /// Clears the value of extension `SwiftProtoTesting_Extend_Extensions_ext_b`.
  249. /// Subsequent reads from it will return its default value.
  250. mutating func clearSwiftProtoTesting_Extend_extB() {
  251. clearExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_b)
  252. }
  253. }
  254. extension SwiftProtoTesting_Extend_MsgUsesStorage {
  255. var SwiftProtoTesting_Extend_extC: Int32 {
  256. get {return getExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_c) ?? 0}
  257. set {setExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_c, value: newValue)}
  258. }
  259. /// Returns true if extension `SwiftProtoTesting_Extend_Extensions_ext_c`
  260. /// has been explicitly set.
  261. var hasSwiftProtoTesting_Extend_extC: Bool {
  262. return hasExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_c)
  263. }
  264. /// Clears the value of extension `SwiftProtoTesting_Extend_Extensions_ext_c`.
  265. /// Subsequent reads from it will return its default value.
  266. mutating func clearSwiftProtoTesting_Extend_extC() {
  267. clearExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_c)
  268. }
  269. var SwiftProtoTesting_Extend_extD: Int32 {
  270. get {return getExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_d) ?? 0}
  271. set {setExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_d, value: newValue)}
  272. }
  273. /// Returns true if extension `SwiftProtoTesting_Extend_Extensions_ext_d`
  274. /// has been explicitly set.
  275. var hasSwiftProtoTesting_Extend_extD: Bool {
  276. return hasExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_d)
  277. }
  278. /// Clears the value of extension `SwiftProtoTesting_Extend_Extensions_ext_d`.
  279. /// Subsequent reads from it will return its default value.
  280. mutating func clearSwiftProtoTesting_Extend_extD() {
  281. clearExtensionValue(ext: SwiftProtoTesting_Extend_Extensions_ext_d)
  282. }
  283. }
  284. // MARK: - File's ExtensionMap: SwiftProtoTesting_Extend_UnittestSwiftExtension_Extensions
  285. /// A `SwiftProtobuf.SimpleExtensionMap` that includes all of the extensions defined by
  286. /// this .proto file. It can be used any place an `SwiftProtobuf.ExtensionMap` is needed
  287. /// in parsing, or it can be combined with other `SwiftProtobuf.SimpleExtensionMap`s to create
  288. /// a larger `SwiftProtobuf.SimpleExtensionMap`.
  289. let SwiftProtoTesting_Extend_UnittestSwiftExtension_Extensions: SwiftProtobuf.SimpleExtensionMap = [
  290. SwiftProtoTesting_Extend_Extensions_b,
  291. SwiftProtoTesting_Extend_Extensions_C,
  292. SwiftProtoTesting_Extend_Extensions_a_b,
  293. SwiftProtoTesting_Extend_Extensions_m2,
  294. SwiftProtoTesting_Extend_Extensions_aB,
  295. SwiftProtoTesting_Extend_Extensions_ext_a,
  296. SwiftProtoTesting_Extend_Extensions_ext_b,
  297. SwiftProtoTesting_Extend_Extensions_ext_c,
  298. SwiftProtoTesting_Extend_Extensions_ext_d
  299. ]
  300. // Extension Objects - The only reason these might be needed is when manually
  301. // constructing a `SimpleExtensionMap`, otherwise, use the above _Extension Properties_
  302. // accessors for the extension fields on the messages directly.
  303. let SwiftProtoTesting_Extend_Extensions_b = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufString>, SwiftProtoTesting_Extend_Foo.Bar.Baz>(
  304. _protobuf_fieldNumber: 100,
  305. fieldName: "swift_proto_testing.extend.b"
  306. )
  307. let SwiftProtoTesting_Extend_Extensions_C = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalGroupExtensionField<SwiftProtoTesting_Extend_C>, SwiftProtoTesting_Extend_Foo.Bar.Baz>(
  308. _protobuf_fieldNumber: 101,
  309. fieldName: "swift_proto_testing.extend.c"
  310. )
  311. let SwiftProtoTesting_Extend_Extensions_a_b = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufInt32>, SwiftProtoTesting_Extend_Msg1>(
  312. _protobuf_fieldNumber: 1,
  313. fieldName: "swift_proto_testing.extend.a_b"
  314. )
  315. let SwiftProtoTesting_Extend_Extensions_m2 = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalMessageExtensionField<SwiftProtoTesting_Extend_Msg2>, SwiftProtoTesting_Extend_Msg1>(
  316. _protobuf_fieldNumber: 2,
  317. fieldName: "swift_proto_testing.extend.m2"
  318. )
  319. let SwiftProtoTesting_Extend_Extensions_aB = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufInt32>, SwiftProtoTesting_Extend_Msg2>(
  320. _protobuf_fieldNumber: 1,
  321. fieldName: "swift_proto_testing.extend.aB"
  322. )
  323. let SwiftProtoTesting_Extend_Extensions_ext_a = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufInt32>, SwiftProtoTesting_Extend_MsgNoStorage>(
  324. _protobuf_fieldNumber: 100,
  325. fieldName: "swift_proto_testing.extend.ext_a"
  326. )
  327. let SwiftProtoTesting_Extend_Extensions_ext_b = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufInt32>, SwiftProtoTesting_Extend_MsgNoStorage>(
  328. _protobuf_fieldNumber: 101,
  329. fieldName: "swift_proto_testing.extend.ext_b"
  330. )
  331. let SwiftProtoTesting_Extend_Extensions_ext_c = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufInt32>, SwiftProtoTesting_Extend_MsgUsesStorage>(
  332. _protobuf_fieldNumber: 100,
  333. fieldName: "swift_proto_testing.extend.ext_c"
  334. )
  335. let SwiftProtoTesting_Extend_Extensions_ext_d = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufInt32>, SwiftProtoTesting_Extend_MsgUsesStorage>(
  336. _protobuf_fieldNumber: 101,
  337. fieldName: "swift_proto_testing.extend.ext_d"
  338. )
  339. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  340. fileprivate let _protobuf_package = "swift_proto_testing.extend"
  341. extension SwiftProtoTesting_Extend_Foo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  342. static let protoMessageName: String = _protobuf_package + ".Foo"
  343. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  344. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  345. // Load everything into unknown fields
  346. while try decoder.nextFieldNumber() != nil {}
  347. }
  348. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  349. try unknownFields.traverse(visitor: &visitor)
  350. }
  351. static func ==(lhs: SwiftProtoTesting_Extend_Foo, rhs: SwiftProtoTesting_Extend_Foo) -> Bool {
  352. if lhs.unknownFields != rhs.unknownFields {return false}
  353. return true
  354. }
  355. }
  356. extension SwiftProtoTesting_Extend_Foo.Bar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  357. static let protoMessageName: String = SwiftProtoTesting_Extend_Foo.protoMessageName + ".Bar"
  358. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  359. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  360. // Load everything into unknown fields
  361. while try decoder.nextFieldNumber() != nil {}
  362. }
  363. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  364. try unknownFields.traverse(visitor: &visitor)
  365. }
  366. static func ==(lhs: SwiftProtoTesting_Extend_Foo.Bar, rhs: SwiftProtoTesting_Extend_Foo.Bar) -> Bool {
  367. if lhs.unknownFields != rhs.unknownFields {return false}
  368. return true
  369. }
  370. }
  371. extension SwiftProtoTesting_Extend_Foo.Bar.Baz: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  372. static let protoMessageName: String = SwiftProtoTesting_Extend_Foo.Bar.protoMessageName + ".Baz"
  373. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  374. 1: .same(proto: "a"),
  375. ]
  376. public var isInitialized: Bool {
  377. if !_protobuf_extensionFieldValues.isInitialized {return false}
  378. return true
  379. }
  380. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  381. while let fieldNumber = try decoder.nextFieldNumber() {
  382. // The use of inline closures is to circumvent an issue where the compiler
  383. // allocates stack space for every case branch when no optimizations are
  384. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  385. switch fieldNumber {
  386. case 1: try { try decoder.decodeSingularInt32Field(value: &self._a) }()
  387. case 100..<1001:
  388. try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftProtoTesting_Extend_Foo.Bar.Baz.self, fieldNumber: fieldNumber) }()
  389. default: break
  390. }
  391. }
  392. }
  393. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  394. // The use of inline closures is to circumvent an issue where the compiler
  395. // allocates stack space for every if/case branch local when no optimizations
  396. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  397. // https://github.com/apple/swift-protobuf/issues/1182
  398. try { if let v = self._a {
  399. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  400. } }()
  401. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 100, end: 1001)
  402. try unknownFields.traverse(visitor: &visitor)
  403. }
  404. static func ==(lhs: SwiftProtoTesting_Extend_Foo.Bar.Baz, rhs: SwiftProtoTesting_Extend_Foo.Bar.Baz) -> Bool {
  405. if lhs._a != rhs._a {return false}
  406. if lhs.unknownFields != rhs.unknownFields {return false}
  407. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  408. return true
  409. }
  410. }
  411. extension SwiftProtoTesting_Extend_C: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  412. static let protoMessageName: String = _protobuf_package + ".C"
  413. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  414. 999: .same(proto: "c"),
  415. ]
  416. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  417. while let fieldNumber = try decoder.nextFieldNumber() {
  418. // The use of inline closures is to circumvent an issue where the compiler
  419. // allocates stack space for every case branch when no optimizations are
  420. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  421. switch fieldNumber {
  422. case 999: try { try decoder.decodeSingularInt64Field(value: &self._c) }()
  423. default: break
  424. }
  425. }
  426. }
  427. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  428. // The use of inline closures is to circumvent an issue where the compiler
  429. // allocates stack space for every if/case branch local when no optimizations
  430. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  431. // https://github.com/apple/swift-protobuf/issues/1182
  432. try { if let v = self._c {
  433. try visitor.visitSingularInt64Field(value: v, fieldNumber: 999)
  434. } }()
  435. try unknownFields.traverse(visitor: &visitor)
  436. }
  437. static func ==(lhs: SwiftProtoTesting_Extend_C, rhs: SwiftProtoTesting_Extend_C) -> Bool {
  438. if lhs._c != rhs._c {return false}
  439. if lhs.unknownFields != rhs.unknownFields {return false}
  440. return true
  441. }
  442. }
  443. extension SwiftProtoTesting_Extend_Msg1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  444. static let protoMessageName: String = _protobuf_package + ".Msg1"
  445. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  446. public var isInitialized: Bool {
  447. if !_protobuf_extensionFieldValues.isInitialized {return false}
  448. return true
  449. }
  450. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  451. while let fieldNumber = try decoder.nextFieldNumber() {
  452. if (1 <= fieldNumber && fieldNumber < 1001) {
  453. try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftProtoTesting_Extend_Msg1.self, fieldNumber: fieldNumber)
  454. }
  455. }
  456. }
  457. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  458. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1, end: 1001)
  459. try unknownFields.traverse(visitor: &visitor)
  460. }
  461. static func ==(lhs: SwiftProtoTesting_Extend_Msg1, rhs: SwiftProtoTesting_Extend_Msg1) -> Bool {
  462. if lhs.unknownFields != rhs.unknownFields {return false}
  463. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  464. return true
  465. }
  466. }
  467. extension SwiftProtoTesting_Extend_Msg2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  468. static let protoMessageName: String = _protobuf_package + ".Msg2"
  469. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  470. public var isInitialized: Bool {
  471. if !_protobuf_extensionFieldValues.isInitialized {return false}
  472. return true
  473. }
  474. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  475. while let fieldNumber = try decoder.nextFieldNumber() {
  476. if (1 <= fieldNumber && fieldNumber < 1001) {
  477. try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftProtoTesting_Extend_Msg2.self, fieldNumber: fieldNumber)
  478. }
  479. }
  480. }
  481. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  482. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1, end: 1001)
  483. try unknownFields.traverse(visitor: &visitor)
  484. }
  485. static func ==(lhs: SwiftProtoTesting_Extend_Msg2, rhs: SwiftProtoTesting_Extend_Msg2) -> Bool {
  486. if lhs.unknownFields != rhs.unknownFields {return false}
  487. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  488. return true
  489. }
  490. }
  491. extension SwiftProtoTesting_Extend_MsgNoStorage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  492. static let protoMessageName: String = _protobuf_package + ".MsgNoStorage"
  493. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  494. 1: .same(proto: "x"),
  495. ]
  496. public var isInitialized: Bool {
  497. if !_protobuf_extensionFieldValues.isInitialized {return false}
  498. return true
  499. }
  500. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  501. while let fieldNumber = try decoder.nextFieldNumber() {
  502. // The use of inline closures is to circumvent an issue where the compiler
  503. // allocates stack space for every case branch when no optimizations are
  504. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  505. switch fieldNumber {
  506. case 1: try { try decoder.decodeSingularInt32Field(value: &self._x) }()
  507. case 100..<201:
  508. try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftProtoTesting_Extend_MsgNoStorage.self, fieldNumber: fieldNumber) }()
  509. default: break
  510. }
  511. }
  512. }
  513. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  514. // The use of inline closures is to circumvent an issue where the compiler
  515. // allocates stack space for every if/case branch local when no optimizations
  516. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  517. // https://github.com/apple/swift-protobuf/issues/1182
  518. try { if let v = self._x {
  519. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  520. } }()
  521. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 100, end: 201)
  522. try unknownFields.traverse(visitor: &visitor)
  523. }
  524. static func ==(lhs: SwiftProtoTesting_Extend_MsgNoStorage, rhs: SwiftProtoTesting_Extend_MsgNoStorage) -> Bool {
  525. if lhs._x != rhs._x {return false}
  526. if lhs.unknownFields != rhs.unknownFields {return false}
  527. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  528. return true
  529. }
  530. }
  531. extension SwiftProtoTesting_Extend_MsgUsesStorage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  532. static let protoMessageName: String = _protobuf_package + ".MsgUsesStorage"
  533. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  534. 1: .same(proto: "x"),
  535. 2: .same(proto: "y"),
  536. ]
  537. fileprivate class _StorageClass {
  538. var _x: Int32? = nil
  539. var _y: SwiftProtoTesting_Extend_MsgUsesStorage? = nil
  540. // This property is used as the initial default value for new instances of the type.
  541. // The type itself is protecting the reference to its storage via CoW semantics.
  542. // This will force a copy to be made of this reference when the first mutation occurs;
  543. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  544. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  545. private init() {}
  546. init(copying source: _StorageClass) {
  547. _x = source._x
  548. _y = source._y
  549. }
  550. }
  551. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  552. if !isKnownUniquelyReferenced(&_storage) {
  553. _storage = _StorageClass(copying: _storage)
  554. }
  555. return _storage
  556. }
  557. public var isInitialized: Bool {
  558. if !_protobuf_extensionFieldValues.isInitialized {return false}
  559. return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  560. if let v = _storage._y, !v.isInitialized {return false}
  561. return true
  562. }
  563. }
  564. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  565. _ = _uniqueStorage()
  566. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  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 1: try { try decoder.decodeSingularInt32Field(value: &_storage._x) }()
  573. case 2: try { try decoder.decodeSingularMessageField(value: &_storage._y) }()
  574. case 100..<201:
  575. try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftProtoTesting_Extend_MsgUsesStorage.self, fieldNumber: fieldNumber) }()
  576. default: break
  577. }
  578. }
  579. }
  580. }
  581. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  582. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  583. // The use of inline closures is to circumvent an issue where the compiler
  584. // allocates stack space for every if/case branch local when no optimizations
  585. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  586. // https://github.com/apple/swift-protobuf/issues/1182
  587. try { if let v = _storage._x {
  588. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  589. } }()
  590. try { if let v = _storage._y {
  591. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  592. } }()
  593. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 100, end: 201)
  594. }
  595. try unknownFields.traverse(visitor: &visitor)
  596. }
  597. static func ==(lhs: SwiftProtoTesting_Extend_MsgUsesStorage, rhs: SwiftProtoTesting_Extend_MsgUsesStorage) -> Bool {
  598. if lhs._storage !== rhs._storage {
  599. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  600. let _storage = _args.0
  601. let rhs_storage = _args.1
  602. if _storage._x != rhs_storage._x {return false}
  603. if _storage._y != rhs_storage._y {return false}
  604. return true
  605. }
  606. if !storagesAreEqual {return false}
  607. }
  608. if lhs.unknownFields != rhs.unknownFields {return false}
  609. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  610. return true
  611. }
  612. }