| Index: third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc
|
| index 825de542c388da33a4620ec78632dbb2ae21c063..d74e8c8847208fa7fa35669f6cae9509c00cf3d3 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc
|
| +++ b/third_party/protobuf/src/google/protobuf/compiler/csharp/csharp_generator.cc
|
| @@ -41,6 +41,7 @@
|
| #include <google/protobuf/compiler/csharp/csharp_generator.h>
|
| #include <google/protobuf/compiler/csharp/csharp_helpers.h>
|
| #include <google/protobuf/compiler/csharp/csharp_names.h>
|
| +#include <google/protobuf/compiler/csharp/csharp_options.h>
|
| #include <google/protobuf/compiler/csharp/csharp_reflection_class.h>
|
|
|
| using google::protobuf::internal::scoped_ptr;
|
| @@ -51,8 +52,9 @@ namespace compiler {
|
| namespace csharp {
|
|
|
| void GenerateFile(const google::protobuf::FileDescriptor* file,
|
| - io::Printer* printer) {
|
| - ReflectionClassGenerator reflectionClassGenerator(file);
|
| + io::Printer* printer,
|
| + const Options* options) {
|
| + ReflectionClassGenerator reflectionClassGenerator(file, options);
|
| reflectionClassGenerator.Generate(printer);
|
| }
|
|
|
| @@ -71,15 +73,19 @@ bool Generator::Generate(
|
| return false;
|
| }
|
|
|
| - std::string file_extension = ".cs";
|
| - std::string base_namespace = "";
|
| - bool generate_directories = false;
|
| + struct Options cli_options;
|
| +
|
| for (int i = 0; i < options.size(); i++) {
|
| if (options[i].first == "file_extension") {
|
| - file_extension = options[i].second;
|
| + cli_options.file_extension = options[i].second;
|
| } else if (options[i].first == "base_namespace") {
|
| - base_namespace = options[i].second;
|
| - generate_directories = true;
|
| + cli_options.base_namespace = options[i].second;
|
| + cli_options.base_namespace_specified = true;
|
| + } else if (options[i].first == "internal_access") {
|
| + cli_options.internal_access = true;
|
| + } else if (options[i].first == "legacy_enum_values") {
|
| + // TODO: Remove this before final release
|
| + cli_options.legacy_enum_values = true;
|
| } else {
|
| *error = "Unknown generator option: " + options[i].first;
|
| return false;
|
| @@ -87,7 +93,12 @@ bool Generator::Generate(
|
| }
|
|
|
| string filename_error = "";
|
| - std::string filename = GetOutputFile(file, file_extension, generate_directories, base_namespace, &filename_error);
|
| + std::string filename = GetOutputFile(file,
|
| + cli_options.file_extension,
|
| + cli_options.base_namespace_specified,
|
| + cli_options.base_namespace,
|
| + &filename_error);
|
| +
|
| if (filename.empty()) {
|
| *error = filename_error;
|
| return false;
|
| @@ -96,7 +107,7 @@ bool Generator::Generate(
|
| generator_context->Open(filename));
|
| io::Printer printer(output.get(), '$');
|
|
|
| - GenerateFile(file, &printer);
|
| + GenerateFile(file, &printer, &cli_options);
|
|
|
| return true;
|
| }
|
|
|