unittest_swift_deprecated.pb.swift 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  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_deprecated.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_deprecated.proto - test proto
  11. //
  12. // This source file is part of the Swift.org open source project
  13. //
  14. // Copyright (c) 2014 - 2023 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 generation support of deprecated attributes.
  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. /// An enum value marked as deprecated.
  36. enum SwiftProtoTesting_Deprecated_MyEnum: Int, SwiftProtobuf.Enum, Swift.CaseIterable {
  37. case one = 1
  38. /// Enum comment
  39. ///
  40. /// NOTE: This enum value was marked as deprecated in the .proto file
  41. case two = 2
  42. /// NOTE: This enum value was marked as deprecated in the .proto file
  43. case three = 3
  44. init() {
  45. self = .one
  46. }
  47. }
  48. /// Whole enum marked as deprecated.
  49. ///
  50. /// NOTE: This enum was marked as deprecated in the .proto file.
  51. enum SwiftProtoTesting_Deprecated_MyEnum2: Int, SwiftProtobuf.Enum, Swift.CaseIterable {
  52. case one = 1
  53. case two = 2
  54. case three = 3
  55. init() {
  56. self = .one
  57. }
  58. }
  59. /// Marking fields as deprecated.
  60. struct SwiftProtoTesting_Deprecated_MyMsg: SwiftProtobuf.ExtensibleMessage, @unchecked Sendable {
  61. // SwiftProtobuf.Message conformance is added in an extension below. See the
  62. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  63. // methods supported on all messages.
  64. /// Field comment
  65. ///
  66. /// NOTE: This field was marked as deprecated in the .proto file.
  67. var stringField: String {
  68. get {return _storage._stringField ?? String()}
  69. set {_uniqueStorage()._stringField = newValue}
  70. }
  71. /// Returns true if `stringField` has been explicitly set.
  72. var hasStringField: Bool {return _storage._stringField != nil}
  73. /// Clears the value of `stringField`. Subsequent reads from it will return its default value.
  74. mutating func clearStringField() {_uniqueStorage()._stringField = nil}
  75. /// NOTE: This field was marked as deprecated in the .proto file.
  76. var intField: Int32 {
  77. get {return _storage._intField ?? 0}
  78. set {_uniqueStorage()._intField = newValue}
  79. }
  80. /// Returns true if `intField` has been explicitly set.
  81. var hasIntField: Bool {return _storage._intField != nil}
  82. /// Clears the value of `intField`. Subsequent reads from it will return its default value.
  83. mutating func clearIntField() {_uniqueStorage()._intField = nil}
  84. /// NOTE: This field was marked as deprecated in the .proto file.
  85. var fixedField: [UInt32] {
  86. get {return _storage._fixedField}
  87. set {_uniqueStorage()._fixedField = newValue}
  88. }
  89. /// NOTE: This field was marked as deprecated in the .proto file.
  90. var msgField: SwiftProtoTesting_Deprecated_MyMsg {
  91. get {return _storage._msgField ?? SwiftProtoTesting_Deprecated_MyMsg()}
  92. set {_uniqueStorage()._msgField = newValue}
  93. }
  94. /// Returns true if `msgField` has been explicitly set.
  95. var hasMsgField: Bool {return _storage._msgField != nil}
  96. /// Clears the value of `msgField`. Subsequent reads from it will return its default value.
  97. mutating func clearMsgField() {_uniqueStorage()._msgField = nil}
  98. var unknownFields = SwiftProtobuf.UnknownStorage()
  99. init() {}
  100. var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet()
  101. fileprivate var _storage = _StorageClass.defaultInstance
  102. }
  103. /// Marking extension fields (scoped to a message) as deprecated.
  104. struct SwiftProtoTesting_Deprecated_MsgScope: Sendable {
  105. // SwiftProtobuf.Message conformance is added in an extension below. See the
  106. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  107. // methods supported on all messages.
  108. var unknownFields = SwiftProtobuf.UnknownStorage()
  109. init() {}
  110. }
  111. /// Whole message marked as deprecated.
  112. ///
  113. /// NOTE: This message was marked as deprecated in the .proto file.
  114. struct SwiftProtoTesting_Deprecated_MyMsg2: @unchecked Sendable {
  115. // SwiftProtobuf.Message conformance is added in an extension below. See the
  116. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  117. // methods supported on all messages.
  118. var stringField: String {
  119. get {return _storage._stringField ?? String()}
  120. set {_uniqueStorage()._stringField = newValue}
  121. }
  122. /// Returns true if `stringField` has been explicitly set.
  123. var hasStringField: Bool {return _storage._stringField != nil}
  124. /// Clears the value of `stringField`. Subsequent reads from it will return its default value.
  125. mutating func clearStringField() {_uniqueStorage()._stringField = nil}
  126. var intField: Int32 {
  127. get {return _storage._intField ?? 0}
  128. set {_uniqueStorage()._intField = newValue}
  129. }
  130. /// Returns true if `intField` has been explicitly set.
  131. var hasIntField: Bool {return _storage._intField != nil}
  132. /// Clears the value of `intField`. Subsequent reads from it will return its default value.
  133. mutating func clearIntField() {_uniqueStorage()._intField = nil}
  134. var fixedField: [UInt32] {
  135. get {return _storage._fixedField}
  136. set {_uniqueStorage()._fixedField = newValue}
  137. }
  138. var msgField: SwiftProtoTesting_Deprecated_MyMsg2 {
  139. get {return _storage._msgField ?? SwiftProtoTesting_Deprecated_MyMsg2()}
  140. set {_uniqueStorage()._msgField = newValue}
  141. }
  142. /// Returns true if `msgField` has been explicitly set.
  143. var hasMsgField: Bool {return _storage._msgField != nil}
  144. /// Clears the value of `msgField`. Subsequent reads from it will return its default value.
  145. mutating func clearMsgField() {_uniqueStorage()._msgField = nil}
  146. var unknownFields = SwiftProtobuf.UnknownStorage()
  147. init() {}
  148. fileprivate var _storage = _StorageClass.defaultInstance
  149. }
  150. // MARK: - Extension support defined in unittest_swift_deprecated.proto.
  151. // MARK: - Extension Properties
  152. // Swift Extensions on the extended Messages to add easy access to the declared
  153. // extension fields. The names are based on the extension field name from the proto
  154. // declaration. To avoid naming collisions, the names are prefixed with the name of
  155. // the scope where the extend directive occurs.
  156. extension SwiftProtoTesting_Deprecated_MyMsg {
  157. /// Extension field comment
  158. ///
  159. /// NOTE: This extension field was marked as deprecated in the .proto file.
  160. var SwiftProtoTesting_Deprecated_stringExtField: String {
  161. get {return getExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_string_ext_field) ?? String()}
  162. set {setExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_string_ext_field, value: newValue)}
  163. }
  164. /// Returns true if extension `SwiftProtoTesting_Deprecated_Extensions_string_ext_field`
  165. /// has been explicitly set.
  166. var hasSwiftProtoTesting_Deprecated_stringExtField: Bool {
  167. return hasExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_string_ext_field)
  168. }
  169. /// Clears the value of extension `SwiftProtoTesting_Deprecated_Extensions_string_ext_field`.
  170. /// Subsequent reads from it will return its default value.
  171. mutating func clearSwiftProtoTesting_Deprecated_stringExtField() {
  172. clearExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_string_ext_field)
  173. }
  174. /// NOTE: This extension field was marked as deprecated in the .proto file.
  175. var SwiftProtoTesting_Deprecated_intExtField: Int32 {
  176. get {return getExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_int_ext_field) ?? 0}
  177. set {setExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_int_ext_field, value: newValue)}
  178. }
  179. /// Returns true if extension `SwiftProtoTesting_Deprecated_Extensions_int_ext_field`
  180. /// has been explicitly set.
  181. var hasSwiftProtoTesting_Deprecated_intExtField: Bool {
  182. return hasExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_int_ext_field)
  183. }
  184. /// Clears the value of extension `SwiftProtoTesting_Deprecated_Extensions_int_ext_field`.
  185. /// Subsequent reads from it will return its default value.
  186. mutating func clearSwiftProtoTesting_Deprecated_intExtField() {
  187. clearExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_int_ext_field)
  188. }
  189. /// NOTE: This extension field was marked as deprecated in the .proto file.
  190. var SwiftProtoTesting_Deprecated_fixedExtField: [UInt32] {
  191. get {return getExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_fixed_ext_field) ?? []}
  192. set {setExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_fixed_ext_field, value: newValue)}
  193. }
  194. /// NOTE: This extension field was marked as deprecated in the .proto file.
  195. var SwiftProtoTesting_Deprecated_msgExtField: SwiftProtoTesting_Deprecated_MyMsg {
  196. get {return getExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_msg_ext_field) ?? SwiftProtoTesting_Deprecated_MyMsg()}
  197. set {setExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_msg_ext_field, value: newValue)}
  198. }
  199. /// Returns true if extension `SwiftProtoTesting_Deprecated_Extensions_msg_ext_field`
  200. /// has been explicitly set.
  201. var hasSwiftProtoTesting_Deprecated_msgExtField: Bool {
  202. return hasExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_msg_ext_field)
  203. }
  204. /// Clears the value of extension `SwiftProtoTesting_Deprecated_Extensions_msg_ext_field`.
  205. /// Subsequent reads from it will return its default value.
  206. mutating func clearSwiftProtoTesting_Deprecated_msgExtField() {
  207. clearExtensionValue(ext: SwiftProtoTesting_Deprecated_Extensions_msg_ext_field)
  208. }
  209. /// Another extension field comment
  210. ///
  211. /// NOTE: This extension field was marked as deprecated in the .proto file.
  212. var SwiftProtoTesting_Deprecated_MsgScope_stringExt2Field: String {
  213. get {return getExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.string_ext2_field) ?? String()}
  214. set {setExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.string_ext2_field, value: newValue)}
  215. }
  216. /// Returns true if extension `SwiftProtoTesting_Deprecated_MsgScope.Extensions.string_ext2_field`
  217. /// has been explicitly set.
  218. var hasSwiftProtoTesting_Deprecated_MsgScope_stringExt2Field: Bool {
  219. return hasExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.string_ext2_field)
  220. }
  221. /// Clears the value of extension `SwiftProtoTesting_Deprecated_MsgScope.Extensions.string_ext2_field`.
  222. /// Subsequent reads from it will return its default value.
  223. mutating func clearSwiftProtoTesting_Deprecated_MsgScope_stringExt2Field() {
  224. clearExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.string_ext2_field)
  225. }
  226. /// NOTE: This extension field was marked as deprecated in the .proto file.
  227. var SwiftProtoTesting_Deprecated_MsgScope_intExt2Field: Int32 {
  228. get {return getExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.int_ext2_field) ?? 0}
  229. set {setExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.int_ext2_field, value: newValue)}
  230. }
  231. /// Returns true if extension `SwiftProtoTesting_Deprecated_MsgScope.Extensions.int_ext2_field`
  232. /// has been explicitly set.
  233. var hasSwiftProtoTesting_Deprecated_MsgScope_intExt2Field: Bool {
  234. return hasExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.int_ext2_field)
  235. }
  236. /// Clears the value of extension `SwiftProtoTesting_Deprecated_MsgScope.Extensions.int_ext2_field`.
  237. /// Subsequent reads from it will return its default value.
  238. mutating func clearSwiftProtoTesting_Deprecated_MsgScope_intExt2Field() {
  239. clearExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.int_ext2_field)
  240. }
  241. /// NOTE: This extension field was marked as deprecated in the .proto file.
  242. var SwiftProtoTesting_Deprecated_MsgScope_fixedExt2Field: [UInt32] {
  243. get {return getExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.fixed_ext2_field) ?? []}
  244. set {setExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.fixed_ext2_field, value: newValue)}
  245. }
  246. /// NOTE: This extension field was marked as deprecated in the .proto file.
  247. var SwiftProtoTesting_Deprecated_MsgScope_msgExt2Field: SwiftProtoTesting_Deprecated_MyMsg {
  248. get {return getExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.msg_ext2_field) ?? SwiftProtoTesting_Deprecated_MyMsg()}
  249. set {setExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.msg_ext2_field, value: newValue)}
  250. }
  251. /// Returns true if extension `SwiftProtoTesting_Deprecated_MsgScope.Extensions.msg_ext2_field`
  252. /// has been explicitly set.
  253. var hasSwiftProtoTesting_Deprecated_MsgScope_msgExt2Field: Bool {
  254. return hasExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.msg_ext2_field)
  255. }
  256. /// Clears the value of extension `SwiftProtoTesting_Deprecated_MsgScope.Extensions.msg_ext2_field`.
  257. /// Subsequent reads from it will return its default value.
  258. mutating func clearSwiftProtoTesting_Deprecated_MsgScope_msgExt2Field() {
  259. clearExtensionValue(ext: SwiftProtoTesting_Deprecated_MsgScope.Extensions.msg_ext2_field)
  260. }
  261. }
  262. // MARK: - File's ExtensionMap: SwiftProtoTesting_Deprecated_UnittestSwiftDeprecated_Extensions
  263. /// A `SwiftProtobuf.SimpleExtensionMap` that includes all of the extensions defined by
  264. /// this .proto file. It can be used any place an `SwiftProtobuf.ExtensionMap` is needed
  265. /// in parsing, or it can be combined with other `SwiftProtobuf.SimpleExtensionMap`s to create
  266. /// a larger `SwiftProtobuf.SimpleExtensionMap`.
  267. let SwiftProtoTesting_Deprecated_UnittestSwiftDeprecated_Extensions: SwiftProtobuf.SimpleExtensionMap = [
  268. SwiftProtoTesting_Deprecated_Extensions_string_ext_field,
  269. SwiftProtoTesting_Deprecated_Extensions_int_ext_field,
  270. SwiftProtoTesting_Deprecated_Extensions_fixed_ext_field,
  271. SwiftProtoTesting_Deprecated_Extensions_msg_ext_field,
  272. SwiftProtoTesting_Deprecated_MsgScope.Extensions.string_ext2_field,
  273. SwiftProtoTesting_Deprecated_MsgScope.Extensions.int_ext2_field,
  274. SwiftProtoTesting_Deprecated_MsgScope.Extensions.fixed_ext2_field,
  275. SwiftProtoTesting_Deprecated_MsgScope.Extensions.msg_ext2_field
  276. ]
  277. // Extension Objects - The only reason these might be needed is when manually
  278. // constructing a `SimpleExtensionMap`, otherwise, use the above _Extension Properties_
  279. // accessors for the extension fields on the messages directly.
  280. /// Extension field comment
  281. ///
  282. /// NOTE: This extension field was marked as deprecated in the .proto file.
  283. let SwiftProtoTesting_Deprecated_Extensions_string_ext_field = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufString>, SwiftProtoTesting_Deprecated_MyMsg>(
  284. _protobuf_fieldNumber: 101,
  285. fieldName: "swift_proto_testing.deprecated.string_ext_field"
  286. )
  287. /// NOTE: This extension field was marked as deprecated in the .proto file.
  288. let SwiftProtoTesting_Deprecated_Extensions_int_ext_field = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufInt32>, SwiftProtoTesting_Deprecated_MyMsg>(
  289. _protobuf_fieldNumber: 102,
  290. fieldName: "swift_proto_testing.deprecated.int_ext_field"
  291. )
  292. /// NOTE: This extension field was marked as deprecated in the .proto file.
  293. let SwiftProtoTesting_Deprecated_Extensions_fixed_ext_field = SwiftProtobuf.MessageExtension<SwiftProtobuf.RepeatedExtensionField<SwiftProtobuf.ProtobufFixed32>, SwiftProtoTesting_Deprecated_MyMsg>(
  294. _protobuf_fieldNumber: 103,
  295. fieldName: "swift_proto_testing.deprecated.fixed_ext_field"
  296. )
  297. /// NOTE: This extension field was marked as deprecated in the .proto file.
  298. let SwiftProtoTesting_Deprecated_Extensions_msg_ext_field = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalMessageExtensionField<SwiftProtoTesting_Deprecated_MyMsg>, SwiftProtoTesting_Deprecated_MyMsg>(
  299. _protobuf_fieldNumber: 104,
  300. fieldName: "swift_proto_testing.deprecated.msg_ext_field"
  301. )
  302. extension SwiftProtoTesting_Deprecated_MsgScope {
  303. enum Extensions {
  304. /// Another extension field comment
  305. ///
  306. /// NOTE: This extension field was marked as deprecated in the .proto file.
  307. static let string_ext2_field = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufString>, SwiftProtoTesting_Deprecated_MyMsg>(
  308. _protobuf_fieldNumber: 201,
  309. fieldName: "swift_proto_testing.deprecated.MsgScope.string_ext2_field"
  310. )
  311. /// NOTE: This extension field was marked as deprecated in the .proto file.
  312. static let int_ext2_field = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufInt32>, SwiftProtoTesting_Deprecated_MyMsg>(
  313. _protobuf_fieldNumber: 202,
  314. fieldName: "swift_proto_testing.deprecated.MsgScope.int_ext2_field"
  315. )
  316. /// NOTE: This extension field was marked as deprecated in the .proto file.
  317. static let fixed_ext2_field = SwiftProtobuf.MessageExtension<SwiftProtobuf.RepeatedExtensionField<SwiftProtobuf.ProtobufFixed32>, SwiftProtoTesting_Deprecated_MyMsg>(
  318. _protobuf_fieldNumber: 203,
  319. fieldName: "swift_proto_testing.deprecated.MsgScope.fixed_ext2_field"
  320. )
  321. /// NOTE: This extension field was marked as deprecated in the .proto file.
  322. static let msg_ext2_field = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalMessageExtensionField<SwiftProtoTesting_Deprecated_MyMsg>, SwiftProtoTesting_Deprecated_MyMsg>(
  323. _protobuf_fieldNumber: 204,
  324. fieldName: "swift_proto_testing.deprecated.MsgScope.msg_ext2_field"
  325. )
  326. }
  327. }
  328. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  329. fileprivate let _protobuf_package = "swift_proto_testing.deprecated"
  330. extension SwiftProtoTesting_Deprecated_MyEnum: SwiftProtobuf._ProtoNameProviding {
  331. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  332. 1: .same(proto: "MYENUM_ONE"),
  333. 2: .same(proto: "MYENUM_TWO"),
  334. 3: .same(proto: "MYENUM_THREE"),
  335. ]
  336. }
  337. extension SwiftProtoTesting_Deprecated_MyEnum2: SwiftProtobuf._ProtoNameProviding {
  338. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  339. 1: .same(proto: "MYENUM2_ONE"),
  340. 2: .same(proto: "MYENUM2_TWO"),
  341. 3: .same(proto: "MYENUM2_THREE"),
  342. ]
  343. }
  344. extension SwiftProtoTesting_Deprecated_MyMsg: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  345. static let protoMessageName: String = _protobuf_package + ".MyMsg"
  346. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  347. 1: .standard(proto: "string_field"),
  348. 2: .standard(proto: "int_field"),
  349. 3: .standard(proto: "fixed_field"),
  350. 4: .standard(proto: "msg_field"),
  351. ]
  352. fileprivate class _StorageClass {
  353. var _stringField: String? = nil
  354. var _intField: Int32? = nil
  355. var _fixedField: [UInt32] = []
  356. var _msgField: SwiftProtoTesting_Deprecated_MyMsg? = nil
  357. // This property is used as the initial default value for new instances of the type.
  358. // The type itself is protecting the reference to its storage via CoW semantics.
  359. // This will force a copy to be made of this reference when the first mutation occurs;
  360. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  361. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  362. private init() {}
  363. init(copying source: _StorageClass) {
  364. _stringField = source._stringField
  365. _intField = source._intField
  366. _fixedField = source._fixedField
  367. _msgField = source._msgField
  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. if !_protobuf_extensionFieldValues.isInitialized {return false}
  378. return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  379. if _storage._intField == nil {return false}
  380. if let v = _storage._msgField, !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.decodeSingularStringField(value: &_storage._stringField) }()
  393. case 2: try { try decoder.decodeSingularInt32Field(value: &_storage._intField) }()
  394. case 3: try { try decoder.decodeRepeatedFixed32Field(value: &_storage._fixedField) }()
  395. case 4: try { try decoder.decodeSingularMessageField(value: &_storage._msgField) }()
  396. case 100..<536870912:
  397. try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftProtoTesting_Deprecated_MyMsg.self, fieldNumber: fieldNumber) }()
  398. default: break
  399. }
  400. }
  401. }
  402. }
  403. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  404. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  405. // The use of inline closures is to circumvent an issue where the compiler
  406. // allocates stack space for every if/case branch local when no optimizations
  407. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  408. // https://github.com/apple/swift-protobuf/issues/1182
  409. try { if let v = _storage._stringField {
  410. try visitor.visitSingularStringField(value: v, fieldNumber: 1)
  411. } }()
  412. try { if let v = _storage._intField {
  413. try visitor.visitSingularInt32Field(value: v, fieldNumber: 2)
  414. } }()
  415. if !_storage._fixedField.isEmpty {
  416. try visitor.visitRepeatedFixed32Field(value: _storage._fixedField, fieldNumber: 3)
  417. }
  418. try { if let v = _storage._msgField {
  419. try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
  420. } }()
  421. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 100, end: 536870912)
  422. }
  423. try unknownFields.traverse(visitor: &visitor)
  424. }
  425. static func ==(lhs: SwiftProtoTesting_Deprecated_MyMsg, rhs: SwiftProtoTesting_Deprecated_MyMsg) -> Bool {
  426. if lhs._storage !== rhs._storage {
  427. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  428. let _storage = _args.0
  429. let rhs_storage = _args.1
  430. if _storage._stringField != rhs_storage._stringField {return false}
  431. if _storage._intField != rhs_storage._intField {return false}
  432. if _storage._fixedField != rhs_storage._fixedField {return false}
  433. if _storage._msgField != rhs_storage._msgField {return false}
  434. return true
  435. }
  436. if !storagesAreEqual {return false}
  437. }
  438. if lhs.unknownFields != rhs.unknownFields {return false}
  439. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  440. return true
  441. }
  442. }
  443. extension SwiftProtoTesting_Deprecated_MsgScope: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  444. static let protoMessageName: String = _protobuf_package + ".MsgScope"
  445. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  446. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  447. // Load everything into unknown fields
  448. while try decoder.nextFieldNumber() != nil {}
  449. }
  450. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  451. try unknownFields.traverse(visitor: &visitor)
  452. }
  453. static func ==(lhs: SwiftProtoTesting_Deprecated_MsgScope, rhs: SwiftProtoTesting_Deprecated_MsgScope) -> Bool {
  454. if lhs.unknownFields != rhs.unknownFields {return false}
  455. return true
  456. }
  457. }
  458. extension SwiftProtoTesting_Deprecated_MyMsg2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  459. static let protoMessageName: String = _protobuf_package + ".MyMsg2"
  460. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  461. 1: .standard(proto: "string_field"),
  462. 2: .standard(proto: "int_field"),
  463. 3: .standard(proto: "fixed_field"),
  464. 4: .standard(proto: "msg_field"),
  465. ]
  466. fileprivate class _StorageClass {
  467. var _stringField: String? = nil
  468. var _intField: Int32? = nil
  469. var _fixedField: [UInt32] = []
  470. var _msgField: SwiftProtoTesting_Deprecated_MyMsg2? = nil
  471. // This property is used as the initial default value for new instances of the type.
  472. // The type itself is protecting the reference to its storage via CoW semantics.
  473. // This will force a copy to be made of this reference when the first mutation occurs;
  474. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  475. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  476. private init() {}
  477. init(copying source: _StorageClass) {
  478. _stringField = source._stringField
  479. _intField = source._intField
  480. _fixedField = source._fixedField
  481. _msgField = source._msgField
  482. }
  483. }
  484. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  485. if !isKnownUniquelyReferenced(&_storage) {
  486. _storage = _StorageClass(copying: _storage)
  487. }
  488. return _storage
  489. }
  490. public var isInitialized: Bool {
  491. return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  492. if _storage._intField == nil {return false}
  493. if let v = _storage._msgField, !v.isInitialized {return false}
  494. return true
  495. }
  496. }
  497. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  498. _ = _uniqueStorage()
  499. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  500. while let fieldNumber = try decoder.nextFieldNumber() {
  501. // The use of inline closures is to circumvent an issue where the compiler
  502. // allocates stack space for every case branch when no optimizations are
  503. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  504. switch fieldNumber {
  505. case 1: try { try decoder.decodeSingularStringField(value: &_storage._stringField) }()
  506. case 2: try { try decoder.decodeSingularInt32Field(value: &_storage._intField) }()
  507. case 3: try { try decoder.decodeRepeatedFixed32Field(value: &_storage._fixedField) }()
  508. case 4: try { try decoder.decodeSingularMessageField(value: &_storage._msgField) }()
  509. default: break
  510. }
  511. }
  512. }
  513. }
  514. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  515. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  516. // The use of inline closures is to circumvent an issue where the compiler
  517. // allocates stack space for every if/case branch local when no optimizations
  518. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  519. // https://github.com/apple/swift-protobuf/issues/1182
  520. try { if let v = _storage._stringField {
  521. try visitor.visitSingularStringField(value: v, fieldNumber: 1)
  522. } }()
  523. try { if let v = _storage._intField {
  524. try visitor.visitSingularInt32Field(value: v, fieldNumber: 2)
  525. } }()
  526. if !_storage._fixedField.isEmpty {
  527. try visitor.visitRepeatedFixed32Field(value: _storage._fixedField, fieldNumber: 3)
  528. }
  529. try { if let v = _storage._msgField {
  530. try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
  531. } }()
  532. }
  533. try unknownFields.traverse(visitor: &visitor)
  534. }
  535. static func ==(lhs: SwiftProtoTesting_Deprecated_MyMsg2, rhs: SwiftProtoTesting_Deprecated_MyMsg2) -> Bool {
  536. if lhs._storage !== rhs._storage {
  537. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  538. let _storage = _args.0
  539. let rhs_storage = _args.1
  540. if _storage._stringField != rhs_storage._stringField {return false}
  541. if _storage._intField != rhs_storage._intField {return false}
  542. if _storage._fixedField != rhs_storage._fixedField {return false}
  543. if _storage._msgField != rhs_storage._msgField {return false}
  544. return true
  545. }
  546. if !storagesAreEqual {return false}
  547. }
  548. if lhs.unknownFields != rhs.unknownFields {return false}
  549. return true
  550. }
  551. }