a.pb.swift 5.7 KB

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