[Gtk-sharp-list] Struct privatization
Mike Kestner
mkestner@speakeasy.net
Wed, 17 Sep 2003 21:14:14 -0500
On Wed, 2003-09-17 at 20:42, Rachel Hestilow wrote:
> The attached patch to the generator makes the following kinds
> of struct fields private:
Comments in-line:
Index: generator/StructBase.cs
===================================================================
RCS file: /cvs/public/gtk-sharp/generator/StructBase.cs,v
retrieving revision 1.38
diff -u -p -r1.38 StructBase.cs
--- generator/StructBase.cs 28 Aug 2003 16:49:29 -0000 1.38
+++ generator/StructBase.cs 18 Sep 2003 01:39:41 -0000
@@ -95,7 +95,13 @@ namespace GtkSharp.Generation {
bool IsPointer (XmlElement field)
{
string c_type = field.GetAttribute("type");
- return (c_type[c_type.Length - 1] == '*');
+ return (c_type[c_type.Length - 1] == '*' ||
c_type == "gpointer" || c_type == "gconstpointer");
======================
How about ctype.EndsWith ("*") || ctype.EndsWith("pointer")?
======================
+ }
+
+ bool IsPadding (XmlElement field)
+ {
+ string c_name = field.GetAttribute ("cname");
+ return (c_name.StartsWith ("dummy"));
}
protected void GenFields (StreamWriter sw)
@@ -114,29 +120,39 @@ namespace GtkSharp.Generation {
}
}
- protected bool GetFieldInfo (XmlElement field, out
string c_type, out string type, out string name)
+ protected bool GetFieldInfo (XmlElement field, out
string c_type, out string type, out string name, out string protection)
===============================
So this method is getting pretty evil. Probably need to refactor this
into a Field class with properties for all those out params. Don't need
to do this right now though. Go ahead and commit with the above change.
--
Mike Kestner <mkestner@speakeasy.net>