unittest_swift_naming_number_prefix.pb.swift 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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_naming_number_prefix.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_naming_number_prefix.proto - test proto
  11. //
  12. // This source file is part of the Swift.org open source project
  13. //
  14. // Copyright (c) 2020 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 Swift reserved words used as enum or message names
  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 _4fun_SwiftProtoTesting_Mumble_MyMessage: 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 a: Int32 {
  40. get {_a ?? 0}
  41. set {_a = newValue}
  42. }
  43. /// Returns true if `a` has been explicitly set.
  44. var hasA: Bool {self._a != nil}
  45. /// Clears the value of `a`. Subsequent reads from it will return its default value.
  46. mutating func clearA() {self._a = nil}
  47. var unknownFields = SwiftProtobuf.UnknownStorage()
  48. init() {}
  49. fileprivate var _a: Int32? = nil
  50. }
  51. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  52. fileprivate let _protobuf_package = "_4fun.swift_proto_testing.mumble"
  53. extension _4fun_SwiftProtoTesting_Mumble_MyMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  54. static let protoMessageName: String = _protobuf_package + ".MyMessage"
  55. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}a\0")
  56. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  57. while let fieldNumber = try decoder.nextFieldNumber() {
  58. // The use of inline closures is to circumvent an issue where the compiler
  59. // allocates stack space for every case branch when no optimizations are
  60. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  61. switch fieldNumber {
  62. case 1: try { try decoder.decodeSingularInt32Field(value: &self._a) }()
  63. default: break
  64. }
  65. }
  66. }
  67. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  68. // The use of inline closures is to circumvent an issue where the compiler
  69. // allocates stack space for every if/case branch local when no optimizations
  70. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  71. // https://github.com/apple/swift-protobuf/issues/1182
  72. try { if let v = self._a {
  73. try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
  74. } }()
  75. try unknownFields.traverse(visitor: &visitor)
  76. }
  77. static func ==(lhs: _4fun_SwiftProtoTesting_Mumble_MyMessage, rhs: _4fun_SwiftProtoTesting_Mumble_MyMessage) -> Bool {
  78. if lhs._a != rhs._a {return false}
  79. if lhs.unknownFields != rhs.unknownFields {return false}
  80. return true
  81. }
  82. }