Example #1
0
 public override void Preprocess(Driver driver, ASTContext ctx)
 {
     driver.AddTranslationUnitPass(new GetterSetterToPropertyPass());
     driver.AddTranslationUnitPass(new CheckMacroPass());
     ctx.SetClassAsValueType("Bar");
     ctx.SetClassAsValueType("Bar2");
 }
Example #2
0
 public override void Preprocess(Driver driver, ASTContext ctx)
 {
     driver.AddTranslationUnitPass(new GetterSetterToPropertyPass());
     driver.AddTranslationUnitPass(new CheckMacroPass());
     ctx.SetClassAsValueType("Bar");
     ctx.SetClassAsValueType("Bar2");
 }
Example #3
0
 public override void Preprocess(Driver driver, ASTContext ctx)
 {
     ctx.SetClassAsValueType("Bar");
     ctx.SetClassAsValueType("Bar2");
     ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOut", 1, ParameterUsage.Out);
     ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOutRef", 1, ParameterUsage.Out);
 }
Example #4
0
 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");
 }
Example #5
0
 public override void Preprocess(Driver driver, ASTContext ctx)
 {
     ctx.SetClassAsValueType("Bar");
     ctx.SetClassAsValueType("Bar2");
     ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOut", 1, ParameterUsage.Out);
     ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOutRef", 1, ParameterUsage.Out);
 }
Example #6
0
        public override void Preprocess(Driver driver, ASTContext ctx)
        {
            ctx.SetClassAsValueType("TestCopyConstructorVal");
            ctx.SetClassAsValueType("QGenericArgument");

            ctx.IgnoreClassWithName("IgnoredTypeInheritingNonIgnoredWithNoEmptyCtor");
        }
Example #7
0
        public void Preprocess(Driver driver, ASTContext lib)
        {
            lib.SetClassAsValueType("CppSharp::ParserOptions");
            lib.SetClassAsValueType("CppSharp::ParserDiagnostic");
            lib.SetClassAsValueType("CppSharp::ParserResult");

            lib.RenameNamespace("CppSharp::CppParser", "Parser");
        }
Example #8
0
 public override void Preprocess(Driver driver, ASTContext ctx)
 {
     driver.AddTranslationUnitPass(new GetterSetterToPropertyPass());
     ctx.SetClassAsValueType("Bar");
     ctx.SetClassAsValueType("Bar2");
     ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOut", 1, ParameterUsage.Out);
     ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOutRef", 1, ParameterUsage.Out);
 }
Example #9
0
        public void Preprocess(Driver driver, ASTContext ctx)
        {
            ctx.SetClassAsValueType("CppSharp::ParserOptions");
            ctx.SetClassAsValueType("CppSharp::ParserDiagnostic");
            ctx.SetClassAsValueType("CppSharp::ParserResult");

            ctx.RenameNamespace("CppSharp::CppParser", "Parser");
        }
Example #10
0
        public override void Preprocess(Driver driver, ASTContext ctx)
        {
            ctx.SetClassAsValueType("TestCopyConstructorVal");
            ctx.SetClassAsValueType("QGenericArgument");
            ctx.SetClassAsValueType("StructWithPrivateFields");
            ctx.SetClassAsValueType("QSize");

            ctx.IgnoreClassWithName("IgnoredTypeInheritingNonIgnoredWithNoEmptyCtor");
        }
Example #11
0
        public override void Preprocess(Driver driver, ASTContext ctx)
        {
            ctx.SetClassAsValueType("Bar");
            ctx.SetClassAsValueType("Bar2");
            ctx.IgnoreClassWithName("IgnoredType");

            ctx.FindCompleteClass("Foo").Enums.First(
                e => string.IsNullOrEmpty(e.Name)).Name = "RenamedEmptyEnum";
        }
Example #12
0
        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";
        }
Example #13
0
        public override void Preprocess(Driver driver, ASTContext ctx)
        {
            driver.AddTranslationUnitPass(new GetterSetterToPropertyPass());
            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";
        }
