Browse Source

Changed Driver.Diagnostics setter to public. Replaced TextDiagnosticPrinter Verbose field by Level.

pull/228/merge
marcos henrich 12 years ago committed by triton
parent
commit
d63ef03200
  1. 5
      src/Core/Diagnostics.cs
  2. 6
      src/Generator/Driver.cs

5
src/Core/Diagnostics.cs

@ -143,17 +143,18 @@ namespace CppSharp
public class TextDiagnosticPrinter : IDiagnosticConsumer public class TextDiagnosticPrinter : IDiagnosticConsumer
{ {
public bool Verbose;
public Stack<int> Indents; public Stack<int> Indents;
public DiagnosticKind Level;
public TextDiagnosticPrinter() public TextDiagnosticPrinter()
{ {
Indents = new Stack<int>(); Indents = new Stack<int>();
Level = DiagnosticKind.Message;
} }
public void Emit(DiagnosticInfo info) public void Emit(DiagnosticInfo info)
{ {
if (info.Kind == DiagnosticKind.Debug && !Verbose) if (info.Kind < Level)
return; return;
var currentIndent = Indents.Sum(); var currentIndent = Indents.Sum();

6
src/Generator/Driver.cs

@ -21,8 +21,9 @@ namespace CppSharp
{ {
public class Driver public class Driver
{ {
public IDiagnosticConsumer Diagnostics { get; set; }
public DriverOptions Options { get; private set; } public DriverOptions Options { get; private set; }
public IDiagnosticConsumer Diagnostics { get; private set; }
public Project Project { get; private set; } public Project Project { get; private set; }
public TypeMapDatabase TypeDatabase { get; private set; } public TypeMapDatabase TypeDatabase { get; private set; }
@ -421,7 +422,8 @@ namespace CppSharp
library.Setup(driver); library.Setup(driver);
driver.Setup(); driver.Setup();
Log.Verbose = driver.Options.Verbose; if(driver.Options.Verbose)
Log.Level = DiagnosticKind.Debug;
if (!options.Quiet) if (!options.Quiet)
Log.EmitMessage("Parsing libraries..."); Log.EmitMessage("Parsing libraries...");

Loading…
Cancel
Save