Ejemplo n.º 1
0
        void GenerateImplementorIface(StreamWriter sw)
        {
            if (IsConsumeOnly)
            {
                return;
            }

            sw.WriteLine();
            sw.WriteLine("\t[GLib.GInterface (typeof (" + Name + "Adapter))]");
            string access = IsInternal ? "internal" : "public";

            sw.WriteLine("\t" + access + " interface " + Name + "Implementor : GLib.IWrapper {");
            sw.WriteLine();
            Hashtable vm_table = new Hashtable();

            foreach (InterfaceVM vm in interface_vms)
            {
                vm_table [vm.Name] = vm;
            }
            foreach (InterfaceVM vm in interface_vms)
            {
                if (vm_table [vm.Name] == null)
                {
                    continue;
                }
                else if (!vm.IsValid)
                {
                    vm_table.Remove(vm.Name);
                    continue;
                }
                else if (vm.IsGetter || vm.IsSetter)
                {
                    string      cmp_name = (vm.IsGetter ? "Set" : "Get") + vm.Name.Substring(3);
                    InterfaceVM cmp      = vm_table [cmp_name] as InterfaceVM;
                    if (cmp != null && (cmp.IsGetter || cmp.IsSetter))
                    {
                        if (vm.IsSetter)
                        {
                            cmp.GenerateDeclaration(sw, vm);
                        }
                        else
                        {
                            vm.GenerateDeclaration(sw, cmp);
                        }
                        vm_table.Remove(cmp.Name);
                    }
                    else
                    {
                        vm.GenerateDeclaration(sw, null);
                    }
                    vm_table.Remove(vm.Name);
                }
                else
                {
                    vm.GenerateDeclaration(sw, null);
                    vm_table.Remove(vm.Name);
                }
            }
            sw.WriteLine("\t}");
        }
Ejemplo n.º 2
0
        void GenerateImplementorIface(GenerationInfo gen_info)
        {
            if (IsConsumeOnly)
            {
                return;
            }

            StreamWriter sw = gen_info.Writer;

            sw.WriteLine();
            sw.WriteLine("\t[GLib.GInterface (typeof (" + AdapterName + "))]");
            string access = IsInternal ? "internal" : "public";

            sw.WriteLine("\t" + access + " partial interface " + ImplementorName + " : GLib.IWrapper {");
            sw.WriteLine();
            var vm_table = new Dictionary <string, InterfaceVM> ();

            foreach (InterfaceVM vm in interface_vms)
            {
                vm_table [vm.Name] = vm;
            }
            foreach (InterfaceVM vm in interface_vms)
            {
                if (!vm_table.ContainsKey(vm.Name))
                {
                    continue;
                }
                else if (!vm.Validate(new LogWriter(QualifiedName)))
                {
                    vm_table.Remove(vm.Name);
                    continue;
                }
                else if (vm.IsGetter || vm.IsSetter)
                {
                    string      cmp_name = (vm.IsGetter ? "Set" : "Get") + vm.Name.Substring(3);
                    InterfaceVM cmp      = null;
                    if (vm_table.TryGetValue(cmp_name, out cmp) && (cmp.IsGetter || cmp.IsSetter))
                    {
                        if (vm.IsSetter)
                        {
                            cmp.GenerateDeclaration(sw, vm);
                        }
                        else
                        {
                            vm.GenerateDeclaration(sw, cmp);
                        }
                        vm_table.Remove(cmp.Name);
                    }
                    else
                    {
                        vm.GenerateDeclaration(sw, null);
                    }
                    vm_table.Remove(vm.Name);
                }
                else
                {
                    vm.GenerateDeclaration(sw, null);
                    vm_table.Remove(vm.Name);
                }
            }
            foreach (Property prop in Properties.Values)
            {
                sw.WriteLine("\t\t[GLib.Property (\"" + prop.CName + "\")]");
                prop.GenerateDecl(sw, "\t\t");
            }

            sw.WriteLine("\t}");
        }
Ejemplo n.º 3
0
        void GenerateImplementorIface(GenerationInfo gen_info)
        {
            if (IsConsumeOnly)
            {
                return;
            }

            StreamWriter sw = gen_info.Writer;

            sw.WriteLine();
            sw.WriteLine("\t[GLib.GInterface (typeof (" + Name + "Adapter))]");
            string access = IsInternal ? "internal" : "public";

            sw.WriteLine("\t" + access + " partial interface " + Name + "Implementor : GLib.IWrapper {");
            sw.WriteLine();
            Hashtable vm_table = new Hashtable();

            foreach (InterfaceVM vm in interface_vms)
            {
                vm_table [vm.Name] = vm;
            }
            foreach (InterfaceVM vm in interface_vms)
            {
                if (vm_table [vm.Name] == null)
                {
                    continue;
                }
                else if (!vm.Validate(new LogWriter(QualifiedName)))
                {
                    vm_table.Remove(vm.Name);
                    continue;
                }
                else if (vm.IsGetter || vm.IsSetter)
                {
                    string      cmp_name = (vm.IsGetter ? "Set" : "Get") + vm.Name.Substring(3);
                    InterfaceVM cmp      = vm_table [cmp_name] as InterfaceVM;
                    if (cmp != null && (cmp.IsGetter || cmp.IsSetter))
                    {
                        if (vm.IsSetter)
                        {
                            cmp.GenerateDeclaration(sw, vm);
                        }
                        else
                        {
                            vm.GenerateDeclaration(sw, cmp);
                        }
                        vm_table.Remove(cmp.Name);
                    }
                    else
                    {
                        vm.GenerateDeclaration(sw, null);
                    }
                    vm_table.Remove(vm.Name);
                }
                else
                {
                    vm.GenerateDeclaration(sw, null);
                    vm_table.Remove(vm.Name);
                }
            }
            foreach (Property prop in props.Values)
            {
                sw.WriteLine("\t\t[GLib.Property (\"" + prop.CName + "\")]");
                prop.GenerateDecl(sw, "\t\t");
            }
            AppendCustom(sw, gen_info.CustomDir, Name + "Implementor");

            sw.WriteLine("\t}");
        }