Browse Source

Added better support for pure virtual functions.

pull/1/head
triton 12 years ago
parent
commit
5077adb8c9
  1. 1
      src/Bridge/Function.cs
  2. 12
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs
  3. 1
      src/Parser/Parser.cpp

1
src/Bridge/Function.cs

@ -69,6 +69,7 @@ namespace CppSharp @@ -69,6 +69,7 @@ namespace CppSharp
public List<Parameter> Parameters { get; set; }
public bool IsVariadic { get; set; }
public bool IsInline { get; set; }
public bool IsPure { get; set; }
public CallingConvention CallingConvention { get; set; }

12
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -340,6 +340,9 @@ namespace CppSharp.Generators.CSharp @@ -340,6 +340,9 @@ namespace CppSharp.Generators.CSharp
if (ctor.IsCopyConstructor || ctor.IsMoveConstructor)
continue;
if (ctor.IsPure)
continue;
NewLineIfNeeded();
GenerateInternalFunction(ctor);
}
@ -355,6 +358,9 @@ namespace CppSharp.Generators.CSharp @@ -355,6 +358,9 @@ namespace CppSharp.Generators.CSharp
if (method.IsSynthetized)
continue;
if (method.IsPure)
continue;
NewLineIfNeeded();
GenerateInternalFunction(method);
}
@ -1218,6 +1224,12 @@ namespace CppSharp.Generators.CSharp @@ -1218,6 +1224,12 @@ namespace CppSharp.Generators.CSharp
public void GenerateFunctionCall(string functionName, List<Parameter> parameters,
Function function)
{
if (function.IsPure)
{
WriteLine("throw new System.NotImplementedException();");
return;
}
var retType = function.ReturnType;
var needsReturn = !retType.Type.IsPrimitiveType(PrimitiveType.Void);

1
src/Parser/Parser.cpp

@ -1256,6 +1256,7 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, CppSharp::Function^ F, @@ -1256,6 +1256,7 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, CppSharp::Function^ F,
F->IsVariadic = FD->isVariadic();
F->IsInline = FD->isInlined();
F->IsDependent = FD->isDependentContext();
F->IsPure = FD->isPure();
auto AbiCC = GetAbiCallConv(CC, FD->isCXXInstanceMember(), FD->isVariadic());
F->CallingConvention = ConvertCallConv(AbiCC);

Loading…
Cancel
Save