[valadoc] libvaladoc/api: Add finalize and free function names to Api.Class
- From: Florian Brosch <flobrosch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [valadoc] libvaladoc/api: Add finalize and free function names to Api.Class
- Date: Fri, 17 Aug 2012 23:25:55 +0000 (UTC)
commit 32b9c64ea4d27780373ac89403a6a020f734b472
Author: Florian Brosch <flo brosch gmail com>
Date: Fri Aug 17 02:14:40 2012 +0200
libvaladoc/api: Add finalize and free function names to Api.Class
src/driver/0.10.x/treebuilder.vala | 18 +++++++++++++++++-
src/driver/0.12.x/treebuilder.vala | 18 +++++++++++++++++-
src/driver/0.14.x/treebuilder.vala | 26 +++++++++++++++++++++++++-
src/driver/0.16.x/treebuilder.vala | 18 +++++++++++++++++-
src/driver/0.18.x/treebuilder.vala | 18 +++++++++++++++++-
src/libvaladoc/api/class.vala | 28 ++++++++++++++++++++++++++--
6 files changed, 119 insertions(+), 7 deletions(-)
---
diff --git a/src/driver/0.10.x/treebuilder.vala b/src/driver/0.10.x/treebuilder.vala
index 6df37bc..01f22f1 100644
--- a/src/driver/0.10.x/treebuilder.vala
+++ b/src/driver/0.10.x/treebuilder.vala
@@ -323,6 +323,22 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
return "%s_GET_INTERFACE".printf (element.get_upper_case_cname ());
}
+ private string? get_free_function_name (Vala.Class element) {
+ if (!element.is_compact) {
+ return null;
+ }
+
+ return element.get_free_function ();
+ }
+
+ private string? get_finalize_function_name (Vala.Class element) {
+ if (!element.is_fundamental ()) {
+ return null;
+ }
+
+ return "%s_finalize".printf (element.get_lower_case_cname ());
+ }
+
private string get_quark_function_name (Vala.ErrorDomain element) {
return element.get_lower_case_cprefix () + "quark";
}
@@ -860,7 +876,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_class == null && element.name == "string";
- Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, element.get_cname (), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), element.get_type_id (), element.get_param_spec_function (), element.get_ref_function (), element.get_unref_function (), element.get_take_value_function (), element.get_get_value_function (), element.get_set_value_function (), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+ Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, element.get_cname (), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), element.get_type_id (), element.get_param_spec_function (), element.get_ref_function (), element.get_unref_function (), get_free_function_name (element), get_finalize_function_name (element), element.get_take_value_function (), element.get_get_value_function (), element.get_set_value_function (), element.is_fundamental (), element.is_abstract, is_basic_type, element);
symbol_map.set (element, node);
parent.add_child (node);
diff --git a/src/driver/0.12.x/treebuilder.vala b/src/driver/0.12.x/treebuilder.vala
index b25e576..f67d642 100644
--- a/src/driver/0.12.x/treebuilder.vala
+++ b/src/driver/0.12.x/treebuilder.vala
@@ -240,6 +240,22 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
}
}
+ private string? get_free_function_name (Vala.Class element) {
+ if (!element.is_compact) {
+ return null;
+ }
+
+ return element.get_free_function ();
+ }
+
+ private string? get_finalize_function_name (Vala.Class element) {
+ if (!element.is_fundamental ()) {
+ return null;
+ }
+
+ return "%s_finalize".printf (element.get_lower_case_cname ());
+ }
+
private string? get_quark_macro_name (Vala.ErrorDomain element) {
return element.get_upper_case_cname ();
}
@@ -911,7 +927,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_class == null && element.name == "string";
- Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, element.get_cname (), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), element.get_type_id (), element.get_param_spec_function (), element.get_ref_function (), element.get_unref_function (), element.get_take_value_function (), element.get_get_value_function (), element.get_set_value_function (), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+ Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, element.get_cname (), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), element.get_type_id (), element.get_param_spec_function (), element.get_ref_function (), element.get_unref_function (), get_free_function_name (element), get_finalize_function_name (element), element.get_take_value_function (), element.get_get_value_function (), element.get_set_value_function (), element.is_fundamental (), element.is_abstract, is_basic_type, element);
symbol_map.set (element, node);
parent.add_child (node);
diff --git a/src/driver/0.14.x/treebuilder.vala b/src/driver/0.14.x/treebuilder.vala
index 8700794..795aa97 100644
--- a/src/driver/0.14.x/treebuilder.vala
+++ b/src/driver/0.14.x/treebuilder.vala
@@ -274,6 +274,30 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
#endif
}
+ private string? get_finalize_function_name (Vala.Class element) {
+ if (!element.is_fundamental ()) {
+ return null;
+ }
+
+#if VALA_0_13_0 || VALA_0_13_1
+ return "%s_finalize".printf (element.get_lower_case_cname ());
+#else
+ return "%s_finalize".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
+#endif
+ }
+
+ private string? get_free_function_name (Vala.Class element) {
+ if (!element.is_compact) {
+ return null;
+ }
+
+#if VALA_0_13_0 || VALA_0_13_1
+ return element.get_free_function ();
+#else
+ return Vala.CCodeBaseModule.get_ccode_free_function (element);
+#endif
+ }
+
private string get_finish_name (Vala.Method m) {
#if VALA_0_13_0 || VALA_0_13_1
return m.get_finish_cname ();
@@ -1015,7 +1039,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_class == null && element.name == "string";
- Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), get_ccode_type_id (element), get_param_spec_function (element), get_ref_function (element), get_unref_function (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+ Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), get_ccode_type_id (element), get_param_spec_function (element), get_ref_function (element), get_unref_function (element), get_free_function_name (element), get_finalize_function_name (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
symbol_map.set (element, node);
parent.add_child (node);
diff --git a/src/driver/0.16.x/treebuilder.vala b/src/driver/0.16.x/treebuilder.vala
index 5c6d5ab..8bf06f3 100644
--- a/src/driver/0.16.x/treebuilder.vala
+++ b/src/driver/0.16.x/treebuilder.vala
@@ -260,6 +260,22 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
return Vala.CCodeBaseModule.get_ccode_unref_function (sym);
}
+ private string? get_finalize_function_name (Vala.Class element) {
+ if (!element.is_fundamental ()) {
+ return null;
+ }
+
+ return "%s_finalize".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
+ }
+
+ private string? get_free_function_name (Vala.Class element) {
+ if (!element.is_compact) {
+ return null;
+ }
+
+ return Vala.CCodeBaseModule.get_ccode_free_function (element);
+ }
+
private string? get_finish_name (Vala.Method m) {
return Vala.CCodeBaseModule.get_ccode_finish_name (m);
}
@@ -931,7 +947,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_class == null && element.name == "string";
- Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), get_ccode_type_id (element), get_param_spec_function (element), get_ref_function (element), get_unref_function (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+ Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), get_ccode_type_id (element), get_param_spec_function (element), get_ref_function (element), get_unref_function (element), get_free_function_name (element), get_finalize_function_name (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
symbol_map.set (element, node);
parent.add_child (node);
diff --git a/src/driver/0.18.x/treebuilder.vala b/src/driver/0.18.x/treebuilder.vala
index 055ab20..37f44bd 100644
--- a/src/driver/0.18.x/treebuilder.vala
+++ b/src/driver/0.18.x/treebuilder.vala
@@ -264,6 +264,22 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
return Vala.CCodeBaseModule.get_ccode_unref_function (sym);
}
+ private string? get_finalize_function_name (Vala.Class element) {
+ if (!element.is_fundamental ()) {
+ return null;
+ }
+
+ return "%s_finalize".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
+ }
+
+ private string? get_free_function_name (Vala.Class element) {
+ if (!element.is_compact) {
+ return null;
+ }
+
+ return Vala.CCodeBaseModule.get_ccode_free_function (element);
+ }
+
private string? get_finish_name (Vala.Method m) {
return Vala.CCodeBaseModule.get_ccode_finish_name (m);
}
@@ -947,7 +963,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_class == null && element.name == "string";
- Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), get_ccode_type_id (element), get_param_spec_function (element), get_ref_function (element), get_unref_function (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+ Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), get_ccode_type_id (element), get_param_spec_function (element), get_ref_function (element), get_unref_function (element), get_free_function_name (element), get_finalize_function_name (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
symbol_map.set (element, node);
parent.add_child (node);
diff --git a/src/libvaladoc/api/class.vala b/src/libvaladoc/api/class.vala
index 273f249..0c5a7a5 100644
--- a/src/libvaladoc/api/class.vala
+++ b/src/libvaladoc/api/class.vala
@@ -35,8 +35,10 @@ public class Valadoc.Api.Class : TypeSymbol {
private string? get_value_function_cname;
private string? set_value_function_cname;
private string? unref_function_name;
- private string? param_spec_function_name;
private string? ref_function_name;
+ private string? free_function_name;
+ private string? finalize_function_name;
+ private string? param_spec_function_name;
private string? type_id;
private string? is_class_type_macro_name;
private string? class_type_macro_name;
@@ -44,7 +46,7 @@ public class Valadoc.Api.Class : TypeSymbol {
private string? private_cname;
private string? cname;
- public Class (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? private_cname, string? class_macro_name, string? type_macro_name, string? is_type_macro_name, string? type_cast_macro_name, string? type_function_name, string? class_type_macro_name, string? is_class_type_macro_name, string? dbus_name, string? type_id, string? param_spec_function_name, string? ref_function_name, string? unref_function_name, string? take_value_function_cname, string? get_value_function_cname, string? set_value_function_cname, bool is_fundamental, bool is_abstract, bool is_basic_type, void* data) {
+ public Class (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? private_cname, string? class_macro_name, string? type_macro_name, string? is_type_macro_name, string? type_cast_macro_name, string? type_function_name, string? class_type_macro_name, string? is_class_type_macro_name, string? dbus_name, string? type_id, string? param_spec_function_name, string? ref_function_name, string? unref_function_name, string? free_function_name, string? finalize_function_name, string? take_value_function_cname, string? get_value_function_cname, string? set_value_function_cname, bool is_fundamental, bool is_abstract, bool is_basic_type, void* data) {
base (parent, file, name, accessibility, comment, type_macro_name, is_type_macro_name, type_cast_macro_name, type_function_name, is_basic_type, data);
this.interfaces = new ArrayList<TypeReference> ();
@@ -61,6 +63,8 @@ public class Valadoc.Api.Class : TypeSymbol {
this.unref_function_name = unref_function_name;
this.ref_function_name = ref_function_name;
+ this.finalize_function_name = finalize_function_name;
+ this.free_function_name = free_function_name;
this.take_value_function_cname = take_value_function_cname;
this.get_value_function_cname = get_value_function_cname;
@@ -122,6 +126,26 @@ public class Valadoc.Api.Class : TypeSymbol {
}
/**
+ * Returns the C function name that frees the
+ * instances of this data type.
+ *
+ * @return the name of the C function or null
+ */
+ public string? get_free_function_name () {
+ return free_function_name;
+ }
+
+ /**
+ * Returns the C function name that finalizes the
+ * instances of this data type.
+ *
+ * @return the name of the C function or null
+ */
+ public string? get_finalize_function_name () {
+ return finalize_function_name;
+ }
+
+ /**
* Returns the cname of the GValue parameter spec function.
*/
public string? get_param_spec_function_cname () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]