summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-04-14 13:44:07 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-05-12 11:59:08 +0100
commitd83c4bc0e7f07d6545fc31af1f2505398cb0d192 (patch)
tree9a28603b5dca5da30fe96ea3a08e7deef0d7e725
parent2d48278c49594a97c6c06cb5b7eeff4ed326bbe4 (diff)
downloadefl-d83c4bc0e7f07d6545fc31af1f2505398cb0d192.tar.gz
docgen: initial support for params and property keys/values
-rw-r--r--gendoc.lua68
1 files changed, 68 insertions, 0 deletions
diff --git a/gendoc.lua b/gendoc.lua
index 7ead430e7e..08afd0b759 100644
--- a/gendoc.lua
+++ b/gendoc.lua
@@ -324,7 +324,14 @@ local Writer = util.Object:clone {
if type(v) == "table" then
lvl, str = v[1] + 1, v[2]
end
+ local pbeg, pend = str:match("([^\n]+)\n(.+)")
+ if not pbeg then
+ pbeg = str
+ end
self:write_raw((" "):rep(lvl), prec, " ", str, "\n")
+ if pend then
+ self:write_raw(pend, "\n")
+ end
end
return self
end,
@@ -782,6 +789,27 @@ local build_classes = function()
end
end
+local pdir_to_str = {
+ [eolian.parameter_dir.IN] = "(in)",
+ [eolian.parameter_dir.OUT] = "(out)",
+ [eolian.parameter_dir.INOUT] = "(inout)"
+}
+
+local build_parlist = function(f, pl, nodir)
+ local params = {}
+ for i, p in ipairs(pl) do
+ local buf = Buffer()
+ buf:write_b(p:name_get())
+ if not nodir then
+ buf:write_raw(" ")
+ buf:write_i(pdir_to_str[p:direction_get()])
+ end
+ buf:write_raw(" - ", get_full_doc(p:documentation_get()))
+ params[#params + 1] = buf:finish()
+ end
+ f:write_list(params)
+end
+
build_method = function(fn, cl)
local f = Writer(gen_nsp_func(fn, cl))
@@ -791,6 +819,9 @@ build_method = function(fn, cl)
f:write_code(gen_func_csig(fn), "c")
f:write_nl()
+ f:write_h("Parameters", 3)
+ build_parlist(f, fn:parameters_get():to_array())
+
f:write_h("Description", 3)
write_full_doc(f, fn:documentation_get(eolian.function_type.METHOD))
@@ -822,6 +853,43 @@ build_property = function(fn, cl)
f:write_code(table.concat(codes, "\n"), "c")
f:write_nl()
+ local pgkeys = isget and fn:property_keys_get(fts.PROP_GET):to_array() or {}
+ local pskeys = isset and fn:property_keys_get(fts.PROP_SET):to_array() or {}
+ local pgvals = isget and fn:property_values_get(fts.PROP_GET):to_array() or {}
+ local psvals = isset and fn:property_values_get(fts.PROP_SET):to_array() or {}
+
+ if #pgkeys > 0 or #pskeys > 0 then
+ f:write_h("Keys", 3)
+ if #pgkeys > 0 then
+ if #pskeys > 0 then
+ f:write_h("Getter", 4)
+ end
+ build_parlist(f, pgkeys, true)
+ end
+ if #pskeys > 0 then
+ if #pgkeys > 0 then
+ f:write_h("Setter", 4)
+ end
+ build_parlist(f, pskeys, true)
+ end
+ end
+
+ if #pgvals > 0 or #psvals > 0 then
+ f:write_h("Values", 3)
+ if #pgvals > 0 then
+ if #psvals > 0 then
+ f:write_h("Getter", 4)
+ end
+ build_parlist(f, pgvals, true)
+ end
+ if #psvals > 0 then
+ if #pgvals > 0 then
+ f:write_h("Setter", 4)
+ end
+ build_parlist(f, psvals, true)
+ end
+ end
+
if isget and isset then
f:write_h("Description", 3)
if doc or (not gdoc and not sdoc) then