Esempio n. 1
0
    public ApiType GetApiType(Parser.TypeNode td, bool isConst)
    {
        var t = FindApiType(td);

        if (t.IsCefStringPtrType && isConst)
        {
            return(constStringPtrType);
        }

        return(t);
    }
Esempio n. 2
0
    private ApiType FindApiType(Parser.TypeNode td)
    {
        ApiType t = null;

        if (td.Indirection == null)
        {
            if (!apiTypes.TryGetValue(td.Name, out t))
            {
                System.Diagnostics.Debugger.Break();
            }
            return(t);
        }

        if (apiTypes.TryGetValue(td.Name + td.Indirection, out t))
        {
            return(t);
        }

        if (!apiTypes.TryGetValue(td.Name, out t))
        {
            System.Diagnostics.Debugger.Break();
        }

        if (t.IsCefEnumType)
        {
            if (td.Indirection == "*")
            {
                t = new CefEnumPtrType(t.AsCefEnumType);
            }
            else
            {
                System.Diagnostics.Debugger.Break();
            }
        }
        else if (t.IsCefStructType)
        {
            if (td.Indirection.Count((char c) => c.Equals('*')) == 1)
            {
                t = new CefStructPtrType(t.AsCefStructType, td.Indirection);
            }
            else if (td.Indirection == "**")
            {
                var t0 = new CefStructPtrType(t.AsCefStructType, "*");
                t = new CefStructOutType(t0, td.Indirection);
                //t = New CefStructRefType(t0, td.Indirection)
                //Debug.Print("StructRef " & t.ToString())
            }
            else if (td.Indirection.Count((char c) => c.Equals('*')) == 2)
            {
                var t0 = new CefStructPtrType(t.AsCefStructType, "*");
                t = new CefStructPtrPtrType(t0, td.Indirection);
            }
            else
            {
                System.Diagnostics.Debugger.Break();
            }
        }
        else if (t.IsBlittableType)
        {
            t = new BlittablePtrType(t.AsBlittableType, td.Indirection);
        }
        else
        {
            System.Diagnostics.Debugger.Break();
        }

        AddType(t);

        return(t);
    }