]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
add GArray and GTree structures write header files attributes for classes
authorRaffaele Sandrini <rasa@gmx.ch>
Thu, 9 Nov 2006 14:00:36 +0000 (14:00 +0000)
committerRaffaele Sandrini <rasa@src.gnome.org>
Thu, 9 Nov 2006 14:00:36 +0000 (14:00 +0000)
2006-11-09  Raffaele Sandrini  <rasa@gmx.ch>

* vapi/glib-2.0.vala: add GArray and GTree structures
* vala/valainterfacewriter.vala: write header files attributes for
  classes

svn path=/trunk/; revision=172

vala/ChangeLog
vala/vala/valainterfacewriter.vala
vala/vapi/glib-2.0.vala

index 434d487657c345daf20ec70306ec7fc8e2e98507..77b759478480a960e1fa33c403c48ffeab8be08c 100644 (file)
@@ -1,3 +1,9 @@
+2006-11-09  Raffaele Sandrini  <rasa@gmx.ch>
+
+       * vapi/glib-2.0.vala: add GArray and GTree structures
+       * vala/valainterfacewriter.vala: write header files attributes for
+         classes
+
 2006-11-09  Jürg Billeter  <j@bitron.ch>
 
        * vapi/libxml-2.0.vala: some fixes and additions
index 7b23de57322ee835c44bf47d68e6ce5329d67ed8..7ec35e61bbf4bc79b7848e2d3f2fd04f726a9485 100644 (file)
@@ -93,6 +93,20 @@ public class Vala.InterfaceWriter : CodeVisitor {
                }
                
                write_indent ();
+               
+               var first = true;
+               string cheaders;
+               foreach (string cheader in cl.get_cheader_filenames ()) {
+                       if (first) {
+                               cheaders = cheader;
+                               first = false;
+                       } else {
+                               cheaders = "%s, %s".printf (cheaders, cheader);
+                       }
+               }
+               write_string ("[CCode (cheader_filename = \"%s\")]".printf (cheaders));
+               write_newline ();
+               
                write_string ("public ");
                if (cl.is_abstract) {
                        write_string ("abstract ");
index 40d8b14ab583c250e81fcb11cab943cb458362e0..7973934a09244bbcf5374ce125b7fa73389281e8 100644 (file)
@@ -29,6 +29,10 @@ public struct bool {
 public struct pointer {
 }
 
+[CCode (cname = "gconstpointer", cheader_filename = "glib.h", type_id = "G_TYPE_POINTER", marshaller_type_name = "POINTER", get_value_function = "g_value_get_pointer", set_value_function = "g_value_set_pointer")]
+public struct constpointer {
+}
+
 [CCode (cheader_filename = "glib.h", type_id = "G_TYPE_CHAR", marshaller_type_name = "CHAR", get_value_function = "g_value_get_char", set_value_function = "g_value_set_char")]
 [IntegerType (rank = 1)]
 public struct char {
@@ -1117,4 +1121,65 @@ namespace GLib {
                public static Quark from_string (string string);
                public string to_string ();
        }
+       
+       /* GArray */
+       
+       [ReferenceType ()]
+       public struct Array<G> {
+               public construct (bool zero_terminated, bool clear, uint element_size);
+               [CCode (cname = "g_array_sized_new")]
+               public construct sized (bool zero_terminated, bool clear, uint element_size, uint reserved_size);
+               [ReturnsModifiedPointer ()]
+               public void append_val (G value);
+               [ReturnsModifiedPointer ()]
+               public void append_vals (constpointer data, uint len);
+               [ReturnsModifiedPointer ()]
+               public void prepend_val (G value);
+               [ReturnsModifiedPointer ()]
+               public void prepend_vals (constpointer data, uint len);
+               [ReturnsModifiedPointer ()]
+               public void insert_val (uint index, G value);
+               [ReturnsModifiedPointer ()]
+               public void insert_vals (uint index, constpointer data, uint len);
+               [ReturnsModifiedPointer ()]
+               public void remove_index (uint index);
+               [ReturnsModifiedPointer ()]
+               public void remove_index_fast (uint index);
+               [ReturnsModifiedPointer ()]
+               public void remove_range (uint index, uint length);
+               public void sort (CompareFunc compare_func);
+               public void sort_with_data (CompareDataFunc compare_func, pointer user_data);
+               [ReturnsModifiedPointer ()]
+               public void set_size (uint length);
+               public string free (bool free_segment);
+       }
+       
+       /* GTree */
+       
+       public callback int TraverseFunc (pointer key, pointer value, pointer data);
+       
+       [CCode (c_prefix="C_")]
+       public enum TraverseType {
+               IN_ORDER,
+               PRE_ORDER,
+               POST_ORDER,
+               LEVEL_ORDER
+       }
+       
+       [ReferenceType (free_function = "g_tree_destroy")]
+       public struct Tree<K,V> {
+               public construct (CompareFunc key_compare_func);
+               public construct with_data (CompareFunc key_compare_func, pointer key_compare_data);
+               public construct full (CompareFunc key_compare_func, pointer key_compare_data, DestroyNotify key_destroy_func, DestroyNotify value_destroy_func);
+               public void insert (K key, V value);
+               public void replace (K key, V value);
+               public int nnodes ();
+               public int height ();
+               public V lookup (K key);
+               public bool lookup_extended (K lookup_key, K orig_key, V value);
+               public void tree_foreach (TraverseFunc traverse_func, TraverseType traverse_type, pointer user_data);
+               public V tree_search (CompareFunc search_func, pointer user_data);
+               public bool remove (K key);
+               public bool steal (K key);
+       }
 }