pluginlib_descriptor_delimited.pb.swift 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. // This property is used as the initial default value for new instances of the type.
  93. // The type itself is protecting the reference to its storage via CoW semantics.
  94. // This will force a copy to be made of this reference when the first mutation occurs;
  95. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  96. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  97. private init() {}
  98. init(copying source: _StorageClass) {
  99. _scalarField = source._scalarField
  100. _mapField = source._mapField
  101. _messageMapField = source._messageMapField
  102. _delimitedField = source._delimitedField
  103. _lengthPrefixedField = source._lengthPrefixedField
  104. }
  105. }
  106. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  107. if !isKnownUniquelyReferenced(&_storage) {
  108. _storage = _StorageClass(copying: _storage)
  109. }
  110. return _storage
  111. }
  112. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  113. _ = _uniqueStorage()
  114. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  115. while let fieldNumber = try decoder.nextFieldNumber() {
  116. // The use of inline closures is to circumvent an issue where the compiler
  117. // allocates stack space for every case branch when no optimizations are
  118. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  119. switch fieldNumber {
  120. case 1: try { try decoder.decodeSingularInt32Field(value: &_storage._scalarField) }()
  121. case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufString>.self, value: &_storage._mapField) }()
  122. case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,SwiftDescriptorTest_EditionsMessageForDelimited>.self, value: &_storage._messageMapField) }()
  123. case 4: try { try decoder.decodeSingularGroupField(value: &_storage._delimitedField) }()
  124. case 5: try { try decoder.decodeSingularMessageField(value: &_storage._lengthPrefixedField) }()
  125. default: break
  126. }
  127. }
  128. }
  129. }
  130. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  131. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  132. // The use of inline closures is to circumvent an issue where the compiler
  133. // allocates stack space for every if/case branch local when no optimizations
  134. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  135. // https://github.com/apple/swift-protobuf/issues/1182
  136. try { if let v = _storage._scalarField {
  137. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  138. } }()
  139. if !_storage._mapField.isEmpty {
  140. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufString>.self, value: _storage._mapField, fieldNumber: 2)
  141. }
  142. if !_storage._messageMapField.isEmpty {
  143. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,SwiftDescriptorTest_EditionsMessageForDelimited>.self, value: _storage._messageMapField, fieldNumber: 3)
  144. }
  145. try { if let v = _storage._delimitedField {
  146. try visitor.visitSingularGroupField(value: v, fieldNumber: 4)
  147. } }()
  148. try { if let v = _storage._lengthPrefixedField {
  149. try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
  150. } }()
  151. }
  152. try unknownFields.traverse(visitor: &visitor)
  153. }
  154. static func ==(lhs: SwiftDescriptorTest_EditionsMessageForDelimited, rhs: SwiftDescriptorTest_EditionsMessageForDelimited) -> Bool {
  155. if lhs._storage !== rhs._storage {
  156. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  157. let _storage = _args.0
  158. let rhs_storage = _args.1
  159. if _storage._scalarField != rhs_storage._scalarField {return false}
  160. if _storage._mapField != rhs_storage._mapField {return false}
  161. if _storage._messageMapField != rhs_storage._messageMapField {return false}
  162. if _storage._delimitedField != rhs_storage._delimitedField {return false}
  163. if _storage._lengthPrefixedField != rhs_storage._lengthPrefixedField {return false}
  164. return true
  165. }
  166. if !storagesAreEqual {return false}
  167. }
  168. if lhs.unknownFields != rhs.unknownFields {return false}
  169. return true
  170. }
  171. }