Exemplo n.º 1
0
        public static int GetVTableComponentIndex(Class @class, VTableComponent entry)
        {
            switch (@class.Layout.ABI)
            {
            case CppAbi.Microsoft:
                foreach (var vfptr in @class.Layout.VFTables)
                {
                    var index = GetVTableComponentIndex(vfptr.Layout, entry);
                    if (index >= 0)
                        return index;
                }
                break;
            case CppAbi.Itanium:
                return GetVTableComponentIndex(@class.Layout.Layout, entry);
            }

            throw new NotSupportedException();
        }
Exemplo n.º 2
0
        public static int GetVTableComponentIndex(Class @class, VTableComponent entry)
        {
            switch (@class.Layout.ABI)
            {
            case CppAbi.Microsoft:
                foreach (var vfptr in @class.Layout.VFTables)
                {
                    var index = vfptr.Layout.Components.IndexOf(entry);
                    if (index >= 0)
                        return index;
                }
                break;
            case CppAbi.Itanium:
                // ignore offset to top and RTTI
                return @class.Layout.Layout.Components.IndexOf(entry) - 2;
            }

            throw new NotSupportedException();
        }
Exemplo n.º 3
0
 public static int GetVTableComponentIndex(VTableLayout layout, VTableComponent entry)
 {
     return layout.Components.IndexOf(entry);
 }