2008-12-02 Stephane Delcroix <sdelcroix@novell.com>

* generator/Ctor.cs:
	* generator/Method.cs:
	* generator/MethodBase.cs: refactor the Protection from Method to
	MethodBase, generate ctors with the correct proteciton too.

svn path=/trunk/gtk-sharp/; revision=120487
This commit is contained in:
Stephane Delcroix 2008-12-02 15:03:02 +00:00
parent b519876db7
commit 66be12eebe
4 changed files with 30 additions and 27 deletions

View File

@ -1,3 +1,10 @@
2008-12-02 Stephane Delcroix <sdelcroix@novell.com>
* generator/Ctor.cs:
* generator/Method.cs:
* generator/MethodBase.cs: refactor the Protection from Method to
MethodBase, generate ctors with the correct proteciton too.
2008-12-01 Mike Kestner <mkestner@novell.com>
* gtk/Gtk.metadata: automarshal TreeSelection.GetSelectedRows.

View File

@ -71,7 +71,7 @@ namespace GtkSharp.Generation {
void GenerateStatic (GenerationInfo gen_info)
{
StreamWriter sw = gen_info.Writer;
sw.WriteLine("\t\tpublic static " + Safety + Modifiers + name + " " + StaticName + "(" + Signature + ")");
sw.WriteLine("\t\t" + Protection + " static " + Safety + Modifiers + name + " " + StaticName + "(" + Signature + ")");
sw.WriteLine("\t\t{");
Body.Initialize(gen_info, false, false, "");
@ -100,7 +100,7 @@ namespace GtkSharp.Generation {
if (IsStatic)
GenerateStatic (gen_info);
else {
sw.WriteLine("\t\tpublic {0}{1} ({2}) {3}", Safety, name, Signature.ToString(), needs_chaining ? ": base (IntPtr.Zero)" : "");
sw.WriteLine("\t\t{0} {1}{2} ({3}) {4}", Protection, Safety, name, Signature.ToString(), needs_chaining ? ": base (IntPtr.Zero)" : "");
sw.WriteLine("\t\t{");
if (needs_chaining) {

View File

@ -32,7 +32,6 @@ namespace GtkSharp.Generation {
private ReturnValue retval;
private string call;
private string protection = "public";
private bool is_get, is_set;
private bool deprecated = false;
@ -44,18 +43,6 @@ namespace GtkSharp.Generation {
string attr = elem.GetAttribute ("deprecated");
deprecated = attr == "1" || attr == "true";
}
if (elem.HasAttribute ("accessibility")) {
string attr = elem.GetAttribute ("accessibility");
switch (attr) {
case "public":
case "protected":
case "internal":
case "private":
case "protected internal":
protection = attr;
break;
}
}
if (Name == "GetType")
Name = "GetGType";
@ -79,15 +66,6 @@ namespace GtkSharp.Generation {
}
}
public string Protection {
get {
return protection;
}
set {
protection = value;
}
}
public string ReturnType {
get {
return retval.CSType;
@ -251,8 +229,8 @@ namespace GtkSharp.Generation {
if (IsDeprecated)
gen_info.Writer.WriteLine("\t\t[Obsolete]");
gen_info.Writer.Write("\t\t");
if (protection != "")
gen_info.Writer.Write("{0} ", protection);
if (Protection != "")
gen_info.Writer.Write("{0} ", Protection);
GenerateDeclCommon (gen_info.Writer, implementor);
if (is_get || is_set)

View File

@ -33,6 +33,7 @@ namespace GtkSharp.Generation {
bool is_static = false;
string mods = String.Empty;
string name;
private string protection = "public";
protected MethodBase (XmlElement elem, ClassBase container_type)
{
@ -43,6 +44,18 @@ namespace GtkSharp.Generation {
IsStatic = elem.GetAttribute ("shared") == "true";
if (elem.HasAttribute ("new_flag"))
mods = "new ";
if (elem.HasAttribute ("accessibility")) {
string attr = elem.GetAttribute ("accessibility");
switch (attr) {
case "public":
case "protected":
case "internal":
case "private":
case "protected internal":
protection = attr;
break;
}
}
}
protected string BaseName {
@ -135,7 +148,12 @@ namespace GtkSharp.Generation {
return parms;
}
}
public string Protection {
get { return protection; }
set { protection = value; }
}
protected string Safety {
get {
return Body.ThrowsException && !(container_type is InterfaceGen) ? "unsafe " : "";