cpp_features.pb.swift 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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/cpp_features.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 2023 Google Inc. All rights reserved.
  12. //
  13. // Use of this source code is governed by a BSD-style
  14. // license that can be found in the LICENSE file or at
  15. // https://developers.google.com/open-source/licenses/bsd
  16. import SwiftProtobuf
  17. // If the compiler emits an error on this type, it is because this file
  18. // was generated by a version of the `protoc` Swift plug-in that is
  19. // incompatible with the version of SwiftProtobuf to which you are linking.
  20. // Please ensure that you are building against the same version of the API
  21. // that was used to generate this file.
  22. fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  23. struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  24. typealias Version = _2
  25. }
  26. struct Pb_CppFeatures: Sendable {
  27. // SwiftProtobuf.Message conformance is added in an extension below. See the
  28. // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
  29. // methods supported on all messages.
  30. /// Whether or not to treat an enum field as closed. This option is only
  31. /// applicable to enum fields, and will be removed in the future. It is
  32. /// consistent with the legacy behavior of using proto3 enum types for proto2
  33. /// fields.
  34. var legacyClosedEnum: Bool {
  35. get {_legacyClosedEnum ?? false}
  36. set {_legacyClosedEnum = newValue}
  37. }
  38. /// Returns true if `legacyClosedEnum` has been explicitly set.
  39. var hasLegacyClosedEnum: Bool {self._legacyClosedEnum != nil}
  40. /// Clears the value of `legacyClosedEnum`. Subsequent reads from it will return its default value.
  41. mutating func clearLegacyClosedEnum() {self._legacyClosedEnum = nil}
  42. var stringType: Pb_CppFeatures.StringType {
  43. get {_stringType ?? .unknown}
  44. set {_stringType = newValue}
  45. }
  46. /// Returns true if `stringType` has been explicitly set.
  47. var hasStringType: Bool {self._stringType != nil}
  48. /// Clears the value of `stringType`. Subsequent reads from it will return its default value.
  49. mutating func clearStringType() {self._stringType = nil}
  50. var enumNameUsesStringView: Bool {
  51. get {_enumNameUsesStringView ?? false}
  52. set {_enumNameUsesStringView = newValue}
  53. }
  54. /// Returns true if `enumNameUsesStringView` has been explicitly set.
  55. var hasEnumNameUsesStringView: Bool {self._enumNameUsesStringView != nil}
  56. /// Clears the value of `enumNameUsesStringView`. Subsequent reads from it will return its default value.
  57. mutating func clearEnumNameUsesStringView() {self._enumNameUsesStringView = nil}
  58. var unknownFields = SwiftProtobuf.UnknownStorage()
  59. enum StringType: Int, SwiftProtobuf.Enum, Swift.CaseIterable {
  60. case unknown = 0
  61. case view = 1
  62. case cord = 2
  63. case string = 3
  64. init() {
  65. self = .unknown
  66. }
  67. }
  68. init() {}
  69. fileprivate var _legacyClosedEnum: Bool? = nil
  70. fileprivate var _stringType: Pb_CppFeatures.StringType? = nil
  71. fileprivate var _enumNameUsesStringView: Bool? = nil
  72. }
  73. // MARK: - Extension support defined in cpp_features.proto.
  74. // MARK: - Extension Properties
  75. // Swift Extensions on the extended Messages to add easy access to the declared
  76. // extension fields. The names are based on the extension field name from the proto
  77. // declaration. To avoid naming collisions, the names are prefixed with the name of
  78. // the scope where the extend directive occurs.
  79. extension SwiftProtobuf.Google_Protobuf_FeatureSet {
  80. var Pb_cpp: Pb_CppFeatures {
  81. get {return getExtensionValue(ext: Pb_Extensions_cpp) ?? Pb_CppFeatures()}
  82. set {setExtensionValue(ext: Pb_Extensions_cpp, value: newValue)}
  83. }
  84. /// Returns true if extension `Pb_Extensions_cpp`
  85. /// has been explicitly set.
  86. var hasPb_cpp: Bool {
  87. return hasExtensionValue(ext: Pb_Extensions_cpp)
  88. }
  89. /// Clears the value of extension `Pb_Extensions_cpp`.
  90. /// Subsequent reads from it will return its default value.
  91. mutating func clearPb_cpp() {
  92. clearExtensionValue(ext: Pb_Extensions_cpp)
  93. }
  94. }
  95. // MARK: - File's ExtensionMap: Pb_CppFeatures_Extensions
  96. /// A `SwiftProtobuf.SimpleExtensionMap` that includes all of the extensions defined by
  97. /// this .proto file. It can be used any place an `SwiftProtobuf.ExtensionMap` is needed
  98. /// in parsing, or it can be combined with other `SwiftProtobuf.SimpleExtensionMap`s to create
  99. /// a larger `SwiftProtobuf.SimpleExtensionMap`.
  100. let Pb_CppFeatures_Extensions: SwiftProtobuf.SimpleExtensionMap = [
  101. Pb_Extensions_cpp
  102. ]
  103. // Extension Objects - The only reason these might be needed is when manually
  104. // constructing a `SimpleExtensionMap`, otherwise, use the above _Extension Properties_
  105. // accessors for the extension fields on the messages directly.
  106. let Pb_Extensions_cpp = SwiftProtobuf.MessageExtension<SwiftProtobuf.OptionalMessageExtensionField<Pb_CppFeatures>, SwiftProtobuf.Google_Protobuf_FeatureSet>(
  107. _protobuf_fieldNumber: 1000,
  108. fieldName: "pb.cpp"
  109. )
  110. // MARK: - Code below here is support for the SwiftProtobuf runtime.
  111. fileprivate let _protobuf_package = "pb"
  112. extension Pb_CppFeatures: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
  113. static let protoMessageName: String = _protobuf_package + ".CppFeatures"
  114. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}legacy_closed_enum\0\u{3}string_type\0\u{3}enum_name_uses_string_view\0")
  115. mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
  116. while let fieldNumber = try decoder.nextFieldNumber() {
  117. // The use of inline closures is to circumvent an issue where the compiler
  118. // allocates stack space for every case branch when no optimizations are
  119. // enabled. https://github.com/apple/swift-protobuf/issues/1034
  120. switch fieldNumber {
  121. case 1: try { try decoder.decodeSingularBoolField(value: &self._legacyClosedEnum) }()
  122. case 2: try { try decoder.decodeSingularEnumField(value: &self._stringType) }()
  123. case 3: try { try decoder.decodeSingularBoolField(value: &self._enumNameUsesStringView) }()
  124. default: break
  125. }
  126. }
  127. }
  128. func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
  129. // The use of inline closures is to circumvent an issue where the compiler
  130. // allocates stack space for every if/case branch local when no optimizations
  131. // are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
  132. // https://github.com/apple/swift-protobuf/issues/1182
  133. try { if let v = self._legacyClosedEnum {
  134. try visitor.visitSingularBoolField(value: v, fieldNumber: 1)
  135. } }()
  136. try { if let v = self._stringType {
  137. try visitor.visitSingularEnumField(value: v, fieldNumber: 2)
  138. } }()
  139. try { if let v = self._enumNameUsesStringView {
  140. try visitor.visitSingularBoolField(value: v, fieldNumber: 3)
  141. } }()
  142. try unknownFields.traverse(visitor: &visitor)
  143. }
  144. static func ==(lhs: Pb_CppFeatures, rhs: Pb_CppFeatures) -> Bool {
  145. if lhs._legacyClosedEnum != rhs._legacyClosedEnum {return false}
  146. if lhs._stringType != rhs._stringType {return false}
  147. if lhs._enumNameUsesStringView != rhs._enumNameUsesStringView {return false}
  148. if lhs.unknownFields != rhs.unknownFields {return false}
  149. return true
  150. }
  151. }
  152. extension Pb_CppFeatures.StringType: SwiftProtobuf._ProtoNameProviding {
  153. static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0STRING_TYPE_UNKNOWN\0\u{1}VIEW\0\u{1}CORD\0\u{1}STRING\0")
  154. }