struct.pb.swift 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  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: google/protobuf/struct.proto
  7. //
  8. // For information on using the generated types, please see the documentation:
  9. // https://github.com/apple/swift-protobuf/
  10. // Protocol Buffers - Google's data interchange format
  11. // Copyright 2008 Google Inc. All rights reserved.
  12. // https://developers.google.com/protocol-buffers/
  13. //
  14. // Redistribution and use in source and binary forms, with or without
  15. // modification, are permitted provided that the following conditions are
  16. // met:
  17. //
  18. // * Redistributions of source code must retain the above copyright
  19. // notice, this list of conditions and the following disclaimer.
  20. // * Redistributions in binary form must reproduce the above
  21. // copyright notice, this list of conditions and the following disclaimer
  22. // in the documentation and/or other materials provided with the
  23. // distribution.
  24. // * Neither the name of Google Inc. nor the names of its
  25. // contributors may be used to endorse or promote products derived from
  26. // this software without specific prior written permission.
  27. //
  28. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  29. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  30. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  31. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  32. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  33. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  34. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  35. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  36. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  38. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. // 'import SwiftProtobuf' suppressed, this proto file is meant to be bundled in the runtime.
  40. // If the compiler emits an error on this type, it is because this file
  41. // was generated by a version of the `protoc` Swift plug-in that is
  42. // incompatible with the version of SwiftProtobuf to which you are linking.
  43. // Please ensure that you are building against the same version of the API
  44. // that was used to generate this file.
  45. fileprivate struct _GeneratedWithProtocGenSwiftVersion: ProtobufAPIVersionCheck {
  46. struct _2: ProtobufAPIVersion_2 {}
  47. typealias Version = _2
  48. }
  49. /// `NullValue` is a singleton enumeration to represent the null value for the
  50. /// `Value` type union.
  51. ///
  52. /// The JSON representation for `NullValue` is JSON `null`.
  53. public enum Google_Protobuf_NullValue: Enum, Swift.CaseIterable {
  54. public typealias RawValue = Int
  55. /// Null value.
  56. case nullValue // = 0
  57. case UNRECOGNIZED(Int)
  58. public init() {
  59. self = .nullValue
  60. }
  61. public init?(rawValue: Int) {
  62. switch rawValue {
  63. case 0: self = .nullValue
  64. default: self = .UNRECOGNIZED(rawValue)
  65. }
  66. }
  67. public var rawValue: Int {
  68. switch self {
  69. case .nullValue: return 0
  70. case .UNRECOGNIZED(let i): return i
  71. }
  72. }
  73. // The compiler won't synthesize support with the UNRECOGNIZED case.
  74. public static let allCases: [Google_Protobuf_NullValue] = [
  75. .nullValue,
  76. ]
  77. }
  78. /// `Struct` represents a structured data value, consisting of fields
  79. /// which map to dynamically typed values. In some languages, `Struct`
  80. /// might be supported by a native representation. For example, in
  81. /// scripting languages like JS a struct is represented as an
  82. /// object. The details of that representation are described together
  83. /// with the proto support for the language.
  84. ///
  85. /// The JSON representation for `Struct` is JSON object.
  86. public struct Google_Protobuf_Struct: Sendable {
  87. // SwiftProtobuf.Message conformance is added in an extension below. See the
  88. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  89. // methods supported on all messages.
  90. /// Unordered map of dynamically typed values.
  91. public var fields: Dictionary<String,Google_Protobuf_Value> = [:]
  92. public var unknownFields = UnknownStorage()
  93. public init() {}
  94. }
  95. /// `Value` represents a dynamically typed value which can be either
  96. /// null, a number, a string, a boolean, a recursive struct value, or a
  97. /// list of values. A producer of value is expected to set one of these
  98. /// variants. Absence of any variant indicates an error.
  99. ///
  100. /// The JSON representation for `Value` is JSON value.
  101. public struct Google_Protobuf_Value: Sendable {
  102. // SwiftProtobuf.Message conformance is added in an extension below. See the
  103. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  104. // methods supported on all messages.
  105. /// The kind of value.
  106. public var kind: Google_Protobuf_Value.OneOf_Kind? = nil
  107. /// Represents a null value.
  108. public var nullValue: Google_Protobuf_NullValue {
  109. get {
  110. if case .nullValue(let v)? = kind {return v}
  111. return .nullValue
  112. }
  113. set {kind = .nullValue(newValue)}
  114. }
  115. /// Represents a double value.
  116. public var numberValue: Double {
  117. get {
  118. if case .numberValue(let v)? = kind {return v}
  119. return 0
  120. }
  121. set {kind = .numberValue(newValue)}
  122. }
  123. /// Represents a string value.
  124. public var stringValue: String {
  125. get {
  126. if case .stringValue(let v)? = kind {return v}
  127. return String()
  128. }
  129. set {kind = .stringValue(newValue)}
  130. }
  131. /// Represents a boolean value.
  132. public var boolValue: Bool {
  133. get {
  134. if case .boolValue(let v)? = kind {return v}
  135. return false
  136. }
  137. set {kind = .boolValue(newValue)}
  138. }
  139. /// Represents a structured value.
  140. public var structValue: Google_Protobuf_Struct {
  141. get {
  142. if case .structValue(let v)? = kind {return v}
  143. return Google_Protobuf_Struct()
  144. }
  145. set {kind = .structValue(newValue)}
  146. }
  147. /// Represents a repeated `Value`.
  148. public var listValue: Google_Protobuf_ListValue {
  149. get {
  150. if case .listValue(let v)? = kind {return v}
  151. return Google_Protobuf_ListValue()
  152. }
  153. set {kind = .listValue(newValue)}
  154. }
  155. public var unknownFields = UnknownStorage()
  156. /// The kind of value.
  157. public enum OneOf_Kind: Equatable, Sendable {
  158. /// Represents a null value.
  159. case nullValue(Google_Protobuf_NullValue)
  160. /// Represents a double value.
  161. case numberValue(Double)
  162. /// Represents a string value.
  163. case stringValue(String)
  164. /// Represents a boolean value.
  165. case boolValue(Bool)
  166. /// Represents a structured value.
  167. case structValue(Google_Protobuf_Struct)
  168. /// Represents a repeated `Value`.
  169. case listValue(Google_Protobuf_ListValue)
  170. }
  171. public init() {}
  172. }
  173. /// `ListValue` is a wrapper around a repeated field of values.
  174. ///
  175. /// The JSON representation for `ListValue` is JSON array.
  176. public struct Google_Protobuf_ListValue: Sendable {
  177. // SwiftProtobuf.Message conformance is added in an extension below. See the
  178. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  179. // methods supported on all messages.
  180. /// Repeated field of dynamically typed values.
  181. public var values: [Google_Protobuf_Value] = []
  182. public var unknownFields = UnknownStorage()
  183. public init() {}
  184. }
  185. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  186. fileprivate let _protobuf_package = "google.protobuf"
  187. extension Google_Protobuf_NullValue: _ProtoNameProviding {
  188. public static let _protobuf_nameMap = _NameMap(bytecode: "\0\u{2}\0NULL_VALUE\0")
  189. }
  190. extension Google_Protobuf_Struct: Message, _MessageImplementationBase, _ProtoNameProviding {
  191. public static let protoMessageName: String = _protobuf_package + ".Struct"
  192. public static let _protobuf_nameMap = _NameMap(bytecode: "\0\u{1}fields\0")
  193. public mutating func decodeMessage<D: Decoder>(decoder: inout D) throws {
  194. while let fieldNumber = try decoder.nextFieldNumber() {
  195. // The use of inline closures is to circumvent an issue where the compiler
  196. // allocates stack space for every case branch when no optimizations are
  197. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  198. switch fieldNumber {
  199. case 1: try { try decoder.decodeMapField(fieldType: _ProtobufMessageMap<ProtobufString,Google_Protobuf_Value>.self, value: &self.fields) }()
  200. default: break
  201. }
  202. }
  203. }
  204. public func traverse<V: Visitor>(visitor: inout V) throws {
  205. if !self.fields.isEmpty {
  206. try visitor.visitMapField(fieldType: _ProtobufMessageMap<ProtobufString,Google_Protobuf_Value>.self, value: self.fields, fieldNumber: 1)
  207. }
  208. try unknownFields.traverse(visitor: &visitor)
  209. }
  210. public static func ==(lhs: Google_Protobuf_Struct, rhs: Google_Protobuf_Struct) -> Bool {
  211. if lhs.fields != rhs.fields {return false}
  212. if lhs.unknownFields != rhs.unknownFields {return false}
  213. return true
  214. }
  215. }
  216. extension Google_Protobuf_Value: Message, _MessageImplementationBase, _ProtoNameProviding {
  217. public static let protoMessageName: String = _protobuf_package + ".Value"
  218. public static let _protobuf_nameMap = _NameMap(bytecode: "\0\u{3}null_value\0\u{3}number_value\0\u{3}string_value\0\u{3}bool_value\0\u{3}struct_value\0\u{3}list_value\0")
  219. public mutating func decodeMessage<D: Decoder>(decoder: inout D) throws {
  220. while let fieldNumber = try decoder.nextFieldNumber() {
  221. // The use of inline closures is to circumvent an issue where the compiler
  222. // allocates stack space for every case branch when no optimizations are
  223. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  224. switch fieldNumber {
  225. case 1: try {
  226. var v: Google_Protobuf_NullValue?
  227. try decoder.decodeSingularEnumField(value: &v)
  228. if let v = v {
  229. if self.kind != nil {try decoder.handleConflictingOneOf()}
  230. self.kind = .nullValue(v)
  231. }
  232. }()
  233. case 2: try {
  234. var v: Double?
  235. try decoder.decodeSingularDoubleField(value: &v)
  236. if let v = v {
  237. if self.kind != nil {try decoder.handleConflictingOneOf()}
  238. self.kind = .numberValue(v)
  239. }
  240. }()
  241. case 3: try {
  242. var v: String?
  243. try decoder.decodeSingularStringField(value: &v)
  244. if let v = v {
  245. if self.kind != nil {try decoder.handleConflictingOneOf()}
  246. self.kind = .stringValue(v)
  247. }
  248. }()
  249. case 4: try {
  250. var v: Bool?
  251. try decoder.decodeSingularBoolField(value: &v)
  252. if let v = v {
  253. if self.kind != nil {try decoder.handleConflictingOneOf()}
  254. self.kind = .boolValue(v)
  255. }
  256. }()
  257. case 5: try {
  258. var v: Google_Protobuf_Struct?
  259. var hadOneofValue = false
  260. if let current = self.kind {
  261. hadOneofValue = true
  262. if case .structValue(let m) = current {v = m}
  263. }
  264. try decoder.decodeSingularMessageField(value: &v)
  265. if let v = v {
  266. if hadOneofValue {try decoder.handleConflictingOneOf()}
  267. self.kind = .structValue(v)
  268. }
  269. }()
  270. case 6: try {
  271. var v: Google_Protobuf_ListValue?
  272. var hadOneofValue = false
  273. if let current = self.kind {
  274. hadOneofValue = true
  275. if case .listValue(let m) = current {v = m}
  276. }
  277. try decoder.decodeSingularMessageField(value: &v)
  278. if let v = v {
  279. if hadOneofValue {try decoder.handleConflictingOneOf()}
  280. self.kind = .listValue(v)
  281. }
  282. }()
  283. default: break
  284. }
  285. }
  286. }
  287. public func traverse<V: Visitor>(visitor: inout V) throws {
  288. // The use of inline closures is to circumvent an issue where the compiler
  289. // allocates stack space for every if/case branch local when no optimizations
  290. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  291. // https://github.com/apple/swift-protobuf/issues/1182
  292. switch self.kind {
  293. case .nullValue?: try {
  294. guard case .nullValue(let v)? = self.kind else { preconditionFailure() }
  295. try visitor.visitSingularEnumField(value: v, fieldNumber: 1)
  296. }()
  297. case .numberValue?: try {
  298. guard case .numberValue(let v)? = self.kind else { preconditionFailure() }
  299. try visitor.visitSingularDoubleField(value: v, fieldNumber: 2)
  300. }()
  301. case .stringValue?: try {
  302. guard case .stringValue(let v)? = self.kind else { preconditionFailure() }
  303. try visitor.visitSingularStringField(value: v, fieldNumber: 3)
  304. }()
  305. case .boolValue?: try {
  306. guard case .boolValue(let v)? = self.kind else { preconditionFailure() }
  307. try visitor.visitSingularBoolField(value: v, fieldNumber: 4)
  308. }()
  309. case .structValue?: try {
  310. guard case .structValue(let v)? = self.kind else { preconditionFailure() }
  311. try visitor.visitSingularMessageField(value: v, fieldNumber: 5)
  312. }()
  313. case .listValue?: try {
  314. guard case .listValue(let v)? = self.kind else { preconditionFailure() }
  315. try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
  316. }()
  317. case nil: break
  318. }
  319. try unknownFields.traverse(visitor: &visitor)
  320. }
  321. public static func ==(lhs: Google_Protobuf_Value, rhs: Google_Protobuf_Value) -> Bool {
  322. if lhs.kind != rhs.kind {return false}
  323. if lhs.unknownFields != rhs.unknownFields {return false}
  324. return true
  325. }
  326. }
  327. extension Google_Protobuf_ListValue: Message, _MessageImplementationBase, _ProtoNameProviding {
  328. public static let protoMessageName: String = _protobuf_package + ".ListValue"
  329. public static let _protobuf_nameMap = _NameMap(bytecode: "\0\u{1}values\0")
  330. public mutating func decodeMessage<D: Decoder>(decoder: inout D) throws {
  331. while let fieldNumber = try decoder.nextFieldNumber() {
  332. // The use of inline closures is to circumvent an issue where the compiler
  333. // allocates stack space for every case branch when no optimizations are
  334. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  335. switch fieldNumber {
  336. case 1: try { try decoder.decodeRepeatedMessageField(value: &self.values) }()
  337. default: break
  338. }
  339. }
  340. }
  341. public func traverse<V: Visitor>(visitor: inout V) throws {
  342. if !self.values.isEmpty {
  343. try visitor.visitRepeatedMessageField(value: self.values, fieldNumber: 1)
  344. }
  345. try unknownFields.traverse(visitor: &visitor)
  346. }
  347. public static func ==(lhs: Google_Protobuf_ListValue, rhs: Google_Protobuf_ListValue) -> Bool {
  348. if lhs.values != rhs.values {return false}
  349. if lhs.unknownFields != rhs.unknownFields {return false}
  350. return true
  351. }
  352. }