예제 #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
    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);
                }
            }
        }
    }