neo_doxygen: Read the `prot` attribute of the `innerclass` elements.
[nit.git] / contrib / neo_doxygen / src / doxml / compounddef.nit
index 21d8d3c..5f00313 100644 (file)
@@ -22,8 +22,11 @@ import more_collections
 class CompoundDefListener
        super EntityDefListener
 
+       # The defined compound.
        var compound: Compound is writable, noinit
+
        private var memberdef: MemberDefListener is noinit
+       private var param_listener: TypeParamListener is noinit
 
        # Default attributes for members in the current section.
        private var member_defaults: MemberDefaults is noinit
@@ -44,6 +47,7 @@ class CompoundDefListener
                var defaults = new MemberDefaults("public", false, false)
 
                memberdef = new MemberDefListener(reader, self)
+               param_listener = new TypeParamListener(reader, self)
 
                member_defaults = defaults
                section_kinds = new DefaultMap[String, MemberDefaults](defaults)
@@ -90,16 +94,17 @@ class CompoundDefListener
        redef fun entity: Entity do return compound
 
        redef fun start_dox_element(local_name: String, atts: Attributes) do
-               if ["compoundname", "innerclass", "innernamespace"].has(local_name) then
+               if "compoundname" == local_name then
                        text.listen_until(dox_uri, local_name)
-                       if ["innerclass", "innernamespace"].has(local_name) then
-                               refid = get_required(atts, "refid")
-                       end
-               else if "basecompoundref" == local_name then
-                       refid = get_optional(atts, "refid", "")
+               else if ["innerclass", "innernamespace", "basecompoundref"].has(local_name) then
                        prot = get_optional(atts, "prot", "")
-                       virt = get_optional(atts, "virt", "")
                        text.listen_until(dox_uri, local_name)
+                       if "basecompoundref" == local_name then
+                               refid = get_optional(atts, "refid", "")
+                               virt = get_optional(atts, "virt", "")
+                       else
+                               refid = get_required(atts, "refid")
+                       end
                else if "memberdef" == local_name then
                        read_member(atts)
                else if local_name == "sectiondef" then
@@ -107,18 +112,18 @@ class CompoundDefListener
                        if member_defaults.is_special then
                                super # TODO
                        end
-               else
+               else if "param" == local_name then
+                       param_listener.listen_until(dox_uri, local_name)
+               else if "templateparamlist" != local_name then
                        super
                end
        end
 
        redef fun end_dox_element(local_name: String) do
-               if local_name == "compounddef" then
-                       compound.put_in_graph
-               else if local_name == "compoundname" then
+               if local_name == "compoundname" then
                        compound.full_name = text.to_s
                else if local_name == "innerclass" then
-                       compound.declare_class(refid, text.to_s)
+                       compound.declare_class(refid, text.to_s, prot)
                else if local_name == "innernamespace" then
                        compound.declare_namespace(refid, text.to_s)
                else if "memberdef" == local_name then
@@ -127,6 +132,8 @@ class CompoundDefListener
                        end
                else if local_name == "basecompoundref" then
                        compound.declare_super(refid, text.to_s, prot, virt)
+               else if "param" == local_name and compound isa ClassCompound then
+                       compound.as(ClassCompound).add_type_parameter(param_listener.parameter)
                else
                        super
                end