コード例 #1
0
        private void ParseBody(StructData parent, string body)
        {
            var memberDeclerations = body.Split(';');

            for (var i = 0; i <= memberDeclerations.Length - 2; i++)
            {
                if (memberDeclerations[i].Contains("CEF_CALLBACK"))
                {
                    var sm = ParseCallback(memberDeclerations[i]);
                    if (sm != null)
                    {
                        parent.StructMembers.Add(sm);
                    }
                }
                else
                {
                    if (!varEx.IsMatch(memberDeclerations[i]))
                    {
                        System.Diagnostics.Debugger.Break();
                    }
                    var m = varEx.Match(memberDeclerations[i]);

                    var sm     = new StructMemberData();
                    var unused = false;
                    sm.MemberType = ParseTypeDecl(m.Groups[1].Value.Trim(), ref unused);
                    sm.Name       = m.Groups[2].Value;
                    parent.StructMembers.Add(sm);
                }
            }
        }
コード例 #2
0
        private StructMemberData ParseCallback(string declaration)
        {
            if (!callbackRegex.IsMatch(declaration))
            {
                System.Diagnostics.Debugger.Break();
            }

            var m = callbackRegex.Match(declaration);

            var cb = new StructMemberData();

            cb.Name = m.Groups[2].Value;
            cb.CallbackSignature            = new SignatureData();
            cb.CallbackSignature.ReturnType = ParseTypeDecl(m.Groups[1].Value.Trim(), ref cb.CallbackSignature.ReturnValueIsConst);
            ParseArgumentList(cb.CallbackSignature, m.Groups[3].Value);
            return(cb);
        }
コード例 #3
0
ファイル: CfxClass.cs プロジェクト: jooo000hn/ChromiumFX
    public StructMember(CefStructType parent, StructCategory structCategory, Parser.StructMemberData smd, ApiTypeBuilder api)
    {
        Debug.Assert(structCategory == StructCategory.Values);
        Debug.Assert(smd.MemberType != null);

        Name      = smd.Name;
        Comments  = smd.Comments;
        cefConfig = smd.CefConfig;

        MemberType = api.GetApiType(smd.MemberType, false);
        if (MemberType.Name == "int" && Comments != null)
        {
            foreach (var c in Comments.Lines)
            {
                if (c.Contains("true") || c.Contains("false"))
                {
                    MemberType = BooleanInteger.Convert(MemberType);
                }
            }
        }
    }