a.pb.swift 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  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: Sources/ModuleA/a.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. import SwiftProtobuf
  11. // If the compiler emits an error on this type, it is because this file
  12. // was generated by a version of the `protoc` Swift plug-in that is
  13. // incompatible with the version of SwiftProtobuf to which you are linking.
  14. // Please ensure that you are building against the same version of the API
  15. // that was used to generate this file.
  16. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  17. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  18. typealias Version = _2
  19. }
  20. public enum E: SwiftProtobuf.Enum, Swift.CaseIterable {
  21. public typealias RawValue = Int
  22. case unset // = 0
  23. case a // = 1
  24. case b // = 2
  25. public init() {
  26. self = .unset
  27. }
  28. public init?(rawValue: Int) {
  29. switch rawValue {
  30. case 0: self = .unset
  31. case 1: self = .a
  32. case 2: self = .b
  33. default: return nil
  34. }
  35. }
  36. public var rawValue: Int {
  37. switch self {
  38. case .unset: return 0
  39. case .a: return 1
  40. case .b: return 2
  41. }
  42. }
  43. }
  44. public struct A: SwiftProtobuf.ExtensibleMessage, Sendable {
  45. // SwiftProtobuf.Message conformance is added in an extension below. See the
  46. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  47. // methods supported on all messages.
  48. public var e: E {
  49. get {return _e ?? .unset}
  50. set {_e = newValue}
  51. }
  52. /// Returns true if `e` has been explicitly set.
  53. public var hasE: Bool {return self._e != nil}
  54. /// Clears the value of `e`. Subsequent reads from it will return its default value.
  55. public mutating func clearE() {self._e = nil}
  56. public var unknownFields = SwiftProtobuf.UnknownStorage()
  57. public init() {}
  58. public var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet()
  59. fileprivate var _e: E? = nil
  60. }
  61. // MARK: - Extension support defined in a.proto.
  62. // MARK: - Extension Properties
  63. // Swift Extensions on the extended Messages to add easy access to the declared
  64. // extension fields. The names are based on the extension field name from the proto
  65. // declaration. To avoid naming collisions, the names are prefixed with the name of
  66. // the scope where the extend directive occurs.
  67. extension A {
  68. public var extStr: String {
  69. get {return getExtensionValue(ext: Extensions_ext_str) ?? String()}
  70. set {setExtensionValue(ext: Extensions_ext_str, value: newValue)}
  71. }
  72. /// Returns true if extension `Extensions_ext_str`
  73. /// has been explicitly set.
  74. public var hasExtStr: Bool {
  75. return hasExtensionValue(ext: Extensions_ext_str)
  76. }
  77. /// Clears the value of extension `Extensions_ext_str`.
  78. /// Subsequent reads from it will return its default value.
  79. public mutating func clearExtStr() {
  80. clearExtensionValue(ext: Extensions_ext_str)
  81. }
  82. }
  83. // MARK: - File's ExtensionMap: A_Extensions
  84. /// A `SwiftProtobuf.SimpleExtensionMap` that includes all of the extensions defined by
  85. /// this .proto file. It can be used any place an `SwiftProtobuf.ExtensionMap` is needed
  86. /// in parsing, or it can be combined with other `SwiftProtobuf.SimpleExtensionMap`s to create
  87. /// a larger `SwiftProtobuf.SimpleExtensionMap`.
  88. public let A_Extensions: SwiftProtobuf.SimpleExtensionMap = [
  89. Extensions_ext_str
  90. ]
  91. // Extension Objects - The only reason these might be needed is when manually
  92. // constructing a `SimpleExtensionMap`, otherwise, use the above _Extension Properties_
  93. // accessors for the extension fields on the messages directly.
  94. public let Extensions_ext_str = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufString>, A>(
  95. _protobuf_fieldNumber: 100,
  96. fieldName: "ext_str"
  97. )
  98. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  99. extension E: SwiftProtobuf._ProtoNameProviding {
  100. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  101. 0: .same(proto: "E_UNSET"),
  102. 1: .same(proto: "E_A"),
  103. 2: .same(proto: "E_B"),
  104. ]
  105. }
  106. extension A: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  107. public static let protoMessageName: String = "A"
  108. public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  109. 1: .same(proto: "e"),
  110. ]
  111. public var isInitialized: Bool {
  112. if !_protobuf_extensionFieldValues.isInitialized {return false}
  113. return true
  114. }
  115. public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  116. while let fieldNumber = try decoder.nextFieldNumber() {
  117. // The use of inline closures is to circumvent an issue where the compiler
  118. // allocates stack space for every case branch when no optimizations are
  119. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  120. switch fieldNumber {
  121. case 1: try { try decoder.decodeSingularEnumField(value: &self._e) }()
  122. case 100..<1001:
  123. try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: A.self, fieldNumber: fieldNumber) }()
  124. default: break
  125. }
  126. }
  127. }
  128. public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  129. // The use of inline closures is to circumvent an issue where the compiler
  130. // allocates stack space for every if/case branch local when no optimizations
  131. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  132. // https://github.com/apple/swift-protobuf/issues/1182
  133. try { if let v = self._e {
  134. try visitor.visitSingularEnumField(value: v, fieldNumber: 1)
  135. } }()
  136. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 100, end: 1001)
  137. try unknownFields.traverse(visitor: &visitor)
  138. }
  139. public static func ==(lhs: A, rhs: A) -> Bool {
  140. if lhs._e != rhs._e {return false}
  141. if lhs.unknownFields != rhs.unknownFields {return false}
  142. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  143. return true
  144. }
  145. }