vala r1852 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1852 - in trunk: . vala
- Date: Fri, 17 Oct 2008 13:33:40 +0000 (UTC)
Author: juergbi
Date: Fri Oct 17 13:33:39 2008
New Revision: 1852
URL: http://svn.gnome.org/viewvc/vala?rev=1852&view=rev
Log:
2008-10-17 JÃrg Billeter <j bitron ch>
* vala/valaenumvalue.vala:
* vala/valainterfacewriter.vala:
Improve custom cname support for enum values
Modified:
trunk/ChangeLog
trunk/vala/valaenumvalue.vala
trunk/vala/valainterfacewriter.vala
Modified: trunk/vala/valaenumvalue.vala
==============================================================================
--- trunk/vala/valaenumvalue.vala (original)
+++ trunk/vala/valaenumvalue.vala Fri Oct 17 13:33:39 2008
@@ -107,7 +107,6 @@
}
}
-
/**
* Returns the name of this enum value as it is used in C code.
*
@@ -115,9 +114,22 @@
*/
public string get_cname () {
if (cname == null) {
- var en = (Enum) parent_symbol;
- cname = "%s%s".printf (en.get_cprefix (), name);
+ cname = get_default_cname ();
}
return cname;
}
+
+ public string get_default_cname () {
+ var en = (Enum) parent_symbol;
+ return "%s%s".printf (en.get_cprefix (), name);
+ }
+
+ /**
+ * Sets the name of this enum value to be used in C code.
+ *
+ * @param cname the name to be used in C code
+ */
+ public void set_cname (string cname) {
+ this.cname = cname;
+ }
}
Modified: trunk/vala/valainterfacewriter.vala
==============================================================================
--- trunk/vala/valainterfacewriter.vala (original)
+++ trunk/vala/valainterfacewriter.vala Fri Oct 17 13:33:39 2008
@@ -412,6 +412,10 @@
write_newline ();
}
+ if (ev.get_cname () != ev.get_default_cname ()) {
+ write_indent ();
+ write_string ("[CCode (cname = \"%s\")]".printf (ev.get_cname ()));
+ }
write_indent ();
write_identifier (ev.name);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]