uses_a_transitively.pb.swift 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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: Tests/Test1/uses_a_transitively.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. import Foundation
  11. import SwiftProtobuf
  12. import ImportsAPublicly
  13. // If the compiler emits an error on this type, it is because this file
  14. // was generated by a version of the `protoc` Swift plug-in that is
  15. // incompatible with the version of SwiftProtobuf to which you are linking.
  16. // Please ensure that you are building against the same version of the API
  17. // that was used to generate this file.
  18. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  19. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  20. typealias Version = _2
  21. }
  22. public struct UsesATransitively: Sendable {
  23. // SwiftProtobuf.Message conformance is added in an extension below. See the
  24. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  25. // methods supported on all messages.
  26. public var a: ModuleA.A {
  27. get {return _a ?? ModuleA.A()}
  28. set {_a = newValue}
  29. }
  30. /// Returns true if `a` has been explicitly set.
  31. public var hasA: Bool {return self._a != nil}
  32. /// Clears the value of `a`. Subsequent reads from it will return its default value.
  33. public mutating func clearA() {self._a = nil}
  34. public var e: ModuleA.E {
  35. get {return _e ?? .unset}
  36. set {_e = newValue}
  37. }
  38. /// Returns true if `e` has been explicitly set.
  39. public var hasE: Bool {return self._e != nil}
  40. /// Clears the value of `e`. Subsequent reads from it will return its default value.
  41. public mutating func clearE() {self._e = nil}
  42. public var unknownFields = SwiftProtobuf.UnknownStorage()
  43. public init() {}
  44. fileprivate var _a: ModuleA.A? = nil
  45. fileprivate var _e: ModuleA.E? = nil
  46. }
  47. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  48. extension UsesATransitively: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  49. public static let protoMessageName: String = "UsesATransitively"
  50. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  51. 101: .same(proto: "a"),
  52. 102: .same(proto: "e"),
  53. ]
  54. public var isInitialized: Bool {
  55. if let v = self._a, !v.isInitialized {return false}
  56. return true
  57. }
  58. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  59. while let fieldNumber = try decoder.nextFieldNumber() {
  60. // The use of inline closures is to circumvent an issue where the compiler
  61. // allocates stack space for every case branch when no optimizations are
  62. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  63. switch fieldNumber {
  64. case 101: try { try decoder.decodeSingularMessageField(value: &self._a) }()
  65. case 102: try { try decoder.decodeSingularEnumField(value: &self._e) }()
  66. default: break
  67. }
  68. }
  69. }
  70. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  71. // The use of inline closures is to circumvent an issue where the compiler
  72. // allocates stack space for every if/case branch local when no optimizations
  73. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  74. // https://github.com/apple/swift-protobuf/issues/1182
  75. try { if let v = self._a {
  76. try visitor.visitSingularMessageField(value: v, fieldNumber: 101)
  77. } }()
  78. try { if let v = self._e {
  79. try visitor.visitSingularEnumField(value: v, fieldNumber: 102)
  80. } }()
  81. try unknownFields.traverse(visitor: &visitor)
  82. }
  83. public static func ==(lhs: UsesATransitively, rhs: UsesATransitively) -> Bool {
  84. if lhs._a != rhs._a {return false}
  85. if lhs._e != rhs._e {return false}
  86. if lhs.unknownFields != rhs.unknownFields {return false}
  87. return true
  88. }
  89. }