Beispiel #1
0
        public static void GenerateMembers(this IGeneratable gen, IndentWriter writer, Func <IMemberGeneratable, bool> where = null)
        {
            var array = gen.GetMemberGeneratables().Where(x => where == null || where (x)).ToArray();

            for (int i = 0; i < array.Length; ++i)
            {
                var member = array [i];

                // Generate pinvoke signature for a method
                if (!(gen is Interface) && member is INativeCallable callable)
                {
                    callable.GenerateImport(gen, writer);
                }

                // Generate documentation is a member supports it.
                if (member is IDocumented doc)
                {
                    doc.GenerateDocumentation(writer);
                }

                // Call the main member generation implementation.
                member.Generate(gen, writer);

                if (i != array.Length - 1 && member.NewlineAfterGeneration(writer.Options))
                {
                    writer.WriteLine();
                }
            }
        }
        public static void GenerateMembers(this IGeneratable gen, GenerationOptions opts, IndentWriter writer)
        {
            var array = gen.GetMemberGeneratables().ToArray();

            for (int i = 0; i < array.Length; ++i)
            {
                var member = array[i];
                member.Generate(opts, gen, writer);

                if (i != array.Length - 1 && member.NewlineAfterGeneration(opts))
                {
                    writer.WriteLine();
                }
            }
        }