• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CppSharp.Driver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CppSharp.Driver的典型用法代码示例。如果您正苦于以下问题:C# Driver类的具体用法?C# Driver怎么用?C# Driver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Driver类属于CppSharp命名空间,在下文中一共展示了Driver类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Preprocess

        public void Preprocess(Driver driver, ASTContext ctx)
        {
            ctx.IgnoreEnumWithMatchingItem("SDL_FALSE");
            ctx.IgnoreEnumWithMatchingItem("DUMMY_ENUM_VALUE");

            ctx.SetNameOfEnumWithMatchingItem("SDL_SCANCODE_UNKNOWN", "ScanCode");
            ctx.SetNameOfEnumWithMatchingItem("SDLK_UNKNOWN", "Key");
            ctx.SetNameOfEnumWithMatchingItem("KMOD_NONE", "KeyModifier");
            ctx.SetNameOfEnumWithMatchingItem("SDL_LOG_CATEGORY_CUSTOM", "LogCategory");

            ctx.GenerateEnumFromMacros("InitFlags", "SDL_INIT_(.*)").SetFlags();
            ctx.GenerateEnumFromMacros("Endianness", "SDL_(.*)_ENDIAN");
            ctx.GenerateEnumFromMacros("InputState", "SDL_RELEASED", "SDL_PRESSED");
            ctx.GenerateEnumFromMacros("AlphaState", "SDL_ALPHA_(.*)");
            ctx.GenerateEnumFromMacros("HatState", "SDL_HAT_(.*)");

            ctx.IgnoreHeadersWithName("SDL_atomic*");
            ctx.IgnoreHeadersWithName("SDL_endian*");
            ctx.IgnoreHeadersWithName("SDL_main*");
            ctx.IgnoreHeadersWithName("SDL_mutex*");
            ctx.IgnoreHeadersWithName("SDL_stdinc*");
            ctx.IgnoreHeadersWithName("SDL_error");

            ctx.IgnoreEnumWithMatchingItem("SDL_ENOMEM");
            ctx.IgnoreFunctionWithName("SDL_Error");
        }
开发者ID:tritao,项目名称:CppSharp,代码行数:26,代码来源:SDL.cs


示例2: Run

        public static void Run(ILibrary library)
        {
            var options = new DriverOptions();

            var Log = new TextDiagnosticPrinter();
            var driver = new Driver(options, Log);

            library.Setup(driver);
            driver.Setup();

            if(driver.Options.Verbose)
                Log.Level = DiagnosticKind.Debug;

            if (!options.Quiet)
                Log.EmitMessage("Parsing libraries...");

            if (!driver.ParseLibraries())
                return;

            if (!options.Quiet)
                Log.EmitMessage("Indexing library symbols...");

            driver.Symbols.IndexSymbols();

            if (!options.Quiet)
                Log.EmitMessage("Parsing code...");

            if (!driver.ParseCode())
                return;

            if (!options.Quiet)
                Log.EmitMessage("Processing code...");

            library.Preprocess(driver, driver.ASTContext);

            driver.SetupPasses(library);

            driver.ProcessCode();
            library.Postprocess(driver, driver.ASTContext);

            if (!options.Quiet)
                Log.EmitMessage("Generating code...");

            var outputs = driver.GenerateCode();

            foreach (var output in outputs)
            {
                foreach (var pass in driver.GeneratorOutputPasses.Passes)
                {
                    pass.Driver = driver;
                    pass.VisitGeneratorOutput(output);
                }
            }

            if (!driver.Options.DryRun)
                driver.WriteCode(outputs);

            if (driver.Options.IsCSharpGenerator)
                driver.CompileCode();
        }
开发者ID:kitsilanosoftware,项目名称:CppSharp,代码行数:60,代码来源:Driver.cs


