]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
support static interfaces make set_type_id public add GBoxed as interface
authorJürg Billeter <j@bitron.ch>
Wed, 21 Mar 2007 17:05:04 +0000 (17:05 +0000)
committerJürg Billeter <juergbi@src.gnome.org>
Wed, 21 Mar 2007 17:05:04 +0000 (17:05 +0000)
2007-03-21  Jürg Billeter  <j@bitron.ch>

* vala/parser.y, vala/valainterface.vala: support static interfaces
* vala/valastruct.vala: make set_type_id public
* vapi/glib-2.0.vala: add GBoxed as interface

svn path=/trunk/; revision=255

vala/ChangeLog
vala/vala/parser.y
vala/vala/valainterface.vala
vala/vala/valastruct.vala
vala/vapi/glib-2.0.vala

index 484bb7b4d5f29cb86437724ed2f80fc6c32d2e0f..518bae3fbc5060c06a020177d9a00c8bbbd7d014 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-21  Jürg Billeter  <j@bitron.ch>
+
+       * vala/parser.y, vala/valainterface.vala: support static interfaces
+       * vala/valastruct.vala: make set_type_id public
+       * vapi/glib-2.0.vala: add GBoxed as interface
+
 2007-03-21  Jürg Billeter  <j@bitron.ch>
 
        * vala/valastruct.vala: use pointer as default of type_id and
index ffb33a3715eb828241b284ff3a6f0e11e0b65030..1333fed5d1682352c2d6a23c12ce2d5cbf252160 100644 (file)
@@ -2937,24 +2937,24 @@ struct_member_declaration
        ;
 
 interface_declaration
-       : comment opt_attributes opt_access_modifier INTERFACE identifier opt_name_specifier opt_type_parameter_list opt_class_base
+       : comment opt_attributes opt_access_modifier opt_modifiers INTERFACE identifier opt_name_specifier opt_type_parameter_list opt_class_base
          {
-               char *name = $5;
+               char *name = $6;
          
-               if ($6 != NULL) {
-                       ValaSourceReference *ns_src = src(@5);
-                       current_namespace = vala_namespace_new ($5, ns_src);
-                       g_free ($5);
+               if ($7 != NULL) {
+                       ValaSourceReference *ns_src = src(@6);
+                       current_namespace = vala_namespace_new ($6, ns_src);
+                       g_free ($6);
                        g_object_unref (ns_src);
                        current_namespace_implicit = TRUE;
 
                        vala_source_file_add_namespace (current_source_file, current_namespace);
                        g_object_unref (current_namespace);
                        
-                       name = $6;
+                       name = $7;
                }
                
-               ValaSourceReference *src = src_com(@5, $1);
+               ValaSourceReference *src = src_com(@6, $1);
                current_interface = vala_interface_new (name, src);
                g_free (name);
                g_object_unref (src);
@@ -2963,21 +2963,24 @@ interface_declaration
                if ($3 != 0) {
                        VALA_DATA_TYPE(current_interface)->access = $3;
                }
-               if ($7 != NULL) {
+               if (($4 & VALA_MODIFIER_STATIC) == VALA_MODIFIER_STATIC) {
+                       vala_interface_set_is_static (current_interface, TRUE);
+               }
+               if ($8 != NULL) {
                        GList *l;
-                       for (l = $7; l != NULL; l = l->next) {
+                       for (l = $8; l != NULL; l = l->next) {
                                vala_interface_add_type_parameter (current_interface, l->data);
                                g_object_unref (l->data);
                        }
-                       g_list_free ($7);
+                       g_list_free ($8);
                }
-               if ($8 != NULL) {
+               if ($9 != NULL) {
                        GList *l;
-                       for (l = $8; l != NULL; l = l->next) {
+                       for (l = $9; l != NULL; l = l->next) {
                                vala_interface_add_prerequisite (current_interface, l->data);
                                g_object_unref (l->data);
                        }
-                       g_list_free ($8);
+                       g_list_free ($9);
                }
          }
          interface_body
index c496d5da614f695cd5829bcd8089d1f33db403a6..a9abea8f4afd8df235581e3d273154c110da74b5 100644 (file)
@@ -26,6 +26,12 @@ using GLib;
  * Represents a class declaration in the source code.
  */
 public class Vala.Interface : DataType {
+       /**
+        * Specifies whether this interface is static. Static interfaces are not
+        * available at run-time. They can be implemented by structs.
+        */
+       public bool is_static { get; set; }
+
        private List<TypeParameter> type_parameters;
        
        private List<TypeReference> prerequisites;
index 383e04d38c783a70915bb40c8a54c3d5cdde3b18..f6e6b5e7722591e3c61ca80d2ff33f4a967df68d 100644 (file)
@@ -340,7 +340,7 @@ public class Vala.Struct : DataType {
                return type_id;
        }
        
-       private void set_type_id (string! name) {
+       public void set_type_id (string! name) {
                this.type_id = name;
        }
 
index 4e4cc6c7d6184dff0f3c6f7ea3f990dea0e61219..78d8d9767aa66c43057e7627313f7c4e0e971e3b 100644 (file)
@@ -479,7 +479,12 @@ namespace GLib {
        
        public abstract class InitiallyUnowned : Object {
        }
-       
+
+       public /* static */ interface Boxed<G> {
+               public abstract G copy ();
+               public abstract void free ();
+       }
+
        [ReferenceType (free_function = "g_free")]
        public struct Value {
                public weak Object get_object ();