Browse Source

Merge pull request #463 from ddobrev/master

Added an option to skip ignored bases when getting the root one
pull/450/merge
João Matos 10 years ago
parent
commit
96d0333a37
  1. 4
      src/AST/ClassExtensions.cs
  2. 2
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs
  3. 4
      tests/CSharpTemp/CSharpTemp.h

4
src/AST/ClassExtensions.cs

@ -43,11 +43,11 @@ namespace CppSharp.AST
} }
} }
public static Class GetRootBase(this Class @class) public static Class GetNonIgnoredRootBase(this Class @class)
{ {
while (true) while (true)
{ {
if (@class.BaseClass == null) if (!@class.HasNonIgnoredBase || @class.BaseClass == null)
return @class; return @class;
@class = @class.BaseClass; @class = @class.BaseClass;

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

@ -1784,7 +1784,7 @@ namespace CppSharp.Generators.CSharp
if (@class.IsRefType) if (@class.IsRefType)
{ {
var @base = @class.GetRootBase(); var @base = @class.GetNonIgnoredRootBase();
var className = @base.IsAbstractImpl ? @base.BaseClass.Name : @base.Name; var className = @base.IsAbstractImpl ? @base.BaseClass.Name : @base.Name;
// Use interfaces if any - derived types with a this class as a seconary base, must be compatible with the map // Use interfaces if any - derived types with a this class as a seconary base, must be compatible with the map

4
tests/CSharpTemp/CSharpTemp.h

@ -230,6 +230,10 @@ private:
const char* _name; const char* _name;
}; };
class TestObjectMapWithClassDerivedFromStruct : public QGenericArgument
{
};
#define DEFAULT_INT (2 * 1000UL + 500UL) #define DEFAULT_INT (2 * 1000UL + 500UL)
namespace Qt namespace Qt

Loading…
Cancel
Save