示例3: Preprocess

 public void Preprocess(Driver driver, ASTContext lib)
 {
     string qtModule = "Qt" + this.module;
     string moduleIncludes = Path.Combine(this.includePath, qtModule);
     foreach (TranslationUnit unit in lib.TranslationUnits.Where(u => u.FilePath != "<invalid>"))
     {
         if (Path.GetDirectoryName(unit.FilePath) != moduleIncludes)
         {
             unit.ExplicityIgnored = true;
         }
         else
         {
             IgnorePrivateDeclarations(unit);
         }
     }
     lib.SetClassAsValueType("QByteArray");
     lib.SetClassAsValueType("QListData");
     lib.SetClassAsValueType("QListData::Data");
     lib.SetClassAsValueType("QLocale");
     lib.SetClassAsValueType("QModelIndex");
     lib.SetClassAsValueType("QPoint");
     lib.SetClassAsValueType("QPointF");
     lib.SetClassAsValueType("QSize");
     lib.SetClassAsValueType("QSizeF");
     lib.SetClassAsValueType("QRect");
     lib.SetClassAsValueType("QRectF");
     lib.SetClassAsValueType("QGenericArgument");
     lib.SetClassAsValueType("QVariant");
     // TODO: remove these when their symbols have been replaced or included
     lib.IgnoreClassMethodWithName("QXmlStreamReader", "attributes");
     lib.IgnoreClassMethodWithName("QTimeZone", "offsetData");
     lib.IgnoreClassMethodWithName("QTimeZone", "nextTransition");
     lib.IgnoreClassMethodWithName("QTimeZone", "previousTransition");
 }
开发者ID:RodolpheFouquet,项目名称:QtSharp,代码行数:34,代码来源:QtSharp.cs


示例4: Setup

        public void Setup(Driver driver)
        {
            var options = driver.Options;
            options.LibraryName = "CppSharp";
            options.DryRun = true;
            options.Headers.AddRange(new string[]
            {
                "clang/AST/Expr.h",
            });

            options.SetupXcode();
            options.MicrosoftMode = false;
            options.TargetTriple = "i686-apple-darwin12.4.0";

            options.addDefines ("__STDC_LIMIT_MACROS");
            options.addDefines ("__STDC_CONSTANT_MACROS");

            var llvmPath = Path.Combine (GetSourceDirectory ("deps"), "llvm");
            var clangPath = Path.Combine(llvmPath, "tools", "clang");

            options.addIncludeDirs(Path.Combine(llvmPath, "include"));
            options.addIncludeDirs(Path.Combine(llvmPath, "build", "include"));
            options.addIncludeDirs (Path.Combine (llvmPath, "build", "tools", "clang", "include"));
            options.addIncludeDirs(Path.Combine(clangPath, "include"));
        }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:25,代码来源:Bootstrap.cs


示例5: SetupPasses

 public void SetupPasses(Driver driver)
 {
     driver.TranslationUnitPasses.RemovePrefix("SDL_");
     driver.TranslationUnitPasses.RemovePrefix("SCANCODE_");
     driver.TranslationUnitPasses.RemovePrefix("SDLK_");
     driver.TranslationUnitPasses.RemovePrefix("KMOD_");
     driver.TranslationUnitPasses.RemovePrefix("LOG_CATEGORY_");
 }
开发者ID:tritao,项目名称:CppSharp,代码行数:8,代码来源:SDL.cs


示例6: Setup

 public void Setup(Driver driver)
 {
     var options = driver.Options;
     options.LibraryName = "SDL";
     options.Headers.Add("SDL.h");
     options.addIncludeDirs("../../../examples/SDL/SDL-2.0/include");
     options.OutputDir = "SDL";
 }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:8,代码来源:SDL.cs


示例7: Preprocess

        public void Preprocess(Driver driver, ASTContext lib)
        {
            lib.SetClassAsValueType("CppSharp::ParserOptions");
            lib.SetClassAsValueType("CppSharp::ParserDiagnostic");
            lib.SetClassAsValueType("CppSharp::ParserResult");

            lib.RenameNamespace("CppSharp::CppParser", "Parser");
        }
