| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214 |
- // DO NOT EDIT.
- // swift-format-ignore-file
- // swiftlint:disable all
- //
- // Generated by the Swift generator plugin for the protocol buffer compiler.
- // Source: google/protobuf/unittest_no_field_presence.proto
- //
- // For information on using the generated types, please see the documentation:
- // https://github.com/apple/swift-protobuf/
- // Protocol Buffers - Google's data interchange format
- // Copyright 2008 Google Inc. All rights reserved.
- //
- // Use of this source code is governed by a BSD-style
- // license that can be found in the LICENSE file or at
- // https://developers.google.com/open-source/licenses/bsd
- // A proto file used to test a message type with no explicit field presence.
- import Foundation
- import SwiftProtobuf
- // If the compiler emits an error on this type, it is because this file
- // was generated by a version of the `protoc` Swift plug-in that is
- // incompatible with the version of SwiftProtobuf to which you are linking.
- // Please ensure that you are building against the same version of the API
- // that was used to generate this file.
- fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
- struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
- typealias Version = _2
- }
- enum Proto2NofieldpresenceUnittest_ForeignEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
- typealias RawValue = Int
- case foreignFoo // = 0
- case foreignBar // = 1
- case foreignBaz // = 2
- case UNRECOGNIZED(Int)
- init() {
- self = .foreignFoo
- }
- init?(rawValue: Int) {
- switch rawValue {
- case 0: self = .foreignFoo
- case 1: self = .foreignBar
- case 2: self = .foreignBaz
- default: self = .UNRECOGNIZED(rawValue)
- }
- }
- var rawValue: Int {
- switch self {
- case .foreignFoo: return 0
- case .foreignBar: return 1
- case .foreignBaz: return 2
- case .UNRECOGNIZED(let i): return i
- }
- }
- // The compiler won't synthesize support with the UNRECOGNIZED case.
- static let allCases: [Proto2NofieldpresenceUnittest_ForeignEnum] = [
- .foreignFoo,
- .foreignBar,
- .foreignBaz,
- ]
- }
- /// This proto includes every type of field in both singular and repeated
- /// forms.
- struct Proto2NofieldpresenceUnittest_TestAllTypes: @unchecked Sendable {
- // SwiftProtobuf.Message conformance is added in an extension below. See the
- // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
- // methods supported on all messages.
- /// Singular
- /// TODO: remove 'optional' labels as soon as CL 69188077 is LGTM'd to make
- /// 'optional' optional.
- var optionalInt32: Int32 {
- get {return _storage._optionalInt32}
- set {_uniqueStorage()._optionalInt32 = newValue}
- }
- var optionalInt64: Int64 {
- get {return _storage._optionalInt64}
- set {_uniqueStorage()._optionalInt64 = newValue}
- }
- var optionalUint32: UInt32 {
- get {return _storage._optionalUint32}
- set {_uniqueStorage()._optionalUint32 = newValue}
- }
- var optionalUint64: UInt64 {
- get {return _storage._optionalUint64}
- set {_uniqueStorage()._optionalUint64 = newValue}
- }
- var optionalSint32: Int32 {
- get {return _storage._optionalSint32}
- set {_uniqueStorage()._optionalSint32 = newValue}
- }
- var optionalSint64: Int64 {
- get {return _storage._optionalSint64}
- set {_uniqueStorage()._optionalSint64 = newValue}
- }
- var optionalFixed32: UInt32 {
- get {return _storage._optionalFixed32}
- set {_uniqueStorage()._optionalFixed32 = newValue}
- }
- var optionalFixed64: UInt64 {
- get {return _storage._optionalFixed64}
- set {_uniqueStorage()._optionalFixed64 = newValue}
- }
- var optionalSfixed32: Int32 {
- get {return _storage._optionalSfixed32}
- set {_uniqueStorage()._optionalSfixed32 = newValue}
- }
- var optionalSfixed64: Int64 {
- get {return _storage._optionalSfixed64}
- set {_uniqueStorage()._optionalSfixed64 = newValue}
- }
- var optionalFloat: Float {
- get {return _storage._optionalFloat}
- set {_uniqueStorage()._optionalFloat = newValue}
- }
- var optionalDouble: Double {
- get {return _storage._optionalDouble}
- set {_uniqueStorage()._optionalDouble = newValue}
- }
- var optionalBool: Bool {
- get {return _storage._optionalBool}
- set {_uniqueStorage()._optionalBool = newValue}
- }
- var optionalString: String {
- get {return _storage._optionalString}
- set {_uniqueStorage()._optionalString = newValue}
- }
- var optionalBytes: Data {
- get {return _storage._optionalBytes}
- set {_uniqueStorage()._optionalBytes = newValue}
- }
- var optionalNestedMessage: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage {
- get {return _storage._optionalNestedMessage ?? Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage()}
- set {_uniqueStorage()._optionalNestedMessage = newValue}
- }
- /// Returns true if `optionalNestedMessage` has been explicitly set.
- var hasOptionalNestedMessage: Bool {return _storage._optionalNestedMessage != nil}
- /// Clears the value of `optionalNestedMessage`. Subsequent reads from it will return its default value.
- mutating func clearOptionalNestedMessage() {_uniqueStorage()._optionalNestedMessage = nil}
- var optionalForeignMessage: Proto2NofieldpresenceUnittest_ForeignMessage {
- get {return _storage._optionalForeignMessage ?? Proto2NofieldpresenceUnittest_ForeignMessage()}
- set {_uniqueStorage()._optionalForeignMessage = newValue}
- }
- /// Returns true if `optionalForeignMessage` has been explicitly set.
- var hasOptionalForeignMessage: Bool {return _storage._optionalForeignMessage != nil}
- /// Clears the value of `optionalForeignMessage`. Subsequent reads from it will return its default value.
- mutating func clearOptionalForeignMessage() {_uniqueStorage()._optionalForeignMessage = nil}
- var optionalProto2Message: Proto2Unittest_TestAllTypes {
- get {return _storage._optionalProto2Message ?? Proto2Unittest_TestAllTypes()}
- set {_uniqueStorage()._optionalProto2Message = newValue}
- }
- /// Returns true if `optionalProto2Message` has been explicitly set.
- var hasOptionalProto2Message: Bool {return _storage._optionalProto2Message != nil}
- /// Clears the value of `optionalProto2Message`. Subsequent reads from it will return its default value.
- mutating func clearOptionalProto2Message() {_uniqueStorage()._optionalProto2Message = nil}
- var optionalNestedEnum: Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum {
- get {return _storage._optionalNestedEnum}
- set {_uniqueStorage()._optionalNestedEnum = newValue}
- }
- /// N.B.: proto2-enum-type fields not allowed, because their default values
- /// might not be zero.
- /// optional proto2_unittest.ForeignEnum optional_proto2_enum =
- /// 23;
- var optionalForeignEnum: Proto2NofieldpresenceUnittest_ForeignEnum {
- get {return _storage._optionalForeignEnum}
- set {_uniqueStorage()._optionalForeignEnum = newValue}
- }
- var optionalStringPiece: String {
- get {return _storage._optionalStringPiece}
- set {_uniqueStorage()._optionalStringPiece = newValue}
- }
- var optionalCord: String {
- get {return _storage._optionalCord}
- set {_uniqueStorage()._optionalCord = newValue}
- }
- var optionalLazyMessage: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage {
- get {return _storage._optionalLazyMessage ?? Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage()}
- set {_uniqueStorage()._optionalLazyMessage = newValue}
- }
- /// Returns true if `optionalLazyMessage` has been explicitly set.
- var hasOptionalLazyMessage: Bool {return _storage._optionalLazyMessage != nil}
- /// Clears the value of `optionalLazyMessage`. Subsequent reads from it will return its default value.
- mutating func clearOptionalLazyMessage() {_uniqueStorage()._optionalLazyMessage = nil}
- /// Repeated
- var repeatedInt32: [Int32] {
- get {return _storage._repeatedInt32}
- set {_uniqueStorage()._repeatedInt32 = newValue}
- }
- var repeatedInt64: [Int64] {
- get {return _storage._repeatedInt64}
- set {_uniqueStorage()._repeatedInt64 = newValue}
- }
- var repeatedUint32: [UInt32] {
- get {return _storage._repeatedUint32}
- set {_uniqueStorage()._repeatedUint32 = newValue}
- }
- var repeatedUint64: [UInt64] {
- get {return _storage._repeatedUint64}
- set {_uniqueStorage()._repeatedUint64 = newValue}
- }
- var repeatedSint32: [Int32] {
- get {return _storage._repeatedSint32}
- set {_uniqueStorage()._repeatedSint32 = newValue}
- }
- var repeatedSint64: [Int64] {
- get {return _storage._repeatedSint64}
- set {_uniqueStorage()._repeatedSint64 = newValue}
- }
- var repeatedFixed32: [UInt32] {
- get {return _storage._repeatedFixed32}
- set {_uniqueStorage()._repeatedFixed32 = newValue}
- }
- var repeatedFixed64: [UInt64] {
- get {return _storage._repeatedFixed64}
- set {_uniqueStorage()._repeatedFixed64 = newValue}
- }
- var repeatedSfixed32: [Int32] {
- get {return _storage._repeatedSfixed32}
- set {_uniqueStorage()._repeatedSfixed32 = newValue}
- }
- var repeatedSfixed64: [Int64] {
- get {return _storage._repeatedSfixed64}
- set {_uniqueStorage()._repeatedSfixed64 = newValue}
- }
- var repeatedFloat: [Float] {
- get {return _storage._repeatedFloat}
- set {_uniqueStorage()._repeatedFloat = newValue}
- }
- var repeatedDouble: [Double] {
- get {return _storage._repeatedDouble}
- set {_uniqueStorage()._repeatedDouble = newValue}
- }
- var repeatedBool: [Bool] {
- get {return _storage._repeatedBool}
- set {_uniqueStorage()._repeatedBool = newValue}
- }
- var repeatedString: [String] {
- get {return _storage._repeatedString}
- set {_uniqueStorage()._repeatedString = newValue}
- }
- var repeatedBytes: [Data] {
- get {return _storage._repeatedBytes}
- set {_uniqueStorage()._repeatedBytes = newValue}
- }
- var repeatedNestedMessage: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage] {
- get {return _storage._repeatedNestedMessage}
- set {_uniqueStorage()._repeatedNestedMessage = newValue}
- }
- var repeatedForeignMessage: [Proto2NofieldpresenceUnittest_ForeignMessage] {
- get {return _storage._repeatedForeignMessage}
- set {_uniqueStorage()._repeatedForeignMessage = newValue}
- }
- var repeatedProto2Message: [Proto2Unittest_TestAllTypes] {
- get {return _storage._repeatedProto2Message}
- set {_uniqueStorage()._repeatedProto2Message = newValue}
- }
- var repeatedNestedEnum: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum] {
- get {return _storage._repeatedNestedEnum}
- set {_uniqueStorage()._repeatedNestedEnum = newValue}
- }
- var repeatedForeignEnum: [Proto2NofieldpresenceUnittest_ForeignEnum] {
- get {return _storage._repeatedForeignEnum}
- set {_uniqueStorage()._repeatedForeignEnum = newValue}
- }
- var repeatedStringPiece: [String] {
- get {return _storage._repeatedStringPiece}
- set {_uniqueStorage()._repeatedStringPiece = newValue}
- }
- var repeatedCord: [String] {
- get {return _storage._repeatedCord}
- set {_uniqueStorage()._repeatedCord = newValue}
- }
- var repeatedLazyMessage: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage] {
- get {return _storage._repeatedLazyMessage}
- set {_uniqueStorage()._repeatedLazyMessage = newValue}
- }
- var oneofField: OneOf_OneofField? {
- get {return _storage._oneofField}
- set {_uniqueStorage()._oneofField = newValue}
- }
- var oneofUint32: UInt32 {
- get {
- if case .oneofUint32(let v)? = _storage._oneofField {return v}
- return 0
- }
- set {_uniqueStorage()._oneofField = .oneofUint32(newValue)}
- }
- var oneofNestedMessage: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage {
- get {
- if case .oneofNestedMessage(let v)? = _storage._oneofField {return v}
- return Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage()
- }
- set {_uniqueStorage()._oneofField = .oneofNestedMessage(newValue)}
- }
- var oneofString: String {
- get {
- if case .oneofString(let v)? = _storage._oneofField {return v}
- return String()
- }
- set {_uniqueStorage()._oneofField = .oneofString(newValue)}
- }
- var oneofEnum: Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum {
- get {
- if case .oneofEnum(let v)? = _storage._oneofField {return v}
- return .foo
- }
- set {_uniqueStorage()._oneofField = .oneofEnum(newValue)}
- }
- var unknownFields = SwiftProtobuf.UnknownStorage()
- enum OneOf_OneofField: Equatable, Sendable {
- case oneofUint32(UInt32)
- case oneofNestedMessage(Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage)
- case oneofString(String)
- case oneofEnum(Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum)
- }
- enum NestedEnum: SwiftProtobuf.Enum, Swift.CaseIterable {
- typealias RawValue = Int
- case foo // = 0
- case bar // = 1
- case baz // = 2
- case UNRECOGNIZED(Int)
- init() {
- self = .foo
- }
- init?(rawValue: Int) {
- switch rawValue {
- case 0: self = .foo
- case 1: self = .bar
- case 2: self = .baz
- default: self = .UNRECOGNIZED(rawValue)
- }
- }
- var rawValue: Int {
- switch self {
- case .foo: return 0
- case .bar: return 1
- case .baz: return 2
- case .UNRECOGNIZED(let i): return i
- }
- }
- // The compiler won't synthesize support with the UNRECOGNIZED case.
- static let allCases: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum] = [
- .foo,
- .bar,
- .baz,
- ]
- }
- struct NestedMessage: Sendable {
- // SwiftProtobuf.Message conformance is added in an extension below. See the
- // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
- // methods supported on all messages.
- var bb: Int32 = 0
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- init() {}
- fileprivate var _storage = _StorageClass.defaultInstance
- }
- struct Proto2NofieldpresenceUnittest_TestAllMapTypes: Sendable {
- // SwiftProtobuf.Message conformance is added in an extension below. See the
- // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
- // methods supported on all messages.
- var mapInt32Bytes: Dictionary<Int32,Data> = [:]
- var mapInt32ForeignEnum: Dictionary<Int32,Proto2NofieldpresenceUnittest_ForeignEnum> = [:]
- var mapInt32ForeignMessage: Dictionary<Int32,Proto2NofieldpresenceUnittest_ForeignMessage> = [:]
- var mapInt32ExplicitForeignMessage: Dictionary<Int32,Proto2NofieldpresenceUnittest_ExplicitForeignMessage> = [:]
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- struct Proto2NofieldpresenceUnittest_TestProto2Required: Sendable {
- // SwiftProtobuf.Message conformance is added in an extension below. See the
- // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
- // methods supported on all messages.
- var proto2: Proto2Unittest_TestRequired {
- get {return _proto2 ?? Proto2Unittest_TestRequired()}
- set {_proto2 = newValue}
- }
- /// Returns true if `proto2` has been explicitly set.
- var hasProto2: Bool {return self._proto2 != nil}
- /// Clears the value of `proto2`. Subsequent reads from it will return its default value.
- mutating func clearProto2() {self._proto2 = nil}
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- fileprivate var _proto2: Proto2Unittest_TestRequired? = nil
- }
- /// Define these after TestAllTypes to make sure the compiler can handle
- /// that.
- struct Proto2NofieldpresenceUnittest_ForeignMessage: Sendable {
- // SwiftProtobuf.Message conformance is added in an extension below. See the
- // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
- // methods supported on all messages.
- var c: Int32 = 0
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- }
- /// Same as ForeignMessage, but all fields have explicit presence.
- /// It can be useful for testing explicit-implicit presence interop behaviour.
- struct Proto2NofieldpresenceUnittest_ExplicitForeignMessage: Sendable {
- // SwiftProtobuf.Message conformance is added in an extension below. See the
- // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
- // methods supported on all messages.
- var c: Int32 {
- get {return _c ?? 0}
- set {_c = newValue}
- }
- /// Returns true if `c` has been explicitly set.
- var hasC: Bool {return self._c != nil}
- /// Clears the value of `c`. Subsequent reads from it will return its default value.
- mutating func clearC() {self._c = nil}
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- fileprivate var _c: Int32? = nil
- }
- // MARK: - Code below here is support for the SwiftProtobuf runtime.
- fileprivate let _protobuf_package = "proto2_nofieldpresence_unittest"
- extension Proto2NofieldpresenceUnittest_ForeignEnum: SwiftProtobuf._ProtoNameProviding {
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 0: .same(proto: "FOREIGN_FOO"),
- 1: .same(proto: "FOREIGN_BAR"),
- 2: .same(proto: "FOREIGN_BAZ"),
- ]
- }
- extension Proto2NofieldpresenceUnittest_TestAllTypes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".TestAllTypes"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .standard(proto: "optional_int32"),
- 2: .standard(proto: "optional_int64"),
- 3: .standard(proto: "optional_uint32"),
- 4: .standard(proto: "optional_uint64"),
- 5: .standard(proto: "optional_sint32"),
- 6: .standard(proto: "optional_sint64"),
- 7: .standard(proto: "optional_fixed32"),
- 8: .standard(proto: "optional_fixed64"),
- 9: .standard(proto: "optional_sfixed32"),
- 10: .standard(proto: "optional_sfixed64"),
- 11: .standard(proto: "optional_float"),
- 12: .standard(proto: "optional_double"),
- 13: .standard(proto: "optional_bool"),
- 14: .standard(proto: "optional_string"),
- 15: .standard(proto: "optional_bytes"),
- 18: .standard(proto: "optional_nested_message"),
- 19: .standard(proto: "optional_foreign_message"),
- 20: .standard(proto: "optional_proto2_message"),
- 21: .standard(proto: "optional_nested_enum"),
- 22: .standard(proto: "optional_foreign_enum"),
- 24: .standard(proto: "optional_string_piece"),
- 25: .standard(proto: "optional_cord"),
- 30: .standard(proto: "optional_lazy_message"),
- 31: .standard(proto: "repeated_int32"),
- 32: .standard(proto: "repeated_int64"),
- 33: .standard(proto: "repeated_uint32"),
- 34: .standard(proto: "repeated_uint64"),
- 35: .standard(proto: "repeated_sint32"),
- 36: .standard(proto: "repeated_sint64"),
- 37: .standard(proto: "repeated_fixed32"),
- 38: .standard(proto: "repeated_fixed64"),
- 39: .standard(proto: "repeated_sfixed32"),
- 40: .standard(proto: "repeated_sfixed64"),
- 41: .standard(proto: "repeated_float"),
- 42: .standard(proto: "repeated_double"),
- 43: .standard(proto: "repeated_bool"),
- 44: .standard(proto: "repeated_string"),
- 45: .standard(proto: "repeated_bytes"),
- 48: .standard(proto: "repeated_nested_message"),
- 49: .standard(proto: "repeated_foreign_message"),
- 50: .standard(proto: "repeated_proto2_message"),
- 51: .standard(proto: "repeated_nested_enum"),
- 52: .standard(proto: "repeated_foreign_enum"),
- 54: .standard(proto: "repeated_string_piece"),
- 55: .standard(proto: "repeated_cord"),
- 57: .standard(proto: "repeated_lazy_message"),
- 111: .standard(proto: "oneof_uint32"),
- 112: .standard(proto: "oneof_nested_message"),
- 113: .standard(proto: "oneof_string"),
- 114: .standard(proto: "oneof_enum"),
- ]
- fileprivate class _StorageClass {
- var _optionalInt32: Int32 = 0
- var _optionalInt64: Int64 = 0
- var _optionalUint32: UInt32 = 0
- var _optionalUint64: UInt64 = 0
- var _optionalSint32: Int32 = 0
- var _optionalSint64: Int64 = 0
- var _optionalFixed32: UInt32 = 0
- var _optionalFixed64: UInt64 = 0
- var _optionalSfixed32: Int32 = 0
- var _optionalSfixed64: Int64 = 0
- var _optionalFloat: Float = 0
- var _optionalDouble: Double = 0
- var _optionalBool: Bool = false
- var _optionalString: String = String()
- var _optionalBytes: Data = Data()
- var _optionalNestedMessage: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage? = nil
- var _optionalForeignMessage: Proto2NofieldpresenceUnittest_ForeignMessage? = nil
- var _optionalProto2Message: Proto2Unittest_TestAllTypes? = nil
- var _optionalNestedEnum: Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum = .foo
- var _optionalForeignEnum: Proto2NofieldpresenceUnittest_ForeignEnum = .foreignFoo
- var _optionalStringPiece: String = String()
- var _optionalCord: String = String()
- var _optionalLazyMessage: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage? = nil
- var _repeatedInt32: [Int32] = []
- var _repeatedInt64: [Int64] = []
- var _repeatedUint32: [UInt32] = []
- var _repeatedUint64: [UInt64] = []
- var _repeatedSint32: [Int32] = []
- var _repeatedSint64: [Int64] = []
- var _repeatedFixed32: [UInt32] = []
- var _repeatedFixed64: [UInt64] = []
- var _repeatedSfixed32: [Int32] = []
- var _repeatedSfixed64: [Int64] = []
- var _repeatedFloat: [Float] = []
- var _repeatedDouble: [Double] = []
- var _repeatedBool: [Bool] = []
- var _repeatedString: [String] = []
- var _repeatedBytes: [Data] = []
- var _repeatedNestedMessage: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage] = []
- var _repeatedForeignMessage: [Proto2NofieldpresenceUnittest_ForeignMessage] = []
- var _repeatedProto2Message: [Proto2Unittest_TestAllTypes] = []
- var _repeatedNestedEnum: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum] = []
- var _repeatedForeignEnum: [Proto2NofieldpresenceUnittest_ForeignEnum] = []
- var _repeatedStringPiece: [String] = []
- var _repeatedCord: [String] = []
- var _repeatedLazyMessage: [Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage] = []
- var _oneofField: Proto2NofieldpresenceUnittest_TestAllTypes.OneOf_OneofField?
- // This property is used as the initial default value for new instances of the type.
- // The type itself is protecting the reference to its storage via CoW semantics.
- // This will force a copy to be made of this reference when the first mutation occurs;
- // hence, it is safe to mark this as `nonisolated(unsafe)`.
- static nonisolated(unsafe) let defaultInstance = _StorageClass()
- private init() {}
- init(copying source: _StorageClass) {
- _optionalInt32 = source._optionalInt32
- _optionalInt64 = source._optionalInt64
- _optionalUint32 = source._optionalUint32
- _optionalUint64 = source._optionalUint64
- _optionalSint32 = source._optionalSint32
- _optionalSint64 = source._optionalSint64
- _optionalFixed32 = source._optionalFixed32
- _optionalFixed64 = source._optionalFixed64
- _optionalSfixed32 = source._optionalSfixed32
- _optionalSfixed64 = source._optionalSfixed64
- _optionalFloat = source._optionalFloat
- _optionalDouble = source._optionalDouble
- _optionalBool = source._optionalBool
- _optionalString = source._optionalString
- _optionalBytes = source._optionalBytes
- _optionalNestedMessage = source._optionalNestedMessage
- _optionalForeignMessage = source._optionalForeignMessage
- _optionalProto2Message = source._optionalProto2Message
- _optionalNestedEnum = source._optionalNestedEnum
- _optionalForeignEnum = source._optionalForeignEnum
- _optionalStringPiece = source._optionalStringPiece
- _optionalCord = source._optionalCord
- _optionalLazyMessage = source._optionalLazyMessage
- _repeatedInt32 = source._repeatedInt32
- _repeatedInt64 = source._repeatedInt64
- _repeatedUint32 = source._repeatedUint32
- _repeatedUint64 = source._repeatedUint64
- _repeatedSint32 = source._repeatedSint32
- _repeatedSint64 = source._repeatedSint64
- _repeatedFixed32 = source._repeatedFixed32
- _repeatedFixed64 = source._repeatedFixed64
- _repeatedSfixed32 = source._repeatedSfixed32
- _repeatedSfixed64 = source._repeatedSfixed64
- _repeatedFloat = source._repeatedFloat
- _repeatedDouble = source._repeatedDouble
- _repeatedBool = source._repeatedBool
- _repeatedString = source._repeatedString
- _repeatedBytes = source._repeatedBytes
- _repeatedNestedMessage = source._repeatedNestedMessage
- _repeatedForeignMessage = source._repeatedForeignMessage
- _repeatedProto2Message = source._repeatedProto2Message
- _repeatedNestedEnum = source._repeatedNestedEnum
- _repeatedForeignEnum = source._repeatedForeignEnum
- _repeatedStringPiece = source._repeatedStringPiece
- _repeatedCord = source._repeatedCord
- _repeatedLazyMessage = source._repeatedLazyMessage
- _oneofField = source._oneofField
- }
- }
- fileprivate mutating func _uniqueStorage() -> _StorageClass {
- if !isKnownUniquelyReferenced(&_storage) {
- _storage = _StorageClass(copying: _storage)
- }
- return _storage
- }
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- _ = _uniqueStorage()
- try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
- while let fieldNumber = try decoder.nextFieldNumber() {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every case branch when no optimizations are
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
- switch fieldNumber {
- case 1: try { try decoder.decodeSingularInt32Field(value: &_storage._optionalInt32) }()
- case 2: try { try decoder.decodeSingularInt64Field(value: &_storage._optionalInt64) }()
- case 3: try { try decoder.decodeSingularUInt32Field(value: &_storage._optionalUint32) }()
- case 4: try { try decoder.decodeSingularUInt64Field(value: &_storage._optionalUint64) }()
- case 5: try { try decoder.decodeSingularSInt32Field(value: &_storage._optionalSint32) }()
- case 6: try { try decoder.decodeSingularSInt64Field(value: &_storage._optionalSint64) }()
- case 7: try { try decoder.decodeSingularFixed32Field(value: &_storage._optionalFixed32) }()
- case 8: try { try decoder.decodeSingularFixed64Field(value: &_storage._optionalFixed64) }()
- case 9: try { try decoder.decodeSingularSFixed32Field(value: &_storage._optionalSfixed32) }()
- case 10: try { try decoder.decodeSingularSFixed64Field(value: &_storage._optionalSfixed64) }()
- case 11: try { try decoder.decodeSingularFloatField(value: &_storage._optionalFloat) }()
- case 12: try { try decoder.decodeSingularDoubleField(value: &_storage._optionalDouble) }()
- case 13: try { try decoder.decodeSingularBoolField(value: &_storage._optionalBool) }()
- case 14: try { try decoder.decodeSingularStringField(value: &_storage._optionalString) }()
- case 15: try { try decoder.decodeSingularBytesField(value: &_storage._optionalBytes) }()
- case 18: try { try decoder.decodeSingularMessageField(value: &_storage._optionalNestedMessage) }()
- case 19: try { try decoder.decodeSingularMessageField(value: &_storage._optionalForeignMessage) }()
- case 20: try { try decoder.decodeSingularMessageField(value: &_storage._optionalProto2Message) }()
- case 21: try { try decoder.decodeSingularEnumField(value: &_storage._optionalNestedEnum) }()
- case 22: try { try decoder.decodeSingularEnumField(value: &_storage._optionalForeignEnum) }()
- case 24: try { try decoder.decodeSingularStringField(value: &_storage._optionalStringPiece) }()
- case 25: try { try decoder.decodeSingularStringField(value: &_storage._optionalCord) }()
- case 30: try { try decoder.decodeSingularMessageField(value: &_storage._optionalLazyMessage) }()
- case 31: try { try decoder.decodeRepeatedInt32Field(value: &_storage._repeatedInt32) }()
- case 32: try { try decoder.decodeRepeatedInt64Field(value: &_storage._repeatedInt64) }()
- case 33: try { try decoder.decodeRepeatedUInt32Field(value: &_storage._repeatedUint32) }()
- case 34: try { try decoder.decodeRepeatedUInt64Field(value: &_storage._repeatedUint64) }()
- case 35: try { try decoder.decodeRepeatedSInt32Field(value: &_storage._repeatedSint32) }()
- case 36: try { try decoder.decodeRepeatedSInt64Field(value: &_storage._repeatedSint64) }()
- case 37: try { try decoder.decodeRepeatedFixed32Field(value: &_storage._repeatedFixed32) }()
- case 38: try { try decoder.decodeRepeatedFixed64Field(value: &_storage._repeatedFixed64) }()
- case 39: try { try decoder.decodeRepeatedSFixed32Field(value: &_storage._repeatedSfixed32) }()
- case 40: try { try decoder.decodeRepeatedSFixed64Field(value: &_storage._repeatedSfixed64) }()
- case 41: try { try decoder.decodeRepeatedFloatField(value: &_storage._repeatedFloat) }()
- case 42: try { try decoder.decodeRepeatedDoubleField(value: &_storage._repeatedDouble) }()
- case 43: try { try decoder.decodeRepeatedBoolField(value: &_storage._repeatedBool) }()
- case 44: try { try decoder.decodeRepeatedStringField(value: &_storage._repeatedString) }()
- case 45: try { try decoder.decodeRepeatedBytesField(value: &_storage._repeatedBytes) }()
- case 48: try { try decoder.decodeRepeatedMessageField(value: &_storage._repeatedNestedMessage) }()
- case 49: try { try decoder.decodeRepeatedMessageField(value: &_storage._repeatedForeignMessage) }()
- case 50: try { try decoder.decodeRepeatedMessageField(value: &_storage._repeatedProto2Message) }()
- case 51: try { try decoder.decodeRepeatedEnumField(value: &_storage._repeatedNestedEnum) }()
- case 52: try { try decoder.decodeRepeatedEnumField(value: &_storage._repeatedForeignEnum) }()
- case 54: try { try decoder.decodeRepeatedStringField(value: &_storage._repeatedStringPiece) }()
- case 55: try { try decoder.decodeRepeatedStringField(value: &_storage._repeatedCord) }()
- case 57: try { try decoder.decodeRepeatedMessageField(value: &_storage._repeatedLazyMessage) }()
- case 111: try {
- var v: UInt32?
- try decoder.decodeSingularUInt32Field(value: &v)
- if let v = v {
- if _storage._oneofField != nil {try decoder.handleConflictingOneOf()}
- _storage._oneofField = .oneofUint32(v)
- }
- }()
- case 112: try {
- var v: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage?
- var hadOneofValue = false
- if let current = _storage._oneofField {
- hadOneofValue = true
- if case .oneofNestedMessage(let m) = current {v = m}
- }
- try decoder.decodeSingularMessageField(value: &v)
- if let v = v {
- if hadOneofValue {try decoder.handleConflictingOneOf()}
- _storage._oneofField = .oneofNestedMessage(v)
- }
- }()
- case 113: try {
- var v: String?
- try decoder.decodeSingularStringField(value: &v)
- if let v = v {
- if _storage._oneofField != nil {try decoder.handleConflictingOneOf()}
- _storage._oneofField = .oneofString(v)
- }
- }()
- case 114: try {
- var v: Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum?
- try decoder.decodeSingularEnumField(value: &v)
- if let v = v {
- if _storage._oneofField != nil {try decoder.handleConflictingOneOf()}
- _storage._oneofField = .oneofEnum(v)
- }
- }()
- default: break
- }
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every if/case branch local when no optimizations
- // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
- // https://github.com/apple/swift-protobuf/issues/1182
- if _storage._optionalInt32 != 0 {
- try visitor.visitSingularInt32Field(value: _storage._optionalInt32, fieldNumber: 1)
- }
- if _storage._optionalInt64 != 0 {
- try visitor.visitSingularInt64Field(value: _storage._optionalInt64, fieldNumber: 2)
- }
- if _storage._optionalUint32 != 0 {
- try visitor.visitSingularUInt32Field(value: _storage._optionalUint32, fieldNumber: 3)
- }
- if _storage._optionalUint64 != 0 {
- try visitor.visitSingularUInt64Field(value: _storage._optionalUint64, fieldNumber: 4)
- }
- if _storage._optionalSint32 != 0 {
- try visitor.visitSingularSInt32Field(value: _storage._optionalSint32, fieldNumber: 5)
- }
- if _storage._optionalSint64 != 0 {
- try visitor.visitSingularSInt64Field(value: _storage._optionalSint64, fieldNumber: 6)
- }
- if _storage._optionalFixed32 != 0 {
- try visitor.visitSingularFixed32Field(value: _storage._optionalFixed32, fieldNumber: 7)
- }
- if _storage._optionalFixed64 != 0 {
- try visitor.visitSingularFixed64Field(value: _storage._optionalFixed64, fieldNumber: 8)
- }
- if _storage._optionalSfixed32 != 0 {
- try visitor.visitSingularSFixed32Field(value: _storage._optionalSfixed32, fieldNumber: 9)
- }
- if _storage._optionalSfixed64 != 0 {
- try visitor.visitSingularSFixed64Field(value: _storage._optionalSfixed64, fieldNumber: 10)
- }
- if _storage._optionalFloat.bitPattern != 0 {
- try visitor.visitSingularFloatField(value: _storage._optionalFloat, fieldNumber: 11)
- }
- if _storage._optionalDouble.bitPattern != 0 {
- try visitor.visitSingularDoubleField(value: _storage._optionalDouble, fieldNumber: 12)
- }
- if _storage._optionalBool != false {
- try visitor.visitSingularBoolField(value: _storage._optionalBool, fieldNumber: 13)
- }
- if !_storage._optionalString.isEmpty {
- try visitor.visitSingularStringField(value: _storage._optionalString, fieldNumber: 14)
- }
- if !_storage._optionalBytes.isEmpty {
- try visitor.visitSingularBytesField(value: _storage._optionalBytes, fieldNumber: 15)
- }
- try { if let v = _storage._optionalNestedMessage {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 18)
- } }()
- try { if let v = _storage._optionalForeignMessage {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 19)
- } }()
- try { if let v = _storage._optionalProto2Message {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 20)
- } }()
- if _storage._optionalNestedEnum != .foo {
- try visitor.visitSingularEnumField(value: _storage._optionalNestedEnum, fieldNumber: 21)
- }
- if _storage._optionalForeignEnum != .foreignFoo {
- try visitor.visitSingularEnumField(value: _storage._optionalForeignEnum, fieldNumber: 22)
- }
- if !_storage._optionalStringPiece.isEmpty {
- try visitor.visitSingularStringField(value: _storage._optionalStringPiece, fieldNumber: 24)
- }
- if !_storage._optionalCord.isEmpty {
- try visitor.visitSingularStringField(value: _storage._optionalCord, fieldNumber: 25)
- }
- try { if let v = _storage._optionalLazyMessage {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 30)
- } }()
- if !_storage._repeatedInt32.isEmpty {
- try visitor.visitPackedInt32Field(value: _storage._repeatedInt32, fieldNumber: 31)
- }
- if !_storage._repeatedInt64.isEmpty {
- try visitor.visitPackedInt64Field(value: _storage._repeatedInt64, fieldNumber: 32)
- }
- if !_storage._repeatedUint32.isEmpty {
- try visitor.visitPackedUInt32Field(value: _storage._repeatedUint32, fieldNumber: 33)
- }
- if !_storage._repeatedUint64.isEmpty {
- try visitor.visitPackedUInt64Field(value: _storage._repeatedUint64, fieldNumber: 34)
- }
- if !_storage._repeatedSint32.isEmpty {
- try visitor.visitPackedSInt32Field(value: _storage._repeatedSint32, fieldNumber: 35)
- }
- if !_storage._repeatedSint64.isEmpty {
- try visitor.visitPackedSInt64Field(value: _storage._repeatedSint64, fieldNumber: 36)
- }
- if !_storage._repeatedFixed32.isEmpty {
- try visitor.visitPackedFixed32Field(value: _storage._repeatedFixed32, fieldNumber: 37)
- }
- if !_storage._repeatedFixed64.isEmpty {
- try visitor.visitPackedFixed64Field(value: _storage._repeatedFixed64, fieldNumber: 38)
- }
- if !_storage._repeatedSfixed32.isEmpty {
- try visitor.visitPackedSFixed32Field(value: _storage._repeatedSfixed32, fieldNumber: 39)
- }
- if !_storage._repeatedSfixed64.isEmpty {
- try visitor.visitPackedSFixed64Field(value: _storage._repeatedSfixed64, fieldNumber: 40)
- }
- if !_storage._repeatedFloat.isEmpty {
- try visitor.visitPackedFloatField(value: _storage._repeatedFloat, fieldNumber: 41)
- }
- if !_storage._repeatedDouble.isEmpty {
- try visitor.visitPackedDoubleField(value: _storage._repeatedDouble, fieldNumber: 42)
- }
- if !_storage._repeatedBool.isEmpty {
- try visitor.visitPackedBoolField(value: _storage._repeatedBool, fieldNumber: 43)
- }
- if !_storage._repeatedString.isEmpty {
- try visitor.visitRepeatedStringField(value: _storage._repeatedString, fieldNumber: 44)
- }
- if !_storage._repeatedBytes.isEmpty {
- try visitor.visitRepeatedBytesField(value: _storage._repeatedBytes, fieldNumber: 45)
- }
- if !_storage._repeatedNestedMessage.isEmpty {
- try visitor.visitRepeatedMessageField(value: _storage._repeatedNestedMessage, fieldNumber: 48)
- }
- if !_storage._repeatedForeignMessage.isEmpty {
- try visitor.visitRepeatedMessageField(value: _storage._repeatedForeignMessage, fieldNumber: 49)
- }
- if !_storage._repeatedProto2Message.isEmpty {
- try visitor.visitRepeatedMessageField(value: _storage._repeatedProto2Message, fieldNumber: 50)
- }
- if !_storage._repeatedNestedEnum.isEmpty {
- try visitor.visitPackedEnumField(value: _storage._repeatedNestedEnum, fieldNumber: 51)
- }
- if !_storage._repeatedForeignEnum.isEmpty {
- try visitor.visitPackedEnumField(value: _storage._repeatedForeignEnum, fieldNumber: 52)
- }
- if !_storage._repeatedStringPiece.isEmpty {
- try visitor.visitRepeatedStringField(value: _storage._repeatedStringPiece, fieldNumber: 54)
- }
- if !_storage._repeatedCord.isEmpty {
- try visitor.visitRepeatedStringField(value: _storage._repeatedCord, fieldNumber: 55)
- }
- if !_storage._repeatedLazyMessage.isEmpty {
- try visitor.visitRepeatedMessageField(value: _storage._repeatedLazyMessage, fieldNumber: 57)
- }
- switch _storage._oneofField {
- case .oneofUint32?: try {
- guard case .oneofUint32(let v)? = _storage._oneofField else { preconditionFailure() }
- try visitor.visitSingularUInt32Field(value: v, fieldNumber: 111)
- }()
- case .oneofNestedMessage?: try {
- guard case .oneofNestedMessage(let v)? = _storage._oneofField else { preconditionFailure() }
- try visitor.visitSingularMessageField(value: v, fieldNumber: 112)
- }()
- case .oneofString?: try {
- guard case .oneofString(let v)? = _storage._oneofField else { preconditionFailure() }
- try visitor.visitSingularStringField(value: v, fieldNumber: 113)
- }()
- case .oneofEnum?: try {
- guard case .oneofEnum(let v)? = _storage._oneofField else { preconditionFailure() }
- try visitor.visitSingularEnumField(value: v, fieldNumber: 114)
- }()
- case nil: break
- }
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2NofieldpresenceUnittest_TestAllTypes, rhs: Proto2NofieldpresenceUnittest_TestAllTypes) -> Bool {
- if lhs._storage !== rhs._storage {
- let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
- let _storage = _args.0
- let rhs_storage = _args.1
- if _storage._optionalInt32 != rhs_storage._optionalInt32 {return false}
- if _storage._optionalInt64 != rhs_storage._optionalInt64 {return false}
- if _storage._optionalUint32 != rhs_storage._optionalUint32 {return false}
- if _storage._optionalUint64 != rhs_storage._optionalUint64 {return false}
- if _storage._optionalSint32 != rhs_storage._optionalSint32 {return false}
- if _storage._optionalSint64 != rhs_storage._optionalSint64 {return false}
- if _storage._optionalFixed32 != rhs_storage._optionalFixed32 {return false}
- if _storage._optionalFixed64 != rhs_storage._optionalFixed64 {return false}
- if _storage._optionalSfixed32 != rhs_storage._optionalSfixed32 {return false}
- if _storage._optionalSfixed64 != rhs_storage._optionalSfixed64 {return false}
- if _storage._optionalFloat != rhs_storage._optionalFloat {return false}
- if _storage._optionalDouble != rhs_storage._optionalDouble {return false}
- if _storage._optionalBool != rhs_storage._optionalBool {return false}
- if _storage._optionalString != rhs_storage._optionalString {return false}
- if _storage._optionalBytes != rhs_storage._optionalBytes {return false}
- if _storage._optionalNestedMessage != rhs_storage._optionalNestedMessage {return false}
- if _storage._optionalForeignMessage != rhs_storage._optionalForeignMessage {return false}
- if _storage._optionalProto2Message != rhs_storage._optionalProto2Message {return false}
- if _storage._optionalNestedEnum != rhs_storage._optionalNestedEnum {return false}
- if _storage._optionalForeignEnum != rhs_storage._optionalForeignEnum {return false}
- if _storage._optionalStringPiece != rhs_storage._optionalStringPiece {return false}
- if _storage._optionalCord != rhs_storage._optionalCord {return false}
- if _storage._optionalLazyMessage != rhs_storage._optionalLazyMessage {return false}
- if _storage._repeatedInt32 != rhs_storage._repeatedInt32 {return false}
- if _storage._repeatedInt64 != rhs_storage._repeatedInt64 {return false}
- if _storage._repeatedUint32 != rhs_storage._repeatedUint32 {return false}
- if _storage._repeatedUint64 != rhs_storage._repeatedUint64 {return false}
- if _storage._repeatedSint32 != rhs_storage._repeatedSint32 {return false}
- if _storage._repeatedSint64 != rhs_storage._repeatedSint64 {return false}
- if _storage._repeatedFixed32 != rhs_storage._repeatedFixed32 {return false}
- if _storage._repeatedFixed64 != rhs_storage._repeatedFixed64 {return false}
- if _storage._repeatedSfixed32 != rhs_storage._repeatedSfixed32 {return false}
- if _storage._repeatedSfixed64 != rhs_storage._repeatedSfixed64 {return false}
- if _storage._repeatedFloat != rhs_storage._repeatedFloat {return false}
- if _storage._repeatedDouble != rhs_storage._repeatedDouble {return false}
- if _storage._repeatedBool != rhs_storage._repeatedBool {return false}
- if _storage._repeatedString != rhs_storage._repeatedString {return false}
- if _storage._repeatedBytes != rhs_storage._repeatedBytes {return false}
- if _storage._repeatedNestedMessage != rhs_storage._repeatedNestedMessage {return false}
- if _storage._repeatedForeignMessage != rhs_storage._repeatedForeignMessage {return false}
- if _storage._repeatedProto2Message != rhs_storage._repeatedProto2Message {return false}
- if _storage._repeatedNestedEnum != rhs_storage._repeatedNestedEnum {return false}
- if _storage._repeatedForeignEnum != rhs_storage._repeatedForeignEnum {return false}
- if _storage._repeatedStringPiece != rhs_storage._repeatedStringPiece {return false}
- if _storage._repeatedCord != rhs_storage._repeatedCord {return false}
- if _storage._repeatedLazyMessage != rhs_storage._repeatedLazyMessage {return false}
- if _storage._oneofField != rhs_storage._oneofField {return false}
- return true
- }
- if !storagesAreEqual {return false}
- }
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Proto2NofieldpresenceUnittest_TestAllTypes.NestedEnum: SwiftProtobuf._ProtoNameProviding {
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 0: .same(proto: "FOO"),
- 1: .same(proto: "BAR"),
- 2: .same(proto: "BAZ"),
- ]
- }
- extension Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = Proto2NofieldpresenceUnittest_TestAllTypes.protoMessageName + ".NestedMessage"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "bb"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every case branch when no optimizations are
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
- switch fieldNumber {
- case 1: try { try decoder.decodeSingularInt32Field(value: &self.bb) }()
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if self.bb != 0 {
- try visitor.visitSingularInt32Field(value: self.bb, fieldNumber: 1)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage, rhs: Proto2NofieldpresenceUnittest_TestAllTypes.NestedMessage) -> Bool {
- if lhs.bb != rhs.bb {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Proto2NofieldpresenceUnittest_TestAllMapTypes: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".TestAllMapTypes"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .standard(proto: "map_int32_bytes"),
- 2: .standard(proto: "map_int32_foreign_enum"),
- 3: .standard(proto: "map_int32_foreign_message"),
- 4: .standard(proto: "map_int32_explicit_foreign_message"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every case branch when no optimizations are
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
- switch fieldNumber {
- case 1: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufBytes>.self, value: &self.mapInt32Bytes) }()
- case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufEnumMap<SwiftProtobuf.ProtobufInt32,Proto2NofieldpresenceUnittest_ForeignEnum>.self, value: &self.mapInt32ForeignEnum) }()
- case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2NofieldpresenceUnittest_ForeignMessage>.self, value: &self.mapInt32ForeignMessage) }()
- case 4: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2NofieldpresenceUnittest_ExplicitForeignMessage>.self, value: &self.mapInt32ExplicitForeignMessage) }()
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if !self.mapInt32Bytes.isEmpty {
- try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufBytes>.self, value: self.mapInt32Bytes, fieldNumber: 1)
- }
- if !self.mapInt32ForeignEnum.isEmpty {
- try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufEnumMap<SwiftProtobuf.ProtobufInt32,Proto2NofieldpresenceUnittest_ForeignEnum>.self, value: self.mapInt32ForeignEnum, fieldNumber: 2)
- }
- if !self.mapInt32ForeignMessage.isEmpty {
- try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2NofieldpresenceUnittest_ForeignMessage>.self, value: self.mapInt32ForeignMessage, fieldNumber: 3)
- }
- if !self.mapInt32ExplicitForeignMessage.isEmpty {
- try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,Proto2NofieldpresenceUnittest_ExplicitForeignMessage>.self, value: self.mapInt32ExplicitForeignMessage, fieldNumber: 4)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2NofieldpresenceUnittest_TestAllMapTypes, rhs: Proto2NofieldpresenceUnittest_TestAllMapTypes) -> Bool {
- if lhs.mapInt32Bytes != rhs.mapInt32Bytes {return false}
- if lhs.mapInt32ForeignEnum != rhs.mapInt32ForeignEnum {return false}
- if lhs.mapInt32ForeignMessage != rhs.mapInt32ForeignMessage {return false}
- if lhs.mapInt32ExplicitForeignMessage != rhs.mapInt32ExplicitForeignMessage {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Proto2NofieldpresenceUnittest_TestProto2Required: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".TestProto2Required"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "proto2"),
- ]
- public var isInitialized: Bool {
- if let v = self._proto2, !v.isInitialized {return false}
- return true
- }
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every case branch when no optimizations are
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
- switch fieldNumber {
- case 1: try { try decoder.decodeSingularMessageField(value: &self._proto2) }()
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every if/case branch local when no optimizations
- // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
- // https://github.com/apple/swift-protobuf/issues/1182
- try { if let v = self._proto2 {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
- } }()
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2NofieldpresenceUnittest_TestProto2Required, rhs: Proto2NofieldpresenceUnittest_TestProto2Required) -> Bool {
- if lhs._proto2 != rhs._proto2 {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Proto2NofieldpresenceUnittest_ForeignMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".ForeignMessage"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "c"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every case branch when no optimizations are
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
- switch fieldNumber {
- case 1: try { try decoder.decodeSingularInt32Field(value: &self.c) }()
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if self.c != 0 {
- try visitor.visitSingularInt32Field(value: self.c, fieldNumber: 1)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2NofieldpresenceUnittest_ForeignMessage, rhs: Proto2NofieldpresenceUnittest_ForeignMessage) -> Bool {
- if lhs.c != rhs.c {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Proto2NofieldpresenceUnittest_ExplicitForeignMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".ExplicitForeignMessage"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "c"),
- ]
- mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
- while let fieldNumber = try decoder.nextFieldNumber() {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every case branch when no optimizations are
- // enabled. https://github.com/apple/swift-protobuf/issues/1034
- switch fieldNumber {
- case 1: try { try decoder.decodeSingularInt32Field(value: &self._c) }()
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- // The use of inline closures is to circumvent an issue where the compiler
- // allocates stack space for every if/case branch local when no optimizations
- // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
- // https://github.com/apple/swift-protobuf/issues/1182
- try { if let v = self._c {
- try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
- } }()
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2NofieldpresenceUnittest_ExplicitForeignMessage, rhs: Proto2NofieldpresenceUnittest_ExplicitForeignMessage) -> Bool {
- if lhs._c != rhs._c {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
|