any_test.pb.swift 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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: any_test.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
  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: SwiftProtobuf.ProtobufAPIVersionCheck {
  46. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  47. typealias Version = _2
  48. }
  49. struct SwiftProtoTesting_TestAny: Sendable {
  50. // SwiftProtobuf.Message conformance is added in an extension below. See the
  51. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  52. // methods supported on all messages.
  53. var int32Value: Int32 = 0
  54. var anyValue: SwiftProtobuf.Google_Protobuf_Any {
  55. get {_anyValue ?? SwiftProtobuf.Google_Protobuf_Any()}
  56. set {_anyValue = newValue}
  57. }
  58. /// Returns true if `anyValue` has been explicitly set.
  59. var hasAnyValue: Bool {self._anyValue != nil}
  60. /// Clears the value of `anyValue`. Subsequent reads from it will return its default value.
  61. mutating func clearAnyValue() {self._anyValue = nil}
  62. var repeatedAnyValue: [SwiftProtobuf.Google_Protobuf_Any] = []
  63. var text: String = String()
  64. var unknownFields = SwiftProtobuf.UnknownStorage()
  65. init() {}
  66. fileprivate var _anyValue: SwiftProtobuf.Google_Protobuf_Any? = nil
  67. }
  68. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  69. fileprivate let _protobuf_package = "swift_proto_testing"
  70. extension SwiftProtoTesting_TestAny: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  71. static let protoMessageName: String = _protobuf_package + ".TestAny"
  72. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}int32_value\0\u{3}any_value\0\u{3}repeated_any_value\0\u{1}text\0")
  73. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  74. while let fieldNumber = try decoder.nextFieldNumber() {
  75. // The use of inline closures is to circumvent an issue where the compiler
  76. // allocates stack space for every case branch when no optimizations are
  77. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  78. switch fieldNumber {
  79. case 1: try { try decoder.decodeSingularInt32Field(value: &self.int32Value) }()
  80. case 2: try { try decoder.decodeSingularMessageField(value: &self._anyValue) }()
  81. case 3: try { try decoder.decodeRepeatedMessageField(value: &self.repeatedAnyValue) }()
  82. case 4: try { try decoder.decodeSingularStringField(value: &self.text) }()
  83. default: break
  84. }
  85. }
  86. }
  87. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  88. // The use of inline closures is to circumvent an issue where the compiler
  89. // allocates stack space for every if/case branch local when no optimizations
  90. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  91. // https://github.com/apple/swift-protobuf/issues/1182
  92. if self.int32Value != 0 {
  93. try visitor.visitSingularInt32Field(value: self.int32Value, fieldNumber: 1)
  94. }
  95. try { if let v = self._anyValue {
  96. try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
  97. } }()
  98. if !self.repeatedAnyValue.isEmpty {
  99. try visitor.visitRepeatedMessageField(value: self.repeatedAnyValue, fieldNumber: 3)
  100. }
  101. if !self.text.isEmpty {
  102. try visitor.visitSingularStringField(value: self.text, fieldNumber: 4)
  103. }
  104. try unknownFields.traverse(visitor: &visitor)
  105. }
  106. static func ==(lhs: SwiftProtoTesting_TestAny, rhs: SwiftProtoTesting_TestAny) -> Bool {
  107. if lhs.int32Value != rhs.int32Value {return false}
  108. if lhs._anyValue != rhs._anyValue {return false}
  109. if lhs.repeatedAnyValue != rhs.repeatedAnyValue {return false}
  110. if lhs.text != rhs.text {return false}
  111. if lhs.unknownFields != rhs.unknownFields {return false}
  112. return true
  113. }
  114. }