开发者ID:jijamw,项目名称:CppSharp,代码行数:8,代码来源:ParserGen.cs


示例8: Setup

 public void Setup(Driver driver)
 {
     var options = driver.Options;
     options.LibraryName = "SDL";
     options.Headers.Add("SDL.h");
     var sdlPath = Path.Combine(GetExamplesDirectory("SDL"), "SDL-2.0/include");
     options.addIncludeDirs(sdlPath);
     options.OutputDir = "SDL";
 }
开发者ID:tritao,项目名称:CppSharp,代码行数:9,代码来源:SDL.cs


示例9: Postprocess

 public void Postprocess(Driver driver, ASTContext lib)
 {
     CollectTypeDefsPerTypePass collectTypeDefsPerTypePass = new CollectTypeDefsPerTypePass();
     collectTypeDefsPerTypePass.VisitLibrary(driver.ASTContext);
     new ClearCommentsPass().VisitLibrary(driver.ASTContext);
     new GetCommentsFromQtDocsPass(this.docs, this.module, collectTypeDefsPerTypePass.TypeDefsPerType).VisitLibrary(driver.ASTContext);
     new CaseRenamePass(
         RenameTargets.Function | RenameTargets.Method | RenameTargets.Property | RenameTargets.Delegate | RenameTargets.Field,
         RenameCasePattern.UpperCamelCase).VisitLibrary(driver.ASTContext);
 }
开发者ID:RodolpheFouquet,项目名称:QtSharp,代码行数:10,代码来源:QtSharp.cs


示例10: Preprocess

        public void Preprocess(Driver driver, ASTContext ctx)
        {
            ctx.RenameNamespace("CppSharp::CppParser", "Parser");

            var exprClass = ctx.FindCompleteClass ("clang::Expr");

            var exprUnit = ctx.TranslationUnits [0];
            var subclassVisitor = new SubclassVisitor (exprClass);
            exprUnit.Visit (subclassVisitor);

            var subclasses = subclassVisitor.Classes;
        }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:12,代码来源:Bootstrap.cs


示例11: Postprocess

 public void Postprocess(Driver driver, ASTContext ctx)
 {
     ctx.SetNameOfEnumWithName("PIXELTYPE", "PixelType");
     ctx.SetNameOfEnumWithName("BITMAPORDER", "BitmapOrder");
     ctx.SetNameOfEnumWithName("PACKEDORDER", "PackedOrder");
     ctx.SetNameOfEnumWithName("ARRAYORDER", "ArrayOrder");
     ctx.SetNameOfEnumWithName("PACKEDLAYOUT", "PackedLayout");
     ctx.SetNameOfEnumWithName("PIXELFORMAT", "PixelFormats");
     ctx.SetNameOfEnumWithName("assert_state", "AssertState");
     ctx.SetClassBindName("assert_data", "AssertData");
     ctx.SetNameOfEnumWithName("eventaction", "EventAction");
     ctx.SetNameOfEnumWithName("LOG_CATEGORY", "LogCategory");
 }
开发者ID:tritao,项目名称:CppSharp,代码行数:13,代码来源:SDL.cs


