aboutsummaryrefslogtreecommitdiff
path: root/src/ProtoGen/UmbrellaClassGenerator.cs
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2010-09-03 16:36:50 -0500
committercsharptest <roger@csharptest.net>2010-09-03 16:36:50 -0500
commite8e1dab03f8cdd473a3504c4efbe6920eb2c2612 (patch)
tree7c03f66af7cb01ed678a82f2832cf90c00a34eca /src/ProtoGen/UmbrellaClassGenerator.cs
parent5c69749b0b4b4aaa808c208d33b9192e4328e7b4 (diff)
downloadprotobuf-e8e1dab03f8cdd473a3504c4efbe6920eb2c2612.tar.gz
protobuf-e8e1dab03f8cdd473a3504c4efbe6920eb2c2612.tar.bz2
protobuf-e8e1dab03f8cdd473a3504c4efbe6920eb2c2612.zip
Completed the following changes & testing, see todo.txt for more information
1 - Add a way to specify the output directory 2 - Added an option "file_extension" to control the suffix for cs files generated, defaults to ".cs" 3 - Added the option for "umbrella_namespace" used when nest_classes=false and having name conflicts 4 - Optionally remove dependencies to csharp options 5 - Investigate command line parsing library 6 - Investigate calling protoc directly 7 - Unable to resolve dependencies correctly 8 - Added several (20) nunits to automate the command-line invocation of each option
Diffstat (limited to 'src/ProtoGen/UmbrellaClassGenerator.cs')
-rw-r--r--src/ProtoGen/UmbrellaClassGenerator.cs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/ProtoGen/UmbrellaClassGenerator.cs b/src/ProtoGen/UmbrellaClassGenerator.cs
index 9dcbcab9..d596f1a1 100644
--- a/src/ProtoGen/UmbrellaClassGenerator.cs
+++ b/src/ProtoGen/UmbrellaClassGenerator.cs
@@ -92,7 +92,13 @@ namespace Google.ProtocolBuffers.ProtoGen {
if (!Descriptor.CSharpOptions.NestClasses) {
writer.Outdent();
writer.WriteLine("}");
- }
+
+ //ROK 2010-09-03 - close the namespace around the umbrella class if defined
+ if (!Descriptor.CSharpOptions.NestClasses && Descriptor.CSharpOptions.UmbrellaNamespace != "") {
+ writer.Outdent();
+ writer.WriteLine("}");
+ }
+ }
WriteChildren(writer, "Enums", Descriptor.EnumTypes);
WriteChildren(writer, "Messages", Descriptor.MessageTypes);
WriteChildren(writer, "Services", Descriptor.Services);
@@ -115,7 +121,14 @@ namespace Google.ProtocolBuffers.ProtoGen {
writer.WriteLine("namespace {0} {{", Descriptor.CSharpOptions.Namespace);
writer.Indent();
writer.WriteLine();
- }
+ }
+ //ROK 2010-09-03 - add the namespace around the umbrella class if defined
+ if(!Descriptor.CSharpOptions.NestClasses && Descriptor.CSharpOptions.UmbrellaNamespace != "") {
+ writer.WriteLine("namespace {0} {{", Descriptor.CSharpOptions.UmbrellaNamespace);
+ writer.Indent();
+ writer.WriteLine();
+ }
+
if (Descriptor.CSharpOptions.CodeContracts) {
writer.WriteLine("[global::System.Diagnostics.Contracts.ContractVerificationAttribute(false)]");
}