diff options
author | csharptest <roger@csharptest.net> | 2010-09-03 16:36:50 -0500 |
---|---|---|
committer | csharptest <roger@csharptest.net> | 2010-09-03 16:36:50 -0500 |
commit | e8e1dab03f8cdd473a3504c4efbe6920eb2c2612 (patch) | |
tree | 7c03f66af7cb01ed678a82f2832cf90c00a34eca /src/ProtoGen/DescriptorUtil.cs | |
parent | 5c69749b0b4b4aaa808c208d33b9192e4328e7b4 (diff) | |
download | protobuf-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/DescriptorUtil.cs')
-rw-r--r-- | src/ProtoGen/DescriptorUtil.cs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ProtoGen/DescriptorUtil.cs b/src/ProtoGen/DescriptorUtil.cs index 14d28bb8..f485db6f 100644 --- a/src/ProtoGen/DescriptorUtil.cs +++ b/src/ProtoGen/DescriptorUtil.cs @@ -46,10 +46,24 @@ namespace Google.ProtocolBuffers.ProtoGen { CSharpFileOptions options = descriptor.File.CSharpOptions; string result = options.Namespace; if (result != "") result += '.'; - result += options.UmbrellaClassname; + result += QualifiedUmbrellaClassName(options); return "global::" + result; } + /// <summary> + /// ROK 2010-09-03 + /// Evaluates the options and returns the qualified name of the umbrella class + /// relative to the descriptor type's namespace. Basically contacts the + /// UmbrellaNamespace + UmbrellaClassname fields. + /// </summary> + internal static string QualifiedUmbrellaClassName(CSharpFileOptions options) + { + string fullName = options.UmbrellaClassname; + if (!options.NestClasses && options.UmbrellaNamespace != "") + fullName = String.Format("{0}.{1}", options.UmbrellaNamespace, options.UmbrellaClassname); + return fullName; + } + internal static string GetMappedTypeName(MappedType type) { switch(type) { case MappedType.Int32: return "int"; |