[vala/staging: 2/5] libvaladoc: Add type_id to Api.Enum/Interface



commit 9c2baec3a8d616c4709d4213b679f55e4569164c
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Wed Nov 14 19:55:43 2018 +0100

    libvaladoc: Add type_id to Api.Enum/Interface

 libvaladoc/api/enum.vala      |  9 +++++++++
 libvaladoc/api/interface.vala | 10 +++++++++-
 libvaladoc/ctyperesolver.vala |  2 ++
 3 files changed, 20 insertions(+), 1 deletion(-)
---
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);
        }


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