pluginlib_descriptor_test_import.pb.swift 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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 {return _major ?? 0}
  41. set {_major = newValue}
  42. }
  43. /// Returns true if `major` has been explicitly set.
  44. var hasMajor: Bool {return 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 {return _minor ?? 0}
  49. set {_minor = newValue}
  50. }
  51. /// Returns true if `minor` has been explicitly set.
  52. var hasMinor: Bool {return 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 {return _patch ?? 0}
  57. set {_patch = newValue}
  58. }
  59. /// Returns true if `patch` has been explicitly set.
  60. var hasPatch: Bool {return 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 {return _suffix ?? String()}
  65. set {_suffix = newValue}
  66. }
  67. /// Returns true if `suffix` has been explicitly set.
  68. var hasSuffix: Bool {return 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 {return _subMsgField ?? SwiftDescriptorTest_Import_ExtendableOne.ExtendableTwo()}
  84. set {_subMsgField = newValue}
  85. }
  86. /// Returns true if `subMsgField` has been explicitly set.
  87. var hasSubMsgField: Bool {return 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 = [
  108. 1: .same(proto: "major"),
  109. 2: .same(proto: "minor"),
  110. 3: .same(proto: "patch"),
  111. 4: .same(proto: "suffix"),
  112. ]
  113. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  114. while let fieldNumber = try decoder.nextFieldNumber() {
  115. // The use of inline closures is to circumvent an issue where the compiler
  116. // allocates stack space for every case branch when no optimizations are
  117. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  118. switch fieldNumber {
  119. case 1: try { try decoder.decodeSingularInt32Field(value: &self._major) }()
  120. case 2: try { try decoder.decodeSingularInt32Field(value: &self._minor) }()
  121. case 3: try { try decoder.decodeSingularInt32Field(value: &self._patch) }()
  122. case 4: try { try decoder.decodeSingularStringField(value: &self._suffix) }()
  123. default: break
  124. }
  125. }
  126. }
  127. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  128. // The use of inline closures is to circumvent an issue where the compiler
  129. // allocates stack space for every if/case branch local when no optimizations
  130. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  131. // https://github.com/apple/swift-protobuf/issues/1182
  132. try { if let v = self._major {
  133. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  134. } }()
  135. try { if let v = self._minor {
  136. try visitor.visitSingularInt32Field(value: v, fieldNumber: 2)
  137. } }()
  138. try { if let v = self._patch {
  139. try visitor.visitSingularInt32Field(value: v, fieldNumber: 3)
  140. } }()
  141. try { if let v = self._suffix {
  142. try visitor.visitSingularStringField(value: v, fieldNumber: 4)
  143. } }()
  144. try unknownFields.traverse(visitor: &visitor)
  145. }
  146. static func ==(lhs: SwiftDescriptorTest_Import_Version, rhs: SwiftDescriptorTest_Import_Version) -> Bool {
  147. if lhs._major != rhs._major {return false}
  148. if lhs._minor != rhs._minor {return false}
  149. if lhs._patch != rhs._patch {return false}
  150. if lhs._suffix != rhs._suffix {return false}
  151. if lhs.unknownFields != rhs.unknownFields {return false}
  152. return true
  153. }
  154. }
  155. extension SwiftDescriptorTest_Import_ExtendableOne: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  156. static let protoMessageName: String = _protobuf_package + ".ExtendableOne"
  157. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  158. 1: .standard(proto: "sub_msg_field"),
  159. ]
  160. public var isInitialized: Bool {
  161. if !_protobuf_extensionFieldValues.isInitialized {return false}
  162. if let v = self._subMsgField, !v.isInitialized {return false}
  163. return true
  164. }
  165. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  166. while let fieldNumber = try decoder.nextFieldNumber() {
  167. // The use of inline closures is to circumvent an issue where the compiler
  168. // allocates stack space for every case branch when no optimizations are
  169. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  170. switch fieldNumber {
  171. case 1: try { try decoder.decodeSingularMessageField(value: &self._subMsgField) }()
  172. case 1000..<536870912:
  173. try { try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftDescriptorTest_Import_ExtendableOne.self, fieldNumber: fieldNumber) }()
  174. default: break
  175. }
  176. }
  177. }
  178. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  179. // The use of inline closures is to circumvent an issue where the compiler
  180. // allocates stack space for every if/case branch local when no optimizations
  181. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  182. // https://github.com/apple/swift-protobuf/issues/1182
  183. try { if let v = self._subMsgField {
  184. try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
  185. } }()
  186. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912)
  187. try unknownFields.traverse(visitor: &visitor)
  188. }
  189. static func ==(lhs: SwiftDescriptorTest_Import_ExtendableOne, rhs: SwiftDescriptorTest_Import_ExtendableOne) -> Bool {
  190. if lhs._subMsgField != rhs._subMsgField {return false}
  191. if lhs.unknownFields != rhs.unknownFields {return false}
  192. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  193. return true
  194. }
  195. }
  196. extension SwiftDescriptorTest_Import_ExtendableOne.ExtendableTwo: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  197. static let protoMessageName: String = SwiftDescriptorTest_Import_ExtendableOne.protoMessageName + ".ExtendableTwo"
  198. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  199. public var isInitialized: Bool {
  200. if !_protobuf_extensionFieldValues.isInitialized {return false}
  201. return true
  202. }
  203. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  204. while let fieldNumber = try decoder.nextFieldNumber() {
  205. if (1000 <= fieldNumber && fieldNumber < 536870912) {
  206. try decoder.decodeExtensionField(values: &_protobuf_extensionFieldValues, messageType: SwiftDescriptorTest_Import_ExtendableOne.ExtendableTwo.self, fieldNumber: fieldNumber)
  207. }
  208. }
  209. }
  210. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  211. try visitor.visitExtensionFields(fields: _protobuf_extensionFieldValues, start: 1000, end: 536870912)
  212. try unknownFields.traverse(visitor: &visitor)
  213. }
  214. static func ==(lhs: SwiftDescriptorTest_Import_ExtendableOne.ExtendableTwo, rhs: SwiftDescriptorTest_Import_ExtendableOne.ExtendableTwo) -> Bool {
  215. if lhs.unknownFields != rhs.unknownFields {return false}
  216. if lhs._protobuf_extensionFieldValues != rhs._protobuf_extensionFieldValues {return false}
  217. return true
  218. }
  219. }