[vala] json-glib-1.0: Switch to gir



commit b4fe82e52acb027c18f18e098daee8d1c639a42c
Author: Luca Bruno <lucabru src gnome org>
Date:   Sat Mar 12 11:03:51 2011 +0100

    json-glib-1.0: Switch to gir

 vapi/json-glib-1.0.vapi                            |   59 +-
 vapi/metadata/Json-1.0-custom.vala                 |   12 +
 vapi/metadata/Json-1.0.metadata                    |   23 +
 vapi/packages/json-glib-1.0/json-glib-1.0.defines  |    1 -
 vapi/packages/json-glib-1.0/json-glib-1.0.deps     |    1 -
 vapi/packages/json-glib-1.0/json-glib-1.0.files    |    2 -
 vapi/packages/json-glib-1.0/json-glib-1.0.gi       | 1132 --------------------
 vapi/packages/json-glib-1.0/json-glib-1.0.metadata |   36 -
 .../packages/json-glib-1.0/json-glib-1.0.namespace |    1 -
 9 files changed, 68 insertions(+), 1199 deletions(-)
---
diff --git a/vapi/json-glib-1.0.vapi b/vapi/json-glib-1.0.vapi
index 6cca23b..9fe5e00 100644
--- a/vapi/json-glib-1.0.vapi
+++ b/vapi/json-glib-1.0.vapi
@@ -1,9 +1,9 @@
 /* json-glib-1.0.vapi generated by vapigen, do not modify. */
 
