| Index: third_party/protobuf/src/google/protobuf/compiler/code_generator.h
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/code_generator.h b/third_party/protobuf/src/google/protobuf/compiler/code_generator.h
|
| index 252f68d1dc269898a64118fc8dd6015176b98cb0..b989f151328fc7c8e08c5c3fbe2225fd11fb3f7d 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/code_generator.h
|
| +++ b/third_party/protobuf/src/google/protobuf/compiler/code_generator.h
|
| @@ -1,6 +1,6 @@
|
| // Protocol Buffers - Google's data interchange format
|
| // Copyright 2008 Google Inc. All rights reserved.
|
| -// http://code.google.com/p/protobuf/
|
| +// https://developers.google.com/protocol-buffers/
|
| //
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| @@ -79,6 +79,37 @@ class LIBPROTOC_EXPORT CodeGenerator {
|
| GeneratorContext* generator_context,
|
| string* error) const = 0;
|
|
|
| + // Generates code for all given proto files, generating one or more files in
|
| + // the given output directory.
|
| + //
|
| + // This method should be called instead of |Generate()| when
|
| + // |HasGenerateAll()| returns |true|. It is used to emulate legacy semantics
|
| + // when more than one `.proto` file is specified on one compiler invocation.
|
| + //
|
| + // WARNING: Please do not use unless legacy semantics force the code generator
|
| + // to produce a single output file for all input files, or otherwise require
|
| + // an examination of all input files first. The canonical code generator
|
| + // design produces one output file per input .proto file, and we do not wish
|
| + // to encourage alternate designs.
|
| + //
|
| + // A parameter is given as passed on the command line, as in |Generate()|
|
| + // above.
|
| + //
|
| + // Returns true if successful. Otherwise, sets *error to a description of
|
| + // the problem (e.g. "invalid parameter") and returns false.
|
| + virtual bool GenerateAll(const vector<const FileDescriptor*>& files,
|
| + const string& parameter,
|
| + GeneratorContext* generator_context,
|
| + string* error) const {
|
| + *error = "Unimplemented GenerateAll() method.";
|
| + return false;
|
| + }
|
| +
|
| + // Returns true if the code generator expects to receive all FileDescriptors
|
| + // at once (via |GenerateAll()|), rather than one at a time (via
|
| + // |Generate()|). This is required to implement legacy semantics.
|
| + virtual bool HasGenerateAll() const { return false; }
|
| +
|
| private:
|
| GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CodeGenerator);
|
| };
|
| @@ -104,6 +135,9 @@ class LIBPROTOC_EXPORT GeneratorContext {
|
| // contain "." or ".." components.
|
| virtual io::ZeroCopyOutputStream* Open(const string& filename) = 0;
|
|
|
| + // Similar to Open() but the output will be appended to the file if exists
|
| + virtual io::ZeroCopyOutputStream* OpenForAppend(const string& filename);
|
| +
|
| // Creates a ZeroCopyOutputStream which will insert code into the given file
|
| // at the given insertion point. See plugin.proto (plugin.pb.h) for more
|
| // information on insertion points. The default implementation
|
|
|