pluginlib_descriptor_delimited.pb.swift 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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 {_storage._scalarField ?? 0}
  41. set {_uniqueStorage()._scalarField = newValue}
  42. }
  43. /// Returns true if `scalarField` has been explicitly set.
  44. var hasScalarField: Bool {_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 {_storage._mapField}
  49. set {_uniqueStorage()._mapField = newValue}
  50. }
  51. var messageMapField: Dictionary<Int32,SwiftDescriptorTest_EditionsMessageForDelimited> {
  52. get {_storage._messageMapField}
  53. set {_uniqueStorage()._messageMapField = newValue}
  54. }
  55. var delimitedField: SwiftDescriptorTest_EditionsMessageForDelimited {
  56. get {_storage._delimitedField ?? SwiftDescriptorTest_EditionsMessageForDelimited()}
  57. set {_uniqueStorage()._delimitedField = newValue}
  58. }
  59. /// Returns true if `delimitedField` has been explicitly set.
  60. var hasDelimitedField: Bool {_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 {_storage._lengthPrefixedField ?? SwiftDescriptorTest_EditionsMessageForDelimited()}
  65. set {_uniqueStorage()._lengthPrefixedField = newValue}
  66. }
  67. /// Returns true if `lengthPrefixedField` has been explicitly set.
  68. var hasLengthPrefixedField: Bool {_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(bytecode: "\0\u{3}scalar_field\0\u{3}map_field\0\u{3}message_map_field\0\u{3}delimited_field\0\u{3}length_prefixed_field\0")
  80. fileprivate class _StorageClass {
  81. var _scalarField: Int32? = nil
  82. var _mapField: Dictionary<Int32,String> = [:]
  83. var _messageMapField: Dictionary<Int32,SwiftDescriptorTest_EditionsMessageForDelimited> = [:]
  84. var _delimitedField: SwiftDescriptorTest_EditionsMessageForDelimited? = nil
  85. var _lengthPrefixedField: SwiftDescriptorTest_EditionsMessageForDelimited? = nil
  86. // This property is used as the initial default value for new instances of the type.
  87. // The type itself is protecting the reference to its storage via CoW semantics.
  88. // This will force a copy to be made of this reference when the first mutation occurs;
  89. // hence, it is safe to mark this as `nonisolated(unsafe)`.
  90. static nonisolated(unsafe) let defaultInstance = _StorageClass()
  91. private init() {}
  92. init(copying source: _StorageClass) {
  93. _scalarField = source._scalarField
  94. _mapField = source._mapField
  95. _messageMapField = source._messageMapField
  96. _delimitedField = source._delimitedField
  97. _lengthPrefixedField = source._lengthPrefixedField
  98. }
  99. }
  100. fileprivate mutating func _uniqueStorage() -> _StorageClass {
  101. if !isKnownUniquelyReferenced(&_storage) {
  102. _storage = _StorageClass(copying: _storage)
  103. }
  104. return _storage
  105. }
  106. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  107. _ = _uniqueStorage()
  108. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  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: &_storage._scalarField) }()
  115. case 2: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufString>.self, value: &_storage._mapField) }()
  116. case 3: try { try decoder.decodeMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,SwiftDescriptorTest_EditionsMessageForDelimited>.self, value: &_storage._messageMapField) }()
  117. case 4: try { try decoder.decodeSingularGroupField(value: &_storage._delimitedField) }()
  118. case 5: try { try decoder.decodeSingularMessageField(value: &_storage._lengthPrefixedField) }()
  119. default: break
  120. }
  121. }
  122. }
  123. }
  124. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  125. try withExtendedLifetime(_storage) { (_storage: _StorageClass) in
  126. // The use of inline closures is to circumvent an issue where the compiler
  127. // allocates stack space for every if/case branch local when no optimizations
  128. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  129. // https://github.com/apple/swift-protobuf/issues/1182
  130. try { if let v = _storage._scalarField {
  131. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  132. } }()
  133. if !_storage._mapField.isEmpty {
  134. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMap<SwiftProtobuf.ProtobufInt32,SwiftProtobuf.ProtobufString>.self, value: _storage._mapField, fieldNumber: 2)
  135. }
  136. if !_storage._messageMapField.isEmpty {
  137. try visitor.visitMapField(fieldType: SwiftProtobuf._ProtobufMessageMap<SwiftProtobuf.ProtobufInt32,SwiftDescriptorTest_EditionsMessageForDelimited>.self, value: _storage._messageMapField, fieldNumber: 3)
  138. }
  139. try { if let v = _storage._delimitedField {
  140. try visitor.visitSingularGroupField(value: v, fieldNumber: 4)
  141. } }()
  142. try { if let v = _storage._lengthPrefixedField {
  143. try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
  144. } }()
  145. }
  146. try unknownFields.traverse(visitor: &visitor)
  147. }
  148. static func ==(lhs: SwiftDescriptorTest_EditionsMessageForDelimited, rhs: SwiftDescriptorTest_EditionsMessageForDelimited) -> Bool {
  149. if lhs._storage !== rhs._storage {
  150. let storagesAreEqual: Bool = withExtendedLifetime((lhs._storage, rhs._storage)) { (_args: (_StorageClass, _StorageClass)) in
  151. let _storage = _args.0
  152. let rhs_storage = _args.1
  153. if _storage._scalarField != rhs_storage._scalarField {return false}
  154. if _storage._mapField != rhs_storage._mapField {return false}
  155. if _storage._messageMapField != rhs_storage._messageMapField {return false}
  156. if _storage._delimitedField != rhs_storage._delimitedField {return false}
  157. if _storage._lengthPrefixedField != rhs_storage._lengthPrefixedField {return false}
  158. return true
  159. }
  160. if !storagesAreEqual {return false}
  161. }
  162. if lhs.unknownFields != rhs.unknownFields {return false}
  163. return true
  164. }
  165. }