pluginlib_descriptor_delimited.pb.swift 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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_delimited.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Protos/pluginlib_descriptor_test.proto - test proto
  11. //
  12. // This source file is part of the Swift.org open source project
  13. //
  14. // Copyright (c) 2014 - 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_EditionsMessageForDelimited: @unchecked 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 scalarField: Int32 {
  40. get {return _storage._scalarField ?? 0}
  41. set {_uniqueStorage()._scalarField = newValue}
  42. }
  43. /// Returns true if `scalarField` has been explicitly set.
  44. var hasScalarField: Bool {return _storage._scalarField != nil}
  45. /// Clears the value of `scalarField`. Subsequent reads from it will return its default value.
  46. mutating func clearScalarField() {_uniqueStorage()._scalarField = nil}
  47. var mapField: Dictionary<Int32,String> {
  48. get {return _storage._mapField}
  49. set {_uniqueStorage()._mapField = newValue}
  50. }
  51. var messageMapField: Dictionary<Int32,SwiftDescriptorTest_EditionsMessageForDelimited> {
  52. get {return _storage._messageMapField}
  53. set {_uniqueStorage()._messageMapField = newValue}
  54. }
  55. var delimitedField: SwiftDescriptorTest_EditionsMessageForDelimited {
  56. get {return _storage._delimitedField ?? SwiftDescriptorTest_EditionsMessageForDelimited()}
  57. set {_uniqueStorage()._delimitedField = newValue}
  58. }
  59. /// Returns true if `delimitedField` has been explicitly set.
  60. var hasDelimitedField: Bool {return _storage._delimitedField != nil}
  61. /// Clears the value of `delimitedField`. Subsequent reads from it will return its default value.
  62. mutating func clearDelimitedField() {_uniqueStorage()._delimitedField = nil}
  63. var lengthPrefixedField: SwiftDescriptorTest_EditionsMessageForDelimited {
  64. get {return _storage._lengthPrefixedField ?? SwiftDescriptorTest_EditionsMessageForDelimited()}
  65. set {_uniqueStorage()._lengthPrefixedField = newValue}
  66. }
  67. /// Returns true if `lengthPrefixedField` has been explicitly set.
  68. var hasLengthPrefixedField: Bool {return _storage._lengthPrefixedField != nil}
  69. /// Clears the value of `lengthPrefixedField`. Subsequent reads from it will return its default value.
  70. mutating func clearLengthPrefixedField() {_uniqueStorage()._lengthPrefixedField = nil}
  71. var unknownFields = SwiftProtobuf.UnknownStorage()
  72. init() {}
  73. fileprivate var _storage = _StorageClass.defaultInstance
  74. }
  75. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  76. fileprivate let _protobuf_package = "swift_descriptor_test"
  77. extension SwiftDescriptorTest_EditionsMessageForDelimited: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  78. static let protoMessageName: String = _protobuf_package + ".EditionsMessageForDelimited"
  79. static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
  80. 1: .standard(proto: "scalar_field"),
  81. 2: .standard(proto: "map_field"),
  82. 3: .standard(proto: "message_map_field"),
  83. 4: .standard(proto: "delimited_field"),
  84. 5: .standard(proto: "length_prefixed_field"),
  85. ]
  86. fileprivate class _StorageClass {
  87. var _scalarField: Int32? = nil
  88. var _mapField: Dictionary<Int32,String> = [:]
  89. var _messageMapField: Dictionary<Int32,SwiftDescriptorTest_EditionsMessageForDelimited> = [:]
  90. var _delimitedField: SwiftDescriptorTest_EditionsMessageForDelimited? = nil
  91. var _lengthPrefixedField: SwiftDescriptorTest_EditionsMessageForDelimited? = nil
  92. #if swift(>=5.10)
  93. // This property is used as the initial default value for new instances of the type.
  94. // The type itself is protecting the reference to its storage via CoW semantics.
  95. // This will force a copy to be made of this reference when the first mutation occurs;
  96. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  97. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  98. #else
  99. static let defaultInstance = _StorageClass()
  100. #endif
  101. private init() {}
  102. init(copying source: _StorageClass) {
  103. _scalarField = source._scalarField
  104. _mapField = source._mapField
  105. _messageMapField = source._messageMapField
  106. _delimitedField = source._delimitedField
  107. _lengthPrefixedField = source._lengthPrefixedField
  108. }
  109. }
  110. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  111. if !isKnownUniquelyReferenced(&_storage) {
  112. _storage = _StorageClass(copying: _storage)
  113. }
  114. return _storage
  115. }
  116. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  117. _ = _uniqueStorage()
  118. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  119. while let fieldNumber = try decoder.nextFieldNumber() {
  120. // The use of inline closures is to circumvent an issue where the compiler
  121. // allocates stack space for every case branch when no optimizations are
  122. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  123. switch fieldNumber {
  124. case 1: try { try decoder.decodeSingularInt32Field(value: &_storage._scalarField) }()
  125. case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufString>.self, value: &_storage._mapField) }()
  126. case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,SwiftDescriptorTest_EditionsMessageForDelimited>.self, value: &_storage._messageMapField) }()
  127. case 4: try { try decoder.decodeSingularGroupField(value: &_storage._delimitedField) }()
  128. case 5: try { try decoder.decodeSingularMessageField(value: &_storage._lengthPrefixedField) }()
  129. default: break
  130. }
  131. }
  132. }
  133. }
  134. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  135. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  136. // The use of inline closures is to circumvent an issue where the compiler
  137. // allocates stack space for every if/case branch local when no optimizations
  138. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  139. // https://github.com/apple/swift-protobuf/issues/1182
  140. try { if let v = _storage._scalarField {
  141. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  142. } }()
  143. if !_storage._mapField.isEmpty {
  144. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufString>.self, value: _storage._mapField, fieldNumber: 2)
  145. }
  146. if !_storage._messageMapField.isEmpty {
  147. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,SwiftDescriptorTest_EditionsMessageForDelimited>.self, value: _storage._messageMapField, fieldNumber: 3)
  148. }
  149. try { if let v = _storage._delimitedField {
  150. try visitor.visitSingularGroupField(value: v, fieldNumber: 4)
  151. } }()
  152. try { if let v = _storage._lengthPrefixedField {
  153. try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
  154. } }()
  155. }
  156. try unknownFields.traverse(visitor: &visitor)
  157. }
  158. static func ==(lhs: SwiftDescriptorTest_EditionsMessageForDelimited, rhs: SwiftDescriptorTest_EditionsMessageForDelimited) -> Bool {
  159. if lhs._storage !== rhs._storage {
  160. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  161. let _storage = _args.0
  162. let rhs_storage = _args.1
  163. if _storage._scalarField != rhs_storage._scalarField {return false}
  164. if _storage._mapField != rhs_storage._mapField {return false}
  165. if _storage._messageMapField != rhs_storage._messageMapField {return false}
  166. if _storage._delimitedField != rhs_storage._delimitedField {return false}
  167. if _storage._lengthPrefixedField != rhs_storage._lengthPrefixedField {return false}
  168. return true
  169. }
  170. if !storagesAreEqual {return false}
  171. }
  172. if lhs.unknownFields != rhs.unknownFields {return false}
  173. return true
  174. }
  175. }