[Vala] [PATCH] Bindings for GIconv, GDate, and more



Index: vapi/glib-2.0.vala
===================================================================
--- vapi/glib-2.0.vala    (revision 297)
+++ vapi/glib-2.0.vala    (working copy)
@@ -621,6 +621,14 @@
         public static double PI;
     }
     
+    /* IConv */
+    [ReferenceType (free_function = "g_iconv_close")]
+    public struct IConv {
+        [CCode (cname = "g_iconv_open")]
+        public Iconv (string to_codeset, string from_codeset);
+        public uint iconv (ref string inbuf, ref uint inbytes_left, ref string outbuf, ref uint outbytes_left);
+    }
+    
     /* The Main Event Loop */
     
     [ReferenceType (dup_function = "g_main_loop_ref", free_function = "g_main_loop_unref")]
@@ -1005,9 +1013,92 @@
         [InstanceLast ()]
         public bool from_iso8601 (string iso_date);
         public ref string to_iso8601 ();
-        
     }
     
+    public struct DateDay {
+        [CCode (cname = "g_date_valid_day")]
+        public bool valid ();
+    }
+    
+    [CCode (cprefix = "GSF_DATE_")]
+    public enum DateMonth {
+        BAD_MONTH,
+        JANUARY,
+        FEBRUARY,
+        MARCH,
+        APRIL,
+        MAY,
+        JUNE,
+        JULY,
+        AUGUST,
+        SEPTEMBER,
+        OCTOBER,
+        NOVEMBER,
+        DECEMBER
+        /* possible to add methods on enums?
+        public uint get_days_in_month (DateYear year);
+        [CCode (cname = "g_date_valid_month")]
+        public bool valid ();
+        */
+    }
+    [CCode (cprefix = "GSF_DATE_")]
+    public enum DateWeekday {
+        BAD_WEEKDAY,
+        MONDAY,
+        TUESDAY,
+        WEDNESDAY,
+        THURSDAY,
+        FRIDAY,
+        SATURDAY,
+        SUNDAY
+        /*
+        [CCode (cname = "g_date_valid_weekday")]
+        public bool valid ();
+        */
+    }
+    
+    public struct DateYear {
+        public bool is_leap_year ();
+        public uint get_monday_weeks_in_year ();
+        public uint get_sunday_weeks_in_year ();
+        [CCode (cname = "g_date_valid_year")]
+        public bool valid ();
+    }
+    
+    [ReferenceType (free_function = "g_date_free")]
+    public struct Date {
+        public Date ();
+        public Date.dmy (DateDay day, DateMonth month, DateYear year);
+        public Date.julian (uint julian_day);
+        public void set_day (DateDay day);
+        public void set_month (DateMonth month);
+        public void set_year (DateYear year);
+        public void set_dmy (DateDay day, DateMonth month, DateYear year);
+        public void set_julian (uint julian_day);
+        public void set_time_val (TimeVal timeval);
+        public void set_parse (string str);
+        public void add_days (uint n_days);
+        public void subtract_days (uint n_days);
+        public void add_months (uint n_months);
+        public void subtract_months (uint n_months);
+        public int days_between (Date date2);
+        public int compare (Date rhs);
+        public void clamp (Date min_date, Date max_date);
+        public void order (Date date2);
+        public DateDay get_day ();
+        public DateMonth get_month ();
+        public DateYear get_year ();
+        public uint get_julian ();
+        public DateWeekday get_weekday ();
+        public uint get_day_of_year ();
+        public bool is_first_of_month ();
+        public bool is_last_of_month ();
+        public uint get_monday_week_of_year ();
+        public uint get_sunday_week_of_year ();
+        public uint get_iso8601_week_of_year ();
+        public bool valid ();
+    }
+        
     /* Random Numbers */
     
     [ReferenceType (dup_function = "g_rand_copy", free_function = "g_rand_free")]
@@ -1548,6 +1641,8 @@
     [CCode (cname = "g_object_unref")]
     public static GLib.DestroyNotify g_object_unref;
     
+    public callback void HFunc (pointer key, pointer value, pointer user_data);
+    
     /* Strings */
     
     [ReferenceType (free_function = "g_string_free")]
@@ -1578,6 +1673,12 @@
     public struct PtrArray {
     }
     
+    /* Byte Arrays */
+    
+    [ReferenceType (free_function = "g_byte_array_free")]
+    public struct ByteArray {
+    }
+    
     /* Quarks */
     
     public struct Quark {

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