<commit_before>using System;
using System.Collections.Generic;
using System.Linq;

namespace Cxxi
{
    // A C++ access specifier.
    public enum AccessSpecifier
    {
        Private,
        Protected,
        Public
    }

    // Represents a base class of a C++ class.
    public class BaseClassSpecifier
    {
        public AccessSpecifier Access { get; set; }
        public bool IsVirtual { get; set; }
        public Type Type { get; set; }

        public Class Class
        {
            get
            {
                Class @class;
                if (!Type.IsTagDecl(out @class))
                    throw new NotSupportedException();

                return @class;
            }
        }

        public bool IsClass
        {
            get
            {
                Class @class;
                return Type.IsTagDecl(out @class);
            }
        }

        public BaseClassSpecifier()
        {
            
        }
    }

    // Represents a C++ virtual function table.
    public class VFTable
    {

    }

    // Represents a C++ virtual base table.
    public class VBTable
    {

    }

    // Represents ABI-specific layout details for a class.
    public class ClassLayout
    {
        public CppAbi ABI { get; set; }
        public VFTable VirtualFunctions { get; set; }
        public VBTable VirtualBases { get; set; }

        public bool HasOwnVFTable;
        public bool HasVirtualBases;

        public int Alignment;
        public int Size;
        public int DataSize;
    }

    public enum ClassType
    {
        ValueType,
        RefType,
    }

    // Represents a C++ record Decl.
    public class Class : Declaration
    {
        public List<BaseClassSpecifier> Bases;
        public List<Class> NestedClasses;
        public List<Enumeration> NestedEnums;
        public List<Field> Fields;
        public List<Property> Properties;
        public List<Method> Methods;
        public List<Variable> Variables;
        public List<Event> Events;
        public List<FunctionTemplate> FunctionTemplates;

        // True if the record is a POD (Plain Old Data) type.
        public bool IsPOD;

        // Semantic type of the class.
        public ClassType Type;

        // ABI-specific class layout.
        public ClassLayout Layout;

        // True if class provides pure virtual methods.
        public bool IsAbstract;

        // True if the type is to be treated as a union.
        public bool IsUnion;

        // True if the type is to be treated as opaque.
        public bool IsOpaque;

        public Class()
        {
            Bases = new List<BaseClassSpecifier>();
            Fields = new List<Field>();
            Properties = new List<Property>();
            Methods = new List<Method>();
            Variables = new List<Variable>();
            Events = new List<Event>();
            NestedClasses = new List<Class>();
            NestedEnums = new List<Enumeration>();
            FunctionTemplates = new List<FunctionTemplate>();
            IsAbstract = false;
            IsUnion = false;
            IsOpaque = false;
            IsPOD = false;
            Type = ClassType.RefType;
            Layout = new ClassLayout();
        }

        public bool HasBase
        {
            get { return Bases.Count > 0; }
        }

        public bool HasBaseClass
        {
            get { return Bases.Count > 0 && Bases[0].IsClass; }
        }

        public bool IsValueType
        {
            get { return Type == ClassType.ValueType; }
        }

        public bool IsRefType
        {
            get { return Type == ClassType.RefType; }
        }

        public IEnumerable<Method> Constructors<commit_msg>Added an helper property to get the base class of a class.<commit_after>using System;
using System.Collections.Generic;
using System.Linq;

namespace Cxxi
{
    // A C++ access specifier.
    public enum AccessSpecifier
    {
        Private,
        Protected,
        Public
    }

    // Represents a base class of a C++ class.
    public class BaseClassSpecifier
    {
        public AccessSpecifier Access { get; set; }
        public bool IsVirtual { get; set; }
        public Type Type { get; set; }

        public Class Class
        {
            get
            {
                Class @class;
                if (!Type.IsTagDecl(out @class))
                    throw new NotSupportedException();

                return @class;
            }
        }

        public bool IsClass
        {
            get
            {
                Class @class;
                return Type.IsTagDecl(out @class);
            }
        }

        public BaseClassSpecifier()
        {
            
        }
    }

    // Represents a C++ virtual function table.
    public class VFTable
    {

    }

    // Represents a C++ virtual base table.
    public class VBTable
    {

    }

    // Represents ABI-specific layout details for a class.
    public class ClassLayout
    {
        public CppAbi ABI { get; set; }
        public VFTable VirtualFunctions { get; set; }
        public VBTable VirtualBases { get; set; }

        public bool HasOwnVFTable;
        public bool HasVirtualBases;

        public int Alignment;
        public int Size;
        public int DataSize;
    }

    public enum ClassType
    {
        ValueType,
        RefType,
    }

    // Represents a C++ record Decl.
    public class Class : Declaration
    {
        public List<BaseClassSpecifier> Bases;
        public List<Class> NestedClasses;
        public List<Enumeration> NestedEnums;
        public List<Field> Fields;
        public List<Property> Properties;
        public List<Method> Methods;
        public List<Variable> Variables;
        public List<Event> Events;
        public List<FunctionTemplate> FunctionTemplates;

        // True if the record is a POD (Plain Old Data) type.
        public bool IsPOD;

        // Semantic type of the class.
        public ClassType Type;

        // ABI-specific class layout.
        public ClassLayout Layout;

        // True if class provides pure virtual methods.
        public bool IsAbstract;

        // True if the type is to be treated as a union.
        public bool IsUnion;

        // True if the type is to be treated as opaque.
        public bool IsOpaque;

        public Class()
        {
            Bases = new List<BaseClassSpecifier>();
            Fields = new List<Field>();
            Properties = new List<Property>();
            Methods = new List<Method>();
            Variables = new List<Variable>();
            Events = new List<Event>();
            NestedClasses = new List<Class>();
            NestedEnums = new List<Enumeration>();
            FunctionTemplates = new List<FunctionTemplate>();
            IsAbstract = false;
            IsUnion = false;
            IsOpaque = false;
            IsPOD = false;
            Type = ClassType.RefType;
            Layout = new ClassLayout();
        }

        public bool HasBase
        {
            get { return Bases.Count > 0; }
        }

        public bool HasBaseClass
        {
            get { return BaseClass != null; }
        }

        public Class BaseClass
        {
            get
            {
                foreach (var @base in Bases)
                {
                    if (@base.IsClass && !@base.Class.Ignore)
                        return @base.Class;
                }

                return null;
            }
        }

        public bool IsValueType
        {
            get { return Type == ClassType.ValueType; }
        }

        public bool IsRefType
        {
            get { return Type == ClassType.RefType; }
        }

        public IEnumerable<Method> Constructors
{'fraction_non_alphanumeric': 0.07519280205655526, 'fraction_numerical': 0.0005141388174807198, 'mean_word_length': 1.4545741324921135, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1505990', 'n_tokens_mistral': 2039, 'n_tokens_neox': 1937, 'n_words': 639}