示例12: Preprocess

 public void Preprocess(Driver driver, ASTContext lib)
 {
     var qtModule = "Qt" + this.module;
     var moduleIncludes = Path.Combine(this.includePath, qtModule);
     foreach (var unit in lib.TranslationUnits.Where(u => u.FilePath != "<invalid>"))
     {
         if (Path.GetDirectoryName(unit.FilePath) != moduleIncludes)
         {
             LinkDeclaration(unit);
         }
         else
         {
             IgnorePrivateDeclarations(unit);
         }
     }
     lib.SetClassAsValueType("QByteArray");
     lib.SetClassAsValueType("QListData");
     lib.SetClassAsValueType("QListData::Data");
     lib.SetClassAsValueType("QLocale");
     lib.SetClassAsValueType("QModelIndex");
     lib.SetClassAsValueType("QPoint");
     lib.SetClassAsValueType("QPointF");
     lib.SetClassAsValueType("QSize");
     lib.SetClassAsValueType("QSizeF");
     lib.SetClassAsValueType("QRect");
     lib.SetClassAsValueType("QRectF");
     lib.SetClassAsValueType("QGenericArgument");
     lib.SetClassAsValueType("QGenericReturnArgument");
     lib.SetClassAsValueType("QVariant");
     lib.IgnoreClassMethodWithName("QString", "fromStdWString");
     lib.IgnoreClassMethodWithName("QString", "toStdWString");
     if (this.module == "Widgets")
     {
         // HACK: work around https://llvm.org/bugs/show_bug.cgi?id=24655
         foreach (var method in lib.FindCompleteClass("QAbstractSlider").Methods.Where(m => m.Access == AccessSpecifier.Protected))
         {
             method.AccessDecl.PreprocessedEntities.Clear();
         }
         string[] classesWithTypeEnums =
         {
             "QGraphicsEllipseItem", "QGraphicsItemGroup", "QGraphicsLineItem",
             "QGraphicsPathItem", "QGraphicsPixmapItem", "QGraphicsPolygonItem", "QGraphicsProxyWidget",
             "QGraphicsRectItem", "QGraphicsSimpleTextItem", "QGraphicsTextItem", "QGraphicsWidget"
         };
         foreach (var enumeration in classesWithTypeEnums.Select(c => lib.FindCompleteClass(c)).SelectMany(
             @class => @class.Enums.Where(e => string.IsNullOrEmpty(e.Name))))
         {
             enumeration.Name = "TypeEnum";
         }
     }
 }
开发者ID:YekMX,项目名称:QtSharp,代码行数:51,代码来源:QtSharp.cs


示例13:

 void ILibrary.Setup(Driver driver)
 {
     // 现在先写死的路径,以方便 测试功能是否使,后面真正用到时,再写命令行来更灵活的处理绑定吧
     // 估计以后要区分 32位与64位
     // 擦: 现在的 CppSharp 只支持32位,估计以后可能支持吧
     var options = driver.Options;
     options.GeneratorKind = GeneratorKind.CSharp;
     options.LibraryName = "Common";
     options.Headers.Add(@"D:\GitSourceCode\TempCode\XunLongJiMobileServer\Common\Include\TestExportClass.h");
     options.Libraries.Add(@"D:\GitSourceCode\TempCode\XunLongJiMobileServer\Lib/Win32/Debug\Common.lib");
     options.ShowHelpText = true;
     options.OutputDir = @"d:\CppWrapper";
     options.OutputNamespace = "XLJCommon";
 }        
开发者ID:daxiazh,项目名称:OrleansPractice,代码行数:14,代码来源:CppWrapper.cs


示例14: Setup

 public void Setup(Driver driver)
 {
     var options = driver.Options;
     options.LibraryName = "CppSharp.CppParser.dll";
     options.GeneratorKind = Kind;
     options.Headers.Add("AST.h");
     options.Headers.Add("CppParser.h");
     var basePath = Path.Combine(GetSourceDirectory(), "CppParser");
     options.IncludeDirs.Add(basePath);
     options.Libraries.Add("CppSharp.CppParser.lib");
     options.LibraryDirs.Add(".");
     options.OutputDir = "../../../../src/CppParser/Bindings/";
     options.OutputDir += Kind.ToString();
     options.GenerateLibraryNamespace = false;
     options.CheckSymbols = false;
 }
开发者ID:jijamw,项目名称:CppSharp,代码行数:16,代码来源:ParserGen.cs


示例15: Preprocess

        public void Preprocess(Driver driver, Library lib)
        {
            // FBase.h is just an aggregrating header file, which also contains
            // a block-comment for the Base namespace.   We don't need to generate
            // any code for it.
            lib.IgnoreHeadersWithName("FBase.h");

            // We are mapping Tizen::Base::String to a standard .NET string class,
            // so don't need to generate any code for that either.
            //lib.IgnoreHeadersWithName("FBaseString.h");

            // Don't know why we are ignoring these.   Ask Joao.
            //lib.IgnoreHeadersWithName("FBaseObject.h");
            //lib.IgnoreHeadersWithName("FOspCompat.h");
            //lib.IgnoreClassWithName("Tizen::Base::Object");
        }
