aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/code_generator.h
diff options
context:
space:
mode:
authorGravatar Bo Yang <teboring@google.com>2016-09-19 13:45:07 -0700
committerGravatar Bo Yang <teboring@google.com>2016-10-10 11:23:36 -0700
commitcc8ca5b6a5478b40546d4206392eb1471454460d (patch)
treec0b45abfa16d7d373a6ea8f7fe50f1de00ab938e /src/google/protobuf/compiler/code_generator.h
parent337a028bb65ccca4dda768695950b5aba53ae2c9 (diff)
Integrate internal changes
Diffstat (limited to 'src/google/protobuf/compiler/code_generator.h')
-rw-r--r--src/google/protobuf/compiler/code_generator.h41
1 files changed, 16 insertions, 25 deletions
diff --git a/src/google/protobuf/compiler/code_generator.h b/src/google/protobuf/compiler/code_generator.h
index b989f151..642bbfad 100644
--- a/src/google/protobuf/compiler/code_generator.h
+++ b/src/google/protobuf/compiler/code_generator.h
@@ -66,11 +66,11 @@ class LIBPROTOC_EXPORT CodeGenerator {
// Generates code for the given proto file, generating one or more files in
// the given output directory.
//
- // A parameter to be passed to the generator can be specified on the
- // command line. This is intended to be used by Java and similar languages
- // to specify which specific class from the proto file is to be generated,
- // though it could have other uses as well. It is empty if no parameter was
- // given.
+ // A parameter to be passed to the generator can be specified on the command
+ // line. This is intended to be used to pass generator specific parameters.
+ // It is empty if no parameter was given. ParseGeneratorParameter (below),
+ // can be used to accept multiple parameters within the single parameter
+ // command line flag.
//
// Returns true if successful. Otherwise, sets *error to a description of
// the problem (e.g. "invalid parameter") and returns false.
@@ -79,18 +79,11 @@ 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.
+ // Generates code for all given proto files.
//
- // 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.
+ // WARNING: The canonical code generator design produces one or two output
+ // files 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.
@@ -100,15 +93,13 @@ class LIBPROTOC_EXPORT CodeGenerator {
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; }
+ string* error) const;
+
+ // This is no longer used, but this class is part of the opensource protobuf
+ // library, so it has to remain to keep vtables the same for the current
+ // version of the library. When protobufs does a api breaking change, the
+ // method can be removed.
+ virtual bool HasGenerateAll() const { return true; }
private:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CodeGenerator);