]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
libvaladoc: Add type_id to Api.Enum/Interface
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 14 Nov 2018 18:55:43 +0000 (19:55 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 14 Nov 2018 19:11:04 +0000 (20:11 +0100)
libvaladoc/api/enum.vala
libvaladoc/api/interface.vala
libvaladoc/ctyperesolver.vala

index 6774b5c846e85a14563077f7b2db5cd632423bfb..1af6f0d8dcfb580f911e0d62514a8c55ae05dce2 100644 (file)
@@ -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}
         */
index a9cc860a9e3fde63963bf954bf18d70168d2753e..7916649c305261ef28377e0942e0d341f3c83c91 100644 (file)
@@ -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.
         */
index e6444e0aefeee2b0d78432716dff35e043c51767..e017854351abe57ed1e4efb4e0b3ff13d6545a38 100644 (file)
@@ -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);
        }