Browse Source

Entirely removed the Internal struct from implementations of abstract classes.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/349/head
Dimitar Dobrev 11 years ago
parent
commit
dd5c324d01
  1. 5
      src/AST/Class.cs
  2. 8
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

5
src/AST/Class.cs

@ -178,6 +178,11 @@ namespace CppSharp.AST
get { return Type == ClassType.Interface; } get { return Type == ClassType.Interface; }
} }
public bool IsAbstractImpl
{
get { return Methods.Any(m => m.SynthKind == FunctionSynthKind.AbstractImplCall); }
}
public IEnumerable<Method> Constructors public IEnumerable<Method> Constructors
{ {
get get

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

@ -333,7 +333,8 @@ namespace CppSharp.Generators.CSharp
if (!@class.IsOpaque) if (!@class.IsOpaque)
{ {
GenerateClassInternals(@class); if (!@class.IsAbstractImpl)
GenerateClassInternals(@class);
GenerateDeclContext(@class); GenerateDeclContext(@class);
if (@class.IsDependent || !@class.IsGenerated) if (@class.IsDependent || !@class.IsGenerated)
@ -1893,8 +1894,7 @@ namespace CppSharp.Generators.CSharp
string className = @class.Name; string className = @class.Name;
string safeIdentifier = className; string safeIdentifier = className;
bool isAbstractImpl = @class.Methods.Any(m => m.SynthKind == FunctionSynthKind.AbstractImplCall); if (@class.IsAbstractImpl)
if (isAbstractImpl)
{ {
className = className.Substring(0, className = className.Substring(0,
safeIdentifier.LastIndexOf("Internal", StringComparison.Ordinal)); safeIdentifier.LastIndexOf("Internal", StringComparison.Ordinal));
@ -1920,7 +1920,7 @@ namespace CppSharp.Generators.CSharp
var hasBaseClass = @class.HasBaseClass && @class.BaseClass.IsRefType; var hasBaseClass = @class.HasBaseClass && @class.BaseClass.IsRefType;
if (hasBaseClass) if (hasBaseClass)
WriteLineIndent(": base(({0}.Internal*) native{1})", WriteLineIndent(": base(({0}.Internal*) native{1})",
@class.BaseClass.Name, isAbstractImpl ? ", true" : string.Empty); @class.BaseClass.Name, @class.IsAbstractImpl ? ", true" : string.Empty);
WriteStartBraceIndent(); WriteStartBraceIndent();

Loading…
Cancel
Save