当前位置: 首页>>代码示例>>C#>>正文


C# ASTContext.FindCompleteClass方法代码示例

本文整理汇总了C#中ASTContext.FindCompleteClass方法的典型用法代码示例。如果您正苦于以下问题:C# ASTContext.FindCompleteClass方法的具体用法?C# ASTContext.FindCompleteClass怎么用?C# ASTContext.FindCompleteClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ASTContext的用法示例。


在下文中一共展示了ASTContext.FindCompleteClass方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Preprocess

        public override void Preprocess(Driver driver, ASTContext ctx)
        {
            driver.AddTranslationUnitPass(new CheckMacroPass());
            ctx.SetClassAsValueType("Bar");
            ctx.SetClassAsValueType("Bar2");
            ctx.IgnoreClassWithName("IgnoredType");

            ctx.FindCompleteClass("Foo").Enums.First(
                e => string.IsNullOrEmpty(e.Name)).Name = "RenamedEmptyEnum";
        }
开发者ID:ddobrev,项目名称:CppSharp,代码行数:10,代码来源:Common.cs

示例2: 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

示例3: 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

示例4: 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

示例5: Preprocess

 public override void Preprocess(Driver driver, ASTContext ctx)
 {
     ctx.SetClassAsValueType("HasQList");
     ctx.FindCompleteClass("QList").Constructors.First(c => c.IsCopyConstructor).GenerationKind = GenerationKind.None;
     ctx.IgnoreClassWithName("IgnoredType");
 }
开发者ID:corefan,项目名称:CppSharp,代码行数:6,代码来源:TypeMaps.cs

示例6: DumpClasses

        static void DumpClasses(TextWriter writer, ASTContext ctx, IEnumerable<string> types,
            bool optional = false)
        {
            foreach (var @struct in types)
            {
                var @class = ctx.FindCompleteClass(@struct);
                if (@class == null)
                    @class = ctx.FindCompleteClass("_" + @struct);

                if (@class == null)
                {
                    var typedef = ctx.FindTypedef(@struct).FirstOrDefault(
                        decl => !decl.IsIncomplete);

                    if (typedef != null)
                        @class = GetClassFromTypedef(typedef);
                }

                if (@class == null && optional)
                    continue;

                if (@class == null)
                    throw new Exception("Expected to find struct definition for " + @struct);

                DumpStruct(writer, @class);
            }
        }
开发者ID:sushihangover,项目名称:playscript,代码行数:27,代码来源:MonoAotOffsetsDumper.cs

示例7: Preprocess

        public void Preprocess(Driver driver, ASTContext lib)
        {
            foreach (var unit in lib.TranslationUnits.Where(u => u.IsValid))
            {
                // HACK: work around https://github.com/mono/CppSharp/issues/677
                if (unit.FileName == "locale_classes.tcc" || unit.FileName == "locale_facets.tcc")
                {
                    unit.ExplicitlyIgnore();
                }
                else
                {
                    IgnorePrivateDeclarations(unit);
                }
            }

            // QString is type-mapped to string so we only need two methods for the conversion
            var qString = lib.FindCompleteClass("QString");
            foreach (var @class in qString.Declarations)
            {
                @class.ExplicitlyIgnore();
            }
            foreach (var method in qString.Methods.Where(m => m.OriginalName != "utf16" && m.OriginalName != "fromUtf16"))
            {
                method.ExplicitlyIgnore();
            }

            // HACK: work around https://github.com/mono/CppSharp/issues/594
            lib.FindCompleteClass("QGraphicsItem").FindEnum("Extension").Access = AccessSpecifier.Public;
            lib.FindCompleteClass("QAbstractSlider").FindEnum("SliderChange").Access = AccessSpecifier.Public;
            lib.FindCompleteClass("QAbstractItemView").FindEnum("CursorAction").Access = AccessSpecifier.Public;
            lib.FindCompleteClass("QAbstractItemView").FindEnum("State").Access = AccessSpecifier.Public;
            lib.FindCompleteClass("QAbstractItemView").FindEnum("DropIndicatorPosition").Access = AccessSpecifier.Public;
            var classesWithTypeEnums = new[]
                                       {
                                           "QGraphicsEllipseItem", "QGraphicsItemGroup", "QGraphicsLineItem",
                                           "QGraphicsPathItem", "QGraphicsPixmapItem", "QGraphicsPolygonItem",
                                           "QGraphicsProxyWidget", "QGraphicsRectItem", "QGraphicsSimpleTextItem",
                                           "QGraphicsTextItem", "QGraphicsWidget", "QGraphicsSvgItem"
                                       };
            foreach (var enumeration in from @class in classesWithTypeEnums
                                        from @enum in lib.FindCompleteClass(@class).Enums
                                        where string.IsNullOrEmpty(@enum.Name)
                                        select @enum)
            {
                enumeration.Name = "TypeEnum";
            }

            // HACK: work around https://github.com/mono/CppSharp/issues/692
            foreach (var name in new[] { "QImage", "QPixmap" })
            {
                var @class = lib.FindCompleteClass(name);
                var ctorWithArray = @class.Constructors.FirstOrDefault(
                    c => c.Parameters.Count == 1 && c.Parameters[0].Type.Desugar() is ArrayType);
                if (ctorWithArray != null)
                {
                    ctorWithArray.ExplicitlyIgnore();
                }
            }
            foreach (var name in new[] { "QGraphicsScene", "QGraphicsView" })
            {
                var @class = lib.FindCompleteClass(name);
                var drawItems = @class.Methods.FirstOrDefault(m => m.OriginalName == "drawItems");
                if (drawItems != null)
                {
                    drawItems.ExplicitlyIgnore();
                }
            }
            lib.FindCompleteClass("QAbstractPlanarVideoBuffer").ExplicitlyIgnore();
            var qAbstractVideoBuffer = lib.FindCompleteClass("QAbstractVideoBuffer");
            var mapPlanes = qAbstractVideoBuffer.Methods.FirstOrDefault(m => m.OriginalName == "mapPlanes");
            if (mapPlanes != null)
            {
                mapPlanes.ExplicitlyIgnore();
            }
        }
开发者ID:grbd,项目名称:QtSharp,代码行数:75,代码来源:QtSharp.cs

示例8: 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:nanox,项目名称:QtSharp,代码行数:51,代码来源:QtSharp.cs

示例9: Postprocess

 public override void Postprocess(Driver driver, ASTContext ctx)
 {
     // HACK: as seen above, GetterSetterToPropertyPass is called before all other passes
     // that is a hack in order for the pass to generate properties in Common.h
     // it is incapable of generating them in the proper manner
     // so it generates a property in system type from a member which is later ignored
     // so let's ignore that property manually
     var @class = ctx.FindCompleteClass("basic_string");
     foreach (var property in @class.Specializations.SelectMany(c => c.Properties))
         property.ExplicitlyIgnore();
 }
开发者ID:tritao,项目名称:CppSharp,代码行数:11,代码来源:Common.cs


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