Skip to content

Commit b9a9295

Browse files
committed
Updated C++# in order not to manually ignore functions which use external types.
Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent c8118c3 commit b9a9295

File tree

6 files changed

+20
-67
lines changed

6 files changed

+20
-67
lines changed

QtSharp.CLI/QtSharp.CLI.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,27 @@
6363
</PropertyGroup>
6464
<ItemGroup>
6565
<Reference Include="CppSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
66-
<HintPath>..\packages\CppSharp.0.7.9\lib\CppSharp.dll</HintPath>
66+
<HintPath>..\packages\CppSharp.0.7.12\lib\CppSharp.dll</HintPath>
6767
<Private>True</Private>
6868
</Reference>
6969
<Reference Include="CppSharp.AST, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
70-
<HintPath>..\packages\CppSharp.0.7.9\lib\CppSharp.AST.dll</HintPath>
70+
<HintPath>..\packages\CppSharp.0.7.12\lib\CppSharp.AST.dll</HintPath>
7171
<Private>True</Private>
7272
</Reference>
7373
<Reference Include="CppSharp.Generator, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
74-
<HintPath>..\packages\CppSharp.0.7.9\lib\CppSharp.Generator.dll</HintPath>
74+
<HintPath>..\packages\CppSharp.0.7.12\lib\CppSharp.Generator.dll</HintPath>
7575
<Private>True</Private>
7676
</Reference>
7777
<Reference Include="CppSharp.Parser, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
78-
<HintPath>..\packages\CppSharp.0.7.9\lib\CppSharp.Parser.dll</HintPath>
78+
<HintPath>..\packages\CppSharp.0.7.12\lib\CppSharp.Parser.dll</HintPath>
7979
<Private>True</Private>
8080
</Reference>
8181
<Reference Include="CppSharp.Parser.CLI, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64">
82-
<HintPath>..\packages\CppSharp.0.7.9\lib\CppSharp.Parser.CLI.dll</HintPath>
82+
<HintPath>..\packages\CppSharp.0.7.12\lib\CppSharp.Parser.CLI.dll</HintPath>
8383
<Private>True</Private>
8484
</Reference>
8585
<Reference Include="CppSharp.Runtime, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
86-
<HintPath>..\packages\CppSharp.0.7.9\lib\CppSharp.Runtime.dll</HintPath>
86+
<HintPath>..\packages\CppSharp.0.7.12\lib\CppSharp.Runtime.dll</HintPath>
8787
<Private>True</Private>
8888
</Reference>
8989
<Reference Include="System" />

QtSharp.CLI/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Baseclass.Contrib.Nuget.Output" version="2.1.0" targetFramework="net451" />
4-
<package id="CppSharp" version="0.7.9" targetFramework="net451" developmentDependency="true" />
4+
<package id="CppSharp" version="0.7.12" targetFramework="net451" developmentDependency="true" />
55
</packages>

QtSharp/GenerateSignalEventsPass.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,10 @@ public override bool VisitClassDecl(Class @class)
144144
{
145145
return false;
146146
}
147-
foreach (var method in from method in @class.Methods
148-
where method.Access != AccessSpecifier.Private
149-
select method)
147+
Declaration decl;
148+
foreach (var method in @class.Methods.Where(m => m.IsGenerated ||
149+
(m.Parameters.Any() && m.Parameters.Last().Type.Desugar().TryGetDeclaration(out decl) &&
150+
decl.OriginalName == "QPrivateSignal")))
150151
{
151152
this.HandleQSignal(@class, method);
152153
}
@@ -170,7 +171,7 @@ private void HandleQSignal(Class @class, Method method)
170171
if (method.Parameters.Any())
171172
{
172173
Class decl;
173-
if (method.Parameters.Last().Type.TryGetClass(out decl) && decl.Name == "QPrivateSignal")
174+
if (method.Parameters.Last().Type.Desugar().TryGetClass(out decl) && decl.Name == "QPrivateSignal")
174175
{
175176
method.Parameters.RemoveAt(method.Parameters.Count - 1);
176177
}

QtSharp/QtSharp.cs

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -57,54 +57,6 @@ public void Preprocess(Driver driver, ASTContext lib)
5757
method.ExplicitlyIgnore();
5858
}
5959

