public virtual void BeginHeaders()
        {
            headers.WriteLine();
            headers.WriteLine($"/** Class {Name}");
            headers.WriteLine($" *  Corresponding .NET Qualified Name: `{AssemblyQualifiedName}`");
            headers.WriteLine(" */");
            headers.Write($"@interface {Name} : {BaseTypeName}");
            var pcount = Protocols.Count;

            if (pcount > 0)
            {
                headers.Write(" <");
                for (int i = 0; i < pcount; i++)
                {
                    if (i > 0)
                    {
                        headers.Write(", ");
                    }
                    headers.Write(Protocols [i]);
                }
                headers.Write(">");
            }
            headers.WriteLine(" {");
            if (!IsStatic && !IsBaseTypeBound)
            {
                headers.Indent++;
                headers.WriteLine("// This field is not meant to be accessed from user code");
                headers.WriteLine("@public MonoEmbedObject* _object;");
                headers.Indent--;
            }
            headers.WriteLine("}");
            headers.WriteLine();
        }
        public virtual void BeginImplementation(string implementationName = null)
        {
            var name = implementationName ?? Name;

            implementation.WriteLine();
            implementation.WriteLine($"@implementation {name} {{");
            implementation.WriteLine("}");
            implementation.WriteLine();
            WriteInitialize(name);
            WriteDealloc();
        }
Пример #3
0
 public virtual void WriteHeaders()
 {
     WriteSignature(headers);
     headers.WriteLine(';');
 }
Пример #4
0
 public void BeginImplementation()
 {
     WriteSignature(implementation);
     implementation.WriteLine();
     implementation.WriteLine("{");
     implementation.Indent++;
     implementation.WriteLine("MONO_THREAD_ATTACH;");
 }
Пример #5
0
        public virtual void Write(string outputDirectory)
        {
            if (!GenerateLinkerExclusions)
            {
                return;
            }
            var xml = new SourceWriter();

            xml.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
            xml.WriteLine("<linker>");
            xml.Indent++;
            foreach (var a in Processor.Assemblies.Where((arg) => !arg.UserCode))
            {
                xml.WriteLine($"<assembly fullname=\"{a.Name}\">");
                xml.Indent++;
                foreach (var t in Processor.Types.Where((arg) => arg.Assembly == a))
                {
                    xml.WriteLine($"<type fullname=\"{t}\">");
                    xml.Indent++;
                    if (t.HasConstructors)
                    {
                        foreach (var c in t.Constructors)
                        {
                            xml.WriteLine($"<method signature=\"{ToXml (c)}\"/>");
                        }
                    }
                    if (t.HasMethods)
                    {
                        foreach (var m in t.Methods)
                        {
                            xml.WriteLine($"<method signature=\"{ToXml (m)}\"/>");
                        }
                    }
                    if (t.HasProperties)
                    {
                        foreach (var p in t.Properties)
                        {
                            var prop   = p.Property;
                            var getter = prop.GetGetMethod();
                            if (getter != null)
                            {
                                xml.WriteLine($"<method signature=\"{ToXml (p.ToString (getter))}\"/>");
                            }
                            var setter = prop.GetSetMethod();
                            if (setter != null)
                            {
                                xml.WriteLine($"<method signature=\"{ToXml (p.ToString (setter))}\"/>");
                            }
                        }
                    }
                    if (t.HasFields)
                    {
                        foreach (var f in t.Fields)
                        {
                            xml.WriteLine($"<field signature=\"{ToXml (f)}\"/>");
                        }
                    }
                    xml.Indent--;
                    xml.WriteLine("</type>");
                }
                xml.Indent--;
                xml.WriteLine("</assembly>");
            }
            xml.Indent--;
            xml.WriteLine("</linker>");
            WriteFile(Path.Combine(outputDirectory, "bindings.xml"), xml.ToString());
        }