|
| 1 | +// DO NOT EDIT. |
| 2 | +// swift-format-ignore-file |
| 3 | +// swiftlint:disable all |
| 4 | +// |
| 5 | +// Generated by the Swift generator plugin for the protocol buffer compiler. |
| 6 | +// Source: pluginlib_descriptor_test_import.proto |
| 7 | +// |
| 8 | +// For information on using the generated types, please see the documentation: |
| 9 | +// https://github.com/apple/swift-protobuf/ |
| 10 | + |
| 11 | +// Protos/SwiftProtobufPluginLibraryTests/pluginlib_descriptor_test_import.proto - test proto |
| 12 | +// |
| 13 | +// This source file is part of the Swift.org open source project |
| 14 | +// |
| 15 | +// Copyright (c) 2024 Apple Inc. and the Swift project authors |
| 16 | +// Licensed under Apache License v2.0 with Runtime Library Exception |
| 17 | +// |
| 18 | +// See http://swift.org/LICENSE.txt for license information |
| 19 | +// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors |
| 20 | +// |
| 21 | +// ----------------------------------------------------------------------------- |
| 22 | +/// |
| 23 | +/// Test proto for Tests/SwiftProtobufPluginLibraryTests/Test_Descriptor.swift |
| 24 | +/// |
| 25 | +// ----------------------------------------------------------------------------- |
| 26 | + |
| 27 | +import Foundation |
| 28 | +import SwiftProtobuf |
| 29 | + |
| 30 | +// If the compiler emits an error on this type, it is because this file |
| 31 | +// was generated by a version of the `protoc` Swift plug-in that is |
| 32 | +// incompatible with the version of SwiftProtobuf to which you are linking. |
| 33 | +// Please ensure that you are building against the same version of the API |
| 34 | +// that was used to generate this file. |
| 35 | +fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { |
| 36 | + struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} |
| 37 | + typealias Version = _2 |
| 38 | +} |
| 39 | + |
| 40 | +struct SwiftDescriptorTest_Import_Version: Sendable { |
| 41 | + // SwiftProtobuf.Message conformance is added in an extension below. See the |
| 42 | + // `Message` and `Message+*Additions` files in the SwiftProtobuf library for |
| 43 | + // methods supported on all messages. |
| 44 | + |
| 45 | + var major: Int32 { |
| 46 | + get {return _major ?? 0} |
| 47 | + set {_major = newValue} |
| 48 | + } |
| 49 | + /// Returns true if `major` has been explicitly set. |
| 50 | + var hasMajor: Bool {return self._major != nil} |
| 51 | + /// Clears the value of `major`. Subsequent reads from it will return its default value. |
| 52 | + mutating func clearMajor() {self._major = nil} |
| 53 | + |
| 54 | + var minor: Int32 { |
| 55 | + get {return _minor ?? 0} |
| 56 | + set {_minor = newValue} |
| 57 | + } |
| 58 | + /// Returns true if `minor` has been explicitly set. |
| 59 | + var hasMinor: Bool {return self._minor != nil} |
| 60 | + /// Clears the value of `minor`. Subsequent reads from it will return its default value. |
| 61 | + mutating func clearMinor() {self._minor = nil} |
| 62 | + |
| 63 | + var patch: Int32 { |
| 64 | + get {return _patch ?? 0} |
| 65 | + set {_patch = newValue} |
| 66 | + } |
| 67 | + /// Returns true if `patch` has been explicitly set. |
| 68 | + var hasPatch: Bool {return self._patch != nil} |
| 69 | + /// Clears the value of `patch`. Subsequent reads from it will return its default value. |
| 70 | + mutating func clearPatch() {self._patch = nil} |
| 71 | + |
| 72 | + var suffix: String { |
| 73 | + get {return _suffix ?? String()} |
| 74 | + set {_suffix = newValue} |
| 75 | + } |
| 76 | + /// Returns true if `suffix` has been explicitly set. |
| 77 | + var hasSuffix: Bool {return self._suffix != nil} |
| 78 | + /// Clears the value of `suffix`. Subsequent reads from it will return its default value. |
| 79 | + mutating func clearSuffix() {self._suffix = nil} |
| 80 | + |
| 81 | + var unknownFields = SwiftProtobuf.UnknownStorage() |
| 82 | + |
| 83 | + init() {} |
| 84 | + |
| 85 | + fileprivate var _major: Int32? = nil |
| 86 | + fileprivate var _minor: Int32? = nil |
| 87 | + fileprivate var _patch: Int32? = nil |
| 88 | + fileprivate var _suffix: String? = nil |
| 89 | +} |
| 90 | + |
| 91 | +// MARK: - Code below here is support for the SwiftProtobuf runtime. |
| 92 | + |
| 93 | +fileprivate let _protobuf_package = "swift_descriptor_test.import" |
| 94 | + |
| 95 | +extension SwiftDescriptorTest_Import_Version: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { |
| 96 | + static let protoMessageName: String = _protobuf_package + ".Version" |
| 97 | + static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ |
| 98 | + 1: .same(proto: "major"), |
| 99 | + 2: .same(proto: "minor"), |
| 100 | + 3: .same(proto: "patch"), |
| 101 | + 4: .same(proto: "suffix"), |
| 102 | + ] |
| 103 | + |
| 104 | + mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws { |
| 105 | + while let fieldNumber = try decoder.nextFieldNumber() { |
| 106 | + // The use of inline closures is to circumvent an issue where the compiler |
| 107 | + // allocates stack space for every case branch when no optimizations are |
| 108 | + // enabled. https://github.com/apple/swift-protobuf/issues/1034 |
| 109 | + switch fieldNumber { |
| 110 | + case 1: try { try decoder.decodeSingularInt32Field(value: &self._major) }() |
| 111 | + case 2: try { try decoder.decodeSingularInt32Field(value: &self._minor) }() |
| 112 | + case 3: try { try decoder.decodeSingularInt32Field(value: &self._patch) }() |
| 113 | + case 4: try { try decoder.decodeSingularStringField(value: &self._suffix) }() |
| 114 | + default: break |
| 115 | + } |
| 116 | + } |
| 117 | + } |
| 118 | + |
| 119 | + func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws { |
| 120 | + // The use of inline closures is to circumvent an issue where the compiler |
| 121 | + // allocates stack space for every if/case branch local when no optimizations |
| 122 | + // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and |
| 123 | + // https://github.com/apple/swift-protobuf/issues/1182 |
| 124 | + try { if let v = self._major { |
| 125 | + try visitor.visitSingularInt32Field(value: v, fieldNumber: 1) |
| 126 | + } }() |
| 127 | + try { if let v = self._minor { |
| 128 | + try visitor.visitSingularInt32Field(value: v, fieldNumber: 2) |
| 129 | + } }() |
| 130 | + try { if let v = self._patch { |
| 131 | + try visitor.visitSingularInt32Field(value: v, fieldNumber: 3) |
| 132 | + } }() |
| 133 | + try { if let v = self._suffix { |
| 134 | + try visitor.visitSingularStringField(value: v, fieldNumber: 4) |
| 135 | + } }() |
| 136 | + try unknownFields.traverse(visitor: &visitor) |
| 137 | + } |
| 138 | + |
| 139 | + static func ==(lhs: SwiftDescriptorTest_Import_Version, rhs: SwiftDescriptorTest_Import_Version) -> Bool { |
| 140 | + if lhs._major != rhs._major {return false} |
| 141 | + if lhs._minor != rhs._minor {return false} |
| 142 | + if lhs._patch != rhs._patch {return false} |
| 143 | + if lhs._suffix != rhs._suffix {return false} |
| 144 | + if lhs.unknownFields != rhs.unknownFields {return false} |
| 145 | + return true |
| 146 | + } |
| 147 | +} |
0 commit comments