pluginlib_descriptor_test_import.pb.swift 5.8 KB

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