From: Rico Tzschichholz Date: Wed, 14 Nov 2018 18:55:43 +0000 (+0100) Subject: libvaladoc: Add type_id to Api.Enum/Interface X-Git-Tag: 0.43.1~108 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2afd6ebbc6bfa6617273ac8d101b3d398d3095cc;p=thirdparty%2Fvala.git libvaladoc: Add type_id to Api.Enum/Interface --- diff --git a/libvaladoc/api/enum.vala b/libvaladoc/api/enum.vala index 6774b5c84..1af6f0d8d 100644 --- a/libvaladoc/api/enum.vala +++ b/libvaladoc/api/enum.vala @@ -28,6 +28,7 @@ using Valadoc.Content; */ public class Valadoc.Api.Enum : TypeSymbol { private string cname; + private string? type_id; public Enum (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? type_macro_name, @@ -36,6 +37,7 @@ public class Valadoc.Api.Enum : TypeSymbol { base (parent, file, name, accessibility, comment, type_macro_name, null, null, type_function_name, false, data); this.cname = cname; + this.type_id = Vala.get_ccode_type_id (data); } /** @@ -45,6 +47,13 @@ public class Valadoc.Api.Enum : TypeSymbol { return cname; } + /** + * Returns the C symbol representing the runtime type id for this data type. + */ + public string? get_type_id () { + return type_id; + } + /** * {@inheritDoc} */ diff --git a/libvaladoc/api/interface.vala b/libvaladoc/api/interface.vala index a9cc860a9..7916649c3 100644 --- a/libvaladoc/api/interface.vala +++ b/libvaladoc/api/interface.vala @@ -30,7 +30,7 @@ public class Valadoc.Api.Interface : TypeSymbol { private string? interface_macro_name; private string? dbus_name; private string? cname; - + private string? type_id; public Interface (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? type_macro_name, string? is_type_macro_name, @@ -43,6 +43,7 @@ public class Valadoc.Api.Interface : TypeSymbol { this.interface_macro_name = interface_macro_name; this.dbus_name = dbus_name; this.cname = cname; + this.type_id = Vala.get_ccode_type_id (data); } /** @@ -93,6 +94,13 @@ public class Valadoc.Api.Interface : TypeSymbol { return cname; } + /** + * Returns the C symbol representing the runtime type id for this data type. + */ + public string? get_type_id () { + return type_id; + } + /** * Returns the dbus-name. */ diff --git a/libvaladoc/ctyperesolver.vala b/libvaladoc/ctyperesolver.vala index e6444e0ae..e01785435 100644 --- a/libvaladoc/ctyperesolver.vala +++ b/libvaladoc/ctyperesolver.vala @@ -226,6 +226,7 @@ public class Valadoc.CTypeResolver : Visitor { * {@inheritDoc} */ public override void visit_interface (Interface item) { + register_symbol_type (item.get_type_id (), item); register_symbol (item.get_cname (), item); item.accept_all_children (this, false); } @@ -391,6 +392,7 @@ public class Valadoc.CTypeResolver : Visitor { * {@inheritDoc} */ public override void visit_enum (Api.Enum item) { + register_symbol_type (item.get_type_id (), item); register_symbol (item.get_cname (), item); item.accept_all_children (this, false); }