| 1 |
// DO NOT EDIT. |
| 2 |
// |
| 3 |
// Generated by the Swift generator plugin for the protocol buffer compiler. |
| 4 |
// Source: github.com/googleapis/gnostic/plugins/plugin.proto |
| 5 |
// |
| 6 |
// For information on using the generated types, please see the documenation: |
| 7 |
// https://github.com/apple/swift-protobuf/ |
| 8 |
|
| 9 |
// Copyright 2017 Google Inc. All Rights Reserved. |
| 10 |
// |
| 11 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 12 |
// you may not use this file except in compliance with the License. |
| 13 |
// You may obtain a copy of the License at |
| 14 |
// |
| 15 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 16 |
// |
| 17 |
// Unless required by applicable law or agreed to in writing, software |
| 18 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 19 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 20 |
// See the License for the specific language governing permissions and |
| 21 |
// limitations under the License. |
| 22 |
|
| 23 |
// gnostic can be extended with plugins. |
| 24 |
// A plugin is uset a program that reads a Request from stdin |
| 25 |
// and writes a Response to stdout. |
| 26 |
// |
| 27 |
// A plugin executable needs only to be placed somewhere in the path. The |
| 28 |
// plugin should be named "gnostic_$NAME", and will then be used when the |
| 29 |
// flag "--${NAME}_out" is passed to gnostic. |
| 30 |
|
| 31 |
import Foundation |
| 32 |
import SwiftProtobuf |
| 33 |
|
| 34 |
// If the compiler emits an error on this type, it is because this file |
| 35 |
// was generated by a version of the `protoc` Swift plug-in that is |
| 36 |
// incompatible with the version of SwiftProtobuf to which you are linking. |
| 37 |
// Please ensure that your are building against the same version of the API |
| 38 |
// that was used to generate this file. |
| 39 |
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck { |
| 40 |
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {} |
| 41 |
typealias Version = _2 |
| 42 |
} |
| 43 |
|
| 44 |
/// The version number of gnostic. |
| 45 |
public struct Gnostic_Plugin_V1_Version: SwiftProtobuf.Message { |
| 46 |
public static let protoMessageName: String = _protobuf_package + ".Version" |
| 47 |
|
| 48 |
public var major: Int32 = 0 |
| 49 |
|
| 50 |
public var minor: Int32 = 0 |
| 51 |
|
| 52 |
public var patch: Int32 = 0 |
| 53 |
|
| 54 |
/// A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should |
| 55 |
/// be empty for mainline stable releases. |
| 56 |
public var suffix: String = String() |
| 57 |
|
| 58 |
public var unknownFields = SwiftProtobuf.UnknownStorage() |
| 59 |
|
| 60 |
public init() {} |
| 61 |
|
| 62 |
/// Used by the decoding initializers in the SwiftProtobuf library, not generally |
| 63 |
/// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding |
| 64 |
/// initializers are defined in the SwiftProtobuf library. See the Message and |
| 65 |
/// Message+*Additions` files. |
| 66 |
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws { |
| 67 |
while let fieldNumber = try decoder.nextFieldNumber() { |
| 68 |
switch fieldNumber { |
| 69 |
case 1: try decoder.decodeSingularInt32Field(value: &self.major) |
| 70 |
case 2: try decoder.decodeSingularInt32Field(value: &self.minor) |
| 71 |
case 3: try decoder.decodeSingularInt32Field(value: &self.patch) |
| 72 |
case 4: try decoder.decodeSingularStringField(value: &self.suffix) |
| 73 |
default: break |
| 74 |
} |
| 75 |
} |
| 76 |
} |
| 77 |
|
| 78 |
/// Used by the encoding methods of the SwiftProtobuf library, not generally |
| 79 |
/// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and |
| 80 |
/// other serializer methods are defined in the SwiftProtobuf library. See the |
| 81 |
/// `Message` and `Message+*Additions` files. |
| 82 |
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws { |
| 83 |
if self.major != 0 { |
| 84 |
try visitor.visitSingularInt32Field(value: self.major, fieldNumber: 1) |
| 85 |
} |
| 86 |
if self.minor != 0 { |
| 87 |
try visitor.visitSingularInt32Field(value: self.minor, fieldNumber: 2) |
| 88 |
} |
| 89 |
if self.patch != 0 { |
| 90 |
try visitor.visitSingularInt32Field(value: self.patch, fieldNumber: 3) |
| 91 |
} |
| 92 |
if !self.suffix.isEmpty { |
| 93 |
try visitor.visitSingularStringField(value: self.suffix, fieldNumber: 4) |
| 94 |
} |
| 95 |
try unknownFields.traverse(visitor: &visitor) |
| 96 |
} |
| 97 |
} |
| 98 |
|
| 99 |
/// A parameter passed to the plugin from (or through) gnostic. |
| 100 |
public struct Gnostic_Plugin_V1_Parameter: SwiftProtobuf.Message { |
| 101 |
public static let protoMessageName: String = _protobuf_package + ".Parameter" |
| 102 |
|
| 103 |
/// The name of the parameter as specified in the option string |
| 104 |
public var name: String = String() |
| 105 |
|
| 106 |
/// The parameter value as specified in the option string |
| 107 |
public var value: String = String() |
| 108 |
|
| 109 |
public var unknownFields = SwiftProtobuf.UnknownStorage() |
| 110 |
|
| 111 |
public init() {} |
| 112 |
|
| 113 |
/// Used by the decoding initializers in the SwiftProtobuf library, not generally |
| 114 |
/// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding |
| 115 |
/// initializers are defined in the SwiftProtobuf library. See the Message and |
| 116 |
/// Message+*Additions` files. |
| 117 |
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws { |
| 118 |
while let fieldNumber = try decoder.nextFieldNumber() { |
| 119 |
switch fieldNumber { |
| 120 |
case 1: try decoder.decodeSingularStringField(value: &self.name) |
| 121 |
case 2: try decoder.decodeSingularStringField(value: &self.value) |
| 122 |
default: break |
| 123 |
} |
| 124 |
} |
| 125 |
} |
| 126 |
|
| 127 |
/// Used by the encoding methods of the SwiftProtobuf library, not generally |
| 128 |
/// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and |
| 129 |
/// other serializer methods are defined in the SwiftProtobuf library. See the |
| 130 |
/// `Message` and `Message+*Additions` files. |
| 131 |
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws { |
| 132 |
if !self.name.isEmpty { |
| 133 |
try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) |
| 134 |
} |
| 135 |
if !self.value.isEmpty { |
| 136 |
try visitor.visitSingularStringField(value: self.value, fieldNumber: 2) |
| 137 |
} |
| 138 |
try unknownFields.traverse(visitor: &visitor) |
| 139 |
} |
| 140 |
} |
| 141 |
|
| 142 |
/// An encoded Request is written to the plugin's stdin. |
| 143 |
public struct Gnostic_Plugin_V1_Request: SwiftProtobuf.Message { |
| 144 |
public static let protoMessageName: String = _protobuf_package + ".Request" |
| 145 |
|
| 146 |
/// filename or URL of the original source document |
| 147 |
public var sourceName: String { |
| 148 |
get {return _storage._sourceName} |
| 149 |
set {_uniqueStorage()._sourceName = newValue} |
| 150 |
} |
| 151 |
|
| 152 |
/// Output path specified in the plugin invocation. |
| 153 |
public var outputPath: String { |
| 154 |
get {return _storage._outputPath} |
| 155 |
set {_uniqueStorage()._outputPath = newValue} |
| 156 |
} |
| 157 |
|
| 158 |
/// Plugin parameters parsed from the invocation string. |
| 159 |
public var parameters: [Gnostic_Plugin_V1_Parameter] { |
| 160 |
get {return _storage._parameters} |
| 161 |
set {_uniqueStorage()._parameters = newValue} |
| 162 |
} |
| 163 |
|
| 164 |
/// The version number of gnostic. |
| 165 |
public var compilerVersion: Gnostic_Plugin_V1_Version { |
| 166 |
get {return _storage._compilerVersion ?? Gnostic_Plugin_V1_Version()} |
| 167 |
set {_uniqueStorage()._compilerVersion = newValue} |
| 168 |
} |
| 169 |
/// Returns true if `compilerVersion` has been explicitly set. |
| 170 |
public var hasCompilerVersion: Bool {return _storage._compilerVersion != nil} |
| 171 |
/// Clears the value of `compilerVersion`. Subsequent reads from it will return its default value. |
| 172 |
public mutating func clearCompilerVersion() {_storage._compilerVersion = nil} |
| 173 |
|
| 174 |
/// API models |
| 175 |
public var models: [SwiftProtobuf.Google_Protobuf_Any] { |
| 176 |
get {return _storage._models} |
| 177 |
set {_uniqueStorage()._models = newValue} |
| 178 |
} |
| 179 |
|
| 180 |
public var unknownFields = SwiftProtobuf.UnknownStorage() |
| 181 |
|
| 182 |
public init() {} |
| 183 |
|
| 184 |
/// Used by the decoding initializers in the SwiftProtobuf library, not generally |
| 185 |
/// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding |
| 186 |
/// initializers are defined in the SwiftProtobuf library. See the Message and |
| 187 |
/// Message+*Additions` files. |
| 188 |
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws { |
| 189 |
_ = _uniqueStorage() |
| 190 |
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in |
| 191 |
while let fieldNumber = try decoder.nextFieldNumber() { |
| 192 |
switch fieldNumber { |
| 193 |
case 1: try decoder.decodeSingularStringField(value: &_storage._sourceName) |
| 194 |
case 2: try decoder.decodeSingularStringField(value: &_storage._outputPath) |
| 195 |
case 3: try decoder.decodeRepeatedMessageField(value: &_storage._parameters) |
| 196 |
case 4: try decoder.decodeSingularMessageField(value: &_storage._compilerVersion) |
| 197 |
case 5: try decoder.decodeRepeatedMessageField(value: &_storage._models) |
| 198 |
default: break |
| 199 |
} |
| 200 |
} |
| 201 |
} |
| 202 |
} |
| 203 |
|
| 204 |
/// Used by the encoding methods of the SwiftProtobuf library, not generally |
| 205 |
/// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and |
| 206 |
/// other serializer methods are defined in the SwiftProtobuf library. See the |
| 207 |
/// `Message` and `Message+*Additions` files. |
| 208 |
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws { |
| 209 |
try withExtendedLifetime(_storage) { (_storage: _StorageClass) in |
| 210 |
if !_storage._sourceName.isEmpty { |
| 211 |
try visitor.visitSingularStringField(value: _storage._sourceName, fieldNumber: 1) |
| 212 |
} |
| 213 |
if !_storage._outputPath.isEmpty { |
| 214 |
try visitor.visitSingularStringField(value: _storage._outputPath, fieldNumber: 2) |
| 215 |
} |
| 216 |
if !_storage._parameters.isEmpty { |
| 217 |
try visitor.visitRepeatedMessageField(value: _storage._parameters, fieldNumber: 3) |
| 218 |
} |
| 219 |
if let v = _storage._compilerVersion { |
| 220 |
try visitor.visitSingularMessageField(value: v, fieldNumber: 4) |
| 221 |
} |
| 222 |
if !_storage._models.isEmpty { |
| 223 |
try visitor.visitRepeatedMessageField(value: _storage._models, fieldNumber: 5) |
| 224 |
} |
| 225 |
} |
| 226 |
try unknownFields.traverse(visitor: &visitor) |
| 227 |
} |
| 228 |
|
| 229 |
fileprivate var _storage = _StorageClass.defaultInstance |
| 230 |
} |
| 231 |
|
| 232 |
/// The plugin writes an encoded Response to stdout. |
| 233 |
public struct Gnostic_Plugin_V1_Response: SwiftProtobuf.Message { |
| 234 |
public static let protoMessageName: String = _protobuf_package + ".Response" |
| 235 |
|
| 236 |
/// Error message. If non-empty, the plugin failed. |
| 237 |
/// The plugin process should exit with status code zero |
| 238 |
/// even if it reports an error in this way. |
| 239 |
/// |
| 240 |
/// This should be used to indicate errors which prevent the plugin from |
| 241 |
/// operating as intended. Errors which indicate a problem in gnostic |
| 242 |
/// itself -- such as the input Document being unparseable -- should be |
| 243 |
/// reported by writing a message to stderr and exiting with a non-zero |
| 244 |
/// status code. |
| 245 |
public var errors: [String] = [] |
| 246 |
|
| 247 |
/// file output, each file will be written by gnostic to an appropriate location. |
| 248 |
public var files: [Gnostic_Plugin_V1_File] = [] |
| 249 |
|
| 250 |
public var unknownFields = SwiftProtobuf.UnknownStorage() |
| 251 |
|
| 252 |
public init() {} |
| 253 |
|
| 254 |
/// Used by the decoding initializers in the SwiftProtobuf library, not generally |
| 255 |
/// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding |
| 256 |
/// initializers are defined in the SwiftProtobuf library. See the Message and |
| 257 |
/// Message+*Additions` files. |
| 258 |
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws { |
| 259 |
while let fieldNumber = try decoder.nextFieldNumber() { |
| 260 |
switch fieldNumber { |
| 261 |
case 1: try decoder.decodeRepeatedStringField(value: &self.errors) |
| 262 |
case 2: try decoder.decodeRepeatedMessageField(value: &self.files) |
| 263 |
default: break |
| 264 |
} |
| 265 |
} |
| 266 |
} |
| 267 |
|
| 268 |
/// Used by the encoding methods of the SwiftProtobuf library, not generally |
| 269 |
/// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and |
| 270 |
/// other serializer methods are defined in the SwiftProtobuf library. See the |
| 271 |
/// `Message` and `Message+*Additions` files. |
| 272 |
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws { |
| 273 |
if !self.errors.isEmpty { |
| 274 |
try visitor.visitRepeatedStringField(value: self.errors, fieldNumber: 1) |
| 275 |
} |
| 276 |
if !self.files.isEmpty { |
| 277 |
try visitor.visitRepeatedMessageField(value: self.files, fieldNumber: 2) |
| 278 |
} |
| 279 |
try unknownFields.traverse(visitor: &visitor) |
| 280 |
} |
| 281 |
} |
| 282 |
|
| 283 |
/// File describes a file generated by a plugin. |
| 284 |
public struct Gnostic_Plugin_V1_File: SwiftProtobuf.Message { |
| 285 |
public static let protoMessageName: String = _protobuf_package + ".File" |
| 286 |
|
| 287 |
/// name of the file |
| 288 |
public var name: String = String() |
| 289 |
|
| 290 |
/// data to be written to the file |
| 291 |
public var data: Data = SwiftProtobuf.Internal.emptyData |
| 292 |
|
| 293 |
public var unknownFields = SwiftProtobuf.UnknownStorage() |
| 294 |
|
| 295 |
public init() {} |
| 296 |
|
| 297 |
/// Used by the decoding initializers in the SwiftProtobuf library, not generally |
| 298 |
/// used directly. `init(serializedData:)`, `init(jsonUTF8Data:)`, and other decoding |
| 299 |
/// initializers are defined in the SwiftProtobuf library. See the Message and |
| 300 |
/// Message+*Additions` files. |
| 301 |
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws { |
| 302 |
while let fieldNumber = try decoder.nextFieldNumber() { |
| 303 |
switch fieldNumber { |
| 304 |
case 1: try decoder.decodeSingularStringField(value: &self.name) |
| 305 |
case 2: try decoder.decodeSingularBytesField(value: &self.data) |
| 306 |
default: break |
| 307 |
} |
| 308 |
} |
| 309 |
} |
| 310 |
|
| 311 |
/// Used by the encoding methods of the SwiftProtobuf library, not generally |
| 312 |
/// used directly. `Message.serializedData()`, `Message.jsonUTF8Data()`, and |
| 313 |
/// other serializer methods are defined in the SwiftProtobuf library. See the |
| 314 |
/// `Message` and `Message+*Additions` files. |
| 315 |
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws { |
| 316 |
if !self.name.isEmpty { |
| 317 |
try visitor.visitSingularStringField(value: self.name, fieldNumber: 1) |
| 318 |
} |
| 319 |
if !self.data.isEmpty { |
| 320 |
try visitor.visitSingularBytesField(value: self.data, fieldNumber: 2) |
| 321 |
} |
| 322 |
try unknownFields.traverse(visitor: &visitor) |
| 323 |
} |
| 324 |
} |
| 325 |
|
| 326 |
// MARK: - Code below here is support for the SwiftProtobuf runtime. |
| 327 |
|
| 328 |
fileprivate let _protobuf_package = "gnostic.plugin.v1" |
| 329 |
|
| 330 |
extension Gnostic_Plugin_V1_Version: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { |
| 331 |
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ |
| 332 |
1: .same(proto: "major"), |
| 333 |
2: .same(proto: "minor"), |
| 334 |
3: .same(proto: "patch"), |
| 335 |
4: .same(proto: "suffix"), |
| 336 |
] |
| 337 |
|
| 338 |
public func _protobuf_generated_isEqualTo(other: Gnostic_Plugin_V1_Version) -> Bool { |
| 339 |
if self.major != other.major {return false} |
| 340 |
if self.minor != other.minor {return false} |
| 341 |
if self.patch != other.patch {return false} |
| 342 |
if self.suffix != other.suffix {return false} |
| 343 |
if unknownFields != other.unknownFields {return false} |
| 344 |
return true |
| 345 |
} |
| 346 |
} |
| 347 |
|
| 348 |
extension Gnostic_Plugin_V1_Parameter: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { |
| 349 |
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ |
| 350 |
1: .same(proto: "name"), |
| 351 |
2: .same(proto: "value"), |
| 352 |
] |
| 353 |
|
| 354 |
public func _protobuf_generated_isEqualTo(other: Gnostic_Plugin_V1_Parameter) -> Bool { |
| 355 |
if self.name != other.name {return false} |
| 356 |
if self.value != other.value {return false} |
| 357 |
if unknownFields != other.unknownFields {return false} |
| 358 |
return true |
| 359 |
} |
| 360 |
} |
| 361 |
|
| 362 |
extension Gnostic_Plugin_V1_Request: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { |
| 363 |
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ |
| 364 |
1: .standard(proto: "source_name"), |
| 365 |
2: .standard(proto: "output_path"), |
| 366 |
3: .same(proto: "parameters"), |
| 367 |
4: .standard(proto: "compiler_version"), |
| 368 |
5: .same(proto: "models"), |
| 369 |
] |
| 370 |
|
| 371 |
fileprivate class _StorageClass { |
| 372 |
var _sourceName: String = String() |
| 373 |
var _outputPath: String = String() |
| 374 |
var _parameters: [Gnostic_Plugin_V1_Parameter] = [] |
| 375 |
var _compilerVersion: Gnostic_Plugin_V1_Version? = nil |
| 376 |
var _models: [SwiftProtobuf.Google_Protobuf_Any] = [] |
| 377 |
|
| 378 |
static let defaultInstance = _StorageClass() |
| 379 |
|
| 380 |
private init() {} |
| 381 |
|
| 382 |
init(copying source: _StorageClass) { |
| 383 |
_sourceName = source._sourceName |
| 384 |
_outputPath = source._outputPath |
| 385 |
_parameters = source._parameters |
| 386 |
_compilerVersion = source._compilerVersion |
| 387 |
_models = source._models |
| 388 |
} |
| 389 |
} |
| 390 |
|
| 391 |
fileprivate mutating func _uniqueStorage() -> _StorageClass { |
| 392 |
if !isKnownUniquelyReferenced(&_storage) { |
| 393 |
_storage = _StorageClass(copying: _storage) |
| 394 |
} |
| 395 |
return _storage |
| 396 |
} |
| 397 |
|
| 398 |
public func _protobuf_generated_isEqualTo(other: Gnostic_Plugin_V1_Request) -> Bool { |
| 399 |
if _storage !== other._storage { |
| 400 |
let storagesAreEqual: Bool = withExtendedLifetime((_storage, other._storage)) { (_storage, other_storage) in |
| 401 |
if _storage._sourceName != other_storage._sourceName {return false} |
| 402 |
if _storage._outputPath != other_storage._outputPath {return false} |
| 403 |
if _storage._parameters != other_storage._parameters {return false} |
| 404 |
if _storage._compilerVersion != other_storage._compilerVersion {return false} |
| 405 |
if _storage._models != other_storage._models {return false} |
| 406 |
return true |
| 407 |
} |
| 408 |
if !storagesAreEqual {return false} |
| 409 |
} |
| 410 |
if unknownFields != other.unknownFields {return false} |
| 411 |
return true |
| 412 |
} |
| 413 |
} |
| 414 |
|
| 415 |
extension Gnostic_Plugin_V1_Response: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { |
| 416 |
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ |
| 417 |
1: .same(proto: "errors"), |
| 418 |
2: .same(proto: "files"), |
| 419 |
] |
| 420 |
|
| 421 |
public func _protobuf_generated_isEqualTo(other: Gnostic_Plugin_V1_Response) -> Bool { |
| 422 |
if self.errors != other.errors {return false} |
| 423 |
if self.files != other.files {return false} |
| 424 |
if unknownFields != other.unknownFields {return false} |
| 425 |
return true |
| 426 |
} |
| 427 |
} |
| 428 |
|
| 429 |
extension Gnostic_Plugin_V1_File: SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding { |
| 430 |
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [ |
| 431 |
1: .same(proto: "name"), |
| 432 |
2: .same(proto: "data"), |
| 433 |
] |
| 434 |
|
| 435 |
public func _protobuf_generated_isEqualTo(other: Gnostic_Plugin_V1_File) -> Bool { |
| 436 |
if self.name != other.name {return false} |
| 437 |
if self.data != other.data {return false} |
| 438 |
if unknownFields != other.unknownFields {return false} |
| 439 |
return true |
| 440 |
} |
| 441 |
} |