From d773b4bc9fe86d6bcfacdf3d2f9e606c2b613df9 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Mon, 18 Feb 2019 12:09:15 +0000 Subject: [PATCH] Added `PrintModuleOutputNamespace` option to `CSharpTypePrinter`. --- .../Generators/CSharp/CSharpTypePrinter.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index 3c9cbf4c..adb09c05 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -20,6 +20,8 @@ namespace CppSharp.Generators.CSharp public DriverOptions Options => Context.Options; public TypeMapDatabase TypeMapDatabase => Context.TypeMaps; + public bool PrintModuleOutputNamespace = true; + public CSharpTypePrinter(BindingContext context) { Context = context; @@ -646,10 +648,13 @@ namespace CppSharp.Generators.CSharp ctx = ctx.Namespace; } - var unit = ctx.TranslationUnit; - if (!unit.IsSystemHeader && unit.IsValid && - !string.IsNullOrWhiteSpace(unit.Module.OutputNamespace)) - names.Push(unit.Module.OutputNamespace); + if (PrintModuleOutputNamespace) + { + var unit = ctx.TranslationUnit; + if (!unit.IsSystemHeader && unit.IsValid && + !string.IsNullOrWhiteSpace(unit.Module.OutputNamespace)) + names.Push(unit.Module.OutputNamespace); + } return QualifiedType(string.Join(".", names)); }