Example #14
0
 public override void Preprocess(Driver driver, ASTContext ctx)
 {
     driver.AddTranslationUnitPass(new GetterSetterToPropertyPass());
     ctx.SetClassAsValueType("Bar");
     ctx.SetClassAsValueType("Bar2");
     ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOut", 1, ParameterUsage.Out);
     ctx.SetMethodParameterUsage("Hello", "TestPrimitiveOutRef", 1, ParameterUsage.Out);
     ctx.SetMethodParameterUsage("Hello", "TestPrimitiveInOut", 1, ParameterUsage.InOut);
     ctx.SetMethodParameterUsage("Hello", "TestPrimitiveInOutRef", 1, ParameterUsage.InOut);
     ctx.SetMethodParameterUsage("Hello", "EnumOut", 2, ParameterUsage.Out);
     ctx.SetMethodParameterUsage("Hello", "EnumOutRef", 2, ParameterUsage.Out);
 }
Example #15
0
        public override void Preprocess(Driver driver, ASTContext ctx)
        {
            ctx.SetClassAsValueType("TestCopyConstructorVal");
            ctx.SetClassAsValueType("QGenericArgument");
            ctx.SetClassAsValueType("StructWithPrivateFields");
            ctx.SetClassAsValueType("QPoint");
            ctx.SetClassAsValueType("QSize");
            ctx.SetClassAsValueType("QRect");
            ctx.SetClassAsValueType("CSharp");
            ctx.SetClassAsValueType("StructTestArrayTypeFromTypedef");
            ctx.IgnoreClassWithName("IgnoredTypeInheritingNonIgnoredWithNoEmptyCtor");
            ctx.IgnoreClassWithName("Ignored");

            var macroRegex = new Regex("(MY_MACRO_TEST_.*)");
            var list       = (from unit in ctx.TranslationUnits
                              where !unit.IsValid || unit.FileName == "CSharp.h"
                              from macro in unit.PreprocessedEntities.OfType <MacroDefinition>()
                              where macroRegex.IsMatch(macro.Name)
                              select macro.Name).ToList();
            var enumTest = ctx.GenerateEnumFromMacros("MyMacroTestEnum", list.ToArray());

            var enumTest2 = ctx.GenerateEnumFromMacros("MyMacroTest2Enum", "MY_MACRO_TEST2_*");

            enumTest.Namespace = new Namespace()
            {
                Name      = "MacroTest",
                Namespace = ctx.TranslationUnits.First(u => u.IsValid && !u.IsSystemHeader)
            };
        }
Example #16
0
        public override void Preprocess(Driver driver, ASTContext ctx)
        {
            ctx.SetClassAsValueType("TestCopyConstructorVal");
            ctx.SetClassAsValueType("QGenericArgument");
            ctx.SetClassAsValueType("StructWithPrivateFields");
            ctx.SetClassAsValueType("QPoint");
            ctx.SetClassAsValueType("QSize");
            ctx.SetClassAsValueType("QRect");
            ctx.SetClassAsValueType("CSharp");
            ctx.SetClassAsValueType("StructTestArrayTypeFromTypedef");
            ctx.IgnoreClassWithName("IgnoredTypeInheritingNonIgnoredWithNoEmptyCtor");
            ctx.IgnoreClassWithName("Ignored");

            var macroRegex = new Regex("(MY_MACRO_TEST_.*)");
            var list       = (from unit in ctx.TranslationUnits
                              where !unit.IsValid || unit.FileName == "CSharp.h"
                              from macro in unit.PreprocessedEntities.OfType <MacroDefinition>()
                              where macroRegex.IsMatch(macro.Name)
                              select macro.Name).ToList();
            var enumTest = ctx.GenerateEnumFromMacros("MyMacroTestEnum", list.ToArray());

            ctx.GenerateEnumFromMacros("MyMacroTest2Enum", "MY_MACRO_TEST2_.*");
            ctx.GenerateEnumFromMacros("SignedMacroValuesToEnumTest", "SIGNED_MACRO_VALUES_TO_ENUM_TEST_.*");
            ctx.GenerateEnumFromMacros("TestBoolValuedEnums", "TEST_BOOL_VALUED_ENUMS_.*");

            enumTest.Namespace = new Namespace()
            {
                Name      = "MacroTest",
                Namespace = ctx.TranslationUnits.First(u => u.IsValid && !u.IsSystemHeader)
            };

            // Preserve the original semantics except for our one test class.
            driver.Options.ZeroAllocatedMemory = (@class) => @class.Name == "ClassZeroAllocatedMemoryTest";
        }
