unittest_swift_cycle.pb.swift 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  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_cycle.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 2015 Google Inc. All rights reserved.
  12. //
  13. // Redistribution and use in source and binary forms, with or without
  14. // modification, are permitted provided that the following conditions are
  15. // met:
  16. //
  17. // * Redistributions of source code must retain the above copyright
  18. // notice, this list of conditions and the following disclaimer.
  19. // * Redistributions in binary form must reproduce the above
  20. // copyright notice, this list of conditions and the following disclaimer
  21. // in the documentation and/or other materials provided with the
  22. // distribution.
  23. // * Neither the name of Google Inc. nor the names of its
  24. // contributors may be used to endorse or promote products derived from
  25. // this software without specific prior written permission.
  26. //
  27. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  28. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  29. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  30. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  31. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  32. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  33. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  34. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  35. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  36. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  37. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  38. import SwiftProtobuf
  39. // If the compiler emits an error on this type, it is because this file
  40. // was generated by a version of the `protoc` Swift plug-in that is
  41. // incompatible with the version of SwiftProtobuf to which you are linking.
  42. // Please ensure that you are building against the same version of the API
  43. // that was used to generate this file.
  44. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  45. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  46. typealias Version = _2
  47. }
  48. struct SwiftProtoTesting_CycleFoo: @unchecked Sendable {
  49. // SwiftProtobuf.Message conformance is added in an extension below. See the
  50. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  51. // methods supported on all messages.
  52. var aFoo: SwiftProtoTesting_CycleFoo {
  53. get {return _storage._aFoo ?? SwiftProtoTesting_CycleFoo()}
  54. set {_uniqueStorage()._aFoo = newValue}
  55. }
  56. /// Returns true if `aFoo` has been explicitly set.
  57. var hasAFoo: Bool {return _storage._aFoo != nil}
  58. /// Clears the value of `aFoo`. Subsequent reads from it will return its default value.
  59. mutating func clearAFoo() {_uniqueStorage()._aFoo = nil}
  60. var aBar: SwiftProtoTesting_CycleBar {
  61. get {return _storage._aBar ?? SwiftProtoTesting_CycleBar()}
  62. set {_uniqueStorage()._aBar = newValue}
  63. }
  64. /// Returns true if `aBar` has been explicitly set.
  65. var hasABar: Bool {return _storage._aBar != nil}
  66. /// Clears the value of `aBar`. Subsequent reads from it will return its default value.
  67. mutating func clearABar() {_uniqueStorage()._aBar = nil}
  68. var aBaz: SwiftProtoTesting_CycleBaz {
  69. get {return _storage._aBaz ?? SwiftProtoTesting_CycleBaz()}
  70. set {_uniqueStorage()._aBaz = newValue}
  71. }
  72. /// Returns true if `aBaz` has been explicitly set.
  73. var hasABaz: Bool {return _storage._aBaz != nil}
  74. /// Clears the value of `aBaz`. Subsequent reads from it will return its default value.
  75. mutating func clearABaz() {_uniqueStorage()._aBaz = nil}
  76. var unknownFields = SwiftProtobuf.UnknownStorage()
  77. init() {}
  78. fileprivate var _storage = _StorageClass.defaultInstance
  79. }
  80. struct SwiftProtoTesting_CycleBar: @unchecked Sendable {
  81. // SwiftProtobuf.Message conformance is added in an extension below. See the
  82. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  83. // methods supported on all messages.
  84. var aBar: SwiftProtoTesting_CycleBar {
  85. get {return _storage._aBar ?? SwiftProtoTesting_CycleBar()}
  86. set {_uniqueStorage()._aBar = newValue}
  87. }
  88. /// Returns true if `aBar` has been explicitly set.
  89. var hasABar: Bool {return _storage._aBar != nil}
  90. /// Clears the value of `aBar`. Subsequent reads from it will return its default value.
  91. mutating func clearABar() {_uniqueStorage()._aBar = nil}
  92. var aBaz: SwiftProtoTesting_CycleBaz {
  93. get {return _storage._aBaz ?? SwiftProtoTesting_CycleBaz()}
  94. set {_uniqueStorage()._aBaz = newValue}
  95. }
  96. /// Returns true if `aBaz` has been explicitly set.
  97. var hasABaz: Bool {return _storage._aBaz != nil}
  98. /// Clears the value of `aBaz`. Subsequent reads from it will return its default value.
  99. mutating func clearABaz() {_uniqueStorage()._aBaz = nil}
  100. var aFoo: SwiftProtoTesting_CycleFoo {
  101. get {return _storage._aFoo ?? SwiftProtoTesting_CycleFoo()}
  102. set {_uniqueStorage()._aFoo = newValue}
  103. }
  104. /// Returns true if `aFoo` has been explicitly set.
  105. var hasAFoo: Bool {return _storage._aFoo != nil}
  106. /// Clears the value of `aFoo`. Subsequent reads from it will return its default value.
  107. mutating func clearAFoo() {_uniqueStorage()._aFoo = nil}
  108. var unknownFields = SwiftProtobuf.UnknownStorage()
  109. init() {}
  110. fileprivate var _storage = _StorageClass.defaultInstance
  111. }
  112. struct SwiftProtoTesting_CycleBaz: @unchecked Sendable {
  113. // SwiftProtobuf.Message conformance is added in an extension below. See the
  114. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  115. // methods supported on all messages.
  116. var aBaz: SwiftProtoTesting_CycleBaz {
  117. get {return _storage._aBaz ?? SwiftProtoTesting_CycleBaz()}
  118. set {_uniqueStorage()._aBaz = newValue}
  119. }
  120. /// Returns true if `aBaz` has been explicitly set.
  121. var hasABaz: Bool {return _storage._aBaz != nil}
  122. /// Clears the value of `aBaz`. Subsequent reads from it will return its default value.
  123. mutating func clearABaz() {_uniqueStorage()._aBaz = nil}
  124. var aFoo: SwiftProtoTesting_CycleFoo {
  125. get {return _storage._aFoo ?? SwiftProtoTesting_CycleFoo()}
  126. set {_uniqueStorage()._aFoo = newValue}
  127. }
  128. /// Returns true if `aFoo` has been explicitly set.
  129. var hasAFoo: Bool {return _storage._aFoo != nil}
  130. /// Clears the value of `aFoo`. Subsequent reads from it will return its default value.
  131. mutating func clearAFoo() {_uniqueStorage()._aFoo = nil}
  132. var aBar: SwiftProtoTesting_CycleBar {
  133. get {return _storage._aBar ?? SwiftProtoTesting_CycleBar()}
  134. set {_uniqueStorage()._aBar = newValue}
  135. }
  136. /// Returns true if `aBar` has been explicitly set.
  137. var hasABar: Bool {return _storage._aBar != nil}
  138. /// Clears the value of `aBar`. Subsequent reads from it will return its default value.
  139. mutating func clearABar() {_uniqueStorage()._aBar = nil}
  140. var unknownFields = SwiftProtobuf.UnknownStorage()
  141. init() {}
  142. fileprivate var _storage = _StorageClass.defaultInstance
  143. }
  144. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  145. fileprivate let _protobuf_package = "swift_proto_testing"
  146. extension SwiftProtoTesting_CycleFoo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  147. static let protoMessageName: String = _protobuf_package + ".CycleFoo"
  148. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  149. 1: .standard(proto: "a_foo"),
  150. 2: .standard(proto: "a_bar"),
  151. 3: .standard(proto: "a_baz"),
  152. ]
  153. fileprivate class _StorageClass {
  154. var _aFoo: SwiftProtoTesting_CycleFoo? = nil
  155. var _aBar: SwiftProtoTesting_CycleBar? = nil
  156. var _aBaz: SwiftProtoTesting_CycleBaz? = nil
  157. // This property is used as the initial default value for new instances of the type.
  158. // The type itself is protecting the reference to its storage via CoW semantics.
  159. // This will force a copy to be made of this reference when the first mutation occurs;
  160. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  161. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  162. private init() {}
  163. init(copying source: _StorageClass) {
  164. _aFoo = source._aFoo
  165. _aBar = source._aBar
  166. _aBaz = source._aBaz
  167. }
  168. }
  169. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  170. if !isKnownUniquelyReferenced(&_storage) {
  171. _storage = _StorageClass(copying: _storage)
  172. }
  173. return _storage
  174. }
  175. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  176. _ = _uniqueStorage()
  177. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  178. while let fieldNumber = try decoder.nextFieldNumber() {
  179. // The use of inline closures is to circumvent an issue where the compiler
  180. // allocates stack space for every case branch when no optimizations are
  181. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  182. switch fieldNumber {
  183. case 1: try { try decoder.decodeSingularMessageField(value: &_storage._aFoo) }()
  184. case 2: try { try decoder.decodeSingularMessageField(value: &_storage._aBar) }()
  185. case 3: try { try decoder.decodeSingularMessageField(value: &_storage._aBaz) }()
  186. default: break
  187. }
  188. }
  189. }
  190. }
  191. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  192. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  193. // The use of inline closures is to circumvent an issue where the compiler
  194. // allocates stack space for every if/case branch local when no optimizations
  195. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  196. // https://github.com/apple/swift-protobuf/issues/1182
  197. try { if let v = _storage._aFoo {
  198. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  199. } }()
  200. try { if let v = _storage._aBar {
  201. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  202. } }()
  203. try { if let v = _storage._aBaz {
  204. try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
  205. } }()
  206. }
  207. try unknownFields.traverse(visitor: &visitor)
  208. }
  209. static func ==(lhs: SwiftProtoTesting_CycleFoo, rhs: SwiftProtoTesting_CycleFoo) -> Bool {
  210. if lhs._storage !== rhs._storage {
  211. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  212. let _storage = _args.0
  213. let rhs_storage = _args.1
  214. if _storage._aFoo != rhs_storage._aFoo {return false}
  215. if _storage._aBar != rhs_storage._aBar {return false}
  216. if _storage._aBaz != rhs_storage._aBaz {return false}
  217. return true
  218. }
  219. if !storagesAreEqual {return false}
  220. }
  221. if lhs.unknownFields != rhs.unknownFields {return false}
  222. return true
  223. }
  224. }
  225. extension SwiftProtoTesting_CycleBar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  226. static let protoMessageName: String = _protobuf_package + ".CycleBar"
  227. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  228. 1: .standard(proto: "a_bar"),
  229. 2: .standard(proto: "a_baz"),
  230. 3: .standard(proto: "a_foo"),
  231. ]
  232. fileprivate class _StorageClass {
  233. var _aBar: SwiftProtoTesting_CycleBar? = nil
  234. var _aBaz: SwiftProtoTesting_CycleBaz? = nil
  235. var _aFoo: SwiftProtoTesting_CycleFoo? = nil
  236. // This property is used as the initial default value for new instances of the type.
  237. // The type itself is protecting the reference to its storage via CoW semantics.
  238. // This will force a copy to be made of this reference when the first mutation occurs;
  239. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  240. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  241. private init() {}
  242. init(copying source: _StorageClass) {
  243. _aBar = source._aBar
  244. _aBaz = source._aBaz
  245. _aFoo = source._aFoo
  246. }
  247. }
  248. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  249. if !isKnownUniquelyReferenced(&_storage) {
  250. _storage = _StorageClass(copying: _storage)
  251. }
  252. return _storage
  253. }
  254. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  255. _ = _uniqueStorage()
  256. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  257. while let fieldNumber = try decoder.nextFieldNumber() {
  258. // The use of inline closures is to circumvent an issue where the compiler
  259. // allocates stack space for every case branch when no optimizations are
  260. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  261. switch fieldNumber {
  262. case 1: try { try decoder.decodeSingularMessageField(value: &_storage._aBar) }()
  263. case 2: try { try decoder.decodeSingularMessageField(value: &_storage._aBaz) }()
  264. case 3: try { try decoder.decodeSingularMessageField(value: &_storage._aFoo) }()
  265. default: break
  266. }
  267. }
  268. }
  269. }
  270. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  271. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  272. // The use of inline closures is to circumvent an issue where the compiler
  273. // allocates stack space for every if/case branch local when no optimizations
  274. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  275. // https://github.com/apple/swift-protobuf/issues/1182
  276. try { if let v = _storage._aBar {
  277. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  278. } }()
  279. try { if let v = _storage._aBaz {
  280. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  281. } }()
  282. try { if let v = _storage._aFoo {
  283. try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
  284. } }()
  285. }
  286. try unknownFields.traverse(visitor: &visitor)
  287. }
  288. static func ==(lhs: SwiftProtoTesting_CycleBar, rhs: SwiftProtoTesting_CycleBar) -> Bool {
  289. if lhs._storage !== rhs._storage {
  290. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  291. let _storage = _args.0
  292. let rhs_storage = _args.1
  293. if _storage._aBar != rhs_storage._aBar {return false}
  294. if _storage._aBaz != rhs_storage._aBaz {return false}
  295. if _storage._aFoo != rhs_storage._aFoo {return false}
  296. return true
  297. }
  298. if !storagesAreEqual {return false}
  299. }
  300. if lhs.unknownFields != rhs.unknownFields {return false}
  301. return true
  302. }
  303. }
  304. extension SwiftProtoTesting_CycleBaz: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  305. static let protoMessageName: String = _protobuf_package + ".CycleBaz"
  306. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  307. 1: .standard(proto: "a_baz"),
  308. 2: .standard(proto: "a_foo"),
  309. 3: .standard(proto: "a_bar"),
  310. ]
  311. fileprivate class _StorageClass {
  312. var _aBaz: SwiftProtoTesting_CycleBaz? = nil
  313. var _aFoo: SwiftProtoTesting_CycleFoo? = nil
  314. var _aBar: SwiftProtoTesting_CycleBar? = nil
  315. // This property is used as the initial default value for new instances of the type.
  316. // The type itself is protecting the reference to its storage via CoW semantics.
  317. // This will force a copy to be made of this reference when the first mutation occurs;
  318. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  319. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  320. private init() {}
  321. init(copying source: _StorageClass) {
  322. _aBaz = source._aBaz
  323. _aFoo = source._aFoo
  324. _aBar = source._aBar
  325. }
  326. }
  327. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  328. if !isKnownUniquelyReferenced(&_storage) {
  329. _storage = _StorageClass(copying: _storage)
  330. }
  331. return _storage
  332. }
  333. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  334. _ = _uniqueStorage()
  335. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  336. while let fieldNumber = try decoder.nextFieldNumber() {
  337. // The use of inline closures is to circumvent an issue where the compiler
  338. // allocates stack space for every case branch when no optimizations are
  339. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  340. switch fieldNumber {
  341. case 1: try { try decoder.decodeSingularMessageField(value: &_storage._aBaz) }()
  342. case 2: try { try decoder.decodeSingularMessageField(value: &_storage._aFoo) }()
  343. case 3: try { try decoder.decodeSingularMessageField(value: &_storage._aBar) }()
  344. default: break
  345. }
  346. }
  347. }
  348. }
  349. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  350. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  351. // The use of inline closures is to circumvent an issue where the compiler
  352. // allocates stack space for every if/case branch local when no optimizations
  353. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  354. // https://github.com/apple/swift-protobuf/issues/1182
  355. try { if let v = _storage._aBaz {
  356. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  357. } }()
  358. try { if let v = _storage._aFoo {
  359. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  360. } }()
  361. try { if let v = _storage._aBar {
  362. try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
  363. } }()
  364. }
  365. try unknownFields.traverse(visitor: &visitor)
  366. }
  367. static func ==(lhs: SwiftProtoTesting_CycleBaz, rhs: SwiftProtoTesting_CycleBaz) -> Bool {
  368. if lhs._storage !== rhs._storage {
  369. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  370. let _storage = _args.0
  371. let rhs_storage = _args.1
  372. if _storage._aBaz != rhs_storage._aBaz {return false}
  373. if _storage._aFoo != rhs_storage._aFoo {return false}
  374. if _storage._aBar != rhs_storage._aBar {return false}
  375. return true
  376. }
  377. if !storagesAreEqual {return false}
  378. }
  379. if lhs.unknownFields != rhs.unknownFields {return false}
  380. return true
  381. }
  382. }