diff options
author | Jan Tattermusch <jtattermusch@google.com> | 2015-04-13 12:40:48 -0700 |
---|---|---|
committer | Jan Tattermusch <jtattermusch@google.com> | 2015-04-13 12:40:48 -0700 |
commit | 44664bb705fc704ac3cc5a745d200145a4897ed2 (patch) | |
tree | 6c09d5ea86bdc8cddab959ec73af43dabb871b20 /src/google/protobuf/compiler/csharp/csharp_helpers.cc | |
parent | b52cf04b3c4237bc8d2eee865d5a8f981a30d6bd (diff) |
updated C# codegen to use restricted set of csharp options from descriptor.proto
Diffstat (limited to 'src/google/protobuf/compiler/csharp/csharp_helpers.cc')
-rw-r--r-- | src/google/protobuf/compiler/csharp/csharp_helpers.cc | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/google/protobuf/compiler/csharp/csharp_helpers.cc b/src/google/protobuf/compiler/csharp/csharp_helpers.cc index 49ae2c94..ac258f04 100644 --- a/src/google/protobuf/compiler/csharp/csharp_helpers.cc +++ b/src/google/protobuf/compiler/csharp/csharp_helpers.cc @@ -122,16 +122,12 @@ std::string GetUmbrellaClassNameInternal(const std::string& proto_file) { } std::string GetFileUmbrellaClassname(const FileDescriptor* descriptor) { - if (descriptor->options().has_csharp_umbrella_classname()) { - return descriptor->options().csharp_umbrella_namespace(); - } else { - return GetUmbrellaClassNameInternal(descriptor->name()); - } + // umbrella_classname can no longer be set using message option. + return GetUmbrellaClassNameInternal(descriptor->name()); } std::string GetFileUmbrellaNamespace(const FileDescriptor* descriptor) { - if (!descriptor->options().csharp_nest_classes() - && !descriptor->options().has_csharp_umbrella_namespace()) { + if (!descriptor->options().has_csharp_umbrella_namespace()) { bool collision = false; // TODO(jtattermusch): detect collisions! // foreach (IDescriptor d in MessageTypes) @@ -196,12 +192,6 @@ std::string UnderscoresToPascalCase(const std::string& input) { std::string ToCSharpName(const std::string& name, const FileDescriptor* file) { std::string result = GetFileNamespace(file); - if (file->options().csharp_nest_classes()) { - if (result != "") { - result += "."; - } - result += GetFileUmbrellaClassname(file); - } if (result != "") { result += '.'; } @@ -233,8 +223,7 @@ std::string GetQualifiedUmbrellaClassName(const FileDescriptor* descriptor) { std::string umbrellaClassname = GetFileUmbrellaClassname(descriptor); std::string fullName = umbrellaClassname; - if (!descriptor->options().csharp_nest_classes() - && !umbrellaNamespace.empty()) { + if (!umbrellaNamespace.empty()) { fullName = umbrellaNamespace + "." + umbrellaClassname; } return fullName; |