docs: add method to get parameter's direction name
authorDaniel Kolesa <d.kolesa@osg.samsung.com>
Mon, 15 Aug 2016 13:18:20 +0000 (14:18 +0100)
committerDaniel Kolesa <d.kolesa@osg.samsung.com>
Mon, 15 Aug 2016 13:18:36 +0000 (14:18 +0100)
src/scripts/elua/apps/docgen/doctree.lua
src/scripts/elua/apps/docgen/mappings.lua
src/scripts/elua/apps/gendoc.lua

index 8bab6cc..0b686d6 100644 (file)
@@ -412,6 +412,15 @@ M.Parameter = Node:clone {
         return self.param:direction_get()
     end,
 
+    direction_name_get = function(self)
+        local dir_to_str = {
+            [self.IN] = "in",
+            [self.OUT] = "out",
+            [self.INOUT] = "inout"
+        }
+        return dir_to_str[self:direction_get()]
+    end,
+
     type_get = function(self)
         return self.param:type_get()
     end,
index 00f2c44..a319789 100644 (file)
@@ -3,18 +3,6 @@ local dtree = require("docgen.doctree")
 
 local M = {}
 
-M.pdir_to_str = {
-    [dtree.Parameter.IN] = "(in)",
-    [dtree.Parameter.OUT] = "(out)",
-    [dtree.Parameter.INOUT] = "(inout)"
-}
-
-M.scope_to_str = {
-    [dtree.Node.scope.PUBLIC] = "public",
-    [dtree.Node.scope.PRIVATE] = "private",
-    [dtree.Node.scope.PROTECTED] = "protected"
-}
-
 local decl_to_nspace = function(decl)
     local dt = eolian.declaration_type
     local decltypes = {
index dd3ccc2..657e067 100644 (file)
@@ -864,7 +864,7 @@ local build_parlist = function(f, pl, nodir)
         buf:write_b(p:name_get())
         if not nodir then
             buf:write_raw(" ")
-            buf:write_i(eomap.pdir_to_str[p:direction_get()])
+            buf:write_i("(", p:direction_name_get(), ")")
         end
         buf:write_raw(" - ", p:doc_get():full_get())
         params[#params + 1] = buf:finish()