Commit 7cc05ecb authored by Jan Tattermusch's avatar Jan Tattermusch

fixing implementation of GetFileUmbrellaNamespace

parent 5ac8de5b
...@@ -127,26 +127,30 @@ std::string GetFileUmbrellaClassname(const FileDescriptor* descriptor) { ...@@ -127,26 +127,30 @@ std::string GetFileUmbrellaClassname(const FileDescriptor* descriptor) {
} }
std::string GetFileUmbrellaNamespace(const FileDescriptor* descriptor) { std::string GetFileUmbrellaNamespace(const FileDescriptor* descriptor) {
if (!descriptor->options().has_csharp_umbrella_namespace()) { if (descriptor->options().has_csharp_umbrella_namespace()) {
return descriptor->options().csharp_umbrella_namespace();
}
bool collision = false; bool collision = false;
// TODO(jtattermusch): detect collisions! std::string umbrella_classname = GetFileUmbrellaClassname(descriptor);
// foreach (IDescriptor d in MessageTypes) for(int i = 0; i < descriptor->message_type_count(); i++) {
// { if (descriptor->message_type(i)->name() == umbrella_classname) {
// collision |= d.Name == builder.UmbrellaClassname; collision = true;
// } break;
// foreach (IDescriptor d in Services) }
// { }
// collision |= d.Name == builder.UmbrellaClassname; for (int i = 0; i < descriptor->service_count(); i++) {
// } if (descriptor->service(i)->name() == umbrella_classname) {
// foreach (IDescriptor d in EnumTypes) collision = true;
// { break;
// collision |= d.Name == builder.UmbrellaClassname; }
// } }
if (collision) { for (int i = 0; i < descriptor->enum_type_count(); i++) {
return "Proto"; if (descriptor->enum_type(i)->name() == umbrella_classname) {
} collision = true;
} break;
return ""; }
}
return collision ? "Proto" : "";
} }
// TODO(jtattermusch): can we reuse a utility function? // TODO(jtattermusch): can we reuse a utility function?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment