| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- // DO NOT EDIT.
- // swift-format-ignore-file
- // swiftlint:disable all
- //
- // Generated by the Swift generator plugin for the protocol buffer compiler.
- // Source: google/protobuf/any_test.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
- 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_TestAny: 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 int32Value: Int32 = 0
- var anyValue: SwiftProtobuf.Google_Protobuf_Any {
- get {_anyValue ?? SwiftProtobuf.Google_Protobuf_Any()}
- set {_anyValue = newValue}
- }
- /// Returns true if `anyValue` has been explicitly set.
- var hasAnyValue: Bool {self._anyValue != nil}
- /// Clears the value of `anyValue`. Subsequent reads from it will return its default value.
- mutating func clearAnyValue() {self._anyValue = nil}
- var repeatedAnyValue: [SwiftProtobuf.Google_Protobuf_Any] = []
- var text: String = String()
- var unknownFields = SwiftProtobuf.UnknownStorage()
- init() {}
- fileprivate var _anyValue: SwiftProtobuf.Google_Protobuf_Any? = nil
- }
- // MARK: - Code below here is support for the SwiftProtobuf runtime.
- fileprivate let _protobuf_package = "proto2_unittest"
- extension Proto2Unittest_TestAny: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
- static let protoMessageName: String = _protobuf_package + ".TestAny"
- static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}int32_value\0\u{3}any_value\0\u{3}repeated_any_value\0\u{1}text\0")
- 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.int32Value) }()
- case 2: try { try decoder.decodeSingularMessageField(value: &self._anyValue) }()
- case 3: try { try decoder.decodeRepeatedMessageField(value: &self.repeatedAnyValue) }()
- case 4: try { try decoder.decodeSingularStringField(value: &self.text) }()
- 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
- if self.int32Value != 0 {
- try visitor.visitSingularInt32Field(value: self.int32Value, fieldNumber: 1)
- }
- try { if let v = self._anyValue {
- try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
- } }()
- if !self.repeatedAnyValue.isEmpty {
- try visitor.visitRepeatedMessageField(value: self.repeatedAnyValue, fieldNumber: 3)
- }
- if !self.text.isEmpty {
- try visitor.visitSingularStringField(value: self.text, fieldNumber: 4)
- }
- try unknownFields.traverse(visitor: &visitor)
- }
- static func ==(lhs: Proto2Unittest_TestAny, rhs: Proto2Unittest_TestAny) -> Bool {
- if lhs.int32Value != rhs.int32Value {return false}
- if lhs._anyValue != rhs._anyValue {return false}
- if lhs.repeatedAnyValue != rhs.repeatedAnyValue {return false}
- if lhs.text != rhs.text {return false}
- if lhs.unknownFields != rhs.unknownFields {return false}
- return true
- }
- }
|