60-
// HACK: work around https://github.com/mono/CppSharp/issues/657
61-
var qSignalMapper = lib.FindCompleteClass("QSignalMapper");
62-
for (int i = qSignalMapper.Methods.Count - 1; i >= 0; i--)
63-
{
64-
Class @class;
65-
var method = qSignalMapper.Methods[i];
66-
if (method.Parameters.Count > 0)
67-
{
68-
var type = method.Parameters.Last().Type;
69-
var finalType = type.GetFinalPointee() ?? type;
70-
if (finalType.TryGetClass(out @class) &&
71-
@class.TranslationUnit.Module.OutputNamespace == "QtWidgets")
72-
{
73-
if (method.Name == "mapped")
74-
{
75-
qSignalMapper.Methods.RemoveAt(i);
76-
}
77-
else
78-
{
79-
method.ExplicitlyIgnore();
80-
}
81-
}
82-
}
83-
}
84-
var qActionEvent = lib.FindCompleteClass("QActionEvent");
85-
foreach (var method in qActionEvent.Methods)
86-
{
87-
if ((method.Name == "QActionEvent" && method.Parameters.Count == 3) ||
88-
method.Name == "action" || method.Name == "before")
89-
{
90-
method.ExplicitlyIgnore();
91-
}
92-
}
93-
var qCamera = lib.FindClass("QCamera").FirstOrDefault(c => !c.IsIncomplete &&
94-
c.TranslationUnit.Module.OutputNamespace == "QtMultimedia");
95-
var qMediaPlayer = lib.FindCompleteClass("QMediaPlayer");
96-
foreach (var method in qCamera.Methods.Union(qMediaPlayer.Methods).Where(m => m.Parameters.Any()))
97-
{
98-
Class @class;
99-
var type = method.Parameters.Last().Type;
100-
var finalType = type.GetFinalPointee() ?? type;
101-
if (finalType.TryGetClass(out @class) &&
102-
@class.TranslationUnit.Module.OutputNamespace == "QtMultimediaWidgets")
103-
{
104-
method.ExplicitlyIgnore();
105-
}
106-
}
107-
10860
// HACK: work around https://github.com/mono/CppSharp/issues/594
10961
lib.FindCompleteClass("QGraphicsItem").FindEnum("Extension").Access = AccessSpecifier.Public;
11062
lib.FindCompleteClass("QAbstractSlider").FindEnum("SliderChange").Access = AccessSpecifier.Public;
@@ -140,7 +92,7 @@ where string.IsNullOrEmpty(@enum.Name)
14092
foreach (var name in new[] { "QGraphicsScene", "QGraphicsView" })
14193
{
14294
var @class = lib.FindCompleteClass(name);
143-
var drawItems = @class.Methods.FirstOrDefault(m => m.OriginalName == "drawItems");
95+
var drawItems = @class.Methods.FirstOrDefault(m => m.OriginalName == "drawItems");
14496
if (drawItems != null)
14597
{
14698
drawItems.ExplicitlyIgnore();

QtSharp/QtSharp.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,27 +38,27 @@
3838
</PropertyGroup>
3939
<ItemGroup>
4040
<Reference Include="CppSharp, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
41-
<HintPath>..\packages\CppSharp.0.7.9\lib\CppSharp.dll</HintPath>
41+
<HintPath>..\packages\CppSharp.0.7.12\lib\CppSharp.dll</HintPath>
4242
<Private>True</Private>
4343
</Reference>
4444
<Reference Include="CppSharp.AST, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
45-
<HintPath>..\packages\CppSharp.0.7.9\lib\CppSharp.AST.dll</HintPath>
45+
<HintPath>..\packages\CppSharp.0.7.12\lib\CppSharp.AST.dll</HintPath>
4646
<Private>True</Private>
4747
</Reference>
4848
<Reference Include="CppSharp.Generator, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
49-
<HintPath>..\packages\CppSharp.0.7.9\lib\CppSharp.Generator.dll</HintPath>
49+
<HintPath>..\packages\CppSharp.0.7.12\lib\CppSharp.Generator.dll</HintPath>
5050
<Private>True</Private>
5151
</Reference>
5252
<Reference Include="CppSharp.Parser, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
53-
<HintPath>..\packages\CppSharp.0.7.9\lib\CppSharp.Parser.dll</HintPath>
53+
<HintPath>..\packages\CppSharp.0.7.12\lib\CppSharp.Parser.dll</HintPath>
5454
<Private>True</Private>
5555
</Reference>
5656
<Reference Include="CppSharp.Parser.CLI, Version=0.0.0.0, Culture=neutral, processorArchitecture=AMD64">
57-
<HintPath>..\packages\CppSharp.0.7.9\lib\CppSharp.Parser.CLI.dll</HintPath>
57+
<HintPath>..\packages\CppSharp.0.7.12\lib\CppSharp.Parser.CLI.dll</HintPath>
5858
<Private>True</Private>
5959
</Reference>
6060
<Reference Include="CppSharp.Runtime, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
61-
<HintPath>..\packages\CppSharp.0.7.9\lib\CppSharp.Runtime.dll</HintPath>
61+
<HintPath>..\packages\CppSharp.0.7.12\lib\CppSharp.Runtime.dll</HintPath>
6262
<Private>True</Private>
6363
</Reference>
6464
<Reference Include="HtmlAgilityPack, Version=1.4.9.5, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">

QtSharp/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Baseclass.Contrib.Nuget.Output" version="2.1.0" targetFramework="net451" />
4-
<package id="CppSharp" version="0.7.9" targetFramework="net451" developmentDependency="true" />
4+
<package id="CppSharp" version="0.7.12" targetFramework="net451" developmentDependency="true" />
55
<package id="HtmlAgilityPack" version="1.4.9.5" targetFramework="net451" />
66
<package id="zlib.net" version="1.0.4" targetFramework="net451" />
77
</packages>

0 commit comments

Comments
 (0)