diff --git a/src/lib/eolian/Eolian.h b/src/lib/eolian/Eolian.h index 970cc4c728..f92830e64f 100644 --- a/src/lib/eolian/Eolian.h +++ b/src/lib/eolian/Eolian.h @@ -1883,6 +1883,26 @@ EAPI const Eolian_Documentation *eolian_parameter_documentation_get(const Eolian */ EAPI Eina_Bool eolian_parameter_is_optional(const Eolian_Function_Parameter *param_desc); +/* + * @brief Get whether a parameter is by reference. + * + * @param[in] param_desc parameter handle + * @return EINA_TRUE and EINA_FALSE respectively + * + * @ingroup Eolian + */ +EAPI Eina_Bool eolian_parameter_is_by_ref(const Eolian_Function_Parameter *param_desc); + +/* + * @brief Get whether a parameter is moved into the callee. + * + * @param[in] param_desc parameter handle + * @return EINA_TRUE and EINA_FALSE respectively + * + * @ingroup Eolian + */ +EAPI Eina_Bool eolian_parameter_is_move(const Eolian_Function_Parameter *param_desc); + /* * @brief Get the return type of a function. * @@ -1949,6 +1969,38 @@ EAPI const Eolian_Documentation *eolian_function_return_documentation_get(const */ EAPI Eina_Bool eolian_function_return_allow_unused(const Eolian_Function *foo_id, Eolian_Function_Type ftype); +/* + * @brief Get whether a parameter is by reference. + * + * @param[in] function_id id of the function + * @param[in] ftype type of the function + * @return EINA_TRUE and EINA_FALSE respectively + * + * The type of the function is needed because a given function can represent a + * property, that can be set and get functions. + * + * Acceptable input types are METHOD, PROP_GET and PROP_SET. + * + * @ingroup Eolian + */ +EAPI Eina_Bool eolian_function_return_is_by_ref(const Eolian_Function *foo_id, Eolian_Function_Type ftype); + +/* + * @brief Get whether a parameter is moved into the callee. + * + * @param[in] function_id id of the function + * @param[in] ftype type of the function + * @return EINA_TRUE and EINA_FALSE respectively + * + * The type of the function is needed because a given function can represent a + * property, that can be set and get functions. + * + * Acceptable input types are METHOD, PROP_GET and PROP_SET. + * + * @ingroup Eolian + */ +EAPI Eina_Bool eolian_function_return_is_move(const Eolian_Function *foo_id, Eolian_Function_Type ftype); + /* * @brief Indicates if a function object is const. * @@ -2502,6 +2554,26 @@ EAPI const Eolian_Documentation *eolian_typedecl_struct_field_documentation_get( */ EAPI const Eolian_Type *eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl); +/* + * @brief Get whether a struct field is by reference. + * + * @param[in] fl the field. + * @return EINA_TRUE and EINA_FALSE respectively + * + * @ingroup Eolian + */ +EAPI Eina_Bool eolian_typedecl_struct_field_is_by_ref(const Eolian_Struct_Type_Field *fl); + +/* + * @brief Get whether a struct field is moved with the struct. + * + * @param[in] fl the field. + * @return EINA_TRUE and EINA_FALSE respectively + * + * @ingroup Eolian + */ +EAPI Eina_Bool eolian_typedecl_struct_field_is_move(const Eolian_Struct_Type_Field *fl); + /* * @brief Get an iterator to all fields of an enum type. * diff --git a/src/lib/eolian/database_function_api.c b/src/lib/eolian/database_function_api.c index 104ac6e829..dfe66a9490 100644 --- a/src/lib/eolian/database_function_api.c +++ b/src/lib/eolian/database_function_api.c @@ -286,6 +286,58 @@ eolian_function_return_allow_unused(const Eolian_Function *fid, } } +EAPI Eina_Bool +eolian_function_return_is_by_ref(const Eolian_Function *fid, + Eolian_Function_Type ftype) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE); + EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, EINA_FALSE); + EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, EINA_FALSE); + switch (ftype) + { + case EOLIAN_METHOD: + if (fid->type != EOLIAN_METHOD) + return EINA_FALSE; + return fid->get_return_by_ref; + case EOLIAN_PROP_GET: + if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY)) + return EINA_FALSE; + return !fid->get_return_by_ref; + case EOLIAN_PROP_SET: + if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY)) + return EINA_FALSE; + return !fid->set_return_by_ref; + default: + return EINA_FALSE; + } +} + +EAPI Eina_Bool +eolian_function_return_is_move(const Eolian_Function *fid, + Eolian_Function_Type ftype) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE); + EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_UNRESOLVED, EINA_FALSE); + EINA_SAFETY_ON_FALSE_RETURN_VAL(ftype != EOLIAN_PROPERTY, EINA_FALSE); + switch (ftype) + { + case EOLIAN_METHOD: + if (fid->type != EOLIAN_METHOD) + return EINA_FALSE; + return fid->get_return_move; + case EOLIAN_PROP_GET: + if ((fid->type != EOLIAN_PROP_GET) && (fid->type != EOLIAN_PROPERTY)) + return EINA_FALSE; + return !fid->get_return_move; + case EOLIAN_PROP_SET: + if ((fid->type != EOLIAN_PROP_SET) && (fid->type != EOLIAN_PROPERTY)) + return EINA_FALSE; + return !fid->set_return_move; + default: + return EINA_FALSE; + } +} + EAPI Eina_Bool eolian_function_object_is_const(const Eolian_Function *fid) { diff --git a/src/lib/eolian/database_function_parameter_api.c b/src/lib/eolian/database_function_parameter_api.c index 6b1f6a7201..60673a55ff 100644 --- a/src/lib/eolian/database_function_parameter_api.c +++ b/src/lib/eolian/database_function_parameter_api.c @@ -39,3 +39,17 @@ eolian_parameter_is_optional(const Eolian_Function_Parameter *param) EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE); return param->optional; } + +EAPI Eina_Bool +eolian_parameter_is_move(const Eolian_Function_Parameter *param) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE); + return param->move; +} + +EAPI Eina_Bool +eolian_parameter_is_by_ref(const Eolian_Function_Parameter *param) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE); + return param->by_ref; +} diff --git a/src/lib/eolian/database_type_api.c b/src/lib/eolian/database_type_api.c index 527afc5171..39ba042a2b 100644 --- a/src/lib/eolian/database_type_api.c +++ b/src/lib/eolian/database_type_api.c @@ -63,6 +63,20 @@ eolian_typedecl_struct_field_type_get(const Eolian_Struct_Type_Field *fl) return fl->type; } +EAPI Eina_Bool +eolian_typedecl_struct_field_is_by_ref(const Eolian_Struct_Type_Field *fl) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(fl, EINA_FALSE); + return fl->by_ref; +} + +EAPI Eina_Bool +eolian_typedecl_struct_field_is_move(const Eolian_Struct_Type_Field *fl) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(fl, EINA_FALSE); + return fl->move; +} + EAPI Eina_Iterator * eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp) {