-[CCode (cprefix = "Json", lower_case_cprefix = "json_")]
+[CCode (cprefix = "Json", lower_case_cprefix = "json_", gir_namespace = "Json", gir_version = "1.0")]
 namespace Json {
 	[Compact]
-	[CCode (ref_function = "json_array_ref", unref_function = "json_array_unref", type_id = "JSON_TYPE_ARRAY", cheader_filename = "json-glib/json-glib.h")]
+	[CCode (copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "json_array_get_type ()", cheader_filename = "json-glib/json-glib.h")]
 	public class Array {
 		[CCode (has_construct_function = false)]
 		public Array ();
@@ -15,7 +15,7 @@ namespace Json {
 		public void add_null_element ();
 		public void add_object_element (owned Json.Object value);
 		public void add_string_element (string value);
-		public unowned Json.Node dup_element (uint index_);
+		public Json.Node dup_element (uint index_);
 		public void foreach_element (Json.ArrayForeach func);
 		public unowned Json.Array get_array_element (uint index_);
 		public bool get_boolean_element (uint index_);
@@ -27,10 +27,13 @@ namespace Json {
 		public bool get_null_element (uint index_);
 		public unowned Json.Object get_object_element (uint index_);
 		public unowned string get_string_element (uint index_);
+		public Json.Array @ref ();
 		public void remove_element (uint index_);
-		public static unowned Json.Array sized_new (uint n_elements);
+		[CCode (cname = "json_array_sized_new", has_construct_function = false)]
+		public Array.sized (uint n_elements);
+		public void unref ();
 	}
-	[CCode (cheader_filename = "json-glib/json-glib.h")]
+	[CCode (type_id = "json_builder_get_type ()", cheader_filename = "json-glib/json-glib.h")]
 	public class Builder : GLib.Object {
 		[CCode (has_construct_function = false)]
 		public Builder ();
@@ -44,18 +47,18 @@ namespace Json {
 		public unowned Json.Builder begin_object ();
 		public unowned Json.Builder end_array ();
 		public unowned Json.Builder end_object ();
-		public unowned Json.Node get_root ();
+		public Json.Node get_root ();
 		public void reset ();
 		public unowned Json.Builder set_member_name (string member_name);
 	}
-	[CCode (cheader_filename = "json-glib/json-glib.h")]
+	[CCode (type_id = "json_generator_get_type ()", cheader_filename = "json-glib/json-glib.h")]
 	public class Generator : GLib.Object {
 		[CCode (has_construct_function = false)]
 		public Generator ();
 		public void set_root (Json.Node node);
 		public string to_data (out size_t length);
 		public bool to_file (string filename) throws GLib.Error;
-		public bool to_stream (GLib.OutputStream stream, GLib.Cancellable cancellable) throws GLib.Error;
+		public bool to_stream (GLib.OutputStream stream, GLib.Cancellable? cancellable = null) throws GLib.Error;
 		[NoAccessorMethod]
 		public uint indent { get; set; }
 		[NoAccessorMethod]
@@ -66,7 +69,7 @@ namespace Json {
 		public Json.Node root { owned get; set; }
 	}
 	[Compact]
-	[CCode (copy_function = "json_node_copy", type_id = "JSON_TYPE_NODE", cheader_filename = "json-glib/json-glib.h")]
+	[CCode (copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "json_node_get_type ()", cheader_filename = "json-glib/json-glib.h")]
 	public class Node {
 		[CCode (has_construct_function = false)]
 		public Node (Json.NodeType type);
@@ -74,6 +77,7 @@ namespace Json {
 		public Json.Array dup_array ();
 		public Json.Object dup_object ();
 		public string dup_string ();
+		public void free ();
 		public unowned Json.Array get_array ();
 		public bool get_boolean ();
 		public double get_double ();
@@ -98,12 +102,13 @@ namespace Json {
 		public unowned string type_name ();
 	}
 	[Compact]
-	[CCode (ref_function = "json_object_ref", unref_function = "json_object_unref", type_id = "JSON_TYPE_OBJECT", cheader_filename = "json-glib/json-glib.h")]
+	[CCode (copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "json_object_get_type ()", cheader_filename = "json-glib/json-glib.h")]
 	public class Object {
 		[CCode (has_construct_function = false)]
 		public Object ();
+		[Deprecated (since = "0.8", replacement = "Json.Object.set_member")]
 		public void add_member (string member_name, owned Json.Node node);
-		public unowned Json.Node dup_member (string member_name);
+		public Json.Node dup_member (string member_name);
 		public void foreach_member (Json.ObjectForeach func);
 		public unowned Json.Array get_array_member (string member_name);
 		public bool get_boolean_member (string member_name);
@@ -117,6 +122,7 @@ namespace Json {
 		public unowned string get_string_member (string member_name);
 		public GLib.List<weak Json.Node> get_values ();
 		public bool has_member (string member_name);
+		public Json.Object @ref ();
 		public void remove_member (string member_name);
 		public void set_array_member (string member_name, owned Json.Array value);
 		public void set_boolean_member (string member_name, bool value);
@@ -126,8 +132,9 @@ namespace Json {
 		public void set_null_member (string member_name);
 		public void set_object_member (string member_name, owned Json.Object value);
 		public void set_string_member (string member_name, string value);
+		public void unref ();
 	}
-	[CCode (cheader_filename = "json-glib/json-glib.h")]
+	[CCode (type_id = "json_parser_get_type ()", cheader_filename = "json-glib/json-glib.h")]
 	public class Parser : GLib.Object {
 		[CCode (has_construct_function = false)]
 		public Parser ();
@@ -135,11 +142,11 @@ namespace Json {
 		public uint get_current_line ();
 		public uint get_current_pos ();
 		public unowned Json.Node get_root ();
-		public bool has_assignment (out unowned string variable_name);
+		public bool has_assignment (out unowned string? variable_name);
 		public bool load_from_data (string data, ssize_t length = -1) throws GLib.Error;
 		public bool load_from_file (string filename) throws GLib.Error;
-		public bool load_from_stream (GLib.InputStream stream, GLib.Cancellable cancellable) throws GLib.Error;
-		public async bool load_from_stream_async (GLib.InputStream stream, GLib.Cancellable cancellable) throws GLib.Error;
+		public bool load_from_stream (GLib.InputStream stream, GLib.Cancellable? cancellable = null) throws GLib.Error;
+		public async bool load_from_stream_async (GLib.InputStream stream, GLib.Cancellable? cancellable = null) throws GLib.Error;
 		public virtual signal void array_element (Json.Array array, int index_);
 		public virtual signal void array_end (Json.Array array);
 		public virtual signal void array_start ();
@@ -150,10 +157,10 @@ namespace Json {
 		public virtual signal void parse_end ();
 		public virtual signal void parse_start ();
 	}
-	[CCode (cheader_filename = "json-glib/json-glib.h")]
+	[CCode (type_id = "json_reader_get_type ()", cheader_filename = "json-glib/json-glib.h")]
 	public class Reader : GLib.Object {
 		[CCode (has_construct_function = false)]
-		public Reader (Json.Node node);
+		public Reader (Json.Node? node);
 		public int count_elements ();
 		public int count_members ();
 		public void end_element ();
@@ -171,14 +178,14 @@ namespace Json {
 		public bool is_value ();
 		public bool read_element (uint index_);
 		public bool read_member (string member_name);
-		public void set_root (Json.Node root);
+		public void set_root (Json.Node? root);
 		[NoAccessorMethod]
 		public Json.Node root { owned get; set construct; }
 	}
-	[CCode (cheader_filename = "json-glib/json-glib.h,json-glib/json-gobject.h")]
-	public interface Serializable {
+	[CCode (cheader_filename = "json-glib/json-glib.h,json-glib/json-gobject.h", type_id = "json_serializable_get_type ()")]
+	public interface Serializable : GLib.Object {
 		public bool default_deserialize_property (string property_name, GLib.Value value, GLib.ParamSpec pspec, Json.Node property_node);
-		public unowned Json.Node default_serialize_property (string property_name, GLib.Value value, GLib.ParamSpec pspec);
+		public Json.Node default_serialize_property (string property_name, GLib.Value value, GLib.ParamSpec pspec);
 		public abstract bool deserialize_property (string property_name, out GLib.Value value, GLib.ParamSpec pspec, Json.Node property_node);
 		public abstract Json.Node serialize_property (string property_name, GLib.Value value, GLib.ParamSpec pspec);
 	}
@@ -205,13 +212,13 @@ namespace Json {
 		NO_OBJECT,
 		INVALID_MEMBER
 	}
-	[CCode (cheader_filename = "json-glib/json-glib.h")]
+	[CCode (cheader_filename = "json-glib/json-glib.h", instance_pos = 3.9)]
 	public delegate void ArrayForeach (Json.Array array, uint index_, Json.Node element_node);
 	[CCode (cheader_filename = "json-glib/json-glib.h", has_target = false)]
 	public delegate void* BoxedDeserializeFunc (Json.Node node);
 	[CCode (cheader_filename = "json-glib/json-glib.h", has_target = false)]
-	public delegate unowned Json.Node BoxedSerializeFunc (void* boxed);
-	[CCode (cheader_filename = "json-glib/json-glib.h")]
+	public delegate Json.Node BoxedSerializeFunc (void* boxed);
+	[CCode (cheader_filename = "json-glib/json-glib.h", instance_pos = 3.9)]
 	public delegate void ObjectForeach (Json.Object object, string member_name, Json.Node member_node);
 	[CCode (cheader_filename = "json-glib/json-glib.h")]
 	public const int MAJOR_VERSION;
@@ -226,7 +233,7 @@ namespace Json {
 	[CCode (cheader_filename = "json-glib/json-glib.h")]
 	public static bool boxed_can_deserialize (GLib.Type gboxed_type, Json.NodeType node_type);
 	[CCode (cheader_filename = "json-glib/json-glib.h")]
-	public static bool boxed_can_serialize (GLib.Type gboxed_type, Json.NodeType node_type);
+	public static bool boxed_can_serialize (GLib.Type gboxed_type, out Json.NodeType node_type);
 	[CCode (cheader_filename = "json-glib/json-glib.h")]
 	public static void* boxed_deserialize (GLib.Type gboxed_type, Json.Node node);
 	[CCode (cheader_filename = "json-glib/json-glib.h")]
@@ -234,7 +241,7 @@ namespace Json {
 	[CCode (cheader_filename = "json-glib/json-glib.h")]
 	public static void boxed_register_serialize_func (GLib.Type gboxed_type, Json.NodeType node_type, Json.BoxedSerializeFunc serialize_func);
 	[CCode (cheader_filename = "json-glib/json-glib.h")]
-	public static unowned Json.Node boxed_serialize (GLib.Type gboxed_type, void* boxed);
+	public static Json.Node boxed_serialize (GLib.Type gboxed_type, void* boxed);
 	[Deprecated (since = "0.10", replacement = "Json.gobject_from_data")]
 	[CCode (cheader_filename = "json-glib/json-glib.h,json-glib/json-gobject.h")]
 	public static GLib.Object construct_gobject (GLib.Type gtype, string data, size_t length) throws GLib.Error;
diff --git a/vapi/metadata/Json-1.0-custom.vala b/vapi/metadata/Json-1.0-custom.vala
new file mode 100644
index 0000000..021e9aa
--- /dev/null
+++ b/vapi/metadata/Json-1.0-custom.vala
@@ -0,0 +1,12 @@
+namespace Json {
+	[CCode (cheader_filename = "json-glib/json-glib.h")]
+	public const int MAJOR_VERSION;
+	[CCode (cheader_filename = "json-glib/json-glib.h")]
+	public const int MICRO_VERSION;
+	[CCode (cheader_filename = "json-glib/json-glib.h")]
+	public const int MINOR_VERSION;
+	[CCode (cheader_filename = "json-glib/json-glib.h")]
+	public const int VERSION_HEX;
+	[CCode (cheader_filename = "json-glib/json-glib.h")]
+	public const string VERSION_S;
+}
diff --git a/vapi/metadata/Json-1.0.metadata b/vapi/metadata/Json-1.0.metadata
new file mode 100644
index 0000000..7daf6f9
--- /dev/null
+++ b/vapi/metadata/Json-1.0.metadata
@@ -0,0 +1,23 @@
+// Vala specific
+*.*.cancellable default=null
+Parser.load_from_data.length default=-1
+gobject_from_data.length default=-1
+Array.sized_new name="sized"
+
+// Forward Upstream
+Json cheader_filename="json-glib/json-glib.h"
+Array
+	.get_element unowned
+Node
+	.get_parent unowned
+	.get_value.value out
+Object
+	.add_member replacement="Json.Object.set_member"
+	.get_member unowned
+Serializable cheader_filename="json-glib/json-glib.h,json-glib/json-gobject.h"
+	     .deserialize_property.value out
+construct_gobject cheader_filename="json-glib/json-glib.h,json-glib/json-gobject.h" replacement="Json.gobject_from_data"
+serialize_gobject cheader_filename="json-glib/json-glib.h,json-glib/json-gobject.h" replacement="Json.gobject_to_data"
+BoxedDeserializeFunc skip=false
+boxed_register_serialize_func skip=false
+boxed_register_deserialize_func skip=false



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