pluginlib_descriptor_test_import.pb.swift 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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 SwiftProtobuf
  26. // If the compiler emits an error on this type, it is because this file
  27. // was generated by a version of the `protoc` Swift plug-in that is
  28. // incompatible with the version of SwiftProtobuf to which you are linking.
  29. // Please ensure that you are building against the same version of the API
  30. // that was used to generate this file.
  31. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  32. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  33. typealias Version = _2
  34. }
  35. struct SwiftDescriptorTest_Import_Version: Sendable {
  36. // SwiftProtobuf.Message conformance is added in an extension below. See the
  37. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  38. // methods supported on all messages.
  39. var major: Int32 {
  40. get {_major ?? 0}
  41. set {_major = newValue}
  42. }
  43. /// Returns true if `major` has been explicitly set.
  44. var hasMajor: Bool {self._major != nil}
  45. /// Clears the value of `major`. Subsequent reads from it will return its default value.
  46. mutating func clearMajor() {self._major = nil}
  47. var minor: Int32 {
  48. get {_minor ?? 0}
  49. set {_minor = newValue}
  50. }
  51. /// Returns true if `minor` has been explicitly set.
  52. var hasMinor: Bool {self._minor != nil}
  53. /// Clears the value of `minor`. Subsequent reads from it will return its default value.
  54. mutating func clearMinor() {self._minor = nil}
  55. var patch: Int32 {
  56. get {_patch ?? 0}
  57. set {_patch = newValue}
  58. }
  59. /// Returns true if `patch` has been explicitly set.
  60. var hasPatch: Bool {self._patch != nil}
  61. /// Clears the value of `patch`. Subsequent reads from it will return its default value.
  62. mutating func clearPatch() {self._patch = nil}
  63. var suffix: String {
  64. get {_suffix ?? String()}
  65. set {_suffix = newValue}
  66. }
  67. /// Returns true if `suffix` has been explicitly set.
  68. var hasSuffix: Bool {self._suffix != nil}
  69. /// Clears the value of `suffix`. Subsequent reads from it will return its default value.
  70. mutating func clearSuffix() {self._suffix = nil}
  71. var unknownFields = SwiftProtobuf.UnknownStorage()
  72. init() {}
  73. fileprivate var _major: Int32? = nil
  74. fileprivate var _minor: Int32? = nil
  75. fileprivate var _patch: Int32? = nil
  76. fileprivate var _suffix: String? = nil
  77. }
  78. struct SwiftDescriptorTest_Import_ExtendableOne: SwiftProtobuf.ExtensibleMessage, Sendable {
  79. // SwiftProtobuf.Message conformance is added in an extension below. See the
  80. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  81. // methods supported on all messages.
  82. var subMsgField: SwiftDescriptorTest_Import_ExtendableOne.ExtendableTwo {
  83. get {_subMsgField ?? SwiftDescriptorTest_Import_ExtendableOne.ExtendableTwo()}
  84. set {_subMsgField = newValue}
  85. }
  86. /// Returns true if `subMsgField` has been explicitly set.
  87. var hasSubMsgField: Bool {self._subMsgField != nil}
  88. /// Clears the value of `subMsgField`. Subsequent reads from it will return its default value.
  89. mutating func clearSubMsgField() {self._subMsgField = nil}
  90. var unknownFields = SwiftProtobuf.UnknownStorage()
  91. struct ExtendableTwo: SwiftProtobuf.ExtensibleMessage, Sendable {
  92. // SwiftProtobuf.Message conformance is added in an extension below. See the
  93. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  94. // methods supported on all messages.
  95. var unknownFields = SwiftProtobuf.UnknownStorage()
  96. init() {}
  97. var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet()
  98. }
  99. init() {}
  100. var _protobuf_extensionFieldValues = SwiftProtobuf.ExtensionFieldValueSet()
  101. fileprivate var _subMsgField: SwiftDescriptorTest_Import_ExtendableOne.ExtendableTwo? = nil
  102. }
  103. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  104. fileprivate let _protobuf_package = "swift_descriptor_test.import"
  105. extension SwiftDescriptorTest_Import_Version: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  106. static let protoMessageName: String = _protobuf_package + ".Version"
  107. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}major\0\u{1}minor\0\u{1}patch\0\u{1}suffix\0")
  108. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  109. while let fieldNumber = try decoder.nextFieldNumber() {
  110. // The use of inline closures is to circumvent an issue where the compiler
  111. // allocates stack space for every case branch when no optimizations are
  112. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  113. switch fieldNumber {
  114. case 1: try { try decoder.decodeSingularInt32Field(value: &self._major) }()
  115. case 2: try { try decoder.decodeSingularInt32Field(value: &self._minor) }()
  116. case 3: try { try decoder.decodeSingularInt32Field(value: &self._patch) }()
  117. case 4: try { try decoder.decodeSingularStringField(value: &self._suffix) }()
  118. default: break
  119. }
  120. }
  121. }
  122. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  123. // The use of inline closures is to circumvent an issue where the compiler
  124. // allocates stack space for every if/case branch local when no optimizations
  125. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  126. // https://github.com/apple/swift-protobuf/issues/1182
  127. try { if let v = self._major {
  128. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  129. } }()
  130. try { if let v = self._minor {
  131. try visitor.visitSingularInt32Field(value: v, fieldNumber: 2)
  132. } }()
  133. try { if let v = self._patch {
  134. try visitor.visitSingularInt32Field(value: v, fieldNumber: 3)
  135. } }()
  136. try { if let v = self._suffix {
  137. try visitor.visitSingularStringField(value: v, fieldNumber: 4)
  138. } }()
  139. try unknownFields.traverse(visitor: &visitor)
  140. }
  141. static func ==(lhs: SwiftDescriptorTest_Import_Version, rhs: SwiftDescriptorTest_Import_Version) -> Bool {
  142. if lhs._major != rhs._major {return false}
  143. if lhs._minor != rhs._minor {return false}
  144. if lhs._patch != rhs._patch {return false}
  145. if lhs._suffix != rhs._suffix {return false}
  146. if lhs.unknownFields != rhs.unknownFields {return false}
  147. return true
  148. }
  149. }
  150. extension SwiftDescriptorTest_Import_ExtendableOne: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  151. static let protoMessageName: String = _protobuf_package + ".ExtendableOne"
  152. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}sub_msg_field\0")
  153. public var isInitialized: Bool {
  154. if !_protobuf_extensionFieldValues.isInitialized {return false}
  155. if let v = self._subMsgField, !v.isInitialized {return false}
  156. return true
  157. }
  158. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  159. while let fieldNumber = try decoder.nextFieldNumber() {
  160. // The use of inline closures is to circumvent an issue where the compiler
  161. // allocates stack space for every case branch when no optimizations are
  162. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  163. switch fieldNumber {
  164. case 1: try { try decoder.decodeSingularMessageField(value: &self._subMsgField) }()
  165. case 1000..<536870912:
  166. try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftDescriptorTest_Import_ExtendableOne.self, fieldNumber: fieldNumber) }()
  167. default: break
  168. }
  169. }
  170. }
  171. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  172. // The use of inline closures is to circumvent an issue where the compiler
  173. // allocates stack space for every if/case branch local when no optimizations
  174. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  175. // https://github.com/apple/swift-protobuf/issues/1182
  176. try { if let v = self._subMsgField {
  177. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  178. } }()
  179. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912)
  180. try unknownFields.traverse(visitor: &visitor)
  181. }
  182. static func ==(lhs: SwiftDescriptorTest_Import_ExtendableOne, rhs: SwiftDescriptorTest_Import_ExtendableOne) -> Bool {
  183. if lhs._subMsgField != rhs._subMsgField {return false}
  184. if lhs.unknownFields != rhs.unknownFields {return false}
  185. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  186. return true
  187. }
  188. }
  189. extension SwiftDescriptorTest_Import_ExtendableOne.ExtendableTwo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  190. static let protoMessageName: String = SwiftDescriptorTest_Import_ExtendableOne.protoMessageName + ".ExtendableTwo"
  191. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  192. public var isInitialized: Bool {
  193. if !_protobuf_extensionFieldValues.isInitialized {return false}
  194. return true
  195. }
  196. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  197. while let fieldNumber = try decoder.nextFieldNumber() {
  198. if (1000 <= fieldNumber && fieldNumber < 536870912) {
  199. try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftDescriptorTest_Import_ExtendableOne.ExtendableTwo.self, fieldNumber: fieldNumber)
  200. }
  201. }
  202. }
  203. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  204. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912)
  205. try unknownFields.traverse(visitor: &visitor)
  206. }
  207. static func ==(lhs: SwiftDescriptorTest_Import_ExtendableOne.ExtendableTwo, rhs: SwiftDescriptorTest_Import_ExtendableOne.ExtendableTwo) -> Bool {
  208. if lhs.unknownFields != rhs.unknownFields {return false}
  209. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  210. return true
  211. }
  212. }