Exemplo n.º 1
0
        private void IgnoreProperty(string className, string propertyName, ASTContext ctx)
        {
            var cls          = ctx.FindCompleteClass(className);
            var dataProperty = cls.Properties.First(x => x.OriginalName == propertyName);

            dataProperty.Ignore = true;
        }
Exemplo n.º 2
0
 public void Postprocess(Driver driver, ASTContext ctx)
 {
     // ImVectorImTextureID has a pointer type typedef'd to void*
     // This causes the type to expand to void**, but C# sets the field as IntPtr.
     // C# has no implicit cast for this.
     // We implement this property ourselves in the other project :3
     IgnoreProperty("ImVectorImTextureID", "Data", ctx);
     IgnoreProperty("ImVector_const_charPtr", "Data", ctx);
 }
Exemplo n.º 3
0
 private void RecursiveRemovePrefix(IEnumerable <Namespace> namespaces, ASTContext ctx)
 {
     foreach (var ns in namespaces)
     {
         RecursiveRemovePrefix(ns.Namespaces, ctx);
         foreach (var cls in ns.Classes)
         {
             cls.Name = GetNameWithoutPrefix(cls.Name);
         }
     }
 }
Exemplo n.º 4
0
        private void RemovePrefix(ASTContext ctx)
        {
            foreach (var unit in ctx.TranslationUnits)
            {
                foreach (var func in unit.Functions)
                {
                    func.Name = GetNameWithoutPrefix(func.Name);
                }

                RecursiveRemovePrefix(unit.Namespaces, ctx);
            }
        }
Exemplo n.º 5
0
        public CppSharp.AST.ASTContext Convert()
        {
            var _ctx = new AST.ASTContext();

            for (uint i = 0; i < Context.TranslationUnitsCount; ++i)
            {
                var unit  = Context.getTranslationUnits(i);
                var _unit = declConverter.Visit(unit) as AST.TranslationUnit;
                _ctx.TranslationUnits.Add(_unit);
            }

            return(_ctx);
        }
Exemplo n.º 6
0
        public void Preprocess(Driver driver, ASTContext ctx)
        {
            foreach (var decl in ctx.FindDecl <Declaration>("GImGui"))
            {
                decl.Ignore = true;
            }

            // Fix incorrect indirect value passes.
            foreach (var parameter in from translationUnit in ctx.TranslationUnits
                     from function in translationUnit.Functions
                     from parameter in function.Parameters
                     where parameter.DebugText.Contains("const ImVec4")
                     select parameter)
            {
                parameter.IsIndirect = false;
            }

            // Remove Prefixes
            RemovePrefix(ctx);
        }