Esempio n. 1
0
        private void WriteInterfaceMembersUsingComImport(AST.Object type)
        {
            foreach (var m in type.Methods)
            {
                if (type.IsMethodOverride(m))
                {
                    continue;
                }
                WriteInterfaceMemberUsingComImport(m);
            }

            foreach (var p in type.Properties)
            {
                var getter = p.CreateGetter();
                if (!type.IsMethodOverride(getter))
                {
                    WriteInterfaceMemberUsingVTableWrapper(getter);
                }

                if (!p.IsReadOnly)
                {
                    var setter = p.CreateSetter();
                    if (!type.IsMethodOverride(setter))
                    {
                        WriteInterfaceMemberUsingVTableWrapper(p.CreateSetter());
                    }
                }
            }

            foreach (var e in type.Events)
            {
                WriteInterfaceMemberUsingComImport(e.CreateAdder());
                WriteInterfaceMemberUsingComImport(e.CreateRemover());
            }
        }
Esempio n. 2
0
        public void GenerateMethodDeclaration(AST.Object type, AST.Method method)
        {
            bool isOverride = type.IsMethodOverride(method);

            if (method.IsAbstract || (method.IsVirtual && !isOverride))
            {
                Code("virtual ");
            }

            Code("{0} {1}({2})", VariableType(method.Return), method.Name, DeclParameters(true, method.Parameters));

            if (method.IsConst)
            {
                Code(" const");
            }

            if (isOverride)
            {
                Line(" override;");
            }
            else if (method.IsAbstract)
            {
                Line(" = 0;");
            }
            else
            {
                Line(";");
            }
        }
Esempio n. 3
0
        public void GenerateInterfaceMembers(AST.Object type, bool pure, bool fullIntellisense = false)
        {
            var suffix = pure ? " = 0" : "";

            if (!fullIntellisense)
            {
                Directive("#ifndef __INTELLISENSE__");
            }

            Region(() =>
            {
                Action <AST.Method> declare = m =>
                {
                    if (type.IsMethodOverride(m))
                    {
                        return;
                    }

                    Line($"METHOD _{m.GetComCompatibleName()}({DeclParameters(m.GetABIParametersCpp())}){suffix};");
                };

                foreach (var method in type.Methods)
                {
                    declare(method);
                }
                Spacer();

                foreach (var prop in type.Properties)
                {
                    declare(prop.CreateGetter());

                    if (!prop.IsReadOnly)
                    {
                        declare(prop.CreateSetter());
                    }
                }
                Spacer();

                foreach (var ev in type.Events)
                {
                    declare(ev.CreateAdder());
                    declare(ev.CreateRemover());
                }
            });

            if (!fullIntellisense)
            {
                Directive("#endif");
            }
        }