开发者ID:abhijitrd,项目名称:CppSharpTizen,代码行数:16,代码来源:Tizen.cs


示例16: Setup

        public void Setup(Driver driver)
        {
            var parserOptions = driver.ParserOptions;
            parserOptions.TargetTriple = Triple;
            parserOptions.Abi = Abi;

            var options = driver.Options;
            options.LibraryName = "CppSharp.CppParser";
            options.SharedLibraryName = "CppSharp.CppParser.dll";
            options.GeneratorKind = Kind;
            options.Headers.AddRange(new[]
            {
                "AST.h",
                "Sources.h",
                "CppParser.h"
            });
            options.Libraries.Add("CppSharp.CppParser.lib");

            if (Abi == CppAbi.Microsoft)
                parserOptions.MicrosoftMode = true;

            if (Triple.Contains("apple"))
                SetupMacOptions(parserOptions);

            if (Triple.Contains("linux"))
                SetupLinuxOptions(parserOptions);

            var basePath = Path.Combine(GetSourceDirectory("src"), "CppParser");
            parserOptions.AddIncludeDirs(basePath);
            parserOptions.AddLibraryDirs(".");

            options.OutputDir = Path.Combine(GetSourceDirectory("src"), "CppParser",
                "Bindings", Kind.ToString());

            var extraTriple = IsGnuCpp11Abi ? "-cxx11abi" : string.Empty;

            if (Kind == GeneratorKind.CSharp)
                options.OutputDir = Path.Combine(options.OutputDir, parserOptions.TargetTriple + extraTriple);

            options.OutputNamespace = string.Empty;
            options.CheckSymbols = false;
            //options.Verbose = true;
            options.UnityBuild = true;
        }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:44,代码来源:ParserGen.cs


示例17: Postprocess

 public void Postprocess(Driver driver, ASTContext lib)
 {
     new ClearCommentsPass().VisitLibrary(driver.ASTContext);
     new GetCommentsFromQtDocsPass(this.docs, this.module).VisitLibrary(driver.ASTContext);
     new CaseRenamePass(
         RenameTargets.Function | RenameTargets.Method | RenameTargets.Property | RenameTargets.Delegate |
         RenameTargets.Field | RenameTargets.Variable,
         RenameCasePattern.UpperCamelCase).VisitLibrary(driver.ASTContext);
     switch (this.module)
     {
         case "Core":
             var qChar = lib.FindCompleteClass("QChar");
             qChar.FindOperator(CXXOperatorKind.ExplicitConversion)
                 .First(o => o.Parameters[0].Type.IsPrimitiveType(PrimitiveType.Char))
                 .ExplicitlyIgnore();
             qChar.FindOperator(CXXOperatorKind.Conversion)
                 .First(o => o.Parameters[0].Type.IsPrimitiveType(PrimitiveType.Int))
                 .ExplicitlyIgnore();
             break;
     }
 }
开发者ID:YekMX,项目名称:QtSharp,代码行数:21,代码来源:QtSharp.cs


示例18: Main

        public static void Main(string[] args)
        {
            ParseCommandLineArgs(args);

            Console.WriteLine();
            Console.WriteLine("Parsing Mono's source code...");

            var options = new DriverOptions();

            var log = new TextDiagnosticPrinter();
            var driver = new Driver(options, log);

            Setup(driver);
            driver.Setup();

            BuildParseOptions(driver);
            if (!driver.ParseCode())
                return;

            Check(driver.ASTContext);
        }
开发者ID:Profit0004,项目名称:mono,代码行数:21,代码来源:MonoChecker.cs


