[Gtk-sharp-list] Is and Has methods as properties patch
Martin Willemoes Hansen
mwh@sysrq.dk
Wed, 29 Oct 2003 18:20:48 +0100
--=-NfJNwjXCXhs4yjlljczs
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Tue, 2003-10-28 at 19:03, Martin Willemoes Hansen wrote:
> Hi!
>
> Ived patch the generator to use properties for Is and Has methods.
>
> Okay to commit?
Here is another, just changing the methods to be generated as
properties.
--
Martin Willemoes Hansen
--------------------------------------------------------
E-Mail mwh@sysrq.dk Website mwh.sysrq.dk
IRC MWH, freenode.net
--------------------------------------------------------
--=-NfJNwjXCXhs4yjlljczs
Content-Disposition: attachment; filename=HasAndIsMethodsAsProperties.diff
Content-Type: text/x-patch; name=HasAndIsMethodsAsProperties.diff; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
? HasAndIsMethodsAsProperties.diff
? IsAndHasAsProperties.diff
Index: ChangeLog
===================================================================
RCS file: /cvs/public/gtk-sharp/ChangeLog,v
retrieving revision 1.537
diff -u -r1.537 ChangeLog
--- ChangeLog 28 Oct 2003 20:03:27 -0000 1.537
+++ ChangeLog 29 Oct 2003 17:29:45 -0000
@@ -1,3 +1,8 @@
+2003-10-29 Martin Willemoes Hansen <mwh@sysrq.dk>
+
+ * generator/Method.cs: marked Is and Has methods,
+ to be generated as properties, fixes bug [47910]
+
2003-10-28 Mike Kestner <mkestner@ximian.com>
* configure.in : releasing 0.12
Index: generator/Method.cs
===================================================================
RCS file: /cvs/public/gtk-sharp/generator/Method.cs,v
retrieving revision 1.35
diff -u -r1.35 Method.cs
--- generator/Method.cs 8 Oct 2003 02:56:44 -0000 1.35
+++ generator/Method.cs 29 Oct 2003 17:29:47 -0000
@@ -168,7 +168,7 @@
else
safety = "";
- is_get = (((parms != null && ((parms.IsAccessor && s_ret == "void") || (parms.Count == 0 && s_ret != "void"))) || (parms == null && s_ret != "void")) && Name.Length > 3 && Name.Substring(0, 3) == "Get");
+ is_get = (((parms != null && ((parms.IsAccessor && s_ret == "void") || (parms.Count == 0 && s_ret != "void"))) || (parms == null && s_ret != "void")) && Name.Length > 3 && (Name.StartsWith ("Get") || Name.StartsWith ("Is") || Name.StartsWith ("Has")));
is_set = ((parms != null && (parms.IsAccessor || (parms.Count == 1 && s_ret == "void"))) && (Name.Length > 3 && Name.Substring(0, 3) == "Set"));
if (parms != null) {
@@ -233,7 +233,10 @@
s_ret = parms.AccessorReturnType;
sw.Write(s_ret);
sw.Write(" ");
- sw.Write(Name.Substring (3));
+ if (Name.StartsWith ("Get") || Name.StartsWith ("Set"))
+ sw.Write (Name.Substring (3));
+ else
+ sw.Write (Name);
sw.WriteLine(" { ");
} else {
sw.Write(s_ret + " " + Name + sig);
--=-NfJNwjXCXhs4yjlljczs--