コード例 #1
0
ファイル: Parser.cs プロジェクト: wendywang1993/ChromiumFX
        internal static CefApiNode Parse()
        {
            var apiNode = new CefApiNode();

            Parser p = new CefCApiParser();

            p.SetFile(Path.Combine("cef", "include", "cef_version.h"));
            p.Parse(apiNode);
            var files = Directory.GetFiles(Path.Combine("cef", "include", "capi"));

            foreach (var f in files)
            {
                if (Path.GetFileName(f) == "cef_base_capi.h")
                {
                    continue;
                }
                p.SetFile(f);
                p.Parse(apiNode);
            }



            p = new CefInternalsParser();

            p.SetFile(Path.Combine("cef", "include", "internal", "cef_types.h"));
            p.Parse(apiNode);

            CefApiNode tmpApi = new CefApiNode();

            p.SetFile(Path.Combine("cef", "include", "internal", "cef_time.h"));
            p.Parse(tmpApi);
            apiNode.CefValueStructs.AddRange(tmpApi.CefValueStructs);

            tmpApi = new CefApiNode();

            p.SetFile(Path.Combine("cef", "include", "internal", "cef_string_list.h"));
            p.Parse(tmpApi);
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_string_map.h"));
            p.Parse(tmpApi);
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_string_multimap.h"));
            p.Parse(tmpApi);
            apiNode.CefStringCollectionFunctions = tmpApi.CefFunctions.ToArray();

            tmpApi = new CefApiNode();
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_types_win.h"));
            p.Parse(tmpApi);
            apiNode.CefFunctionsWindows = tmpApi.CefFunctions;
            apiNode.CefStructsWindows   = tmpApi.CefValueStructs;

            tmpApi = new CefApiNode();
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_types_linux.h"));
            p.Parse(tmpApi);
            apiNode.CefFunctionsLinux = tmpApi.CefFunctions;
            apiNode.CefStructsLinux   = tmpApi.CefValueStructs;

            p = new CefClassesParser();

            files = Directory.GetFiles(System.IO.Path.Combine("cef", "include"));
            foreach (var f in files)
            {
                if (Path.GetFileName(f) == "cef_base.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_pack_resources.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_pack_strings.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_sandbox_win.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_version.h")
                {
                    continue;
                }

                p.SetFile(f);
                p.Parse(apiNode);
            }

            return(apiNode);
        }
コード例 #2
0
        internal static CefApiNode Parse()
        {
            var apiNode = new CefApiNode();

            Parser p = new CefCApiParser();

            p.SetFile(Path.Combine("cef", "include", "cef_version.h"));
            p.Parse(apiNode);
            p.SetFile(Path.Combine("cef", "include", "cef_api_hash.h"));
            p.Parse(apiNode);
            var files = Directory.GetFiles(Path.Combine("cef", "include", "capi"));

            foreach (var f in files)
            {
                if (Path.GetFileName(f) == "cef_base_capi.h")
                {
                    continue;
                }
                p.SetFile(f);
                p.Parse(apiNode);
            }



            p = new CefInternalsParser();

            p.SetFile(Path.Combine("cef", "include", "internal", "cef_types.h"));
            p.Parse(apiNode);

            var errorCodeEnum = apiNode.CefEnums.Find(e => e.Name == "cef_errorcode");

            if (errorCodeEnum != null)
            {
                // CEF now uses preprocessor directives to pull enum values from include/base/internal/cef_net_error_list.h
                // This is a hack to pull the values manually
                if (errorCodeEnum.Members.Count == 1)
                {
                    var fn = Path.Combine("cef", "include", "base", "internal", "cef_net_error_list.h");
                    if (!File.Exists(fn))
                    {
                        Debug.Print("error list file not found - please check.");
                        Debugger.Break();
                    }
                    p.SetFile(fn);
                    (p as CefInternalsParser).ParseNetErrorValues(errorCodeEnum.Members);
                }
                else
                {
                    Debug.Print("enum cef_errorcode_t unexpected member count - please check.");
                    Debugger.Break();
                }
            }
            else
            {
                Debug.Print("enum cef_errorcode_t is missing - please check.");
                Debugger.Break();
            }

            CefApiNode tmpApi = new CefApiNode();

            p.SetFile(Path.Combine("cef", "include", "internal", "cef_time.h"));
            p.Parse(tmpApi);
            apiNode.CefValueStructs.AddRange(tmpApi.CefValueStructs);

            tmpApi = new CefApiNode();

            p.SetFile(Path.Combine("cef", "include", "internal", "cef_string_list.h"));
            p.Parse(tmpApi);
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_string_map.h"));
            p.Parse(tmpApi);
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_string_multimap.h"));
            p.Parse(tmpApi);
            apiNode.CefStringCollectionFunctions = tmpApi.CefFunctions.ToArray();

            tmpApi = new CefApiNode();
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_types_win.h"));
            p.Parse(tmpApi);
            apiNode.CefFunctionsWindows = tmpApi.CefFunctions;
            apiNode.CefStructsWindows   = tmpApi.CefValueStructs;

            tmpApi = new CefApiNode();
            p.SetFile(Path.Combine("cef", "include", "internal", "cef_types_linux.h"));
            p.Parse(tmpApi);
            apiNode.CefFunctionsLinux = tmpApi.CefFunctions;
            apiNode.CefStructsLinux   = tmpApi.CefValueStructs;

            p = new CefClassesParser();

            files = Directory.GetFiles(System.IO.Path.Combine("cef", "include"));
            foreach (var f in files)
            {
                if (Path.GetFileName(f) == "cef_base.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_pack_resources.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_pack_strings.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_sandbox_win.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_version.h")
                {
                    continue;
                }
                if (Path.GetFileName(f) == "cef_api_hash.h")
                {
                    continue;
                }

                p.SetFile(f);
                p.Parse(apiNode);
            }

            return(apiNode);
        }