vala r924 - in trunk: . gobject vapi



Author: juergbi
Date: Tue Jan 29 20:29:22 2008
New Revision: 924
URL: http://svn.gnome.org/viewvc/vala?rev=924&view=rev

Log:
2008-01-29  Juerg Billeter  <j bitron ch>

	* gobject/valaccodegenerator.vala, vapi/glib-2.0.vapi: bind GString
	  as GLib.StringBuilder to avoid confusion between string and String


Modified:
   trunk/ChangeLog
   trunk/gobject/valaccodegenerator.vala
   trunk/vapi/glib-2.0.vapi

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Tue Jan 29 20:29:22 2008
@@ -98,6 +98,7 @@
 	public Typesymbol glist_type;
 	public Typesymbol gslist_type;
 	public Typesymbol gstring_type;
+	public Typesymbol gstringbuilder_type;
 	public Typesymbol garray_type;
 	public DataType gquark_type;
 	public DataType mutex_type;
@@ -218,7 +219,8 @@
 		gerror_type = (Typesymbol) glib_ns.scope.lookup ("Error");
 		glist_type = (Typesymbol) glib_ns.scope.lookup ("List");
 		gslist_type = (Typesymbol) glib_ns.scope.lookup ("SList");
-		gstring_type = (Typesymbol) glib_ns.scope.lookup ("String");
+		gstring_type = (Typesymbol) glib_ns.scope.lookup ("StringBuilder");
+		gstringbuilder_type = (Typesymbol) glib_ns.scope.lookup ("String");
 		garray_type = (Typesymbol) glib_ns.scope.lookup ("Array");
 
 		gquark_type = new ValueType ((Typesymbol) glib_ns.scope.lookup ("Quark"));
@@ -1099,7 +1101,7 @@
 				cunrefcall.add_argument (new CCodeConstant ("NULL"));
 				ccomma.append_expression (cunrefcall);
 			}
-		} else if (type.data_type == gstring_type) {
+		} else if (type.data_type == gstring_type || type.data_type == gstringbuilder_type) {
 			ccall.add_argument (new CCodeConstant ("TRUE"));
 		} else if (type is ArrayType) {
 			var array_type = (ArrayType) type;

Modified: trunk/vapi/glib-2.0.vapi
==============================================================================
--- trunk/vapi/glib-2.0.vapi	(original)
+++ trunk/vapi/glib-2.0.vapi	Tue Jan 29 20:29:22 2008
@@ -2579,7 +2579,35 @@
 	public static GLib.DestroyNotify g_list_free;
 
 	/* Strings */
-	
+
+	[CCode (cname = "GString", cprefix = "g_string_", free_function = "g_string_free", type_id = "G_TYPE_GSTRING")]
+	public class StringBuilder : Boxed {
+		public StringBuilder (string init = "");
+		[CCode (cname = "g_string_sized_new")]
+		public StringBuilder.sized (ulong dfl_size);
+		public weak StringBuilder assign (string! rval);
+		public weak StringBuilder append (string! val);
+		public weak StringBuilder append_c (char c);
+		public weak StringBuilder append_unichar (unichar wc);
+		public weak StringBuilder append_len (string! val, long len);
+		public weak StringBuilder prepend (string! val);
+		public weak StringBuilder prepend_c (char c);
+		public weak StringBuilder prepend_unichar (unichar wc);
+		public weak StringBuilder prepend_len (string! val, long len);
+		public weak StringBuilder insert (long pos, string! val);
+		public weak StringBuilder erase (long pos, long len);
+
+		[PrintfFormat]
+		public void printf (string! format, ...);
+		[PrintfFormat]
+		public void append_printf (string! format, ...);
+
+		public string str;
+		public long len;
+		public long allocated_len;
+	}
+
+	// will be removed in Vala 0.1.8
 	[CCode (free_function = "g_string_free", type_id = "G_TYPE_GSTRING")]
 	public class String : Boxed {
 		public String (string init = "");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]