unittest_swift_extension.pb.swift 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715
  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 {_a ?? 0}
  51. set {_a = newValue}
  52. }
  53. /// Returns true if `a` has been explicitly set.
  54. var hasA: Bool {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 {_c ?? 0}
  73. set {_c = newValue}
  74. }
  75. /// Returns true if `c` has been explicitly set.
  76. var hasC: Bool {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 {_x ?? 0}
  105. set {_x = newValue}
  106. }
  107. /// Returns true if `x` has been explicitly set.
  108. var hasX: Bool {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 {_storage._x ?? 0}
  122. set {_uniqueStorage()._x = newValue}
  123. }
  124. /// Returns true if `x` has been explicitly set.
  125. var hasX: Bool {_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 {_storage._y ?? SwiftProtoTesting_Extend_MsgUsesStorage()}
  131. set {_uniqueStorage()._y = newValue}
  132. }
  133. /// Returns true if `y` has been explicitly set.
  134. var hasY: Bool {_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(bytecode: "\0\u{1}a\0")
  374. public var isInitialized: Bool {
  375. if !_protobuf_extensionFieldValues.isInitialized {return false}
  376. return true
  377. }
  378. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  379. while let fieldNumber = try decoder.nextFieldNumber() {
  380. // The use of inline closures is to circumvent an issue where the compiler
  381. // allocates stack space for every case branch when no optimizations are
  382. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  383. switch fieldNumber {
  384. case 1: try { try decoder.decodeSingularInt32Field(value: &self._a) }()
  385. case 100..<1001:
  386. try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftProtoTesting_Extend_Foo.Bar.Baz.self, fieldNumber: fieldNumber) }()
  387. default: break
  388. }
  389. }
  390. }
  391. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  392. // The use of inline closures is to circumvent an issue where the compiler
  393. // allocates stack space for every if/case branch local when no optimizations
  394. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  395. // https://github.com/apple/swift-protobuf/issues/1182
  396. try { if let v = self._a {
  397. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  398. } }()
  399. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 100, end: 1001)
  400. try unknownFields.traverse(visitor: &visitor)
  401. }
  402. static func ==(lhs: SwiftProtoTesting_Extend_Foo.Bar.Baz, rhs: SwiftProtoTesting_Extend_Foo.Bar.Baz) -> Bool {
  403. if lhs._a != rhs._a {return false}
  404. if lhs.unknownFields != rhs.unknownFields {return false}
  405. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  406. return true
  407. }
  408. }
  409. extension SwiftProtoTesting_Extend_C: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  410. static let protoMessageName: String = _protobuf_package + ".C"
  411. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}g\u{f}c\0")
  412. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  413. while let fieldNumber = try decoder.nextFieldNumber() {
  414. // The use of inline closures is to circumvent an issue where the compiler
  415. // allocates stack space for every case branch when no optimizations are
  416. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  417. switch fieldNumber {
  418. case 999: try { try decoder.decodeSingularInt64Field(value: &self._c) }()
  419. default: break
  420. }
  421. }
  422. }
  423. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  424. // The use of inline closures is to circumvent an issue where the compiler
  425. // allocates stack space for every if/case branch local when no optimizations
  426. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  427. // https://github.com/apple/swift-protobuf/issues/1182
  428. try { if let v = self._c {
  429. try visitor.visitSingularInt64Field(value: v, fieldNumber: 999)
  430. } }()
  431. try unknownFields.traverse(visitor: &visitor)
  432. }
  433. static func ==(lhs: SwiftProtoTesting_Extend_C, rhs: SwiftProtoTesting_Extend_C) -> Bool {
  434. if lhs._c != rhs._c {return false}
  435. if lhs.unknownFields != rhs.unknownFields {return false}
  436. return true
  437. }
  438. }
  439. extension SwiftProtoTesting_Extend_Msg1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  440. static let protoMessageName: String = _protobuf_package + ".Msg1"
  441. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  442. public var isInitialized: Bool {
  443. if !_protobuf_extensionFieldValues.isInitialized {return false}
  444. return true
  445. }
  446. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  447. while let fieldNumber = try decoder.nextFieldNumber() {
  448. if (1 <= fieldNumber && fieldNumber < 1001) {
  449. try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftProtoTesting_Extend_Msg1.self, fieldNumber: fieldNumber)
  450. }
  451. }
  452. }
  453. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  454. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1, end: 1001)
  455. try unknownFields.traverse(visitor: &visitor)
  456. }
  457. static func ==(lhs: SwiftProtoTesting_Extend_Msg1, rhs: SwiftProtoTesting_Extend_Msg1) -> Bool {
  458. if lhs.unknownFields != rhs.unknownFields {return false}
  459. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  460. return true
  461. }
  462. }
  463. extension SwiftProtoTesting_Extend_Msg2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  464. static let protoMessageName: String = _protobuf_package + ".Msg2"
  465. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  466. public var isInitialized: Bool {
  467. if !_protobuf_extensionFieldValues.isInitialized {return false}
  468. return true
  469. }
  470. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  471. while let fieldNumber = try decoder.nextFieldNumber() {
  472. if (1 <= fieldNumber && fieldNumber < 1001) {
  473. try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftProtoTesting_Extend_Msg2.self, fieldNumber: fieldNumber)
  474. }
  475. }
  476. }
  477. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  478. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1, end: 1001)
  479. try unknownFields.traverse(visitor: &visitor)
  480. }
  481. static func ==(lhs: SwiftProtoTesting_Extend_Msg2, rhs: SwiftProtoTesting_Extend_Msg2) -> Bool {
  482. if lhs.unknownFields != rhs.unknownFields {return false}
  483. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  484. return true
  485. }
  486. }
  487. extension SwiftProtoTesting_Extend_MsgNoStorage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  488. static let protoMessageName: String = _protobuf_package + ".MsgNoStorage"
  489. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}x\0")
  490. public var isInitialized: Bool {
  491. if !_protobuf_extensionFieldValues.isInitialized {return false}
  492. return true
  493. }
  494. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  495. while let fieldNumber = try decoder.nextFieldNumber() {
  496. // The use of inline closures is to circumvent an issue where the compiler
  497. // allocates stack space for every case branch when no optimizations are
  498. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  499. switch fieldNumber {
  500. case 1: try { try decoder.decodeSingularInt32Field(value: &self._x) }()
  501. case 100..<201:
  502. try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftProtoTesting_Extend_MsgNoStorage.self, fieldNumber: fieldNumber) }()
  503. default: break
  504. }
  505. }
  506. }
  507. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  508. // The use of inline closures is to circumvent an issue where the compiler
  509. // allocates stack space for every if/case branch local when no optimizations
  510. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  511. // https://github.com/apple/swift-protobuf/issues/1182
  512. try { if let v = self._x {
  513. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  514. } }()
  515. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 100, end: 201)
  516. try unknownFields.traverse(visitor: &visitor)
  517. }
  518. static func ==(lhs: SwiftProtoTesting_Extend_MsgNoStorage, rhs: SwiftProtoTesting_Extend_MsgNoStorage) -> Bool {
  519. if lhs._x != rhs._x {return false}
  520. if lhs.unknownFields != rhs.unknownFields {return false}
  521. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  522. return true
  523. }
  524. }
  525. extension SwiftProtoTesting_Extend_MsgUsesStorage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  526. static let protoMessageName: String = _protobuf_package + ".MsgUsesStorage"
  527. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}x\0\u{1}y\0")
  528. fileprivate class _StorageClass {
  529. var _x: Int32? = nil
  530. var _y: SwiftProtoTesting_Extend_MsgUsesStorage? = nil
  531. // This property is used as the initial default value for new instances of the type.
  532. // The type itself is protecting the reference to its storage via CoW semantics.
  533. // This will force a copy to be made of this reference when the first mutation occurs;
  534. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  535. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  536. private init() {}
  537. init(copying source: _StorageClass) {
  538. _x = source._x
  539. _y = source._y
  540. }
  541. }
  542. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  543. if !isKnownUniquelyReferenced(&_storage) {
  544. _storage = _StorageClass(copying: _storage)
  545. }
  546. return _storage
  547. }
  548. public var isInitialized: Bool {
  549. if !_protobuf_extensionFieldValues.isInitialized {return false}
  550. return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  551. if let v = _storage._y, !v.isInitialized {return false}
  552. return true
  553. }
  554. }
  555. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  556. _ = _uniqueStorage()
  557. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  558. while let fieldNumber = try decoder.nextFieldNumber() {
  559. // The use of inline closures is to circumvent an issue where the compiler
  560. // allocates stack space for every case branch when no optimizations are
  561. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  562. switch fieldNumber {
  563. case 1: try { try decoder.decodeSingularInt32Field(value: &_storage._x) }()
  564. case 2: try { try decoder.decodeSingularMessageField(value: &_storage._y) }()
  565. case 100..<201:
  566. try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftProtoTesting_Extend_MsgUsesStorage.self, fieldNumber: fieldNumber) }()
  567. default: break
  568. }
  569. }
  570. }
  571. }
  572. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  573. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  574. // The use of inline closures is to circumvent an issue where the compiler
  575. // allocates stack space for every if/case branch local when no optimizations
  576. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  577. // https://github.com/apple/swift-protobuf/issues/1182
  578. try { if let v = _storage._x {
  579. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  580. } }()
  581. try { if let v = _storage._y {
  582. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  583. } }()
  584. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 100, end: 201)
  585. }
  586. try unknownFields.traverse(visitor: &visitor)
  587. }
  588. static func ==(lhs: SwiftProtoTesting_Extend_MsgUsesStorage, rhs: SwiftProtoTesting_Extend_MsgUsesStorage) -> Bool {
  589. if lhs._storage !== rhs._storage {
  590. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  591. let _storage = _args.0
  592. let rhs_storage = _args.1
  593. if _storage._x != rhs_storage._x {return false}
  594. if _storage._y != rhs_storage._y {return false}
  595. return true
  596. }
  597. if !storagesAreEqual {return false}
  598. }
  599. if lhs.unknownFields != rhs.unknownFields {return false}
  600. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  601. return true
  602. }
  603. }