Beispiel #1
0
 protected CppWalker(CSharpCompilation compilation, SemanticModel model, ConversionSettings settings)
 {
   if (compilation == null) throw new ArgumentNullException("compilation");
   if (model == null) throw new ArgumentNullException("model");
   if (settings == null) throw new ArgumentNullException("settings");
   this.compilation = compilation;
   this.model = model;
   this.settings = settings;
 }
    private void ProcessInput(object sender)
    {
      var tree = CSharpSyntaxTree.ParseText(((TextBox) sender).Text);
      var compilation = CSharpCompilation.Create("blackmire")
        .WithOptions(new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary))
        .WithReferences(MetadataReference.CreateFromFile(typeof (Int32).Assembly.Location))
        .AddSyntaxTrees(tree);
      var model = compilation.GetSemanticModel(tree, true);
      var settings = new ConversionSettings();
      var hw = new CppHeaderWalker(compilation, model, settings);
      hw.Visit(tree.GetRoot());
      HeaderBox.Text = hw.ToString();

      var iw = new CppImplWalker(compilation, model, settings);
      iw.Visit(tree.GetRoot());
      CppBox.Text = iw.ToString();
    }
Beispiel #3
0
 protected CppWalker(CSharpCompilation compilation, SemanticModel model, ConversionSettings settings)
 {
     if (compilation == null)
     {
         throw new ArgumentNullException("compilation");
     }
     if (model == null)
     {
         throw new ArgumentNullException("model");
     }
     if (settings == null)
     {
         throw new ArgumentNullException("settings");
     }
     this.compilation = compilation;
     this.model       = model;
     this.settings    = settings;
 }
        private void ProcessInput(object sender)
        {
            var tree        = CSharpSyntaxTree.ParseText(((TextBox)sender).Text);
            var compilation = CSharpCompilation.Create("blackmire")
                              .WithOptions(new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary))
                              .WithReferences(MetadataReference.CreateFromFile(typeof(Int32).Assembly.Location))
                              .AddSyntaxTrees(tree);
            var model    = compilation.GetSemanticModel(tree, true);
            var settings = new ConversionSettings();
            var hw       = new CppHeaderWalker(compilation, model, settings);

            hw.Visit(tree.GetRoot());
            HeaderBox.Text = hw.ToString();

            var iw = new CppImplWalker(compilation, model, settings);

            iw.Visit(tree.GetRoot());
            CppBox.Text = iw.ToString();
        }
Beispiel #5
0
 public CppHeaderWalker(CSharpCompilation compilation, SemanticModel model, ConversionSettings settings)
     : base(compilation, model, settings)
 {
 }
Beispiel #6
0
 public CppImplWalker(CSharpCompilation compilation, SemanticModel model, ConversionSettings settings)
     : base(compilation, model, settings)
 {
 }