示例19: Postprocess

        public void Postprocess(Driver driver, ASTContext lib)
        {
            new ClearCommentsPass().VisitASTContext(driver.Context.ASTContext);
            var modules = this.qtInfo.LibFiles.Select(l => GetModuleNameFromLibFile(l));
            var s = System.Diagnostics.Stopwatch.StartNew();
            new GetCommentsFromQtDocsPass(this.qtInfo.Docs, modules).VisitASTContext(driver.Context.ASTContext);
            System.Console.WriteLine("Documentation done in: {0}", s.Elapsed);
            new CaseRenamePass(
                RenameTargets.Function | RenameTargets.Method | RenameTargets.Property | RenameTargets.Delegate |
                RenameTargets.Field | RenameTargets.Variable,
                RenameCasePattern.UpperCamelCase).VisitASTContext(driver.Context.ASTContext);

            var qChar = lib.FindCompleteClass("QChar");
            var op = qChar.FindOperator(CXXOperatorKind.ExplicitConversion)
                .FirstOrDefault(o => o.Parameters[0].Type.IsPrimitiveType(PrimitiveType.Char));
            if (op != null)
                op.ExplicitlyIgnore();
            op = qChar.FindOperator(CXXOperatorKind.Conversion)
                .FirstOrDefault(o => o.Parameters[0].Type.IsPrimitiveType(PrimitiveType.Int));
            if (op != null)
                op.ExplicitlyIgnore();
            // QString is type-mapped to string so we only need two methods for the conversion
            // go through the methods a second time to ignore free operators moved to the class
            var qString = lib.FindCompleteClass("QString");
            foreach (var method in qString.Methods.Where(
                m => !m.Ignore && m.OriginalName != "utf16" && m.OriginalName != "fromUtf16"))
            {
                method.ExplicitlyIgnore();
            }

            foreach (var module in driver.Options.Modules)
            {
                var prefix = Platform.IsWindows ? string.Empty : "lib";
                var extension = Platform.IsWindows ? ".dll" : Platform.IsMacOS ? ".dylib" : ".so";
                var inlinesLibraryFile = string.Format("{0}{1}{2}", prefix, module.InlinesLibraryName, extension);
                var inlinesLibraryPath = Path.Combine(driver.Options.OutputDir, Platform.IsWindows ? "release" : string.Empty, inlinesLibraryFile);
                this.wrappedModules.Add(new KeyValuePair<string, string>(module.LibraryName + ".dll", inlinesLibraryPath));
            }
        }
开发者ID:grbd,项目名称:QtSharp,代码行数:39,代码来源:QtSharp.cs


示例20: Setup

        public void Setup(Driver driver)
        {
            var options = driver.Options;
            options.TargetTriple = Triple;
            options.Abi = Abi;
            options.LibraryName = "CppSharp.CppParser.dll";
            options.GeneratorKind = Kind;
            options.Headers.AddRange(new[]
            {
                "AST.h",
                "Sources.h",
                "CppParser.h"
            });
            options.Libraries.Add("CppSharp.CppParser.lib");

            if (Abi == CppAbi.Microsoft)
                options.MicrosoftMode = true;

            if (Triple.Contains("apple"))
                SetupMacOptions(options);

            if (Triple.Contains("linux"))
                SetupLinuxOptions(options);

            var basePath = Path.Combine(GetSourceDirectory("src"), "CppParser");
            options.addIncludeDirs(basePath);
            options.addLibraryDirs(".");

            options.OutputDir = Path.Combine(GetSourceDirectory("src"), "CppParser",
                "Bindings", Kind.ToString());

            if (Kind == GeneratorKind.CSharp)
                options.OutputDir = Path.Combine(options.OutputDir, options.TargetTriple);

            options.GenerateLibraryNamespace = false;
            options.CheckSymbols = false;
        }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:37,代码来源:ParserGen.cs



注:本文中的CppSharp.Driver类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AST.Method类代码示例发布时间:2022-05-24
下一篇:
C# N1QL.QueryRequest类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap