unittest_import.pb.swift 5.4 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: unittest_import.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. // Author: kenton@google.com (Kenton Varda)
  40. // Based on original Protocol Buffers design by
  41. // Sanjay Ghemawat, Jeff Dean, and others.
  42. //
  43. // A proto file which is imported by unittest.proto to test importing.
  44. import SwiftProtobuf
  45. // If the compiler emits an error on this type, it is because this file
  46. // was generated by a version of the `protoc` Swift plug-in that is
  47. // incompatible with the version of SwiftProtobuf to which you are linking.
  48. // Please ensure that you are building against the same version of the API
  49. // that was used to generate this file.
  50. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  51. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  52. typealias Version = _2
  53. }
  54. enum SwiftProtoTesting_Import_ImportEnum: Int, SwiftProtobuf.Enum, Swift.CaseIterable {
  55. case importFoo = 7
  56. case importBar = 8
  57. case importBaz = 9
  58. init() {
  59. self = .importFoo
  60. }
  61. }
  62. struct SwiftProtoTesting_Import_ImportMessage: Sendable {
  63. // SwiftProtobuf.Message conformance is added in an extension below. See the
  64. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  65. // methods supported on all messages.
  66. var d: Int32 {
  67. get {_d ?? 0}
  68. set {_d = newValue}
  69. }
  70. /// Returns true if `d` has been explicitly set.
  71. var hasD: Bool {self._d != nil}
  72. /// Clears the value of `d`. Subsequent reads from it will return its default value.
  73. mutating func clearD() {self._d = nil}
  74. var unknownFields = SwiftProtobuf.UnknownStorage()
  75. init() {}
  76. fileprivate var _d: Int32? = nil
  77. }
  78. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  79. fileprivate let _protobuf_package = "swift_proto_testing.import"
  80. extension SwiftProtoTesting_Import_ImportEnum: SwiftProtobuf._ProtoNameProviding {
  81. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\u{7}IMPORT_FOO\0\u{1}IMPORT_BAR\0\u{1}IMPORT_BAZ\0")
  82. }
  83. extension SwiftProtoTesting_Import_ImportMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  84. static let protoMessageName: String = _protobuf_package + ".ImportMessage"
  85. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}d\0")
  86. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  87. while let fieldNumber = try decoder.nextFieldNumber() {
  88. // The use of inline closures is to circumvent an issue where the compiler
  89. // allocates stack space for every case branch when no optimizations are
  90. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  91. switch fieldNumber {
  92. case 1: try { try decoder.decodeSingularInt32Field(value: &self._d) }()
  93. default: break
  94. }
  95. }
  96. }
  97. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  98. // The use of inline closures is to circumvent an issue where the compiler
  99. // allocates stack space for every if/case branch local when no optimizations
  100. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  101. // https://github.com/apple/swift-protobuf/issues/1182
  102. try { if let v = self._d {
  103. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  104. } }()
  105. try unknownFields.traverse(visitor: &visitor)
  106. }
  107. static func ==(lhs: SwiftProtoTesting_Import_ImportMessage, rhs: SwiftProtoTesting_Import_ImportMessage) -> Bool {
  108. if lhs._d != rhs._d {return false}
  109. if lhs.unknownFields != rhs.unknownFields {return false}
  110. return true
  111. }
  112. }