map_unittest.pb.swift 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  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: map_unittest.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Protocol Buffers - Google's data interchange format
  11. // Copyright 2008 Google Inc. All rights reserved.
  12. // https://developers.google.com/protocol-buffers/
  13. //
  14. // Redistribution and use in source and binary forms, with or without
  15. // modification, are permitted provided that the following conditions are
  16. // met:
  17. //
  18. // * Redistributions of source code must retain the above copyright
  19. // notice, this list of conditions and the following disclaimer.
  20. // * Redistributions in binary form must reproduce the above
  21. // copyright notice, this list of conditions and the following disclaimer
  22. // in the documentation and/or other materials provided with the
  23. // distribution.
  24. // * Neither the name of Google Inc. nor the names of its
  25. // contributors may be used to endorse or promote products derived from
  26. // this software without specific prior written permission.
  27. //
  28. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  29. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  30. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  31. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  32. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  33. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  34. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  35. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  36. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  38. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. import Foundation
  40. import SwiftProtobuf
  41. // If the compiler emits an error on this type, it is because this file
  42. // was generated by a version of the `protoc` Swift plug-in that is
  43. // incompatible with the version of SwiftProtobuf to which you are linking.
  44. // Please ensure that you are building against the same version of the API
  45. // that was used to generate this file.
  46. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  47. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  48. typealias Version = _2
  49. }
  50. enum SwiftProtoTesting_MapEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
  51. typealias RawValue = Int
  52. case foo // = 0
  53. case bar // = 1
  54. case baz // = 2
  55. case UNRECOGNIZED(Int)
  56. init() {
  57. self = .foo
  58. }
  59. init?(rawValue: Int) {
  60. switch rawValue {
  61. case 0: self = .foo
  62. case 1: self = .bar
  63. case 2: self = .baz
  64. default: self = .UNRECOGNIZED(rawValue)
  65. }
  66. }
  67. var rawValue: Int {
  68. switch self {
  69. case .foo: return 0
  70. case .bar: return 1
  71. case .baz: return 2
  72. case .UNRECOGNIZED(let i): return i
  73. }
  74. }
  75. // The compiler won't synthesize support with the UNRECOGNIZED case.
  76. static let allCases: [SwiftProtoTesting_MapEnum] = [
  77. .foo,
  78. .bar,
  79. .baz,
  80. ]
  81. }
  82. /// Tests maps.
  83. struct SwiftProtoTesting_TestMap: @unchecked 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 mapInt32Int32: Dictionary<Int32,Int32> {
  88. get {return _storage._mapInt32Int32}
  89. set {_uniqueStorage()._mapInt32Int32 = newValue}
  90. }
  91. var mapInt64Int64: Dictionary<Int64,Int64> {
  92. get {return _storage._mapInt64Int64}
  93. set {_uniqueStorage()._mapInt64Int64 = newValue}
  94. }
  95. var mapUint32Uint32: Dictionary<UInt32,UInt32> {
  96. get {return _storage._mapUint32Uint32}
  97. set {_uniqueStorage()._mapUint32Uint32 = newValue}
  98. }
  99. var mapUint64Uint64: Dictionary<UInt64,UInt64> {
  100. get {return _storage._mapUint64Uint64}
  101. set {_uniqueStorage()._mapUint64Uint64 = newValue}
  102. }
  103. var mapSint32Sint32: Dictionary<Int32,Int32> {
  104. get {return _storage._mapSint32Sint32}
  105. set {_uniqueStorage()._mapSint32Sint32 = newValue}
  106. }
  107. var mapSint64Sint64: Dictionary<Int64,Int64> {
  108. get {return _storage._mapSint64Sint64}
  109. set {_uniqueStorage()._mapSint64Sint64 = newValue}
  110. }
  111. var mapFixed32Fixed32: Dictionary<UInt32,UInt32> {
  112. get {return _storage._mapFixed32Fixed32}
  113. set {_uniqueStorage()._mapFixed32Fixed32 = newValue}
  114. }
  115. var mapFixed64Fixed64: Dictionary<UInt64,UInt64> {
  116. get {return _storage._mapFixed64Fixed64}
  117. set {_uniqueStorage()._mapFixed64Fixed64 = newValue}
  118. }
  119. var mapSfixed32Sfixed32: Dictionary<Int32,Int32> {
  120. get {return _storage._mapSfixed32Sfixed32}
  121. set {_uniqueStorage()._mapSfixed32Sfixed32 = newValue}
  122. }
  123. var mapSfixed64Sfixed64: Dictionary<Int64,Int64> {
  124. get {return _storage._mapSfixed64Sfixed64}
  125. set {_uniqueStorage()._mapSfixed64Sfixed64 = newValue}
  126. }
  127. var mapInt32Float: Dictionary<Int32,Float> {
  128. get {return _storage._mapInt32Float}
  129. set {_uniqueStorage()._mapInt32Float = newValue}
  130. }
  131. var mapInt32Double: Dictionary<Int32,Double> {
  132. get {return _storage._mapInt32Double}
  133. set {_uniqueStorage()._mapInt32Double = newValue}
  134. }
  135. var mapBoolBool: Dictionary<Bool,Bool> {
  136. get {return _storage._mapBoolBool}
  137. set {_uniqueStorage()._mapBoolBool = newValue}
  138. }
  139. var mapStringString: Dictionary<String,String> {
  140. get {return _storage._mapStringString}
  141. set {_uniqueStorage()._mapStringString = newValue}
  142. }
  143. var mapInt32Bytes: Dictionary<Int32,Data> {
  144. get {return _storage._mapInt32Bytes}
  145. set {_uniqueStorage()._mapInt32Bytes = newValue}
  146. }
  147. var mapInt32Enum: Dictionary<Int32,SwiftProtoTesting_MapEnum> {
  148. get {return _storage._mapInt32Enum}
  149. set {_uniqueStorage()._mapInt32Enum = newValue}
  150. }
  151. var mapInt32ForeignMessage: Dictionary<Int32,SwiftProtoTesting_ForeignMessage> {
  152. get {return _storage._mapInt32ForeignMessage}
  153. set {_uniqueStorage()._mapInt32ForeignMessage = newValue}
  154. }
  155. var mapStringForeignMessage: Dictionary<String,SwiftProtoTesting_ForeignMessage> {
  156. get {return _storage._mapStringForeignMessage}
  157. set {_uniqueStorage()._mapStringForeignMessage = newValue}
  158. }
  159. var mapInt32AllTypes: Dictionary<Int32,SwiftProtoTesting_TestAllTypes> {
  160. get {return _storage._mapInt32AllTypes}
  161. set {_uniqueStorage()._mapInt32AllTypes = newValue}
  162. }
  163. var unknownFields = SwiftProtobuf.UnknownStorage()
  164. init() {}
  165. fileprivate var _storage = _StorageClass.defaultInstance
  166. }
  167. /// Test embedded message with required fields
  168. struct SwiftProtoTesting_TestRequiredMessageMap: Sendable {
  169. // SwiftProtobuf.Message conformance is added in an extension below. See the
  170. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  171. // methods supported on all messages.
  172. var mapField: Dictionary<Int32,SwiftProtoTesting_TestRequired> = [:]
  173. var unknownFields = SwiftProtobuf.UnknownStorage()
  174. init() {}
  175. }
  176. struct SwiftProtoTesting_TestRecursiveMapMessage: Sendable {
  177. // SwiftProtobuf.Message conformance is added in an extension below. See the
  178. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  179. // methods supported on all messages.
  180. var a: Dictionary<String,SwiftProtoTesting_TestRecursiveMapMessage> = [:]
  181. var unknownFields = SwiftProtobuf.UnknownStorage()
  182. init() {}
  183. }
  184. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  185. fileprivate let _protobuf_package = "swift_proto_testing"
  186. extension SwiftProtoTesting_MapEnum: SwiftProtobuf._ProtoNameProviding {
  187. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  188. 0: .same(proto: "MAP_ENUM_FOO"),
  189. 1: .same(proto: "MAP_ENUM_BAR"),
  190. 2: .same(proto: "MAP_ENUM_BAZ"),
  191. ]
  192. }
  193. extension SwiftProtoTesting_TestMap: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  194. static let protoMessageName: String = _protobuf_package + ".TestMap"
  195. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  196. 1: .standard(proto: "map_int32_int32"),
  197. 2: .standard(proto: "map_int64_int64"),
  198. 3: .standard(proto: "map_uint32_uint32"),
  199. 4: .standard(proto: "map_uint64_uint64"),
  200. 5: .standard(proto: "map_sint32_sint32"),
  201. 6: .standard(proto: "map_sint64_sint64"),
  202. 7: .standard(proto: "map_fixed32_fixed32"),
  203. 8: .standard(proto: "map_fixed64_fixed64"),
  204. 9: .standard(proto: "map_sfixed32_sfixed32"),
  205. 10: .standard(proto: "map_sfixed64_sfixed64"),
  206. 11: .standard(proto: "map_int32_float"),
  207. 12: .standard(proto: "map_int32_double"),
  208. 13: .standard(proto: "map_bool_bool"),
  209. 14: .standard(proto: "map_string_string"),
  210. 15: .standard(proto: "map_int32_bytes"),
  211. 16: .standard(proto: "map_int32_enum"),
  212. 17: .standard(proto: "map_int32_foreign_message"),
  213. 18: .standard(proto: "map_string_foreign_message"),
  214. 19: .standard(proto: "map_int32_all_types"),
  215. ]
  216. fileprivate class _StorageClass {
  217. var _mapInt32Int32: Dictionary<Int32,Int32> = [:]
  218. var _mapInt64Int64: Dictionary<Int64,Int64> = [:]
  219. var _mapUint32Uint32: Dictionary<UInt32,UInt32> = [:]
  220. var _mapUint64Uint64: Dictionary<UInt64,UInt64> = [:]
  221. var _mapSint32Sint32: Dictionary<Int32,Int32> = [:]
  222. var _mapSint64Sint64: Dictionary<Int64,Int64> = [:]
  223. var _mapFixed32Fixed32: Dictionary<UInt32,UInt32> = [:]
  224. var _mapFixed64Fixed64: Dictionary<UInt64,UInt64> = [:]
  225. var _mapSfixed32Sfixed32: Dictionary<Int32,Int32> = [:]
  226. var _mapSfixed64Sfixed64: Dictionary<Int64,Int64> = [:]
  227. var _mapInt32Float: Dictionary<Int32,Float> = [:]
  228. var _mapInt32Double: Dictionary<Int32,Double> = [:]
  229. var _mapBoolBool: Dictionary<Bool,Bool> = [:]
  230. var _mapStringString: Dictionary<String,String> = [:]
  231. var _mapInt32Bytes: Dictionary<Int32,Data> = [:]
  232. var _mapInt32Enum: Dictionary<Int32,SwiftProtoTesting_MapEnum> = [:]
  233. var _mapInt32ForeignMessage: Dictionary<Int32,SwiftProtoTesting_ForeignMessage> = [:]
  234. var _mapStringForeignMessage: Dictionary<String,SwiftProtoTesting_ForeignMessage> = [:]
  235. var _mapInt32AllTypes: Dictionary<Int32,SwiftProtoTesting_TestAllTypes> = [:]
  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. _mapInt32Int32 = source._mapInt32Int32
  244. _mapInt64Int64 = source._mapInt64Int64
  245. _mapUint32Uint32 = source._mapUint32Uint32
  246. _mapUint64Uint64 = source._mapUint64Uint64
  247. _mapSint32Sint32 = source._mapSint32Sint32
  248. _mapSint64Sint64 = source._mapSint64Sint64
  249. _mapFixed32Fixed32 = source._mapFixed32Fixed32
  250. _mapFixed64Fixed64 = source._mapFixed64Fixed64
  251. _mapSfixed32Sfixed32 = source._mapSfixed32Sfixed32
  252. _mapSfixed64Sfixed64 = source._mapSfixed64Sfixed64
  253. _mapInt32Float = source._mapInt32Float
  254. _mapInt32Double = source._mapInt32Double
  255. _mapBoolBool = source._mapBoolBool
  256. _mapStringString = source._mapStringString
  257. _mapInt32Bytes = source._mapInt32Bytes
  258. _mapInt32Enum = source._mapInt32Enum
  259. _mapInt32ForeignMessage = source._mapInt32ForeignMessage
  260. _mapStringForeignMessage = source._mapStringForeignMessage
  261. _mapInt32AllTypes = source._mapInt32AllTypes
  262. }
  263. }
  264. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  265. if !isKnownUniquelyReferenced(&_storage) {
  266. _storage = _StorageClass(copying: _storage)
  267. }
  268. return _storage
  269. }
  270. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  271. _ = _uniqueStorage()
  272. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  273. while let fieldNumber = try decoder.nextFieldNumber() {
  274. // The use of inline closures is to circumvent an issue where the compiler
  275. // allocates stack space for every case branch when no optimizations are
  276. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  277. switch fieldNumber {
  278. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufInt32>.self, value: &_storage._mapInt32Int32) }()
  279. case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt64,SwiftProtobuf.ProtobufInt64>.self, value: &_storage._mapInt64Int64) }()
  280. case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt32,SwiftProtobuf.ProtobufUInt32>.self, value: &_storage._mapUint32Uint32) }()
  281. case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt64,SwiftProtobuf.ProtobufUInt64>.self, value: &_storage._mapUint64Uint64) }()
  282. case 5: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSInt32,SwiftProtobuf.ProtobufSInt32>.self, value: &_storage._mapSint32Sint32) }()
  283. case 6: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSInt64,SwiftProtobuf.ProtobufSInt64>.self, value: &_storage._mapSint64Sint64) }()
  284. case 7: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufFixed32,SwiftProtobuf.ProtobufFixed32>.self, value: &_storage._mapFixed32Fixed32) }()
  285. case 8: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufFixed64,SwiftProtobuf.ProtobufFixed64>.self, value: &_storage._mapFixed64Fixed64) }()
  286. case 9: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSFixed32,SwiftProtobuf.ProtobufSFixed32>.self, value: &_storage._mapSfixed32Sfixed32) }()
  287. case 10: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSFixed64,SwiftProtobuf.ProtobufSFixed64>.self, value: &_storage._mapSfixed64Sfixed64) }()
  288. case 11: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufFloat>.self, value: &_storage._mapInt32Float) }()
  289. case 12: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufDouble>.self, value: &_storage._mapInt32Double) }()
  290. case 13: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufBool,SwiftProtobuf.ProtobufBool>.self, value: &_storage._mapBoolBool) }()
  291. case 14: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: &_storage._mapStringString) }()
  292. case 15: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufBytes>.self, value: &_storage._mapInt32Bytes) }()
  293. case 16: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufEnumMap<SwiftProtobuf.ProtobufInt32,SwiftProtoTesting_MapEnum>.self, value: &_storage._mapInt32Enum) }()
  294. case 17: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,SwiftProtoTesting_ForeignMessage>.self, value: &_storage._mapInt32ForeignMessage) }()
  295. case 18: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufString,SwiftProtoTesting_ForeignMessage>.self, value: &_storage._mapStringForeignMessage) }()
  296. case 19: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,SwiftProtoTesting_TestAllTypes>.self, value: &_storage._mapInt32AllTypes) }()
  297. default: break
  298. }
  299. }
  300. }
  301. }
  302. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  303. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  304. if !_storage._mapInt32Int32.isEmpty {
  305. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufInt32>.self, value: _storage._mapInt32Int32, fieldNumber: 1)
  306. }
  307. if !_storage._mapInt64Int64.isEmpty {
  308. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt64,SwiftProtobuf.ProtobufInt64>.self, value: _storage._mapInt64Int64, fieldNumber: 2)
  309. }
  310. if !_storage._mapUint32Uint32.isEmpty {
  311. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt32,SwiftProtobuf.ProtobufUInt32>.self, value: _storage._mapUint32Uint32, fieldNumber: 3)
  312. }
  313. if !_storage._mapUint64Uint64.isEmpty {
  314. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt64,SwiftProtobuf.ProtobufUInt64>.self, value: _storage._mapUint64Uint64, fieldNumber: 4)
  315. }
  316. if !_storage._mapSint32Sint32.isEmpty {
  317. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSInt32,SwiftProtobuf.ProtobufSInt32>.self, value: _storage._mapSint32Sint32, fieldNumber: 5)
  318. }
  319. if !_storage._mapSint64Sint64.isEmpty {
  320. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSInt64,SwiftProtobuf.ProtobufSInt64>.self, value: _storage._mapSint64Sint64, fieldNumber: 6)
  321. }
  322. if !_storage._mapFixed32Fixed32.isEmpty {
  323. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufFixed32,SwiftProtobuf.ProtobufFixed32>.self, value: _storage._mapFixed32Fixed32, fieldNumber: 7)
  324. }
  325. if !_storage._mapFixed64Fixed64.isEmpty {
  326. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufFixed64,SwiftProtobuf.ProtobufFixed64>.self, value: _storage._mapFixed64Fixed64, fieldNumber: 8)
  327. }
  328. if !_storage._mapSfixed32Sfixed32.isEmpty {
  329. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSFixed32,SwiftProtobuf.ProtobufSFixed32>.self, value: _storage._mapSfixed32Sfixed32, fieldNumber: 9)
  330. }
  331. if !_storage._mapSfixed64Sfixed64.isEmpty {
  332. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSFixed64,SwiftProtobuf.ProtobufSFixed64>.self, value: _storage._mapSfixed64Sfixed64, fieldNumber: 10)
  333. }
  334. if !_storage._mapInt32Float.isEmpty {
  335. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufFloat>.self, value: _storage._mapInt32Float, fieldNumber: 11)
  336. }
  337. if !_storage._mapInt32Double.isEmpty {
  338. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufDouble>.self, value: _storage._mapInt32Double, fieldNumber: 12)
  339. }
  340. if !_storage._mapBoolBool.isEmpty {
  341. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufBool,SwiftProtobuf.ProtobufBool>.self, value: _storage._mapBoolBool, fieldNumber: 13)
  342. }
  343. if !_storage._mapStringString.isEmpty {
  344. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: _storage._mapStringString, fieldNumber: 14)
  345. }
  346. if !_storage._mapInt32Bytes.isEmpty {
  347. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufBytes>.self, value: _storage._mapInt32Bytes, fieldNumber: 15)
  348. }
  349. if !_storage._mapInt32Enum.isEmpty {
  350. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufEnumMap<SwiftProtobuf.ProtobufInt32,SwiftProtoTesting_MapEnum>.self, value: _storage._mapInt32Enum, fieldNumber: 16)
  351. }
  352. if !_storage._mapInt32ForeignMessage.isEmpty {
  353. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,SwiftProtoTesting_ForeignMessage>.self, value: _storage._mapInt32ForeignMessage, fieldNumber: 17)
  354. }
  355. if !_storage._mapStringForeignMessage.isEmpty {
  356. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufString,SwiftProtoTesting_ForeignMessage>.self, value: _storage._mapStringForeignMessage, fieldNumber: 18)
  357. }
  358. if !_storage._mapInt32AllTypes.isEmpty {
  359. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,SwiftProtoTesting_TestAllTypes>.self, value: _storage._mapInt32AllTypes, fieldNumber: 19)
  360. }
  361. }
  362. try unknownFields.traverse(visitor: &visitor)
  363. }
  364. static func ==(lhs: SwiftProtoTesting_TestMap, rhs: SwiftProtoTesting_TestMap) -> Bool {
  365. if lhs._storage !== rhs._storage {
  366. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  367. let _storage = _args.0
  368. let rhs_storage = _args.1
  369. if _storage._mapInt32Int32 != rhs_storage._mapInt32Int32 {return false}
  370. if _storage._mapInt64Int64 != rhs_storage._mapInt64Int64 {return false}
  371. if _storage._mapUint32Uint32 != rhs_storage._mapUint32Uint32 {return false}
  372. if _storage._mapUint64Uint64 != rhs_storage._mapUint64Uint64 {return false}
  373. if _storage._mapSint32Sint32 != rhs_storage._mapSint32Sint32 {return false}
  374. if _storage._mapSint64Sint64 != rhs_storage._mapSint64Sint64 {return false}
  375. if _storage._mapFixed32Fixed32 != rhs_storage._mapFixed32Fixed32 {return false}
  376. if _storage._mapFixed64Fixed64 != rhs_storage._mapFixed64Fixed64 {return false}
  377. if _storage._mapSfixed32Sfixed32 != rhs_storage._mapSfixed32Sfixed32 {return false}
  378. if _storage._mapSfixed64Sfixed64 != rhs_storage._mapSfixed64Sfixed64 {return false}
  379. if _storage._mapInt32Float != rhs_storage._mapInt32Float {return false}
  380. if _storage._mapInt32Double != rhs_storage._mapInt32Double {return false}
  381. if _storage._mapBoolBool != rhs_storage._mapBoolBool {return false}
  382. if _storage._mapStringString != rhs_storage._mapStringString {return false}
  383. if _storage._mapInt32Bytes != rhs_storage._mapInt32Bytes {return false}
  384. if _storage._mapInt32Enum != rhs_storage._mapInt32Enum {return false}
  385. if _storage._mapInt32ForeignMessage != rhs_storage._mapInt32ForeignMessage {return false}
  386. if _storage._mapStringForeignMessage != rhs_storage._mapStringForeignMessage {return false}
  387. if _storage._mapInt32AllTypes != rhs_storage._mapInt32AllTypes {return false}
  388. return true
  389. }
  390. if !storagesAreEqual {return false}
  391. }
  392. if lhs.unknownFields != rhs.unknownFields {return false}
  393. return true
  394. }
  395. }
  396. extension SwiftProtoTesting_TestRequiredMessageMap: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  397. static let protoMessageName: String = _protobuf_package + ".TestRequiredMessageMap"
  398. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  399. 1: .standard(proto: "map_field"),
  400. ]
  401. public var isInitialized: Bool {
  402. if !SwiftProtobuf.Internal.areAllInitialized(self.mapField) {return false}
  403. return true
  404. }
  405. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  406. while let fieldNumber = try decoder.nextFieldNumber() {
  407. // The use of inline closures is to circumvent an issue where the compiler
  408. // allocates stack space for every case branch when no optimizations are
  409. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  410. switch fieldNumber {
  411. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,SwiftProtoTesting_TestRequired>.self, value: &self.mapField) }()
  412. default: break
  413. }
  414. }
  415. }
  416. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  417. if !self.mapField.isEmpty {
  418. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,SwiftProtoTesting_TestRequired>.self, value: self.mapField, fieldNumber: 1)
  419. }
  420. try unknownFields.traverse(visitor: &visitor)
  421. }
  422. static func ==(lhs: SwiftProtoTesting_TestRequiredMessageMap, rhs: SwiftProtoTesting_TestRequiredMessageMap) -> Bool {
  423. if lhs.mapField != rhs.mapField {return false}
  424. if lhs.unknownFields != rhs.unknownFields {return false}
  425. return true
  426. }
  427. }
  428. extension SwiftProtoTesting_TestRecursiveMapMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  429. static let protoMessageName: String = _protobuf_package + ".TestRecursiveMapMessage"
  430. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  431. 1: .same(proto: "a"),
  432. ]
  433. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  434. while let fieldNumber = try decoder.nextFieldNumber() {
  435. // The use of inline closures is to circumvent an issue where the compiler
  436. // allocates stack space for every case branch when no optimizations are
  437. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  438. switch fieldNumber {
  439. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufString,SwiftProtoTesting_TestRecursiveMapMessage>.self, value: &self.a) }()
  440. default: break
  441. }
  442. }
  443. }
  444. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  445. if !self.a.isEmpty {
  446. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufString,SwiftProtoTesting_TestRecursiveMapMessage>.self, value: self.a, fieldNumber: 1)
  447. }
  448. try unknownFields.traverse(visitor: &visitor)
  449. }
  450. static func ==(lhs: SwiftProtoTesting_TestRecursiveMapMessage, rhs: SwiftProtoTesting_TestRecursiveMapMessage) -> Bool {
  451. if lhs.a != rhs.a {return false}
  452. if lhs.unknownFields != rhs.unknownFields {return false}
  453. return true
  454. }
  455. }