Browse Source

Allow changing the default TypePrinterContextKind when creating a type printer.

pull/1300/head
João Matos 5 years ago committed by João Matos
parent
commit
fd914fa282
  1. 2
      src/Generator/Generators/C/CppTypePrinter.cs
  2. 4
      src/Generator/Generators/TypePrinter.cs

2
src/Generator/Generators/C/CppTypePrinter.cs

@ -21,7 +21,7 @@ namespace CppSharp.Generators.C
public bool PrintTypeModifiers { get; set; } public bool PrintTypeModifiers { get; set; }
public bool PrintVariableArrayAsPointers { get; set; } public bool PrintVariableArrayAsPointers { get; set; }
public CppTypePrinter() public CppTypePrinter() : base(TypePrinterContextKind.Managed)
{ {
PrintFlavorKind = CppTypePrintFlavorKind.Cpp; PrintFlavorKind = CppTypePrintFlavorKind.Cpp;
ScopeKind = TypePrintScopeKind.GlobalQualified; ScopeKind = TypePrintScopeKind.GlobalQualified;

4
src/Generator/Generators/TypePrinter.cs

@ -42,11 +42,11 @@ namespace CppSharp.Generators
public TypePrintScopeKind ScopeKind = TypePrintScopeKind.GlobalQualified; public TypePrintScopeKind ScopeKind = TypePrintScopeKind.GlobalQualified;
public bool IsGlobalQualifiedScope => ScopeKind == TypePrintScopeKind.GlobalQualified; public bool IsGlobalQualifiedScope => ScopeKind == TypePrintScopeKind.GlobalQualified;
public TypePrinter() public TypePrinter(TypePrinterContextKind contextKind = TypePrinterContextKind.Managed)
{ {
contexts = new Stack<TypePrinterContextKind>(); contexts = new Stack<TypePrinterContextKind>();
marshalKinds = new Stack<MarshalKind>(); marshalKinds = new Stack<MarshalKind>();
PushContext(TypePrinterContextKind.Managed); PushContext(contextKind);
PushMarshalKind(MarshalKind.Unknown); PushMarshalKind(MarshalKind.Unknown);
} }

Loading…
Cancel
Save