Example #17
0
        /// Do transformations that should happen after passes are processed.
        public override void Postprocess(Driver driver, ASTContext ctx)
        {
            //ctx.SetClassBindName("@base", "VaiBase");
            //ctx.SetClassAsValueType("@base");
            IEnumerable <Class> classes =
                ctx.FindClass("VaiCtx")
                .Concat(ctx.FindClass("PlaidmlDevconf"))
                .Concat(ctx.FindClass("PlaidmlDevconf"))
                .Concat(ctx.FindClass("PlaidmlDevice"))
                .Concat(ctx.FindClass("PlaidmlDeviceEnumerator"))
                .Concat(ctx.FindClass("PlaidmlBuffer"))
                .Concat(ctx.FindClass("PlaidmlMapping"))
                .Concat(ctx.FindClass("PlaidmlShape"))
                .Concat(ctx.FindClass("PlaidmlFunction"))
                .Concat(ctx.FindClass("PlaidmlVar"))
                .Concat(ctx.FindClass("PlaidmlApplier"))
                .Concat(ctx.FindClass("PlaidmlComposer"))
                .Concat(ctx.FindClass("PlaidmlInvoker"))
                .Concat(ctx.FindClass("PlaidmlInvocatio"))
                .Concat(ctx.FindClass("PlaidmlGradient"));;

            foreach (Class c in classes)
            {
                ctx.SetClassAsValueType(c.Name);
            }
        }
Example #18
0
        public override void Preprocess(Driver driver, ASTContext ctx)
        {
            ctx.SetClassAsValueType("TestCopyConstructorVal");
            ctx.SetClassAsValueType("QGenericArgument");
            ctx.SetClassAsValueType("StructWithPrivateFields");
            ctx.SetClassAsValueType("QPoint");
            ctx.SetClassAsValueType("QSize");
            ctx.SetClassAsValueType("QRect");
            ctx.SetClassAsValueType("StructTestArrayTypeFromTypedef");
            ctx.IgnoreClassWithName("IgnoredTypeInheritingNonIgnoredWithNoEmptyCtor");

            var           macroRegex = new Regex(@"(MY_MACRO_TEST_.*)");
            List <string> list       = new List <string>();

            foreach (TranslationUnit unit in ctx.TranslationUnits)
            {
                if (unit.FilePath == "<invalid>" || unit.FileName == "CSharp.h")
                {
                    foreach (var macro in unit.PreprocessedEntities.OfType <MacroDefinition>())
                    {
                        Match match = macroRegex.Match(macro.Name);
                        if (match.Success)
                        {
                            list.Add(macro.Name);
                        }
                    }
                }
            }
            var enumTest = ctx.GenerateEnumFromMacros("MyMacroTestEnum", list.ToArray());

            enumTest.Namespace = new Namespace()
            {
                Name = "MacroTest"
            };
        }
Example #19
0
        /// Do transformations that should happen after passes are processed.
        public override void Postprocess(Driver driver, ASTContext ctx)
        {
            IEnumerable <Class> classes = ctx.FindClass("MKL_Complex8").Concat(ctx.FindClass("MKL_Complex16")).Concat(ctx.FindClass("MKLVersion"))
                                          .Concat(ctx.FindClass("VSLBRngProperties")) //mkl_vs
                                          .Concat(ctx.FindClass("SparseMatrix")).Concat(ctx.FindClass("MatrixDescr")).Concat(ctx.FindClass("SparseVector")).Concat(ctx.FindClass("ReplaceOperation"));

            foreach (Class c in classes)
            {
                ctx.SetClassAsValueType(c.Name);
            }
        }
