unittest_swift_extension3.pb.swift 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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: unittest_swift_extension3.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Protos/unittest_swift_extension3.proto - test proto
  11. //
  12. // This source file is part of the Swift.org open source project
  13. //
  14. // Copyright (c) 2014 - 2016 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 naming of extensions that differ only in proto package. This is a
  23. /// clone of unittest_swift_extension2.proto, but with a different proto package
  24. /// and different extension numbers.
  25. ///
  26. // -----------------------------------------------------------------------------
  27. import SwiftProtobuf
  28. // If the compiler emits an error on this type, it is because this file
  29. // was generated by a version of the `protoc` Swift plug-in that is
  30. // incompatible with the version of SwiftProtobuf to which you are linking.
  31. // Please ensure that you are building against the same version of the API
  32. // that was used to generate this file.
  33. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  34. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  35. typealias Version = _2
  36. }
  37. struct SwiftProtoTesting_Extend3_MyMessage: Sendable {
  38. // SwiftProtobuf.Message conformance is added in an extension below. See the
  39. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  40. // methods supported on all messages.
  41. var unknownFields = SwiftProtobuf.UnknownStorage()
  42. struct C: Sendable {
  43. // SwiftProtobuf.Message conformance is added in an extension below. See the
  44. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  45. // methods supported on all messages.
  46. var c: Int64 {
  47. get {_c ?? 0}
  48. set {_c = newValue}
  49. }
  50. /// Returns true if `c` has been explicitly set.
  51. var hasC: Bool {self._c != nil}
  52. /// Clears the value of `c`. Subsequent reads from it will return its default value.
  53. mutating func clearC() {self._c = nil}
  54. var unknownFields = SwiftProtobuf.UnknownStorage()
  55. init() {}
  56. fileprivate var _c: Int64? = nil
  57. }
  58. init() {}
  59. }
  60. struct SwiftProtoTesting_Extend3_C: Sendable {
  61. // SwiftProtobuf.Message conformance is added in an extension below. See the
  62. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  63. // methods supported on all messages.
  64. var c: Int64 {
  65. get {_c ?? 0}
  66. set {_c = newValue}
  67. }
  68. /// Returns true if `c` has been explicitly set.
  69. var hasC: Bool {self._c != nil}
  70. /// Clears the value of `c`. Subsequent reads from it will return its default value.
  71. mutating func clearC() {self._c = nil}
  72. var unknownFields = SwiftProtobuf.UnknownStorage()
  73. init() {}
  74. fileprivate var _c: Int64? = nil
  75. }
  76. // MARK: - Extension support defined in unittest_swift_extension3.proto.
  77. // MARK: - Extension Properties
  78. // Swift Extensions on the extended Messages to add easy access to the declared
  79. // extension fields. The names are based on the extension field name from the proto
  80. // declaration. To avoid naming collisions, the names are prefixed with the name of
  81. // the scope where the extend directive occurs.
  82. extension SwiftProtoTesting_Extend_Foo.Bar.Baz {
  83. var SwiftProtoTesting_Extend3_b: String {
  84. get {return getExtensionValue(ext: SwiftProtoTesting_Extend3_Extensions_b) ?? String()}
  85. set {setExtensionValue(ext: SwiftProtoTesting_Extend3_Extensions_b, value: newValue)}
  86. }
  87. /// Returns true if extension `SwiftProtoTesting_Extend3_Extensions_b`
  88. /// has been explicitly set.
  89. var hasSwiftProtoTesting_Extend3_b: Bool {
  90. return hasExtensionValue(ext: SwiftProtoTesting_Extend3_Extensions_b)
  91. }
  92. /// Clears the value of extension `SwiftProtoTesting_Extend3_Extensions_b`.
  93. /// Subsequent reads from it will return its default value.
  94. mutating func clearSwiftProtoTesting_Extend3_b() {
  95. clearExtensionValue(ext: SwiftProtoTesting_Extend3_Extensions_b)
  96. }
  97. var SwiftProtoTesting_Extend3_c: SwiftProtoTesting_Extend3_C {
  98. get {return getExtensionValue(ext: SwiftProtoTesting_Extend3_Extensions_C) ?? SwiftProtoTesting_Extend3_C()}
  99. set {setExtensionValue(ext: SwiftProtoTesting_Extend3_Extensions_C, value: newValue)}
  100. }
  101. /// Returns true if extension `SwiftProtoTesting_Extend3_Extensions_C`
  102. /// has been explicitly set.
  103. var hasSwiftProtoTesting_Extend3_c: Bool {
  104. return hasExtensionValue(ext: SwiftProtoTesting_Extend3_Extensions_C)
  105. }
  106. /// Clears the value of extension `SwiftProtoTesting_Extend3_Extensions_C`.
  107. /// Subsequent reads from it will return its default value.
  108. mutating func clearSwiftProtoTesting_Extend3_c() {
  109. clearExtensionValue(ext: SwiftProtoTesting_Extend3_Extensions_C)
  110. }
  111. var SwiftProtoTesting_Extend3_MyMessage_b: String {
  112. get {return getExtensionValue(ext: SwiftProtoTesting_Extend3_MyMessage.Extensions.b) ?? String()}
  113. set {setExtensionValue(ext: SwiftProtoTesting_Extend3_MyMessage.Extensions.b, value: newValue)}
  114. }
  115. /// Returns true if extension `SwiftProtoTesting_Extend3_MyMessage.Extensions.b`
  116. /// has been explicitly set.
  117. var hasSwiftProtoTesting_Extend3_MyMessage_b: Bool {
  118. return hasExtensionValue(ext: SwiftProtoTesting_Extend3_MyMessage.Extensions.b)
  119. }
  120. /// Clears the value of extension `SwiftProtoTesting_Extend3_MyMessage.Extensions.b`.
  121. /// Subsequent reads from it will return its default value.
  122. mutating func clearSwiftProtoTesting_Extend3_MyMessage_b() {
  123. clearExtensionValue(ext: SwiftProtoTesting_Extend3_MyMessage.Extensions.b)
  124. }
  125. var SwiftProtoTesting_Extend3_MyMessage_c: SwiftProtoTesting_Extend3_MyMessage.C {
  126. get {return getExtensionValue(ext: SwiftProtoTesting_Extend3_MyMessage.Extensions.C) ?? SwiftProtoTesting_Extend3_MyMessage.C()}
  127. set {setExtensionValue(ext: SwiftProtoTesting_Extend3_MyMessage.Extensions.C, value: newValue)}
  128. }
  129. /// Returns true if extension `SwiftProtoTesting_Extend3_MyMessage.Extensions.C`
  130. /// has been explicitly set.
  131. var hasSwiftProtoTesting_Extend3_MyMessage_c: Bool {
  132. return hasExtensionValue(ext: SwiftProtoTesting_Extend3_MyMessage.Extensions.C)
  133. }
  134. /// Clears the value of extension `SwiftProtoTesting_Extend3_MyMessage.Extensions.C`.
  135. /// Subsequent reads from it will return its default value.
  136. mutating func clearSwiftProtoTesting_Extend3_MyMessage_c() {
  137. clearExtensionValue(ext: SwiftProtoTesting_Extend3_MyMessage.Extensions.C)
  138. }
  139. }
  140. // MARK: - File's ExtensionMap: SwiftProtoTesting_Extend3_UnittestSwiftExtension3_Extensions
  141. /// A `SwiftProtobuf.SimpleExtensionMap` that includes all of the extensions defined by
  142. /// this .proto file. It can be used any place an `SwiftProtobuf.ExtensionMap` is needed
  143. /// in parsing, or it can be combined with other `SwiftProtobuf.SimpleExtensionMap`s to create
  144. /// a larger `SwiftProtobuf.SimpleExtensionMap`.
  145. let SwiftProtoTesting_Extend3_UnittestSwiftExtension3_Extensions: SwiftProtobuf.SimpleExtensionMap = [
  146. SwiftProtoTesting_Extend3_Extensions_b,
  147. SwiftProtoTesting_Extend3_Extensions_C,
  148. SwiftProtoTesting_Extend3_MyMessage.Extensions.b,
  149. SwiftProtoTesting_Extend3_MyMessage.Extensions.C
  150. ]
  151. // Extension Objects - The only reason these might be needed is when manually
  152. // constructing a `SimpleExtensionMap`, otherwise, use the above _Extension Properties_
  153. // accessors for the extension fields on the messages directly.
  154. let SwiftProtoTesting_Extend3_Extensions_b = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufString>, SwiftProtoTesting_Extend_Foo.Bar.Baz>(
  155. _protobuf_fieldNumber: 320,
  156. fieldName: "swift_proto_testing.extend3.b"
  157. )
  158. let SwiftProtoTesting_Extend3_Extensions_C = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalGroupExtensionField<SwiftProtoTesting_Extend3_C>, SwiftProtoTesting_Extend_Foo.Bar.Baz>(
  159. _protobuf_fieldNumber: 321,
  160. fieldName: "swift_proto_testing.extend3.c"
  161. )
  162. extension SwiftProtoTesting_Extend3_MyMessage {
  163. enum Extensions {
  164. static let b = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalExtensionField<SwiftProtobuf.ProtobufString>, SwiftProtoTesting_Extend_Foo.Bar.Baz>(
  165. _protobuf_fieldNumber: 310,
  166. fieldName: "swift_proto_testing.extend3.MyMessage.b"
  167. )
  168. static let C = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalGroupExtensionField<SwiftProtoTesting_Extend3_MyMessage.C>, SwiftProtoTesting_Extend_Foo.Bar.Baz>(
  169. _protobuf_fieldNumber: 311,
  170. fieldName: "swift_proto_testing.extend3.MyMessage.c"
  171. )
  172. }
  173. }
  174. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  175. fileprivate let _protobuf_package = "swift_proto_testing.extend3"
  176. extension SwiftProtoTesting_Extend3_MyMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  177. static let protoMessageName: String = _protobuf_package + ".MyMessage"
  178. static let _protobuf_nameMap = SwiftProtobuf._NameMap()
  179. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  180. // Load everything into unknown fields
  181. while try decoder.nextFieldNumber() != nil {}
  182. }
  183. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  184. try unknownFields.traverse(visitor: &visitor)
  185. }
  186. static func ==(lhs: SwiftProtoTesting_Extend3_MyMessage, rhs: SwiftProtoTesting_Extend3_MyMessage) -> Bool {
  187. if lhs.unknownFields != rhs.unknownFields {return false}
  188. return true
  189. }
  190. }
  191. extension SwiftProtoTesting_Extend3_MyMessage.C: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  192. static let protoMessageName: String = SwiftProtoTesting_Extend3_MyMessage.protoMessageName + ".C"
  193. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}^\u{14}c\0")
  194. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  195. while let fieldNumber = try decoder.nextFieldNumber() {
  196. // The use of inline closures is to circumvent an issue where the compiler
  197. // allocates stack space for every case branch when no optimizations are
  198. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  199. switch fieldNumber {
  200. case 1310: try { try decoder.decodeSingularInt64Field(value: &self._c) }()
  201. default: break
  202. }
  203. }
  204. }
  205. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  206. // The use of inline closures is to circumvent an issue where the compiler
  207. // allocates stack space for every if/case branch local when no optimizations
  208. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  209. // https://github.com/apple/swift-protobuf/issues/1182
  210. try { if let v = self._c {
  211. try visitor.visitSingularInt64Field(value: v, fieldNumber: 1310)
  212. } }()
  213. try unknownFields.traverse(visitor: &visitor)
  214. }
  215. static func ==(lhs: SwiftProtoTesting_Extend3_MyMessage.C, rhs: SwiftProtoTesting_Extend3_MyMessage.C) -> Bool {
  216. if lhs._c != rhs._c {return false}
  217. if lhs.unknownFields != rhs.unknownFields {return false}
  218. return true
  219. }
  220. }
  221. extension SwiftProtoTesting_Extend3_C: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  222. static let protoMessageName: String = _protobuf_package + ".C"
  223. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}h\u{14}c\0")
  224. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  225. while let fieldNumber = try decoder.nextFieldNumber() {
  226. // The use of inline closures is to circumvent an issue where the compiler
  227. // allocates stack space for every case branch when no optimizations are
  228. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  229. switch fieldNumber {
  230. case 1320: try { try decoder.decodeSingularInt64Field(value: &self._c) }()
  231. default: break
  232. }
  233. }
  234. }
  235. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  236. // The use of inline closures is to circumvent an issue where the compiler
  237. // allocates stack space for every if/case branch local when no optimizations
  238. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  239. // https://github.com/apple/swift-protobuf/issues/1182
  240. try { if let v = self._c {
  241. try visitor.visitSingularInt64Field(value: v, fieldNumber: 1320)
  242. } }()
  243. try unknownFields.traverse(visitor: &visitor)
  244. }
  245. static func ==(lhs: SwiftProtoTesting_Extend3_C, rhs: SwiftProtoTesting_Extend3_C) -> Bool {
  246. if lhs._c != rhs._c {return false}
  247. if lhs.unknownFields != rhs.unknownFields {return false}
  248. return true
  249. }
  250. }