Commit 9374f2ea authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

support static interfaces make set_type_id public add GBoxed as interface

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
parent e8e178f2
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
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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 ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment