map_unittest.pb.swift 62 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243
  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: google/protobuf/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. //
  13. // Use of this source code is governed by a BSD-style
  14. // license that can be found in the LICENSE file or at
  15. // https://developers.google.com/open-source/licenses/bsd
  16. import Foundation
  17. import SwiftProtobuf
  18. // If the compiler emits an error on this type, it is because this file
  19. // was generated by a version of the `protoc` Swift plug-in that is
  20. // incompatible with the version of SwiftProtobuf to which you are linking.
  21. // Please ensure that you are building against the same version of the API
  22. // that was used to generate this file.
  23. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  24. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  25. typealias Version = _2
  26. }
  27. enum Proto2Unittest_MapEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
  28. typealias RawValue = Int
  29. case foo // = 0
  30. case bar // = 1
  31. case baz // = 2
  32. case UNRECOGNIZED(Int)
  33. init() {
  34. self = .foo
  35. }
  36. init?(rawValue: Int) {
  37. switch rawValue {
  38. case 0: self = .foo
  39. case 1: self = .bar
  40. case 2: self = .baz
  41. default: self = .UNRECOGNIZED(rawValue)
  42. }
  43. }
  44. var rawValue: Int {
  45. switch self {
  46. case .foo: return 0
  47. case .bar: return 1
  48. case .baz: return 2
  49. case .UNRECOGNIZED(let i): return i
  50. }
  51. }
  52. // The compiler won't synthesize support with the UNRECOGNIZED case.
  53. static let allCases: [Proto2Unittest_MapEnum] = [
  54. .foo,
  55. .bar,
  56. .baz,
  57. ]
  58. }
  59. /// Tests maps.
  60. struct Proto2Unittest_TestMap: @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. var mapInt32Int32: Dictionary<Int32,Int32> {
  65. get {return _storage._mapInt32Int32}
  66. set {_uniqueStorage()._mapInt32Int32 = newValue}
  67. }
  68. var mapInt64Int64: Dictionary<Int64,Int64> {
  69. get {return _storage._mapInt64Int64}
  70. set {_uniqueStorage()._mapInt64Int64 = newValue}
  71. }
  72. var mapUint32Uint32: Dictionary<UInt32,UInt32> {
  73. get {return _storage._mapUint32Uint32}
  74. set {_uniqueStorage()._mapUint32Uint32 = newValue}
  75. }
  76. var mapUint64Uint64: Dictionary<UInt64,UInt64> {
  77. get {return _storage._mapUint64Uint64}
  78. set {_uniqueStorage()._mapUint64Uint64 = newValue}
  79. }
  80. var mapSint32Sint32: Dictionary<Int32,Int32> {
  81. get {return _storage._mapSint32Sint32}
  82. set {_uniqueStorage()._mapSint32Sint32 = newValue}
  83. }
  84. var mapSint64Sint64: Dictionary<Int64,Int64> {
  85. get {return _storage._mapSint64Sint64}
  86. set {_uniqueStorage()._mapSint64Sint64 = newValue}
  87. }
  88. var mapFixed32Fixed32: Dictionary<UInt32,UInt32> {
  89. get {return _storage._mapFixed32Fixed32}
  90. set {_uniqueStorage()._mapFixed32Fixed32 = newValue}
  91. }
  92. var mapFixed64Fixed64: Dictionary<UInt64,UInt64> {
  93. get {return _storage._mapFixed64Fixed64}
  94. set {_uniqueStorage()._mapFixed64Fixed64 = newValue}
  95. }
  96. var mapSfixed32Sfixed32: Dictionary<Int32,Int32> {
  97. get {return _storage._mapSfixed32Sfixed32}
  98. set {_uniqueStorage()._mapSfixed32Sfixed32 = newValue}
  99. }
  100. var mapSfixed64Sfixed64: Dictionary<Int64,Int64> {
  101. get {return _storage._mapSfixed64Sfixed64}
  102. set {_uniqueStorage()._mapSfixed64Sfixed64 = newValue}
  103. }
  104. var mapInt32Float: Dictionary<Int32,Float> {
  105. get {return _storage._mapInt32Float}
  106. set {_uniqueStorage()._mapInt32Float = newValue}
  107. }
  108. var mapInt32Double: Dictionary<Int32,Double> {
  109. get {return _storage._mapInt32Double}
  110. set {_uniqueStorage()._mapInt32Double = newValue}
  111. }
  112. var mapBoolBool: Dictionary<Bool,Bool> {
  113. get {return _storage._mapBoolBool}
  114. set {_uniqueStorage()._mapBoolBool = newValue}
  115. }
  116. var mapStringString: Dictionary<String,String> {
  117. get {return _storage._mapStringString}
  118. set {_uniqueStorage()._mapStringString = newValue}
  119. }
  120. var mapInt32Bytes: Dictionary<Int32,Data> {
  121. get {return _storage._mapInt32Bytes}
  122. set {_uniqueStorage()._mapInt32Bytes = newValue}
  123. }
  124. var mapInt32Enum: Dictionary<Int32,Proto2Unittest_MapEnum> {
  125. get {return _storage._mapInt32Enum}
  126. set {_uniqueStorage()._mapInt32Enum = newValue}
  127. }
  128. var mapInt32ForeignMessage: Dictionary<Int32,Proto2Unittest_ForeignMessage> {
  129. get {return _storage._mapInt32ForeignMessage}
  130. set {_uniqueStorage()._mapInt32ForeignMessage = newValue}
  131. }
  132. var mapStringForeignMessage: Dictionary<String,Proto2Unittest_ForeignMessage> {
  133. get {return _storage._mapStringForeignMessage}
  134. set {_uniqueStorage()._mapStringForeignMessage = newValue}
  135. }
  136. var mapInt32AllTypes: Dictionary<Int32,Proto2Unittest_TestAllTypes> {
  137. get {return _storage._mapInt32AllTypes}
  138. set {_uniqueStorage()._mapInt32AllTypes = newValue}
  139. }
  140. var unknownFields = SwiftProtobuf.UnknownStorage()
  141. init() {}
  142. fileprivate var _storage = _StorageClass.defaultInstance
  143. }
  144. struct Proto2Unittest_TestMapWithMessages: Sendable {
  145. // SwiftProtobuf.Message conformance is added in an extension below. See the
  146. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  147. // methods supported on all messages.
  148. var mapInt32AllTypes: Dictionary<Int32,Proto2Unittest_TestAllTypes> = [:]
  149. var mapInt64AllTypes: Dictionary<Int64,Proto2Unittest_TestAllTypes> = [:]
  150. var mapUint32AllTypes: Dictionary<UInt32,Proto2Unittest_TestAllTypes> = [:]
  151. var mapUint64AllTypes: Dictionary<UInt64,Proto2Unittest_TestAllTypes> = [:]
  152. var mapSint32AllTypes: Dictionary<Int32,Proto2Unittest_TestAllTypes> = [:]
  153. var mapSint64AllTypes: Dictionary<Int64,Proto2Unittest_TestAllTypes> = [:]
  154. var mapFixed32AllTypes: Dictionary<UInt32,Proto2Unittest_TestAllTypes> = [:]
  155. var mapFixed64AllTypes: Dictionary<UInt64,Proto2Unittest_TestAllTypes> = [:]
  156. var mapSfixed32AllTypes: Dictionary<Int32,Proto2Unittest_TestAllTypes> = [:]
  157. var mapSfixed64AllTypes: Dictionary<Int64,Proto2Unittest_TestAllTypes> = [:]
  158. var mapBoolAllTypes: Dictionary<Bool,Proto2Unittest_TestAllTypes> = [:]
  159. var mapStringAllTypes: Dictionary<String,Proto2Unittest_TestAllTypes> = [:]
  160. var unknownFields = SwiftProtobuf.UnknownStorage()
  161. init() {}
  162. }
  163. struct Proto2Unittest_TestMapSubmessage: Sendable {
  164. // SwiftProtobuf.Message conformance is added in an extension below. See the
  165. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  166. // methods supported on all messages.
  167. var testMap: Proto2Unittest_TestMap {
  168. get {return _testMap ?? Proto2Unittest_TestMap()}
  169. set {_testMap = newValue}
  170. }
  171. /// Returns true if `testMap` has been explicitly set.
  172. var hasTestMap: Bool {return self._testMap != nil}
  173. /// Clears the value of `testMap`. Subsequent reads from it will return its default value.
  174. mutating func clearTestMap() {self._testMap = nil}
  175. var unknownFields = SwiftProtobuf.UnknownStorage()
  176. init() {}
  177. fileprivate var _testMap: Proto2Unittest_TestMap? = nil
  178. }
  179. struct Proto2Unittest_TestMessageMap: Sendable {
  180. // SwiftProtobuf.Message conformance is added in an extension below. See the
  181. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  182. // methods supported on all messages.
  183. var mapInt32Message: Dictionary<Int32,Proto2Unittest_TestAllTypes> = [:]
  184. var unknownFields = SwiftProtobuf.UnknownStorage()
  185. init() {}
  186. }
  187. /// Two map fields share the same entry default instance.
  188. struct Proto2Unittest_TestSameTypeMap: Sendable {
  189. // SwiftProtobuf.Message conformance is added in an extension below. See the
  190. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  191. // methods supported on all messages.
  192. var map1: Dictionary<Int32,Int32> = [:]
  193. var map2: Dictionary<Int32,Int32> = [:]
  194. var unknownFields = SwiftProtobuf.UnknownStorage()
  195. init() {}
  196. }
  197. /// Test embedded message with required fields
  198. struct Proto2Unittest_TestRequiredMessageMap: Sendable {
  199. // SwiftProtobuf.Message conformance is added in an extension below. See the
  200. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  201. // methods supported on all messages.
  202. var mapField: Dictionary<Int32,Proto2Unittest_TestRequired> = [:]
  203. var unknownFields = SwiftProtobuf.UnknownStorage()
  204. init() {}
  205. }
  206. struct Proto2Unittest_TestArenaMap: @unchecked Sendable {
  207. // SwiftProtobuf.Message conformance is added in an extension below. See the
  208. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  209. // methods supported on all messages.
  210. var mapInt32Int32: Dictionary<Int32,Int32> {
  211. get {return _storage._mapInt32Int32}
  212. set {_uniqueStorage()._mapInt32Int32 = newValue}
  213. }
  214. var mapInt64Int64: Dictionary<Int64,Int64> {
  215. get {return _storage._mapInt64Int64}
  216. set {_uniqueStorage()._mapInt64Int64 = newValue}
  217. }
  218. var mapUint32Uint32: Dictionary<UInt32,UInt32> {
  219. get {return _storage._mapUint32Uint32}
  220. set {_uniqueStorage()._mapUint32Uint32 = newValue}
  221. }
  222. var mapUint64Uint64: Dictionary<UInt64,UInt64> {
  223. get {return _storage._mapUint64Uint64}
  224. set {_uniqueStorage()._mapUint64Uint64 = newValue}
  225. }
  226. var mapSint32Sint32: Dictionary<Int32,Int32> {
  227. get {return _storage._mapSint32Sint32}
  228. set {_uniqueStorage()._mapSint32Sint32 = newValue}
  229. }
  230. var mapSint64Sint64: Dictionary<Int64,Int64> {
  231. get {return _storage._mapSint64Sint64}
  232. set {_uniqueStorage()._mapSint64Sint64 = newValue}
  233. }
  234. var mapFixed32Fixed32: Dictionary<UInt32,UInt32> {
  235. get {return _storage._mapFixed32Fixed32}
  236. set {_uniqueStorage()._mapFixed32Fixed32 = newValue}
  237. }
  238. var mapFixed64Fixed64: Dictionary<UInt64,UInt64> {
  239. get {return _storage._mapFixed64Fixed64}
  240. set {_uniqueStorage()._mapFixed64Fixed64 = newValue}
  241. }
  242. var mapSfixed32Sfixed32: Dictionary<Int32,Int32> {
  243. get {return _storage._mapSfixed32Sfixed32}
  244. set {_uniqueStorage()._mapSfixed32Sfixed32 = newValue}
  245. }
  246. var mapSfixed64Sfixed64: Dictionary<Int64,Int64> {
  247. get {return _storage._mapSfixed64Sfixed64}
  248. set {_uniqueStorage()._mapSfixed64Sfixed64 = newValue}
  249. }
  250. var mapInt32Float: Dictionary<Int32,Float> {
  251. get {return _storage._mapInt32Float}
  252. set {_uniqueStorage()._mapInt32Float = newValue}
  253. }
  254. var mapInt32Double: Dictionary<Int32,Double> {
  255. get {return _storage._mapInt32Double}
  256. set {_uniqueStorage()._mapInt32Double = newValue}
  257. }
  258. var mapBoolBool: Dictionary<Bool,Bool> {
  259. get {return _storage._mapBoolBool}
  260. set {_uniqueStorage()._mapBoolBool = newValue}
  261. }
  262. var mapStringString: Dictionary<String,String> {
  263. get {return _storage._mapStringString}
  264. set {_uniqueStorage()._mapStringString = newValue}
  265. }
  266. var mapInt32Bytes: Dictionary<Int32,Data> {
  267. get {return _storage._mapInt32Bytes}
  268. set {_uniqueStorage()._mapInt32Bytes = newValue}
  269. }
  270. var mapInt32Enum: Dictionary<Int32,Proto2Unittest_MapEnum> {
  271. get {return _storage._mapInt32Enum}
  272. set {_uniqueStorage()._mapInt32Enum = newValue}
  273. }
  274. var mapInt32ForeignMessage: Dictionary<Int32,Proto2Unittest_ForeignMessage> {
  275. get {return _storage._mapInt32ForeignMessage}
  276. set {_uniqueStorage()._mapInt32ForeignMessage = newValue}
  277. }
  278. var unknownFields = SwiftProtobuf.UnknownStorage()
  279. init() {}
  280. fileprivate var _storage = _StorageClass.defaultInstance
  281. }
  282. /// Previously, message containing enum called Type cannot be used as value of
  283. /// map field.
  284. struct Proto2Unittest_MessageContainingEnumCalledType: Sendable {
  285. // SwiftProtobuf.Message conformance is added in an extension below. See the
  286. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  287. // methods supported on all messages.
  288. var type: Dictionary<String,Proto2Unittest_MessageContainingEnumCalledType> = [:]
  289. var unknownFields = SwiftProtobuf.UnknownStorage()
  290. enum TypeEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
  291. typealias RawValue = Int
  292. case foo // = 0
  293. case UNRECOGNIZED(Int)
  294. init() {
  295. self = .foo
  296. }
  297. init?(rawValue: Int) {
  298. switch rawValue {
  299. case 0: self = .foo
  300. default: self = .UNRECOGNIZED(rawValue)
  301. }
  302. }
  303. var rawValue: Int {
  304. switch self {
  305. case .foo: return 0
  306. case .UNRECOGNIZED(let i): return i
  307. }
  308. }
  309. // The compiler won't synthesize support with the UNRECOGNIZED case.
  310. static let allCases: [Proto2Unittest_MessageContainingEnumCalledType.TypeEnum] = [
  311. .foo,
  312. ]
  313. }
  314. init() {}
  315. }
  316. /// Previously, message cannot contain map field called "entry".
  317. struct Proto2Unittest_MessageContainingMapCalledEntry: Sendable {
  318. // SwiftProtobuf.Message conformance is added in an extension below. See the
  319. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  320. // methods supported on all messages.
  321. var entry: Dictionary<Int32,Int32> = [:]
  322. var unknownFields = SwiftProtobuf.UnknownStorage()
  323. init() {}
  324. }
  325. struct Proto2Unittest_TestRecursiveMapMessage: Sendable {
  326. // SwiftProtobuf.Message conformance is added in an extension below. See the
  327. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  328. // methods supported on all messages.
  329. var a: Dictionary<String,Proto2Unittest_TestRecursiveMapMessage> = [:]
  330. var unknownFields = SwiftProtobuf.UnknownStorage()
  331. init() {}
  332. }
  333. struct Proto2Unittest_TestI32StrMap: Sendable {
  334. // SwiftProtobuf.Message conformance is added in an extension below. See the
  335. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  336. // methods supported on all messages.
  337. var m32Str: Dictionary<Int32,String> = [:]
  338. var unknownFields = SwiftProtobuf.UnknownStorage()
  339. init() {}
  340. }
  341. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  342. fileprivate let _protobuf_package = "proto2_unittest"
  343. extension Proto2Unittest_MapEnum: SwiftProtobuf._ProtoNameProviding {
  344. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  345. 0: .same(proto: "MAP_ENUM_FOO"),
  346. 1: .same(proto: "MAP_ENUM_BAR"),
  347. 2: .same(proto: "MAP_ENUM_BAZ"),
  348. ]
  349. }
  350. extension Proto2Unittest_TestMap: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  351. static let protoMessageName: String = _protobuf_package + ".TestMap"
  352. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  353. 1: .standard(proto: "map_int32_int32"),
  354. 2: .standard(proto: "map_int64_int64"),
  355. 3: .standard(proto: "map_uint32_uint32"),
  356. 4: .standard(proto: "map_uint64_uint64"),
  357. 5: .standard(proto: "map_sint32_sint32"),
  358. 6: .standard(proto: "map_sint64_sint64"),
  359. 7: .standard(proto: "map_fixed32_fixed32"),
  360. 8: .standard(proto: "map_fixed64_fixed64"),
  361. 9: .standard(proto: "map_sfixed32_sfixed32"),
  362. 10: .standard(proto: "map_sfixed64_sfixed64"),
  363. 11: .standard(proto: "map_int32_float"),
  364. 12: .standard(proto: "map_int32_double"),
  365. 13: .standard(proto: "map_bool_bool"),
  366. 14: .standard(proto: "map_string_string"),
  367. 15: .standard(proto: "map_int32_bytes"),
  368. 16: .standard(proto: "map_int32_enum"),
  369. 17: .standard(proto: "map_int32_foreign_message"),
  370. 18: .standard(proto: "map_string_foreign_message"),
  371. 19: .standard(proto: "map_int32_all_types"),
  372. ]
  373. fileprivate class _StorageClass {
  374. var _mapInt32Int32: Dictionary<Int32,Int32> = [:]
  375. var _mapInt64Int64: Dictionary<Int64,Int64> = [:]
  376. var _mapUint32Uint32: Dictionary<UInt32,UInt32> = [:]
  377. var _mapUint64Uint64: Dictionary<UInt64,UInt64> = [:]
  378. var _mapSint32Sint32: Dictionary<Int32,Int32> = [:]
  379. var _mapSint64Sint64: Dictionary<Int64,Int64> = [:]
  380. var _mapFixed32Fixed32: Dictionary<UInt32,UInt32> = [:]
  381. var _mapFixed64Fixed64: Dictionary<UInt64,UInt64> = [:]
  382. var _mapSfixed32Sfixed32: Dictionary<Int32,Int32> = [:]
  383. var _mapSfixed64Sfixed64: Dictionary<Int64,Int64> = [:]
  384. var _mapInt32Float: Dictionary<Int32,Float> = [:]
  385. var _mapInt32Double: Dictionary<Int32,Double> = [:]
  386. var _mapBoolBool: Dictionary<Bool,Bool> = [:]
  387. var _mapStringString: Dictionary<String,String> = [:]
  388. var _mapInt32Bytes: Dictionary<Int32,Data> = [:]
  389. var _mapInt32Enum: Dictionary<Int32,Proto2Unittest_MapEnum> = [:]
  390. var _mapInt32ForeignMessage: Dictionary<Int32,Proto2Unittest_ForeignMessage> = [:]
  391. var _mapStringForeignMessage: Dictionary<String,Proto2Unittest_ForeignMessage> = [:]
  392. var _mapInt32AllTypes: Dictionary<Int32,Proto2Unittest_TestAllTypes> = [:]
  393. // This property is used as the initial default value for new instances of the type.
  394. // The type itself is protecting the reference to its storage via CoW semantics.
  395. // This will force a copy to be made of this reference when the first mutation occurs;
  396. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  397. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  398. private init() {}
  399. init(copying source: _StorageClass) {
  400. _mapInt32Int32 = source._mapInt32Int32
  401. _mapInt64Int64 = source._mapInt64Int64
  402. _mapUint32Uint32 = source._mapUint32Uint32
  403. _mapUint64Uint64 = source._mapUint64Uint64
  404. _mapSint32Sint32 = source._mapSint32Sint32
  405. _mapSint64Sint64 = source._mapSint64Sint64
  406. _mapFixed32Fixed32 = source._mapFixed32Fixed32
  407. _mapFixed64Fixed64 = source._mapFixed64Fixed64
  408. _mapSfixed32Sfixed32 = source._mapSfixed32Sfixed32
  409. _mapSfixed64Sfixed64 = source._mapSfixed64Sfixed64
  410. _mapInt32Float = source._mapInt32Float
  411. _mapInt32Double = source._mapInt32Double
  412. _mapBoolBool = source._mapBoolBool
  413. _mapStringString = source._mapStringString
  414. _mapInt32Bytes = source._mapInt32Bytes
  415. _mapInt32Enum = source._mapInt32Enum
  416. _mapInt32ForeignMessage = source._mapInt32ForeignMessage
  417. _mapStringForeignMessage = source._mapStringForeignMessage
  418. _mapInt32AllTypes = source._mapInt32AllTypes
  419. }
  420. }
  421. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  422. if !isKnownUniquelyReferenced(&_storage) {
  423. _storage = _StorageClass(copying: _storage)
  424. }
  425. return _storage
  426. }
  427. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  428. _ = _uniqueStorage()
  429. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  430. while let fieldNumber = try decoder.nextFieldNumber() {
  431. // The use of inline closures is to circumvent an issue where the compiler
  432. // allocates stack space for every case branch when no optimizations are
  433. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  434. switch fieldNumber {
  435. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufInt32>.self, value: &_storage._mapInt32Int32) }()
  436. case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt64,SwiftProtobuf.ProtobufInt64>.self, value: &_storage._mapInt64Int64) }()
  437. case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt32,SwiftProtobuf.ProtobufUInt32>.self, value: &_storage._mapUint32Uint32) }()
  438. case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt64,SwiftProtobuf.ProtobufUInt64>.self, value: &_storage._mapUint64Uint64) }()
  439. case 5: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSInt32,SwiftProtobuf.ProtobufSInt32>.self, value: &_storage._mapSint32Sint32) }()
  440. case 6: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSInt64,SwiftProtobuf.ProtobufSInt64>.self, value: &_storage._mapSint64Sint64) }()
  441. case 7: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufFixed32,SwiftProtobuf.ProtobufFixed32>.self, value: &_storage._mapFixed32Fixed32) }()
  442. case 8: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufFixed64,SwiftProtobuf.ProtobufFixed64>.self, value: &_storage._mapFixed64Fixed64) }()
  443. case 9: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSFixed32,SwiftProtobuf.ProtobufSFixed32>.self, value: &_storage._mapSfixed32Sfixed32) }()
  444. case 10: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSFixed64,SwiftProtobuf.ProtobufSFixed64>.self, value: &_storage._mapSfixed64Sfixed64) }()
  445. case 11: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufFloat>.self, value: &_storage._mapInt32Float) }()
  446. case 12: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufDouble>.self, value: &_storage._mapInt32Double) }()
  447. case 13: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufBool,SwiftProtobuf.ProtobufBool>.self, value: &_storage._mapBoolBool) }()
  448. case 14: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: &_storage._mapStringString) }()
  449. case 15: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufBytes>.self, value: &_storage._mapInt32Bytes) }()
  450. case 16: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufEnumMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_MapEnum>.self, value: &_storage._mapInt32Enum) }()
  451. case 17: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_ForeignMessage>.self, value: &_storage._mapInt32ForeignMessage) }()
  452. case 18: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufString,Proto2Unittest_ForeignMessage>.self, value: &_storage._mapStringForeignMessage) }()
  453. case 19: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_TestAllTypes>.self, value: &_storage._mapInt32AllTypes) }()
  454. default: break
  455. }
  456. }
  457. }
  458. }
  459. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  460. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  461. if !_storage._mapInt32Int32.isEmpty {
  462. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufInt32>.self, value: _storage._mapInt32Int32, fieldNumber: 1)
  463. }
  464. if !_storage._mapInt64Int64.isEmpty {
  465. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt64,SwiftProtobuf.ProtobufInt64>.self, value: _storage._mapInt64Int64, fieldNumber: 2)
  466. }
  467. if !_storage._mapUint32Uint32.isEmpty {
  468. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt32,SwiftProtobuf.ProtobufUInt32>.self, value: _storage._mapUint32Uint32, fieldNumber: 3)
  469. }
  470. if !_storage._mapUint64Uint64.isEmpty {
  471. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt64,SwiftProtobuf.ProtobufUInt64>.self, value: _storage._mapUint64Uint64, fieldNumber: 4)
  472. }
  473. if !_storage._mapSint32Sint32.isEmpty {
  474. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSInt32,SwiftProtobuf.ProtobufSInt32>.self, value: _storage._mapSint32Sint32, fieldNumber: 5)
  475. }
  476. if !_storage._mapSint64Sint64.isEmpty {
  477. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSInt64,SwiftProtobuf.ProtobufSInt64>.self, value: _storage._mapSint64Sint64, fieldNumber: 6)
  478. }
  479. if !_storage._mapFixed32Fixed32.isEmpty {
  480. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufFixed32,SwiftProtobuf.ProtobufFixed32>.self, value: _storage._mapFixed32Fixed32, fieldNumber: 7)
  481. }
  482. if !_storage._mapFixed64Fixed64.isEmpty {
  483. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufFixed64,SwiftProtobuf.ProtobufFixed64>.self, value: _storage._mapFixed64Fixed64, fieldNumber: 8)
  484. }
  485. if !_storage._mapSfixed32Sfixed32.isEmpty {
  486. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSFixed32,SwiftProtobuf.ProtobufSFixed32>.self, value: _storage._mapSfixed32Sfixed32, fieldNumber: 9)
  487. }
  488. if !_storage._mapSfixed64Sfixed64.isEmpty {
  489. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSFixed64,SwiftProtobuf.ProtobufSFixed64>.self, value: _storage._mapSfixed64Sfixed64, fieldNumber: 10)
  490. }
  491. if !_storage._mapInt32Float.isEmpty {
  492. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufFloat>.self, value: _storage._mapInt32Float, fieldNumber: 11)
  493. }
  494. if !_storage._mapInt32Double.isEmpty {
  495. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufDouble>.self, value: _storage._mapInt32Double, fieldNumber: 12)
  496. }
  497. if !_storage._mapBoolBool.isEmpty {
  498. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufBool,SwiftProtobuf.ProtobufBool>.self, value: _storage._mapBoolBool, fieldNumber: 13)
  499. }
  500. if !_storage._mapStringString.isEmpty {
  501. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: _storage._mapStringString, fieldNumber: 14)
  502. }
  503. if !_storage._mapInt32Bytes.isEmpty {
  504. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufBytes>.self, value: _storage._mapInt32Bytes, fieldNumber: 15)
  505. }
  506. if !_storage._mapInt32Enum.isEmpty {
  507. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufEnumMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_MapEnum>.self, value: _storage._mapInt32Enum, fieldNumber: 16)
  508. }
  509. if !_storage._mapInt32ForeignMessage.isEmpty {
  510. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_ForeignMessage>.self, value: _storage._mapInt32ForeignMessage, fieldNumber: 17)
  511. }
  512. if !_storage._mapStringForeignMessage.isEmpty {
  513. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufString,Proto2Unittest_ForeignMessage>.self, value: _storage._mapStringForeignMessage, fieldNumber: 18)
  514. }
  515. if !_storage._mapInt32AllTypes.isEmpty {
  516. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_TestAllTypes>.self, value: _storage._mapInt32AllTypes, fieldNumber: 19)
  517. }
  518. }
  519. try unknownFields.traverse(visitor: &visitor)
  520. }
  521. static func ==(lhs: Proto2Unittest_TestMap, rhs: Proto2Unittest_TestMap) -> Bool {
  522. if lhs._storage !== rhs._storage {
  523. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  524. let _storage = _args.0
  525. let rhs_storage = _args.1
  526. if _storage._mapInt32Int32 != rhs_storage._mapInt32Int32 {return false}
  527. if _storage._mapInt64Int64 != rhs_storage._mapInt64Int64 {return false}
  528. if _storage._mapUint32Uint32 != rhs_storage._mapUint32Uint32 {return false}
  529. if _storage._mapUint64Uint64 != rhs_storage._mapUint64Uint64 {return false}
  530. if _storage._mapSint32Sint32 != rhs_storage._mapSint32Sint32 {return false}
  531. if _storage._mapSint64Sint64 != rhs_storage._mapSint64Sint64 {return false}
  532. if _storage._mapFixed32Fixed32 != rhs_storage._mapFixed32Fixed32 {return false}
  533. if _storage._mapFixed64Fixed64 != rhs_storage._mapFixed64Fixed64 {return false}
  534. if _storage._mapSfixed32Sfixed32 != rhs_storage._mapSfixed32Sfixed32 {return false}
  535. if _storage._mapSfixed64Sfixed64 != rhs_storage._mapSfixed64Sfixed64 {return false}
  536. if _storage._mapInt32Float != rhs_storage._mapInt32Float {return false}
  537. if _storage._mapInt32Double != rhs_storage._mapInt32Double {return false}
  538. if _storage._mapBoolBool != rhs_storage._mapBoolBool {return false}
  539. if _storage._mapStringString != rhs_storage._mapStringString {return false}
  540. if _storage._mapInt32Bytes != rhs_storage._mapInt32Bytes {return false}
  541. if _storage._mapInt32Enum != rhs_storage._mapInt32Enum {return false}
  542. if _storage._mapInt32ForeignMessage != rhs_storage._mapInt32ForeignMessage {return false}
  543. if _storage._mapStringForeignMessage != rhs_storage._mapStringForeignMessage {return false}
  544. if _storage._mapInt32AllTypes != rhs_storage._mapInt32AllTypes {return false}
  545. return true
  546. }
  547. if !storagesAreEqual {return false}
  548. }
  549. if lhs.unknownFields != rhs.unknownFields {return false}
  550. return true
  551. }
  552. }
  553. extension Proto2Unittest_TestMapWithMessages: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  554. static let protoMessageName: String = _protobuf_package + ".TestMapWithMessages"
  555. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  556. 1: .standard(proto: "map_int32_all_types"),
  557. 2: .standard(proto: "map_int64_all_types"),
  558. 3: .standard(proto: "map_uint32_all_types"),
  559. 4: .standard(proto: "map_uint64_all_types"),
  560. 5: .standard(proto: "map_sint32_all_types"),
  561. 6: .standard(proto: "map_sint64_all_types"),
  562. 7: .standard(proto: "map_fixed32_all_types"),
  563. 8: .standard(proto: "map_fixed64_all_types"),
  564. 9: .standard(proto: "map_sfixed32_all_types"),
  565. 10: .standard(proto: "map_sfixed64_all_types"),
  566. 11: .standard(proto: "map_bool_all_types"),
  567. 12: .standard(proto: "map_string_all_types"),
  568. ]
  569. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  570. while let fieldNumber = try decoder.nextFieldNumber() {
  571. // The use of inline closures is to circumvent an issue where the compiler
  572. // allocates stack space for every case branch when no optimizations are
  573. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  574. switch fieldNumber {
  575. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_TestAllTypes>.self, value: &self.mapInt32AllTypes) }()
  576. case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt64,Proto2Unittest_TestAllTypes>.self, value: &self.mapInt64AllTypes) }()
  577. case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufUInt32,Proto2Unittest_TestAllTypes>.self, value: &self.mapUint32AllTypes) }()
  578. case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufUInt64,Proto2Unittest_TestAllTypes>.self, value: &self.mapUint64AllTypes) }()
  579. case 5: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufSInt32,Proto2Unittest_TestAllTypes>.self, value: &self.mapSint32AllTypes) }()
  580. case 6: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufSInt64,Proto2Unittest_TestAllTypes>.self, value: &self.mapSint64AllTypes) }()
  581. case 7: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufFixed32,Proto2Unittest_TestAllTypes>.self, value: &self.mapFixed32AllTypes) }()
  582. case 8: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufFixed64,Proto2Unittest_TestAllTypes>.self, value: &self.mapFixed64AllTypes) }()
  583. case 9: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufSFixed32,Proto2Unittest_TestAllTypes>.self, value: &self.mapSfixed32AllTypes) }()
  584. case 10: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufSFixed64,Proto2Unittest_TestAllTypes>.self, value: &self.mapSfixed64AllTypes) }()
  585. case 11: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufBool,Proto2Unittest_TestAllTypes>.self, value: &self.mapBoolAllTypes) }()
  586. case 12: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufString,Proto2Unittest_TestAllTypes>.self, value: &self.mapStringAllTypes) }()
  587. default: break
  588. }
  589. }
  590. }
  591. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  592. if !self.mapInt32AllTypes.isEmpty {
  593. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_TestAllTypes>.self, value: self.mapInt32AllTypes, fieldNumber: 1)
  594. }
  595. if !self.mapInt64AllTypes.isEmpty {
  596. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt64,Proto2Unittest_TestAllTypes>.self, value: self.mapInt64AllTypes, fieldNumber: 2)
  597. }
  598. if !self.mapUint32AllTypes.isEmpty {
  599. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufUInt32,Proto2Unittest_TestAllTypes>.self, value: self.mapUint32AllTypes, fieldNumber: 3)
  600. }
  601. if !self.mapUint64AllTypes.isEmpty {
  602. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufUInt64,Proto2Unittest_TestAllTypes>.self, value: self.mapUint64AllTypes, fieldNumber: 4)
  603. }
  604. if !self.mapSint32AllTypes.isEmpty {
  605. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufSInt32,Proto2Unittest_TestAllTypes>.self, value: self.mapSint32AllTypes, fieldNumber: 5)
  606. }
  607. if !self.mapSint64AllTypes.isEmpty {
  608. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufSInt64,Proto2Unittest_TestAllTypes>.self, value: self.mapSint64AllTypes, fieldNumber: 6)
  609. }
  610. if !self.mapFixed32AllTypes.isEmpty {
  611. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufFixed32,Proto2Unittest_TestAllTypes>.self, value: self.mapFixed32AllTypes, fieldNumber: 7)
  612. }
  613. if !self.mapFixed64AllTypes.isEmpty {
  614. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufFixed64,Proto2Unittest_TestAllTypes>.self, value: self.mapFixed64AllTypes, fieldNumber: 8)
  615. }
  616. if !self.mapSfixed32AllTypes.isEmpty {
  617. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufSFixed32,Proto2Unittest_TestAllTypes>.self, value: self.mapSfixed32AllTypes, fieldNumber: 9)
  618. }
  619. if !self.mapSfixed64AllTypes.isEmpty {
  620. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufSFixed64,Proto2Unittest_TestAllTypes>.self, value: self.mapSfixed64AllTypes, fieldNumber: 10)
  621. }
  622. if !self.mapBoolAllTypes.isEmpty {
  623. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufBool,Proto2Unittest_TestAllTypes>.self, value: self.mapBoolAllTypes, fieldNumber: 11)
  624. }
  625. if !self.mapStringAllTypes.isEmpty {
  626. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufString,Proto2Unittest_TestAllTypes>.self, value: self.mapStringAllTypes, fieldNumber: 12)
  627. }
  628. try unknownFields.traverse(visitor: &visitor)
  629. }
  630. static func ==(lhs: Proto2Unittest_TestMapWithMessages, rhs: Proto2Unittest_TestMapWithMessages) -> Bool {
  631. if lhs.mapInt32AllTypes != rhs.mapInt32AllTypes {return false}
  632. if lhs.mapInt64AllTypes != rhs.mapInt64AllTypes {return false}
  633. if lhs.mapUint32AllTypes != rhs.mapUint32AllTypes {return false}
  634. if lhs.mapUint64AllTypes != rhs.mapUint64AllTypes {return false}
  635. if lhs.mapSint32AllTypes != rhs.mapSint32AllTypes {return false}
  636. if lhs.mapSint64AllTypes != rhs.mapSint64AllTypes {return false}
  637. if lhs.mapFixed32AllTypes != rhs.mapFixed32AllTypes {return false}
  638. if lhs.mapFixed64AllTypes != rhs.mapFixed64AllTypes {return false}
  639. if lhs.mapSfixed32AllTypes != rhs.mapSfixed32AllTypes {return false}
  640. if lhs.mapSfixed64AllTypes != rhs.mapSfixed64AllTypes {return false}
  641. if lhs.mapBoolAllTypes != rhs.mapBoolAllTypes {return false}
  642. if lhs.mapStringAllTypes != rhs.mapStringAllTypes {return false}
  643. if lhs.unknownFields != rhs.unknownFields {return false}
  644. return true
  645. }
  646. }
  647. extension Proto2Unittest_TestMapSubmessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  648. static let protoMessageName: String = _protobuf_package + ".TestMapSubmessage"
  649. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  650. 1: .standard(proto: "test_map"),
  651. ]
  652. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  653. while let fieldNumber = try decoder.nextFieldNumber() {
  654. // The use of inline closures is to circumvent an issue where the compiler
  655. // allocates stack space for every case branch when no optimizations are
  656. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  657. switch fieldNumber {
  658. case 1: try { try decoder.decodeSingularMessageField(value: &self._testMap) }()
  659. default: break
  660. }
  661. }
  662. }
  663. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  664. // The use of inline closures is to circumvent an issue where the compiler
  665. // allocates stack space for every if/case branch local when no optimizations
  666. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  667. // https://github.com/apple/swift-protobuf/issues/1182
  668. try { if let v = self._testMap {
  669. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  670. } }()
  671. try unknownFields.traverse(visitor: &visitor)
  672. }
  673. static func ==(lhs: Proto2Unittest_TestMapSubmessage, rhs: Proto2Unittest_TestMapSubmessage) -> Bool {
  674. if lhs._testMap != rhs._testMap {return false}
  675. if lhs.unknownFields != rhs.unknownFields {return false}
  676. return true
  677. }
  678. }
  679. extension Proto2Unittest_TestMessageMap: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  680. static let protoMessageName: String = _protobuf_package + ".TestMessageMap"
  681. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  682. 1: .standard(proto: "map_int32_message"),
  683. ]
  684. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  685. while let fieldNumber = try decoder.nextFieldNumber() {
  686. // The use of inline closures is to circumvent an issue where the compiler
  687. // allocates stack space for every case branch when no optimizations are
  688. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  689. switch fieldNumber {
  690. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_TestAllTypes>.self, value: &self.mapInt32Message) }()
  691. default: break
  692. }
  693. }
  694. }
  695. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  696. if !self.mapInt32Message.isEmpty {
  697. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_TestAllTypes>.self, value: self.mapInt32Message, fieldNumber: 1)
  698. }
  699. try unknownFields.traverse(visitor: &visitor)
  700. }
  701. static func ==(lhs: Proto2Unittest_TestMessageMap, rhs: Proto2Unittest_TestMessageMap) -> Bool {
  702. if lhs.mapInt32Message != rhs.mapInt32Message {return false}
  703. if lhs.unknownFields != rhs.unknownFields {return false}
  704. return true
  705. }
  706. }
  707. extension Proto2Unittest_TestSameTypeMap: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  708. static let protoMessageName: String = _protobuf_package + ".TestSameTypeMap"
  709. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  710. 1: .same(proto: "map1"),
  711. 2: .same(proto: "map2"),
  712. ]
  713. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  714. while let fieldNumber = try decoder.nextFieldNumber() {
  715. // The use of inline closures is to circumvent an issue where the compiler
  716. // allocates stack space for every case branch when no optimizations are
  717. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  718. switch fieldNumber {
  719. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufInt32>.self, value: &self.map1) }()
  720. case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufInt32>.self, value: &self.map2) }()
  721. default: break
  722. }
  723. }
  724. }
  725. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  726. if !self.map1.isEmpty {
  727. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufInt32>.self, value: self.map1, fieldNumber: 1)
  728. }
  729. if !self.map2.isEmpty {
  730. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufInt32>.self, value: self.map2, fieldNumber: 2)
  731. }
  732. try unknownFields.traverse(visitor: &visitor)
  733. }
  734. static func ==(lhs: Proto2Unittest_TestSameTypeMap, rhs: Proto2Unittest_TestSameTypeMap) -> Bool {
  735. if lhs.map1 != rhs.map1 {return false}
  736. if lhs.map2 != rhs.map2 {return false}
  737. if lhs.unknownFields != rhs.unknownFields {return false}
  738. return true
  739. }
  740. }
  741. extension Proto2Unittest_TestRequiredMessageMap: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  742. static let protoMessageName: String = _protobuf_package + ".TestRequiredMessageMap"
  743. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  744. 1: .standard(proto: "map_field"),
  745. ]
  746. public var isInitialized: Bool {
  747. if !SwiftProtobuf.Internal.areAllInitialized(self.mapField) {return false}
  748. return true
  749. }
  750. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  751. while let fieldNumber = try decoder.nextFieldNumber() {
  752. // The use of inline closures is to circumvent an issue where the compiler
  753. // allocates stack space for every case branch when no optimizations are
  754. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  755. switch fieldNumber {
  756. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_TestRequired>.self, value: &self.mapField) }()
  757. default: break
  758. }
  759. }
  760. }
  761. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  762. if !self.mapField.isEmpty {
  763. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_TestRequired>.self, value: self.mapField, fieldNumber: 1)
  764. }
  765. try unknownFields.traverse(visitor: &visitor)
  766. }
  767. static func ==(lhs: Proto2Unittest_TestRequiredMessageMap, rhs: Proto2Unittest_TestRequiredMessageMap) -> Bool {
  768. if lhs.mapField != rhs.mapField {return false}
  769. if lhs.unknownFields != rhs.unknownFields {return false}
  770. return true
  771. }
  772. }
  773. extension Proto2Unittest_TestArenaMap: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  774. static let protoMessageName: String = _protobuf_package + ".TestArenaMap"
  775. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  776. 1: .standard(proto: "map_int32_int32"),
  777. 2: .standard(proto: "map_int64_int64"),
  778. 3: .standard(proto: "map_uint32_uint32"),
  779. 4: .standard(proto: "map_uint64_uint64"),
  780. 5: .standard(proto: "map_sint32_sint32"),
  781. 6: .standard(proto: "map_sint64_sint64"),
  782. 7: .standard(proto: "map_fixed32_fixed32"),
  783. 8: .standard(proto: "map_fixed64_fixed64"),
  784. 9: .standard(proto: "map_sfixed32_sfixed32"),
  785. 10: .standard(proto: "map_sfixed64_sfixed64"),
  786. 11: .standard(proto: "map_int32_float"),
  787. 12: .standard(proto: "map_int32_double"),
  788. 13: .standard(proto: "map_bool_bool"),
  789. 14: .standard(proto: "map_string_string"),
  790. 15: .standard(proto: "map_int32_bytes"),
  791. 16: .standard(proto: "map_int32_enum"),
  792. 17: .standard(proto: "map_int32_foreign_message"),
  793. ]
  794. fileprivate class _StorageClass {
  795. var _mapInt32Int32: Dictionary<Int32,Int32> = [:]
  796. var _mapInt64Int64: Dictionary<Int64,Int64> = [:]
  797. var _mapUint32Uint32: Dictionary<UInt32,UInt32> = [:]
  798. var _mapUint64Uint64: Dictionary<UInt64,UInt64> = [:]
  799. var _mapSint32Sint32: Dictionary<Int32,Int32> = [:]
  800. var _mapSint64Sint64: Dictionary<Int64,Int64> = [:]
  801. var _mapFixed32Fixed32: Dictionary<UInt32,UInt32> = [:]
  802. var _mapFixed64Fixed64: Dictionary<UInt64,UInt64> = [:]
  803. var _mapSfixed32Sfixed32: Dictionary<Int32,Int32> = [:]
  804. var _mapSfixed64Sfixed64: Dictionary<Int64,Int64> = [:]
  805. var _mapInt32Float: Dictionary<Int32,Float> = [:]
  806. var _mapInt32Double: Dictionary<Int32,Double> = [:]
  807. var _mapBoolBool: Dictionary<Bool,Bool> = [:]
  808. var _mapStringString: Dictionary<String,String> = [:]
  809. var _mapInt32Bytes: Dictionary<Int32,Data> = [:]
  810. var _mapInt32Enum: Dictionary<Int32,Proto2Unittest_MapEnum> = [:]
  811. var _mapInt32ForeignMessage: Dictionary<Int32,Proto2Unittest_ForeignMessage> = [:]
  812. // This property is used as the initial default value for new instances of the type.
  813. // The type itself is protecting the reference to its storage via CoW semantics.
  814. // This will force a copy to be made of this reference when the first mutation occurs;
  815. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  816. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  817. private init() {}
  818. init(copying source: _StorageClass) {
  819. _mapInt32Int32 = source._mapInt32Int32
  820. _mapInt64Int64 = source._mapInt64Int64
  821. _mapUint32Uint32 = source._mapUint32Uint32
  822. _mapUint64Uint64 = source._mapUint64Uint64
  823. _mapSint32Sint32 = source._mapSint32Sint32
  824. _mapSint64Sint64 = source._mapSint64Sint64
  825. _mapFixed32Fixed32 = source._mapFixed32Fixed32
  826. _mapFixed64Fixed64 = source._mapFixed64Fixed64
  827. _mapSfixed32Sfixed32 = source._mapSfixed32Sfixed32
  828. _mapSfixed64Sfixed64 = source._mapSfixed64Sfixed64
  829. _mapInt32Float = source._mapInt32Float
  830. _mapInt32Double = source._mapInt32Double
  831. _mapBoolBool = source._mapBoolBool
  832. _mapStringString = source._mapStringString
  833. _mapInt32Bytes = source._mapInt32Bytes
  834. _mapInt32Enum = source._mapInt32Enum
  835. _mapInt32ForeignMessage = source._mapInt32ForeignMessage
  836. }
  837. }
  838. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  839. if !isKnownUniquelyReferenced(&_storage) {
  840. _storage = _StorageClass(copying: _storage)
  841. }
  842. return _storage
  843. }
  844. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  845. _ = _uniqueStorage()
  846. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  847. while let fieldNumber = try decoder.nextFieldNumber() {
  848. // The use of inline closures is to circumvent an issue where the compiler
  849. // allocates stack space for every case branch when no optimizations are
  850. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  851. switch fieldNumber {
  852. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufInt32>.self, value: &_storage._mapInt32Int32) }()
  853. case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt64,SwiftProtobuf.ProtobufInt64>.self, value: &_storage._mapInt64Int64) }()
  854. case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt32,SwiftProtobuf.ProtobufUInt32>.self, value: &_storage._mapUint32Uint32) }()
  855. case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt64,SwiftProtobuf.ProtobufUInt64>.self, value: &_storage._mapUint64Uint64) }()
  856. case 5: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSInt32,SwiftProtobuf.ProtobufSInt32>.self, value: &_storage._mapSint32Sint32) }()
  857. case 6: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSInt64,SwiftProtobuf.ProtobufSInt64>.self, value: &_storage._mapSint64Sint64) }()
  858. case 7: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufFixed32,SwiftProtobuf.ProtobufFixed32>.self, value: &_storage._mapFixed32Fixed32) }()
  859. case 8: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufFixed64,SwiftProtobuf.ProtobufFixed64>.self, value: &_storage._mapFixed64Fixed64) }()
  860. case 9: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSFixed32,SwiftProtobuf.ProtobufSFixed32>.self, value: &_storage._mapSfixed32Sfixed32) }()
  861. case 10: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSFixed64,SwiftProtobuf.ProtobufSFixed64>.self, value: &_storage._mapSfixed64Sfixed64) }()
  862. case 11: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufFloat>.self, value: &_storage._mapInt32Float) }()
  863. case 12: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufDouble>.self, value: &_storage._mapInt32Double) }()
  864. case 13: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufBool,SwiftProtobuf.ProtobufBool>.self, value: &_storage._mapBoolBool) }()
  865. case 14: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: &_storage._mapStringString) }()
  866. case 15: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufBytes>.self, value: &_storage._mapInt32Bytes) }()
  867. case 16: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufEnumMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_MapEnum>.self, value: &_storage._mapInt32Enum) }()
  868. case 17: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_ForeignMessage>.self, value: &_storage._mapInt32ForeignMessage) }()
  869. default: break
  870. }
  871. }
  872. }
  873. }
  874. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  875. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  876. if !_storage._mapInt32Int32.isEmpty {
  877. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufInt32>.self, value: _storage._mapInt32Int32, fieldNumber: 1)
  878. }
  879. if !_storage._mapInt64Int64.isEmpty {
  880. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt64,SwiftProtobuf.ProtobufInt64>.self, value: _storage._mapInt64Int64, fieldNumber: 2)
  881. }
  882. if !_storage._mapUint32Uint32.isEmpty {
  883. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt32,SwiftProtobuf.ProtobufUInt32>.self, value: _storage._mapUint32Uint32, fieldNumber: 3)
  884. }
  885. if !_storage._mapUint64Uint64.isEmpty {
  886. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufUInt64,SwiftProtobuf.ProtobufUInt64>.self, value: _storage._mapUint64Uint64, fieldNumber: 4)
  887. }
  888. if !_storage._mapSint32Sint32.isEmpty {
  889. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSInt32,SwiftProtobuf.ProtobufSInt32>.self, value: _storage._mapSint32Sint32, fieldNumber: 5)
  890. }
  891. if !_storage._mapSint64Sint64.isEmpty {
  892. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSInt64,SwiftProtobuf.ProtobufSInt64>.self, value: _storage._mapSint64Sint64, fieldNumber: 6)
  893. }
  894. if !_storage._mapFixed32Fixed32.isEmpty {
  895. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufFixed32,SwiftProtobuf.ProtobufFixed32>.self, value: _storage._mapFixed32Fixed32, fieldNumber: 7)
  896. }
  897. if !_storage._mapFixed64Fixed64.isEmpty {
  898. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufFixed64,SwiftProtobuf.ProtobufFixed64>.self, value: _storage._mapFixed64Fixed64, fieldNumber: 8)
  899. }
  900. if !_storage._mapSfixed32Sfixed32.isEmpty {
  901. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSFixed32,SwiftProtobuf.ProtobufSFixed32>.self, value: _storage._mapSfixed32Sfixed32, fieldNumber: 9)
  902. }
  903. if !_storage._mapSfixed64Sfixed64.isEmpty {
  904. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufSFixed64,SwiftProtobuf.ProtobufSFixed64>.self, value: _storage._mapSfixed64Sfixed64, fieldNumber: 10)
  905. }
  906. if !_storage._mapInt32Float.isEmpty {
  907. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufFloat>.self, value: _storage._mapInt32Float, fieldNumber: 11)
  908. }
  909. if !_storage._mapInt32Double.isEmpty {
  910. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufDouble>.self, value: _storage._mapInt32Double, fieldNumber: 12)
  911. }
  912. if !_storage._mapBoolBool.isEmpty {
  913. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufBool,SwiftProtobuf.ProtobufBool>.self, value: _storage._mapBoolBool, fieldNumber: 13)
  914. }
  915. if !_storage._mapStringString.isEmpty {
  916. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufString,SwiftProtobuf.ProtobufString>.self, value: _storage._mapStringString, fieldNumber: 14)
  917. }
  918. if !_storage._mapInt32Bytes.isEmpty {
  919. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufBytes>.self, value: _storage._mapInt32Bytes, fieldNumber: 15)
  920. }
  921. if !_storage._mapInt32Enum.isEmpty {
  922. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufEnumMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_MapEnum>.self, value: _storage._mapInt32Enum, fieldNumber: 16)
  923. }
  924. if !_storage._mapInt32ForeignMessage.isEmpty {
  925. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2Unittest_ForeignMessage>.self, value: _storage._mapInt32ForeignMessage, fieldNumber: 17)
  926. }
  927. }
  928. try unknownFields.traverse(visitor: &visitor)
  929. }
  930. static func ==(lhs: Proto2Unittest_TestArenaMap, rhs: Proto2Unittest_TestArenaMap) -> Bool {
  931. if lhs._storage !== rhs._storage {
  932. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  933. let _storage = _args.0
  934. let rhs_storage = _args.1
  935. if _storage._mapInt32Int32 != rhs_storage._mapInt32Int32 {return false}
  936. if _storage._mapInt64Int64 != rhs_storage._mapInt64Int64 {return false}
  937. if _storage._mapUint32Uint32 != rhs_storage._mapUint32Uint32 {return false}
  938. if _storage._mapUint64Uint64 != rhs_storage._mapUint64Uint64 {return false}
  939. if _storage._mapSint32Sint32 != rhs_storage._mapSint32Sint32 {return false}
  940. if _storage._mapSint64Sint64 != rhs_storage._mapSint64Sint64 {return false}
  941. if _storage._mapFixed32Fixed32 != rhs_storage._mapFixed32Fixed32 {return false}
  942. if _storage._mapFixed64Fixed64 != rhs_storage._mapFixed64Fixed64 {return false}
  943. if _storage._mapSfixed32Sfixed32 != rhs_storage._mapSfixed32Sfixed32 {return false}
  944. if _storage._mapSfixed64Sfixed64 != rhs_storage._mapSfixed64Sfixed64 {return false}
  945. if _storage._mapInt32Float != rhs_storage._mapInt32Float {return false}
  946. if _storage._mapInt32Double != rhs_storage._mapInt32Double {return false}
  947. if _storage._mapBoolBool != rhs_storage._mapBoolBool {return false}
  948. if _storage._mapStringString != rhs_storage._mapStringString {return false}
  949. if _storage._mapInt32Bytes != rhs_storage._mapInt32Bytes {return false}
  950. if _storage._mapInt32Enum != rhs_storage._mapInt32Enum {return false}
  951. if _storage._mapInt32ForeignMessage != rhs_storage._mapInt32ForeignMessage {return false}
  952. return true
  953. }
  954. if !storagesAreEqual {return false}
  955. }
  956. if lhs.unknownFields != rhs.unknownFields {return false}
  957. return true
  958. }
  959. }
  960. extension Proto2Unittest_MessageContainingEnumCalledType: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  961. static let protoMessageName: String = _protobuf_package + ".MessageContainingEnumCalledType"
  962. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  963. 1: .same(proto: "type"),
  964. ]
  965. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  966. while let fieldNumber = try decoder.nextFieldNumber() {
  967. // The use of inline closures is to circumvent an issue where the compiler
  968. // allocates stack space for every case branch when no optimizations are
  969. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  970. switch fieldNumber {
  971. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufString,Proto2Unittest_MessageContainingEnumCalledType>.self, value: &self.type) }()
  972. default: break
  973. }
  974. }
  975. }
  976. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  977. if !self.type.isEmpty {
  978. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufString,Proto2Unittest_MessageContainingEnumCalledType>.self, value: self.type, fieldNumber: 1)
  979. }
  980. try unknownFields.traverse(visitor: &visitor)
  981. }
  982. static func ==(lhs: Proto2Unittest_MessageContainingEnumCalledType, rhs: Proto2Unittest_MessageContainingEnumCalledType) -> Bool {
  983. if lhs.type != rhs.type {return false}
  984. if lhs.unknownFields != rhs.unknownFields {return false}
  985. return true
  986. }
  987. }
  988. extension Proto2Unittest_MessageContainingEnumCalledType.TypeEnum: SwiftProtobuf._ProtoNameProviding {
  989. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  990. 0: .same(proto: "TYPE_FOO"),
  991. ]
  992. }
  993. extension Proto2Unittest_MessageContainingMapCalledEntry: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  994. static let protoMessageName: String = _protobuf_package + ".MessageContainingMapCalledEntry"
  995. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  996. 1: .same(proto: "entry"),
  997. ]
  998. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  999. while let fieldNumber = try decoder.nextFieldNumber() {
  1000. // The use of inline closures is to circumvent an issue where the compiler
  1001. // allocates stack space for every case branch when no optimizations are
  1002. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  1003. switch fieldNumber {
  1004. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufInt32>.self, value: &self.entry) }()
  1005. default: break
  1006. }
  1007. }
  1008. }
  1009. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1010. if !self.entry.isEmpty {
  1011. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufInt32>.self, value: self.entry, fieldNumber: 1)
  1012. }
  1013. try unknownFields.traverse(visitor: &visitor)
  1014. }
  1015. static func ==(lhs: Proto2Unittest_MessageContainingMapCalledEntry, rhs: Proto2Unittest_MessageContainingMapCalledEntry) -> Bool {
  1016. if lhs.entry != rhs.entry {return false}
  1017. if lhs.unknownFields != rhs.unknownFields {return false}
  1018. return true
  1019. }
  1020. }
  1021. extension Proto2Unittest_TestRecursiveMapMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1022. static let protoMessageName: String = _protobuf_package + ".TestRecursiveMapMessage"
  1023. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1024. 1: .same(proto: "a"),
  1025. ]
  1026. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1027. while let fieldNumber = try decoder.nextFieldNumber() {
  1028. // The use of inline closures is to circumvent an issue where the compiler
  1029. // allocates stack space for every case branch when no optimizations are
  1030. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  1031. switch fieldNumber {
  1032. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufString,Proto2Unittest_TestRecursiveMapMessage>.self, value: &self.a) }()
  1033. default: break
  1034. }
  1035. }
  1036. }
  1037. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1038. if !self.a.isEmpty {
  1039. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufString,Proto2Unittest_TestRecursiveMapMessage>.self, value: self.a, fieldNumber: 1)
  1040. }
  1041. try unknownFields.traverse(visitor: &visitor)
  1042. }
  1043. static func ==(lhs: Proto2Unittest_TestRecursiveMapMessage, rhs: Proto2Unittest_TestRecursiveMapMessage) -> Bool {
  1044. if lhs.a != rhs.a {return false}
  1045. if lhs.unknownFields != rhs.unknownFields {return false}
  1046. return true
  1047. }
  1048. }
  1049. extension Proto2Unittest_TestI32StrMap: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  1050. static let protoMessageName: String = _protobuf_package + ".TestI32StrMap"
  1051. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  1052. 1: .standard(proto: "m_32_str"),
  1053. ]
  1054. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  1055. while let fieldNumber = try decoder.nextFieldNumber() {
  1056. // The use of inline closures is to circumvent an issue where the compiler
  1057. // allocates stack space for every case branch when no optimizations are
  1058. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  1059. switch fieldNumber {
  1060. case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufString>.self, value: &self.m32Str) }()
  1061. default: break
  1062. }
  1063. }
  1064. }
  1065. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  1066. if !self.m32Str.isEmpty {
  1067. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufString>.self, value: self.m32Str, fieldNumber: 1)
  1068. }
  1069. try unknownFields.traverse(visitor: &visitor)
  1070. }
  1071. static func ==(lhs: Proto2Unittest_TestI32StrMap, rhs: Proto2Unittest_TestI32StrMap) -> Bool {
  1072. if lhs.m32Str != rhs.m32Str {return false}
  1073. if lhs.unknownFields != rhs.unknownFields {return false}
  1074. return true
  1075. }
  1076. }