Ejemplo n.º 1
0
        private bool ParseCefCallbackStruct(List <CallbackStructNode> structs)
        {
            Mark();
            var cefStruct = new CallbackStructNode();
            var success   =
                ParseSummary(cefStruct.Comments) &&
                Scan(@"typedef struct _(cef_\w+_t) {", () => cefStruct.Name = Group01);

            if (success)
            {
                Ensure(
                    SkipSummary() &&
                    Scan("(cef_base_(?:ref_counted|scoped)_t) base;", () => cefStruct.CefBaseType = Group01)
                    );

                while (
                    ParseCefCallback(cefStruct.CefCallbacks) ||
                    SkipCommentBlock()
                    )
                {
                    ;
                }
                Ensure(Skip(@"}\s*\w+;"));
                structs.Add(cefStruct);
            }
            Unmark(success);
            return(success);
        }
Ejemplo n.º 2
0
    protected void GetCallbackFunctions(Parser.CallbackStructNode sd, ApiTypeBuilder api)
    {
        var cblist = new List <CefCallbackFunction>();

        foreach (var sm in sd.CefCallbacks)
        {
            cblist.Add(new CefCallbackFunction(CefStruct, Category, sm.Name, sm.CefConfig, sm.Signature, api, sm.Comments));
        }
        CallbackFunctions = cblist.ToArray();
    }
Ejemplo n.º 3
0
    public static CfxClass Create(CefStructType cefStruct, Parser.CallbackStructNode s, ApiTypeBuilder api)
    {
        switch (cefStruct.Category)
        {
        case StructCategory.Client:
            return(new CfxClientClass(cefStruct, s, api));

        case StructCategory.Library:
            return(new CfxLibraryClass(cefStruct, s, api));

        default:
            Debug.Assert(false);
            throw new Exception();
        }
    }
    public CfxLibraryClass(CefStructType cefStruct, Parser.CallbackStructNode sd, ApiTypeBuilder api)
        : base(cefStruct, sd.Comments)
    {
        var flist = new List <CefExportFunction>();

        foreach (var fd in sd.CefFunctions)
        {
            flist.Add(new CefExportFunction(cefStruct, fd, api));
        }
        ExportFunctions = flist.ToArray();

        GetCallbackFunctions(sd, api);

        foreach (var cb in CallbackFunctions)
        {
            var isBoolean = false;
            if (cb.IsPropertyGetter(ref isBoolean))
            {
                CefCallbackFunction setter = null;
                foreach (var cb2 in CallbackFunctions)
                {
                    if (cb2.IsPropertySetterFor(cb))
                    {
                        setter = cb2;
                        setter.Signature.ManagedParameters[1].IsPropertySetterArgument = true;
                        break;
                    }
                }
                var prop = new StructProperty(cb, setter, isBoolean);
                m_structProperties.Add(prop);
            }
        }
        foreach (var sm in CallbackFunctions)
        {
            if (!sm.IsProperty)
            {
                m_structFunctions.Add(sm);
            }
        }

        NeedsWrapFunction = true;
    }
Ejemplo n.º 5
0
 public CfxClientClass(CefStructType cefStruct, Parser.CallbackStructNode s, ApiTypeBuilder api)
     : base(cefStruct, s.Comments)
 {
     GetCallbackFunctions(s, api);
 }
Ejemplo n.º 6
0
 public void SetMembers(Parser.CallbackStructNode s, ApiTypeBuilder api)
 {
     m_classBuilder = CfxClass.Create(this, s, api);
     CefBaseType    = s.CefBaseType;
 }