neo_doxygen: Document the actual logic for relationships between compounds.
authorJean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Mon, 24 Nov 2014 19:27:12 +0000 (14:27 -0500)
committerJean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>
Tue, 25 Nov 2014 17:01:05 +0000 (12:01 -0500)
Signed-off-by: Jean-Christophe Beaupré <jcbrinfo@users.noreply.github.com>

contrib/neo_doxygen/src/model/class_compound.nit
contrib/neo_doxygen/src/model/graph.nit
contrib/neo_doxygen/src/model/module_compound.nit

index 7663c0a..47a95f9 100644 (file)
@@ -72,8 +72,8 @@ class ClassCompound
                class_def["mdoc"] = doc
        end
 
-       redef fun declare_super(id: String, name: String, prot: String, virt: String) do
-               class_def.declare_super(id, name, prot, virt)
+       redef fun declare_super(id: String, full_name: String, prot: String, virt: String) do
+               class_def.declare_super(id, full_name, prot, virt)
        end
 
        redef fun declare_member(member: Member) do
@@ -119,8 +119,9 @@ class ClassDef
                self["is_intro"] = true
        end
 
-       fun declare_super(id: String, name: String, prot: String, virt: String) do
-               # TODO prot, virt, name
+       fun declare_super(id: String, full_name: String, prot: String,
+                       virt: String) do
+               # TODO prot, virt, full_name
                if "" != id then
                        supers.add(id)
                end
index 7607620..ffd4eec 100644 (file)
@@ -205,29 +205,37 @@ abstract class Compound
 
        # Declare an inner namespace.
        #
+       # Note: Althought Doxygen indicates that the name is optional,
+       # declarations with an empty name are not supported yet.
+       #
        # Parameters:
        #
        # * `id`: `model_id` of the inner namespace. May be empty.
-       # * `name`: string identifying the inner namespace. May be empty.
-       fun declare_namespace(id: String, name: String) do end
+       # * `full_name`: qualified name of the inner namespace.
+       fun declare_namespace(id: String, full_name: String) do end
 
        # Declare an inner class.
        #
+       # Note: Althought Doxygen indicates that both arguments are optional,
+       # declarations with either an empty name or an empty ID are not
+       # supported yet.
+       #
        # Parameters:
        #
-       # * `id`: `model_id` of the inner class. May be empty.
-       # * `name`: string identifying the inner class. May be empty.
-       fun declare_class(id: String, name: String) do end
+       # * `id`: `model_id` of the inner class.
+       # * `full_name`: qualified name of the inner class.
+       fun declare_class(id: String, full_name: String) do end
 
        # Declare a base compound (usually, a base class).
        #
        # Parameters:
        #
        # * `id`: `model_id` of the base compound. May be empty.
-       # * `name`: string identifying the base compound. May be empty.
+       # * `full_name`: qualified name of the base compound. May be empty.
        # * `prot`: visibility (proctection) of the relationship.
        # * `virt`: level of virtuality of the relationship.
-       fun declare_super(id: String, name: String, prot: String, virt: String) do end
+       fun declare_super(id: String, full_name: String, prot: String,
+                       virt: String) do end
 end
 
 # An unrecognized compound.
index 6629cc7..6cdd20e 100644 (file)
@@ -65,30 +65,39 @@ class FileCompound
                end
        end
 
-       redef fun declare_namespace(id: String, name: String) do
+       redef fun declare_namespace(id: String, full_name: String) do
                var m: Module
 
-               if inner_namespaces.keys.has(name) then
-                       m = inner_namespaces[name]
+               assert not full_name.is_empty else
+                       sys.stderr.write "Inner mamespace declarations without name are not yet supported.\n"
+               end
+               if inner_namespaces.keys.has(full_name) then
+                       m = inner_namespaces[full_name]
                        if id != "" then m.parent = id
                else
                        m = new Module(graph)
-                       m.full_name = "{name}{ns_separator}{basename}"
+                       m.full_name = "{full_name}{ns_separator}{basename}"
                        m.parent = id
                        m.location = self["location"].as(nullable Location)
-                       inner_namespaces[name] = m
+                       inner_namespaces[full_name] = m
                end
        end
 
-       redef fun declare_class(id: String, name: String) do
-               var match = name.search_last(ns_separator)
+       redef fun declare_class(id: String, full_name: String) do
+               assert not id.is_empty else
+                       sys.stderr.write "Inner class declarations without ID are not yet supported.\n"
+               end
+               assert not full_name.is_empty else
+                       sys.stderr.write "Inner class declarations without name are not yet supported.\n"
+               end
+               var match = full_name.search_last(ns_separator)
                var ns_name: String
                var m: Module
 
                if match == null then
                        ns_name = ""
                else
-                       ns_name = name.substring(0, match.from)
+                       ns_name = full_name.substring(0, match.from)
                end
                if inner_namespaces.keys.has(ns_name) then
                        m = inner_namespaces[ns_name]
@@ -96,7 +105,7 @@ class FileCompound
                        declare_namespace("", ns_name)
                        m = inner_namespaces[ns_name]
                end
-               m.declare_class(id, name)
+               m.declare_class(id, full_name)
        end
 
        redef fun put_in_graph do
@@ -124,7 +133,10 @@ class Module
                self.labels.add("MModule")
        end
 
-       redef fun declare_class(id: String, name: String) do
+       redef fun declare_class(id: String, full_name: String) do
+               assert not id.is_empty else
+                       sys.stderr.write "Inner class declarations without ID not supported yet.\n"
+               end
                inner_classes.add(id)
        end