Skip to content

Commit 9b05a88

Browse files
committed
IBar working
1 parent 7c2cf79 commit 9b05a88

File tree

11 files changed

+339
-147
lines changed

11 files changed

+339
-147
lines changed

App/TestData.cs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ namespace SharpCpp
44
public static class TestData
55
{
66

7-
public const string InputCode = InputCode2;
7+
public const string InputCode = InputCode3;
88

99
// done
10-
private const string InputCode1 = @"namespace CSharpFooBarLibrary
10+
const string InputCode1 = @"namespace CSharpFooBarLibrary
1111
{
1212
public class Foo {
1313
@@ -16,8 +16,31 @@ public class Foo {
1616
}
1717
}";
1818

19-
private const string InputCode2 = @"namespace CSharpFooBarLibrary
19+
// done
20+
const string InputCode2 = @"namespace CSharpFooBarLibrary
21+
{
22+
public class Foo {
23+
24+
public int number = 0;
25+
26+
public int GetNumber() {
27+
return number;
28+
}
29+
30+
public void SetNumber(int number) {
31+
this.number = number;
32+
}
33+
34+
}
35+
}";
36+
37+
const string InputCode3 = @"namespace CSharpFooBarLibrary
2038
{
39+
public interface IBar
40+
{
41+
int GetNumber();
42+
}
43+
2144
public class Foo {
2245
2346
public int number = 0;

App/ViewController.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace SharpCpp
99
{
1010
public partial class ViewController : NSViewController
1111
{
12-
12+
1313
const string CellIdentifier = "FilenameIdentifier";
1414

1515
class TVDataSource : NSTableViewDataSource
@@ -75,6 +75,7 @@ public override void ViewDidLoad()
7575

7676
LabelAboveInputCode.StringValue = "C# goes here";
7777
LabelAboveListOfGeneratedFiles.StringValue = "List of generated files";
78+
LabelAboveGeneratedFileContent.StringValue = "C++ is here";
7879
InputCode.TextDidChange += OnTextChanged;
7980
DragAndDropArea.DragAndDropHandler += OnDragAndDrop;
8081

@@ -125,9 +126,6 @@ void UpdateTextFields(string inputCode)
125126
{
126127
try {
127128
var files = Transpiler.compileCSharpToCpp(inputCode);
128-
if (files.Length > 2) {
129-
throw new Exception("Unsupported");
130-
}
131129

132130
_tvDataSource.files = files;
133131
ListOfGeneratedFiles.ReloadData();
@@ -151,11 +149,9 @@ void UpdateGeneratedFileViews(TFile file)
151149

152150
if (file == null) {
153151
_selectedFilename = null;
154-
LabelAboveGeneratedFileContent.StringValue = null;
155152
GeneratedFileContent.Value = null;
156153
} else {
157154
_selectedFilename = file.ToString();
158-
LabelAboveGeneratedFileContent.StringValue = _selectedFilename;
159155
GeneratedFileContent.Value = file.Content;
160156
}
161157
}

0 commit comments

Comments
 (0)