From f53e8794dda5341be6b688ed62ce362a0769c109 Mon Sep 17 00:00:00 2001 From: triton Date: Tue, 15 Apr 2014 00:28:08 +0100 Subject: [PATCH] Fixed the parser generator to also ignore any functions with std parameters. --- src/CppParser/Bindings/ParserGen.cs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/CppParser/Bindings/ParserGen.cs b/src/CppParser/Bindings/ParserGen.cs index 739b787c..173401a1 100644 --- a/src/CppParser/Bindings/ParserGen.cs +++ b/src/CppParser/Bindings/ParserGen.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; using CppSharp.AST; using CppSharp.Generators; using CppSharp.Passes; @@ -147,14 +148,32 @@ namespace CppSharp if (field.Ignore) return false; - var typePrinter = new CppTypePrinter(Driver.TypeDatabase); - var typeName = field.QualifiedType.Visit(typePrinter); + if (!IsStdType(field.QualifiedType)) return false; + + field.ExplicityIgnored = true; + return true; + } - if (!typeName.Contains("std::")) + public override bool VisitFunctionDecl(Function function) + { + if (function.Ignore) return false; - field.ExplicityIgnored = true; + if (function.Parameters.Any(param => IsStdType(param.QualifiedType))) + { + function.ExplicityIgnored = true; + return false; + } + return true; } + + private bool IsStdType(QualifiedType type) + { + var typePrinter = new CppTypePrinter(Driver.TypeDatabase); + var typeName = type.Visit(typePrinter); + + return typeName.Contains("std::"); + } } }