Example #20
0
 public void Preprocess(Driver driver, ASTContext ctx)
 {
     ctx.SetClassAsValueType("Png_tag");
     ctx.SetClassAsValueType("Gif_tag");
     ctx.SetClassAsValueType("WBMP_tag");
     ctx.SetClassAsValueType("Jpeg_tag");
     ctx.SetClassAsValueType("Gd_tag");
     ctx.SetClassAsValueType("Gd2_tag");
     ctx.SetClassAsValueType("Xbm_tag");
 }
Example #21
0
 /// Do transformations that should happen after passes are processed.
 public override void Postprocess(Driver driver, ASTContext ctx)
 {
     foreach (string s in ClassDecls)
     {
         IEnumerable <Class> classes = ctx.FindClass(s);
         foreach (Class c in classes)
         {
             if (WithoutCommon && !c.Name.Contains(Class))
             {
                 ctx.IgnoreClassWithName(c.Name);
             }
             else
             {
                 ctx.SetClassAsValueType(c.Name);
             }
         }
     }
 }
Example #22
0
 public override void Preprocess(Driver driver, ASTContext ctx)
 {
     ctx.SetClassAsValueType("IntWrapperValueType");
 }
Example #23
0
        public void Preprocess(Driver driver, ASTContext ctx)
        {
            ctx.IgnoreHeadersWithName("API.h");
            ctx.IgnoreHeadersWithName("Concurrency.h");
            ctx.IgnoreHeadersWithName("ConcurrentQueue.h");
            ctx.IgnoreHeadersWithName("Delegate.h");
            ctx.IgnoreHeadersWithName("Event.h");
            ctx.IgnoreHeadersWithName("Handle.h");
            ctx.IgnoreHeadersWithName("Object.h");
            ctx.IgnoreHeadersWithName("Pointers.h");
            ctx.IgnoreHeadersWithName("References.h");
            ctx.IgnoreHeadersWithName("Reflection.h");
            ctx.IgnoreHeadersWithName("ReflectionHelpers.h");
            ctx.IgnoreHeadersWithName("Task.h");
            ctx.IgnoreHeadersWithName("Timer.h");
            ctx.IgnoreHeadersWithName("Swap.h");

            //Core
            ctx.IgnoreClassWithName("Object");
            ctx.IgnoreClassWithName("Class");
            ctx.IgnoreClassWithName("ReferenceCounted");
            ctx.IgnoreClassWithName("HandleManager");

            ctx.IgnoreClassWithName("Delegate0");
            ctx.IgnoreClassWithName("Delegate1");
            ctx.IgnoreClassWithName("Delegate2");

            ctx.IgnoreClassWithName("TaskPool");
            ctx.IgnoreClassWithName("ConcurrentQueue");

            ctx.SetClassAsValueType("StringHash");
            ctx.IgnoreClassWithName("RawStringCompare");

            ctx.SetClassAsValueType("LogEntry");
            ctx.IgnoreFunctionWithName("LogCreate");

            ctx.IgnoreFunctionWithName("AllocatorAllocate");
            ctx.IgnoreFunctionWithName("AllocatorDeallocate");
            ctx.SetNameOfFunction("AllocatorReset", "AllocatorResetMemory");

            ctx.IgnoreClassWithName("StreamFuncs");
            ctx.IgnoreClassWithName("FileStream");
            ctx.SetClassAsValueType("FileWatchEvent");

            ctx.IgnoreFunctionWithPattern(".+GetType");
            ctx.IgnoreFunctionWithName("ClassGetIdMap");

            ctx.IgnoreFunctionWithName("ReflectionSetHandleContext");
            ctx.IgnoreFunctionWithName("SerializerCreateJSON");
            ctx.IgnoreFunctionWithName("SerializerCreateBinary");
            ctx.IgnoreClassWithName("ReflectionContext");
            ctx.IgnoreClassWithName("ValueContext");

            ctx.SetClassAsValueType("ExtensionMetadata");

            ctx.IgnoreClassWithName("MemoryStream");
            ctx.IgnoreClassWithName("Serializer");
            ctx.IgnoreClassWithName("Thread");

            // Math
            ctx.SetClassAsValueType("ColorP");
            ctx.SetClassAsValueType("Color");
            ctx.SetClassAsValueType("Vector2P");
            ctx.SetClassAsValueType("Vector2");
            ctx.SetClassAsValueType("Vector2i");
            ctx.SetClassAsValueType("Vector3P");
            ctx.SetClassAsValueType("Vector3");
            ctx.SetClassAsValueType("Vector4");
            ctx.SetClassAsValueType("EulerAngles");
            ctx.SetClassAsValueType("QuaternionP");
            ctx.SetClassAsValueType("Quaternion");
            ctx.SetClassAsValueType("Matrix4x3");
            ctx.SetClassAsValueType("Matrix4x4");

            ctx.CopyClassFields("ColorP", "Color");
            ctx.CopyClassFields("Vector2P", "Vector2");
            ctx.CopyClassFields("Vector3P", "Vector3");
            ctx.CopyClassFields("QuaternionP", "Quaternion");

            ctx.IgnoreClassWithName("ColorP");
            ctx.IgnoreClassWithName("Vector2P");
            ctx.IgnoreClassWithName("Vector3P");
            ctx.IgnoreClassWithName("QuaternionP");

            ctx.SetNameOfClassMethod("Matrix4x3", "identity", "setIdentity");
            ctx.SetNameOfClassMethod("Matrix4x4", "identity", "setIdentity");
            ctx.SetNameOfClassMethod("Quaternion", "identity", "setIdentity");
            ctx.SetNameOfClassMethod("Vector2", "zero", "setZero");
            ctx.SetNameOfClassMethod("Vector3", "zero", "setZero");
            ctx.SetNameOfClassMethod("Vector4", "zero", "setZero");

            // Resources
            ctx.IgnoreFunctionWithName("ResourcesInitialize");
            ctx.IgnoreFunctionWithName("ResourcesDeinitialize");
            //lib.SetClassAsValueType("ResourceEvent");
            ctx.SetClassAsValueType("ResourceLoadOption");
            ctx.SetClassAsValueType("ResourceLoadOptions");
            ctx.SetNameOfClassMethod("Texture", "allocate", "alloc");
            ctx.ExcludeFromPass("ResourceHandleCreate", typeof (FunctionToInstanceMethodPass));

            // Set generic type constraints on template methods
            var resourceManager = ctx.FindClass("ResourceManager").FirstOrDefault();
            if (resourceManager != null)
                foreach (var template in resourceManager.Templates)
                {
                    for (var i = 0; i < template.Parameters.Count; ++i)
                    {
                        var param = template.Parameters[i];
                        param.Constraint = "Flood::Resource";
                        template.Parameters[i] = param;
                    }
                }

            // Graphics
            ctx.SetClassAsValueType("RenderContextSettings");
            ctx.SetClassAsValueType("RenderBatchRange");
            ctx.SetClassAsValueType("VertexElementP");
            ctx.SetClassAsValueType("VertexElement");
            ctx.SetClassAsValueType("UniformBufferElement");
            ctx.SetClassAsValueType("RenderState");
            ctx.SetClassAsValueType("LightState");
            ctx.IgnoreHeadersWithName("MaxRectsBinPack.h");
            ctx.IgnoreClassWithName("MaxRectsBinPack");
            ctx.IgnoreClassWithName("CompareHandle");
            ctx.SetClassAsValueType("Glyph");
            ctx.SetClassAsValueType("Rectangle");
            ctx.SetClassAsValueType("RectangleF");
            ctx.SetClassAsValueType("SubTexture");
            ctx.SetMethodParameterUsage("TextureAtlas", "getImageSubTexture", 2, ParameterUsage.Out);
            ctx.SetMethodParameterUsage("Font", "getGlyphInfo", 3, ParameterUsage.Out);

            // Engine
            ctx.IgnoreClassMethodWithName("Engine", "addSubsystem");
        }
