diff options
author | Jon Skeet <skeet@pobox.com> | 2008-08-15 20:57:15 +0100 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2008-08-15 20:57:15 +0100 |
commit | 9deef9baec08d5ccc5a1ea78bc078eb42d6d03b7 (patch) | |
tree | ccfc64575b4406b08f24b78a7bd9e748a8b51ae2 | |
parent | 10ad653ce5169ed362ad4464c09588d2c9c3b6c1 (diff) | |
download | protobuf-9deef9baec08d5ccc5a1ea78bc078eb42d6d03b7.tar.gz protobuf-9deef9baec08d5ccc5a1ea78bc078eb42d6d03b7.tar.bz2 protobuf-9deef9baec08d5ccc5a1ea78bc078eb42d6d03b7.zip |
Add aliases into enums
-rw-r--r-- | csharp/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs | 2 | ||||
-rw-r--r-- | src/google/protobuf/compiler/csharp/csharp_enum.cc | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/csharp/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs b/csharp/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs index b638dc46..4cce6eee 100644 --- a/csharp/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs +++ b/csharp/ProtocolBuffers.Test/TestProtos/UnitTestProtoFile.cs @@ -957,6 +957,8 @@ namespace Google.ProtocolBuffers.TestProtos { FOO1 = 1, BAR1 = 2, BAZ = 3, + FOO2 = 1, + BAR2 = 2, } public enum TestSparseEnum { diff --git a/src/google/protobuf/compiler/csharp/csharp_enum.cc b/src/google/protobuf/compiler/csharp/csharp_enum.cc index 42c928f1..38b30863 100644 --- a/src/google/protobuf/compiler/csharp/csharp_enum.cc +++ b/src/google/protobuf/compiler/csharp/csharp_enum.cc @@ -71,20 +71,18 @@ void EnumGenerator::Generate(io::Printer* printer) { printer->Print(vars, "$name$ = $number$,\r\n"); } - printer->Outdent(); - printer->Print("}\r\n\r\n"); - // ----------------------------------------------------------------- - // TODO(jonskeet): Think about aliases! - /* for (int i = 0; i < aliases_.size(); i++) { map<string, string> vars; - vars["classname"] = descriptor_->name(); vars["name"] = aliases_[i].value->name(); - vars["canonical_name"] = aliases_[i].canonical_value->name(); + vars["canonical_number"] = SimpleItoa(aliases_[i].canonical_value->number()); printer->Print(vars, - "public static final $classname$ $name$ = $canonical_name$;\r\n"); - }*/ + "$name$ = $canonical_number$,\r\n"); + } + + printer->Outdent(); + printer->Print("}\r\n\r\n"); + } } // namespace csharp |