summaryrefslogtreecommitdiff
path: root/src/scripts/elua/apps/gendoc.lua
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2017-02-09 15:58:22 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2017-02-09 15:58:52 +0100
commit5e50c9d52bf65427b48ab572930a1583d3482ddf (patch)
tree3239ee75c85b5183e72814a7d0d8c609aae235df /src/scripts/elua/apps/gendoc.lua
parent051f277be25017142a74befce5ed586df3967598 (diff)
docs: list all existing implements of a method/property
Diffstat (limited to '')
-rw-r--r--src/scripts/elua/apps/gendoc.lua50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index a184853aa0..524583acaf 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -1015,6 +1015,50 @@ local write_inherited_from = function(f, impl, cl, over)
1015 f:write_i(buf:finish()) 1015 f:write_i(buf:finish())
1016end 1016end
1017 1017
1018local impls_of = {}
1019
1020local get_all_impls_of
1021get_all_impls_of = function(tbl, cl, fn)
1022 for i, imp in ipairs(cl:implements_get()) do
1023 local ofn = imp:function_get()
1024 if ofn:is_same(fn) then
1025 tbl[#tbl + 1] = cl
1026 break
1027 end
1028 end
1029 for i, cln in ipairs(cl:children_get()) do
1030 local icl = dtree.Class.by_name_get(cln)
1031 get_all_impls_of(tbl, icl, fn)
1032 end
1033end
1034
1035local write_ilist = function(f, impl, cl)
1036 local fn = impl:function_get()
1037 local fnn = fn:name_get()
1038 local ocl = fn:implement_get():class_get()
1039 local onm = ocl:full_name_get() .. "." .. fnn
1040 local imps = impls_of[onm]
1041 if not imps then
1042 imps = {}
1043 impls_of[onm] = imps
1044 get_all_impls_of(imps, ocl, fn)
1045 end
1046
1047 f:write_h("Implemented by", 2)
1048 local t = {}
1049 for i, icl in ipairs(imps) do
1050 local buf = writer.Buffer()
1051 local cfn = icl:full_name_get() .. "." .. fnn
1052 if icl:is_same(cl) then
1053 buf:write_b(cfn)
1054 else
1055 buf:write_link(fn:nspaces_get(icl, true), cfn)
1056 end
1057 t[#t + 1] = buf:finish()
1058 end
1059 f:write_list(t)
1060end
1061
1018build_method = function(impl, cl) 1062build_method = function(impl, cl)
1019 local over = impl:is_overridden(cl) 1063 local over = impl:is_overridden(cl)
1020 local fn = impl:function_get() 1064 local fn = impl:function_get()
@@ -1051,6 +1095,9 @@ build_method = function(impl, cl)
1051 f:write_editable(mns, "description") 1095 f:write_editable(mns, "description")
1052 f:write_nl() 1096 f:write_nl()
1053 1097
1098 write_ilist(f, impl, cl)
1099 f:write_nl()
1100
1054 f:finish() 1101 f:finish()
1055end 1102end
1056 1103
@@ -1156,6 +1203,9 @@ build_property = function(impl, cl)
1156 f:write_nl() 1203 f:write_nl()
1157 end 1204 end
1158 1205
1206 write_ilist(f, impl, cl)
1207 f:write_nl()
1208
1159 f:finish() 1209 f:finish()
1160end 1210end
1161 1211