| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825 |
- // 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_mset.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
- // Author: kenton@google.com (Kenton Varda)
- // Based on original Protocol Buffers design by
- // Sanjay Ghemawat, Jeff Dean, and others.
- //
- // This file is similar to unittest_mset_wire_format.proto, but does not
- // have a TestMessageSet, so it can be downgraded to proto1.
- 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
- }
- struct Proto2Unittest_TestMessageSetContainer: 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 messageSet: Proto2WireformatUnittest_TestMessageSet {
- get {return _messageSet ?? Proto2WireformatUnittest_TestMessageSet()}
- set {_messageSet = newValue}
- }
- /// Returns true if `messageSet` has been explicitly set.
- var hasMessageSet: Bool {return self._messageSet != nil}
- /// Clears the value of `messageSet`. Subsequent reads from it will return its default value.
- mutating func clearMessageSet() {self._messageSet = nil}
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- fileprivate var _messageSet: Proto2WireformatUnittest_TestMessageSet? = nil
- }
- struct Proto2Unittest_NestedTestMessageSetContainer: @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.
- var container: Proto2Unittest_TestMessageSetContainer {
- get {return _storage._container ?? Proto2Unittest_TestMessageSetContainer()}
- set {_uniqueStorage()._container = newValue}
- }
- /// Returns true if `container` has been explicitly set.
- var hasContainer: Bool {return _storage._container != nil}
- /// Clears the value of `container`. Subsequent reads from it will return its default value.
- mutating func clearContainer() {_uniqueStorage()._container = nil}
- var child: Proto2Unittest_NestedTestMessageSetContainer {
- get {return _storage._child ?? Proto2Unittest_NestedTestMessageSetContainer()}
- set {_uniqueStorage()._child = newValue}
- }
- /// Returns true if `child` has been explicitly set.
- var hasChild: Bool {return _storage._child != nil}
- /// Clears the value of `child`. Subsequent reads from it will return its default value.
- mutating func clearChild() {_uniqueStorage()._child = nil}
- var lazyChild: Proto2Unittest_NestedTestMessageSetContainer {
- get {return _storage._lazyChild ?? Proto2Unittest_NestedTestMessageSetContainer()}
- set {_uniqueStorage()._lazyChild = newValue}
- }
- /// Returns true if `lazyChild` has been explicitly set.
- var hasLazyChild: Bool {return _storage._lazyChild != nil}
- /// Clears the value of `lazyChild`. Subsequent reads from it will return its default value.
- mutating func clearLazyChild() {_uniqueStorage()._lazyChild = nil}
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- fileprivate var _storage = _StorageClass.defaultInstance
- }
- struct Proto2Unittest_NestedTestInt: @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.
- var a: UInt32 {
- get {return _storage._a ?? 0}
- set {_uniqueStorage()._a = newValue}
- }
- /// Returns true if `a` has been explicitly set.
- var hasA: Bool {return _storage._a != nil}
- /// Clears the value of `a`. Subsequent reads from it will return its default value.
- mutating func clearA() {_uniqueStorage()._a = nil}
- var b: Int32 {
- get {return _storage._b ?? 0}
- set {_uniqueStorage()._b = newValue}
- }
- /// Returns true if `b` has been explicitly set.
- var hasB: Bool {return _storage._b != nil}
- /// Clears the value of `b`. Subsequent reads from it will return its default value.
- mutating func clearB() {_uniqueStorage()._b = nil}
- var child: Proto2Unittest_NestedTestInt {
- get {return _storage._child ?? Proto2Unittest_NestedTestInt()}
- set {_uniqueStorage()._child = newValue}
- }
- /// Returns true if `child` has been explicitly set.
- var hasChild: Bool {return _storage._child != nil}
- /// Clears the value of `child`. Subsequent reads from it will return its default value.
- mutating func clearChild() {_uniqueStorage()._child = nil}
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- fileprivate var _storage = _StorageClass.defaultInstance
- }
- struct Proto2Unittest_TestMessageSetExtension1: 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 i: Int32 {
- get {return _i ?? 0}
- set {_i = newValue}
- }
- /// Returns true if `i` has been explicitly set.
- var hasI: Bool {return self._i != nil}
- /// Clears the value of `i`. Subsequent reads from it will return its default value.
- mutating func clearI() {self._i = nil}
- var recursive: Proto2WireformatUnittest_TestMessageSet {
- get {return _recursive ?? Proto2WireformatUnittest_TestMessageSet()}
- set {_recursive = newValue}
- }
- /// Returns true if `recursive` has been explicitly set.
- var hasRecursive: Bool {return self._recursive != nil}
- /// Clears the value of `recursive`. Subsequent reads from it will return its default value.
- mutating func clearRecursive() {self._recursive = nil}
- var testAliasing: String {
- get {return _testAliasing ?? String()}
- set {_testAliasing = newValue}
- }
- /// Returns true if `testAliasing` has been explicitly set.
- var hasTestAliasing: Bool {return self._testAliasing != nil}
- /// Clears the value of `testAliasing`. Subsequent reads from it will return its default value.
- mutating func clearTestAliasing() {self._testAliasing = nil}
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- fileprivate var _i: Int32? = nil
- fileprivate var _recursive: Proto2WireformatUnittest_TestMessageSet? = nil
- fileprivate var _testAliasing: String? = nil
- }
- struct Proto2Unittest_TestMessageSetExtension2: 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 str: String {
- get {return _str ?? String()}
- set {_str = newValue}
- }
- /// Returns true if `str` has been explicitly set.
- var hasStr: Bool {return self._str != nil}
- /// Clears the value of `str`. Subsequent reads from it will return its default value.
- mutating func clearStr() {self._str = nil}
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- fileprivate var _str: String? = nil
- }
- struct Proto2Unittest_TestMessageSetExtension3: 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 msg: Proto2Unittest_NestedTestInt {
- get {return _msg ?? Proto2Unittest_NestedTestInt()}
- set {_msg = newValue}
- }
- /// Returns true if `msg` has been explicitly set.
- var hasMsg: Bool {return self._msg != nil}
- /// Clears the value of `msg`. Subsequent reads from it will return its default value.
- mutating func clearMsg() {self._msg = nil}
- var requiredInt: Int32 {
- get {return _requiredInt ?? 0}
- set {_requiredInt = newValue}
- }
- /// Returns true if `requiredInt` has been explicitly set.
- var hasRequiredInt: Bool {return self._requiredInt != nil}
- /// Clears the value of `requiredInt`. Subsequent reads from it will return its default value.
- mutating func clearRequiredInt() {self._requiredInt = nil}
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- fileprivate var _msg: Proto2Unittest_NestedTestInt? = nil
- fileprivate var _requiredInt: Int32? = nil
- }
- /// MessageSet wire format is equivalent to this.
- struct Proto2Unittest_RawMessageSet: 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 item: [Proto2Unittest_RawMessageSet.Item] = []
- var unknownFields = SwiftProtobuf.UnknownStorage()
- struct Item: @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.
- var typeID: Int32 {
- get {return _typeID ?? 0}
- set {_typeID = newValue}
- }
- /// Returns true if `typeID` has been explicitly set.
- var hasTypeID: Bool {return self._typeID != nil}
- /// Clears the value of `typeID`. Subsequent reads from it will return its default value.
- mutating func clearTypeID() {self._typeID = nil}
- var message: Data {
- get {return _message ?? Data()}
- set {_message = newValue}
- }
- /// Returns true if `message` has been explicitly set.
- var hasMessage: Bool {return self._message != nil}
- /// Clears the value of `message`. Subsequent reads from it will return its default value.
- mutating func clearMessage() {self._message = nil}
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- fileprivate var _typeID: Int32? = nil
- fileprivate var _message: Data? = nil
- }
- init() {}
- }
- // MARK: - Extension support defined in unittest_mset.proto.
- // MARK: - Extension Properties
- // Swift Extensions on the extended Messages to add easy access to the declared
- // extension fields. The names are based on the extension field name from the proto
- // declaration. To avoid naming collisions, the names are prefixed with the name of
- // the scope where the extend directive occurs.
- extension Proto2WireformatUnittest_TestMessageSet {
- var Proto2Unittest_TestMessageSetExtension1_messageSetExtension: Proto2Unittest_TestMessageSetExtension1 {
- get {return getExtensionValue(ext: Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension) ?? Proto2Unittest_TestMessageSetExtension1()}
- set {setExtensionValue(ext: Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension, value: newValue)}
- }
- /// Returns true if extension `Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension`
- /// has been explicitly set.
- var hasProto2Unittest_TestMessageSetExtension1_messageSetExtension: Bool {
- return hasExtensionValue(ext: Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension)
- }
- /// Clears the value of extension `Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension`.
- /// Subsequent reads from it will return its default value.
- mutating func clearProto2Unittest_TestMessageSetExtension1_messageSetExtension() {
- clearExtensionValue(ext: Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension)
- }
- var Proto2Unittest_TestMessageSetExtension2_messageSetExtension: Proto2Unittest_TestMessageSetExtension2 {
- get {return getExtensionValue(ext: Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension) ?? Proto2Unittest_TestMessageSetExtension2()}
- set {setExtensionValue(ext: Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension, value: newValue)}
- }
- /// Returns true if extension `Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension`
- /// has been explicitly set.
- var hasProto2Unittest_TestMessageSetExtension2_messageSetExtension: Bool {
- return hasExtensionValue(ext: Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension)
- }
- /// Clears the value of extension `Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension`.
- /// Subsequent reads from it will return its default value.
- mutating func clearProto2Unittest_TestMessageSetExtension2_messageSetExtension() {
- clearExtensionValue(ext: Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension)
- }
- var Proto2Unittest_TestMessageSetExtension3_messageSetExtension: Proto2Unittest_TestMessageSetExtension3 {
- get {return getExtensionValue(ext: Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension) ?? Proto2Unittest_TestMessageSetExtension3()}
- set {setExtensionValue(ext: Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension, value: newValue)}
- }
- /// Returns true if extension `Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension`
- /// has been explicitly set.
- var hasProto2Unittest_TestMessageSetExtension3_messageSetExtension: Bool {
- return hasExtensionValue(ext: Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension)
- }
- /// Clears the value of extension `Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension`.
- /// Subsequent reads from it will return its default value.
- mutating func clearProto2Unittest_TestMessageSetExtension3_messageSetExtension() {
- clearExtensionValue(ext: Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension)
- }
- }
- // MARK: - File's ExtensionMap: Proto2Unittest_UnittestMset_Extensions
- /// A `SwiftProtobuf.SimpleExtensionMap` that includes all of the extensions defined by
- /// this .proto file. It can be used any place an `SwiftProtobuf.ExtensionMap` is needed
- /// in parsing, or it can be combined with other `SwiftProtobuf.SimpleExtensionMap`s to create
- /// a larger `SwiftProtobuf.SimpleExtensionMap`.
- let Proto2Unittest_UnittestMset_Extensions: SwiftProtobuf.SimpleExtensionMap = [
- Proto2Unittest_TestMessageSetExtension1.Extensions.message_set_extension,
- Proto2Unittest_TestMessageSetExtension2.Extensions.message_set_extension,
- Proto2Unittest_TestMessageSetExtension3.Extensions.message_set_extension
- ]
- // Extension Objects - The only reason these might be needed is when manually
- // constructing a `SimpleExtensionMap`, otherwise, use the above _Extension Properties_
- // accessors for the extension fields on the messages directly.
- extension Proto2Unittest_TestMessageSetExtension1 {
- enum Extensions {
- static let message_set_extension = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalMessageExtensionField<Proto2Unittest_TestMessageSetExtension1>, Proto2WireformatUnittest_TestMessageSet>(
- _protobuf_fieldNumber: 1545008,
- fieldName: "proto2_unittest.TestMessageSetExtension1"
- )
- }
- }
- extension Proto2Unittest_TestMessageSetExtension2 {
- enum Extensions {
- static let message_set_extension = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalMessageExtensionField<Proto2Unittest_TestMessageSetExtension2>, Proto2WireformatUnittest_TestMessageSet>(
- _protobuf_fieldNumber: 1547769,
- fieldName: "proto2_unittest.TestMessageSetExtension2"
- )
- }
- }
- extension Proto2Unittest_TestMessageSetExtension3 {
- enum Extensions {
- static let message_set_extension = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalMessageExtensionField<Proto2Unittest_TestMessageSetExtension3>, Proto2WireformatUnittest_TestMessageSet>(
- _protobuf_fieldNumber: 195273129,
- fieldName: "proto2_unittest.TestMessageSetExtension3"
- )
- }
- }
- // MARK: - Code below here is support for the SwiftProtobuf runtime.
- fileprivate let _protobuf_package = "proto2_unittest"
- extension Proto2Unittest_TestMessageSetContainer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".TestMessageSetContainer"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .standard(proto: "message_set"),
- ]
- public var isInitialized: Bool {
- if let v = self._messageSet, !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._messageSet) }()
- 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._messageSet {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
- } }()
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2Unittest_TestMessageSetContainer, rhs: Proto2Unittest_TestMessageSetContainer) -> Bool {
- if lhs._messageSet != rhs._messageSet {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Proto2Unittest_NestedTestMessageSetContainer: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".NestedTestMessageSetContainer"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "container"),
- 2: .same(proto: "child"),
- 3: .standard(proto: "lazy_child"),
- ]
- fileprivate class _StorageClass {
- var _container: Proto2Unittest_TestMessageSetContainer? = nil
- var _child: Proto2Unittest_NestedTestMessageSetContainer? = nil
- var _lazyChild: Proto2Unittest_NestedTestMessageSetContainer? = nil
- // 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) {
- _container = source._container
- _child = source._child
- _lazyChild = source._lazyChild
- }
- }
- fileprivate mutating func _uniqueStorage() -> _StorageClass {
- if !isKnownUniquelyReferenced(&_storage) {
- _storage = _StorageClass(copying: _storage)
- }
- return _storage
- }
- public var isInitialized: Bool {
- return withExtendedLifetime(_storage) { (_storage: _StorageClass) in
- if let v = _storage._container, !v.isInitialized {return false}
- if let v = _storage._child, !v.isInitialized {return false}
- if let v = _storage._lazyChild, !v.isInitialized {return false}
- return true
- }
- }
- 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.decodeSingularMessageField(value: &_storage._container) }()
- case 2: try { try decoder.decodeSingularMessageField(value: &_storage._child) }()
- case 3: try { try decoder.decodeSingularMessageField(value: &_storage._lazyChild) }()
- 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
- try { if let v = _storage._container {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
- } }()
- try { if let v = _storage._child {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
- } }()
- try { if let v = _storage._lazyChild {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
- } }()
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2Unittest_NestedTestMessageSetContainer, rhs: Proto2Unittest_NestedTestMessageSetContainer) -> 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._container != rhs_storage._container {return false}
- if _storage._child != rhs_storage._child {return false}
- if _storage._lazyChild != rhs_storage._lazyChild {return false}
- return true
- }
- if !storagesAreEqual {return false}
- }
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Proto2Unittest_NestedTestInt: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".NestedTestInt"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "a"),
- 3: .same(proto: "b"),
- 2: .same(proto: "child"),
- ]
- fileprivate class _StorageClass {
- var _a: UInt32? = nil
- var _b: Int32? = nil
- var _child: Proto2Unittest_NestedTestInt? = nil
- // 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) {
- _a = source._a
- _b = source._b
- _child = source._child
- }
- }
- 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.decodeSingularFixed32Field(value: &_storage._a) }()
- case 2: try { try decoder.decodeSingularMessageField(value: &_storage._child) }()
- case 3: try { try decoder.decodeSingularInt32Field(value: &_storage._b) }()
- 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
- try { if let v = _storage._a {
- try visitor.visitSingularFixed32Field(value: v, fieldNumber: 1)
- } }()
- try { if let v = _storage._child {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
- } }()
- try { if let v = _storage._b {
- try visitor.visitSingularInt32Field(value: v, fieldNumber: 3)
- } }()
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2Unittest_NestedTestInt, rhs: Proto2Unittest_NestedTestInt) -> 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._a != rhs_storage._a {return false}
- if _storage._b != rhs_storage._b {return false}
- if _storage._child != rhs_storage._child {return false}
- return true
- }
- if !storagesAreEqual {return false}
- }
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Proto2Unittest_TestMessageSetExtension1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".TestMessageSetExtension1"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 15: .same(proto: "i"),
- 16: .same(proto: "recursive"),
- 17: .standard(proto: "test_aliasing"),
- ]
- public var isInitialized: Bool {
- if let v = self._recursive, !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 15: try { try decoder.decodeSingularInt32Field(value: &self._i) }()
- case 16: try { try decoder.decodeSingularMessageField(value: &self._recursive) }()
- case 17: try { try decoder.decodeSingularStringField(value: &self._testAliasing) }()
- 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._i {
- try visitor.visitSingularInt32Field(value: v, fieldNumber: 15)
- } }()
- try { if let v = self._recursive {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 16)
- } }()
- try { if let v = self._testAliasing {
- try visitor.visitSingularStringField(value: v, fieldNumber: 17)
- } }()
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2Unittest_TestMessageSetExtension1, rhs: Proto2Unittest_TestMessageSetExtension1) -> Bool {
- if lhs._i != rhs._i {return false}
- if lhs._recursive != rhs._recursive {return false}
- if lhs._testAliasing != rhs._testAliasing {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Proto2Unittest_TestMessageSetExtension2: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".TestMessageSetExtension2"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 25: .same(proto: "str"),
- ]
- 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 25: try { try decoder.decodeSingularStringField(value: &self._str) }()
- 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._str {
- try visitor.visitSingularStringField(value: v, fieldNumber: 25)
- } }()
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2Unittest_TestMessageSetExtension2, rhs: Proto2Unittest_TestMessageSetExtension2) -> Bool {
- if lhs._str != rhs._str {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Proto2Unittest_TestMessageSetExtension3: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".TestMessageSetExtension3"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 35: .same(proto: "msg"),
- 36: .standard(proto: "required_int"),
- ]
- public var isInitialized: Bool {
- if self._requiredInt == nil {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 35: try { try decoder.decodeSingularMessageField(value: &self._msg) }()
- case 36: try { try decoder.decodeSingularInt32Field(value: &self._requiredInt) }()
- 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._msg {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 35)
- } }()
- try { if let v = self._requiredInt {
- try visitor.visitSingularInt32Field(value: v, fieldNumber: 36)
- } }()
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2Unittest_TestMessageSetExtension3, rhs: Proto2Unittest_TestMessageSetExtension3) -> Bool {
- if lhs._msg != rhs._msg {return false}
- if lhs._requiredInt != rhs._requiredInt {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Proto2Unittest_RawMessageSet: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".RawMessageSet"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 1: .same(proto: "item"),
- 1: .unique(proto: "Item", json: "item"),
- ]
- public var isInitialized: Bool {
- if !SwiftProtobuf.Internal.areAllInitialized(self.item) {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.decodeRepeatedGroupField(value: &self.item) }()
- default: break
- }
- }
- }
- func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
- if !self.item.isEmpty {
- try visitor.visitRepeatedGroupField(value: self.item, fieldNumber: 1)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2Unittest_RawMessageSet, rhs: Proto2Unittest_RawMessageSet) -> Bool {
- if lhs.item != rhs.item {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
- extension Proto2Unittest_RawMessageSet.Item: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = Proto2Unittest_RawMessageSet.protoMessageName + ".Item"
- static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
- 2: .standard(proto: "type_id"),
- 3: .same(proto: "message"),
- ]
- public var isInitialized: Bool {
- if self._typeID == nil {return false}
- if self._message == nil {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 2: try { try decoder.decodeSingularInt32Field(value: &self._typeID) }()
- case 3: try { try decoder.decodeSingularBytesField(value: &self._message) }()
- 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._typeID {
- try visitor.visitSingularInt32Field(value: v, fieldNumber: 2)
- } }()
- try { if let v = self._message {
- try visitor.visitSingularBytesField(value: v, fieldNumber: 3)
- } }()
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2Unittest_RawMessageSet.Item, rhs: Proto2Unittest_RawMessageSet.Item) -> Bool {
- if lhs._typeID != rhs._typeID {return false}
- if lhs._message != rhs._message {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
|