public void Generate(GenerationInfo gen_info, string indent, ClassBase implementor) { SymbolTable table = SymbolTable.Table; StreamWriter sw = gen_info.Writer; if (Hidden || (!Readable && !Writable)) { return; } string modifiers = ""; if (IsNew || (container_type.Parent != null && container_type.Parent.GetPropertyRecursively(Name) != null)) { modifiers = "new "; } else if (implementor != null && implementor.Parent != null && implementor.Parent.GetPropertyRecursively(Name) != null) { modifiers = "new "; } string name = Name; if (name == container_type.Name) { name += "Prop"; } string qpname = "\"" + CName + "\""; string v_type = ""; if (table.IsInterface(CType)) { v_type = "(GLib.Object)"; } else if (table.IsOpaque(CType)) { v_type = "(GLib.Opaque)"; } else if (table.IsEnum(CType)) { v_type = "(Enum)"; } GenerateImports(gen_info, indent); if (IsDeprecated || (Getter != null && Getter.IsDeprecated) || (Setter != null && Setter.IsDeprecated)) { sw.WriteLine(indent + "[Obsolete]"); } sw.WriteLine(indent + PropertyAttribute(qpname)); sw.WriteLine(indent + "public " + modifiers + CSType + " " + name + " {"); indent += "\t"; if (Getter != null) { sw.Write(indent + "get "); Getter.GenerateBody(gen_info, implementor, "\t"); sw.WriteLine(); } else if (Readable) { sw.WriteLine(indent + "get {"); sw.WriteLine(indent + "\tGLib.Value val = " + RawGetter(qpname) + ";"); if (table.IsOpaque(CType) || table.IsBoxed(CType)) { sw.WriteLine(indent + "\t" + CSType + " ret = (" + CSType + ") val;"); } else if (table.IsInterface(CType)) { // Do we have to dispose the GLib.Object from the GLib.Value? sw.WriteLine(indent + "\t{0} ret = {0}Adapter.GetObject ((GLib.Object) val);", CSType); } else { sw.Write(indent + "\t" + CSType + " ret = "); sw.Write("(" + CSType + ") "); if (v_type != "") { sw.Write(v_type + " "); } sw.WriteLine("val;"); } sw.WriteLine(indent + "\tval.Dispose ();"); sw.WriteLine(indent + "\treturn ret;"); sw.WriteLine(indent + "}"); } if (Setter != null) { sw.Write(indent + "set "); Setter.GenerateBody(gen_info, implementor, "\t"); sw.WriteLine(); } else if (Writable) { sw.WriteLine(indent + "set {"); sw.Write(indent + "\tGLib.Value val = "); if (table.IsBoxed(CType)) { sw.WriteLine("(GLib.Value) value;"); } else if (table.IsOpaque(CType)) { sw.WriteLine("new GLib.Value(value, \"{0}\");", CType); } else { sw.Write("new GLib.Value("); if (v_type != "" && !(table.IsObject(CType) || table.IsInterface(CType) || table.IsOpaque(CType))) { sw.Write(v_type + " "); } sw.WriteLine("value);"); } sw.WriteLine(indent + "\t" + RawSetter(qpname) + ";"); sw.WriteLine(indent + "\tval.Dispose ();"); sw.WriteLine(indent + "}"); } sw.WriteLine(indent.Substring(1) + "}"); sw.WriteLine(); Statistics.PropCount++; }