Example #24
0
 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");
 }
Example #25
0
 public override void Preprocess(Driver driver, ASTContext ctx)
 {
     ctx.SetClassAsValueType("TestCopyConstructorVal");
 }
Example #26
0
            public void Postprocess(Driver driver, ASTContext ctx)
            {
                var libNamespace = ctx.FindClass("Size").Single().Namespace;


                ctx.SetClassAsValueType("HostCallbacks");
                ctx.SetClassAsValueType("Size");
                ctx.SetClassAsValueType("Margins");
                ctx.SetClassAsValueType("Position");
                ctx.SetClassAsValueType("ViewLayout");

                var initWithEgl = ctx.FindFunction("InitWithEgl").Single();

                initWithEgl.GenerationKind = GenerationKind.None;

                var performUpdates = ctx.FindFunction("PerformUpdates").Single();

                performUpdates.GenerationKind = GenerationKind.None;

                var loadUrl = ctx.FindFunction("LoadUrl").Single();

                loadUrl.GenerationKind = GenerationKind.None;

                var scroll = ctx.FindFunction("Scroll").Single();

                scroll.GenerationKind = GenerationKind.None;

                var version = ctx.FindFunction("ServoVersion").Single();

                version.GenerationKind = GenerationKind.None;

                var servoSharp = new Class
                {
                    Name      = "ServoSharp",
                    Access    = AccessSpecifier.Public,
                    Type      = ClassType.RefType,
                    Namespace = libNamespace,
                };

                servoSharp.Methods.AddRange(new[]
                {
                    new Method {
                        Namespace = servoSharp, IsDefaultConstructor = true, Kind = CXXMethodKind.Constructor
                    },
                    new Method(initWithEgl)
                    {
                        Namespace = servoSharp, GenerationKind = GenerationKind.Generate
                    },
                    new Method(performUpdates)
                    {
                        Namespace = servoSharp, GenerationKind = GenerationKind.Generate
                    },
                    new Method(loadUrl)
                    {
                        Namespace = servoSharp, GenerationKind = GenerationKind.Generate
                    },
                    new Method(scroll)
                    {
                        Namespace = servoSharp, GenerationKind = GenerationKind.Generate
                    },
                    new Method(version)
                    {
                        Namespace = servoSharp, GenerationKind = GenerationKind.Generate
                    }
                });

                ctx.TranslationUnits[0].Classes.Add(servoSharp);

                ctx.FindEnum("ServoResult").Single().Items.ForEach(item => item.Name = item.Name.Replace("ServoResult", string.Empty));
                ctx.FindEnum("ScrollState").Single().Items.ForEach(item => item.Name = item.Name.Replace("ScrollState", string.Empty));
                ctx.FindEnum("TouchState").Single().Items.ForEach(item => item.Name  = item.Name.Replace("TouchState", string.Empty));
            }
Example #27
0
 public override void Preprocess(Driver driver, ASTContext ctx)
 {
     ctx.SetClassAsValueType("IntWrapperValueType");
 }
Example #28
0
        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");

            lib.FindCompleteClass("QString").GenerationKind = GenerationKind.Internal;
        }
Example #29
0
 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";
         }
     }
 }
Example #30
0
 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");
 }
Example #31
0
 public override void Preprocess(Driver driver, ASTContext ctx)
 {
     ctx.SetClassAsValueType("TestCopyConstructorVal");
 }