From 6421ea6d3ca397c18b1eea5130a1c0b3fad96a86 Mon Sep 17 00:00:00 2001 From: Dave Andreoli Date: Thu, 4 Jan 2018 11:04:50 +0100 Subject: [PATCH] doc generator: show params and return type for functions --- src/scripts/gendoc/doc_macros.include | 122 +++++++++++++++++++++++--- src/scripts/pyolian/eolian.py | 29 +++--- 2 files changed, 124 insertions(+), 27 deletions(-) diff --git a/src/scripts/gendoc/doc_macros.include b/src/scripts/gendoc/doc_macros.include index ac01b99722..577052ef64 100644 --- a/src/scripts/gendoc/doc_macros.include +++ b/src/scripts/gendoc/doc_macros.include @@ -2,7 +2,9 @@ #!#### BEST_SUMMARY(obj) ##################################################### #!############################################################################## - + +${UNTOKENIZE(tokens=obj.summary_tokens)}$#! + ${UNTOKENIZE(tokens=obj.documentation_get(obj.function.type).summary_tokens)}$#! @@ -14,7 +16,7 @@ ${UNTOKENIZE(tokens=parent_impl.documentation_get(parent_impl.function.type).sum - + ${UNTOKENIZE(tokens=obj.documentation.summary_tokens)}$#! **MISSING DOCS !!!!!**#! @@ -24,7 +26,9 @@ ${UNTOKENIZE(tokens=obj.documentation.summary_tokens)}$#! #!#### BEST_DESCRIPTION(obj) ################################################# #!############################################################################## - + +${UNTOKENIZE(tokens=obj.description_tokens)}$#! + ${UNTOKENIZE(tokens=obj.documentation_get(obj.function.type).description_tokens)}$#! @@ -36,7 +40,7 @@ ${UNTOKENIZE(tokens=parent_impl.documentation_get(parent_impl.function.type).des - + ${UNTOKENIZE(tokens=obj.documentation.description_tokens)}$#! **MISSING DOCS !!!!!**#! @@ -46,7 +50,21 @@ ${UNTOKENIZE(tokens=obj.documentation.description_tokens)}$#! #!#### BEST_SINCE(obj) ####################################################### #!############################################################################## - + +//Since ${obj.since}$// + + +//Since ${obj.documentation_get(obj.function.type).since}$// + + + + +//Since ${parent_impl.documentation_get(parent_impl.function.type).since}$// + + + + + //Since ${obj.documentation.since}$// @@ -203,6 +221,74 @@ interface#! #!############################################################################## +#!#### IMPLEMENT_TAGS(impl) ################################################## +#!############################################################################## + + + ''rw'' #! + + ''read only'' #! + + ''write only'' #! + + +#!############################################################################## +#!#### PARAM_DIRECTION_TAG(param) ############################################ +#!############################################################################## + + + ''in'' #! + + ''out'' #! + + ''inout'' #! + + +#!############################################################################## +#!#### METHOD_PARAMS(func) ################################################### +#!############################################################################## + + + + +^ parameters ^ type ^ description ^ + +|${PARAM_DIRECTION_TAG(param=par)}$ **${par.name}$**|${par.type.full_name}$ #! +|${BEST_SUMMARY(obj=par)}$ ${BEST_DESCRIPTION(obj=par)}$| + +**This function do not accept any parameter.** + + + +${setvar("obj", "func.return_documentation(Eolian_Function_Type.METHOD)")}$#! +^ return ^ description ^ +|**${func.method_return_type.full_name}$**|${BEST_SUMMARY(obj=obj)}$ ${BEST_DESCRIPTION(obj=obj)}$| + +**This function do not return anything.** + + + +#!############################################################################## +#!#### PROPERTY_PARAMS(func) ################################################# +#!############################################################################## + + + + +^ values ^ type ^ description ^ + +|**${val.name}$**|${val.type.full_name}$|${BEST_SUMMARY(obj=val)}$| + + + + +^ keys ^ type ^ description ^ + +|**${key.name}$**|${key.type.full_name}$|${BEST_SUMMARY(obj=key)}$| + + + +#!############################################################################## #!#### IMPLEMENT_FULL(impl, cls) ############################################# #!############################################################################## @@ -218,14 +304,9 @@ ${', ' if i else ''}$#! //${param.type.name}$// ''${param.direction.name.lower()}$'' **${param.name}$**#! -)#! - - ''rw'' #! - - ''read only'' #! - - ''write only'' #! - +) #! +${IMPLEMENT_TAGS}$ #! + => //${impl.function.method_return_type.name}$// #! @@ -237,7 +318,20 @@ ${FUNC_SCOPE(func=impl.function)}$#! //[Overridden from ${CLS_LINK(cls=impl.class_)}$]// #! \\ -> ${BEST_SUMMARY(obj=impl)}$ + +> ${BEST_SUMMARY(obj=impl)}$ ${BEST_SINCE(obj=impl)}$ + +++++ more... | + +${BEST_DESCRIPTION(obj=impl)}$ + + +${METHOD_PARAMS(func=impl.function)}$ + +${PROPERTY_PARAMS(func=impl.function)}$ + +++++ + #!############################################################################## #!#### OBJECT_STATIC_CONTENT(obj, section) ################################### diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py index 1b43d5e737..70c0d37565 100644 --- a/src/scripts/pyolian/eolian.py +++ b/src/scripts/pyolian/eolian.py @@ -826,18 +826,30 @@ class Function(EolianBaseObject): return Iterator(Function_Parameter, lib.eolian_function_parameters_get(self._obj)) - def values_get(self, ftype): + def values_get(self, ftype): # TODO rename in property_values_get (or implement a proper Property class?) return Iterator(Function_Parameter, lib.eolian_property_values_get(self._obj, ftype)) @property - def getter_values(self): + def getter_values(self): # TODO rename ... return self.values_get(Eolian_Function_Type.PROP_GET) @property - def setter_values(self): + def setter_values(self): # TODO rename ... return self.values_get(Eolian_Function_Type.PROP_SET) + def keys_get(self, ftype): # TODO rename in property_keys_get (or implement a proper Property class?) + return Iterator(Function_Parameter, + lib.eolian_property_keys_get(self._obj, ftype)) + + @property + def getter_keys(self): # TODO rename ... + return self.keys_get(Eolian_Function_Type.PROP_GET) + + @property + def setter_keys(self): # TODO rename ... + return self.keys_get(Eolian_Function_Type.PROP_SET) + def return_type_get(self, ftype): c_type = lib.eolian_function_return_type_get(self._obj, ftype) return Type(c_type) if c_type else None @@ -845,7 +857,7 @@ class Function(EolianBaseObject): def return_default_value(self, ftye): c_expr = lib.eolian_function_return_default_value_get(sel._obj, ftype) return Expression(c_expr) if c_expr else None - + def return_documentation(self, ftype): c_doc = lib.eolian_function_return_documentation_get(self._obj, ftype) return Documentation(c_doc) if c_doc else None @@ -894,15 +906,6 @@ class Function_Parameter(EolianBaseObject): def name(self): return _str_to_py(lib.eolian_parameter_name_get(self._obj)) - # @property - # def name_fixed(self): - # name = _str_to_py(lib.eolian_parameter_name_get(self._obj)) - # if name in PY_KW: - # return name + '_' - # return name - - # name = name_fixed - @property def direction(self): return Eolian_Parameter_Dir(lib.eolian_parameter_direction_get(self._obj))