*/
EAPI Eina_Bool eolian_function_is_class(const Eolian_Function *function_id);
+/*
+ * @brief Indicates if a function is a constructing function of a given class.
+ *
+ * @param[in] klass the class
+ * @param[in] function_id Id of the function
+ * @return EINA_TRUE and EINA_FALSE respectively
+ *
+ * @ingroup Eolian
+ */
+EAPI Eina_Bool eolian_function_is_constructor(const Eolian_Function *function_id, const Eolian_Class *klass);
+
/*
* @brief Returns a parameter of a function pointed by its id.
*
database_function_del(Eolian_Function *fid)
{
Eolian_Function_Parameter *param;
+ Eina_Stringshare *cls_name;
if (!fid) return;
if (fid->base.file) eina_stringshare_del(fid->base.file);
eina_stringshare_del(fid->name);
EINA_LIST_FREE(fid->keys, param) database_parameter_del(param);
EINA_LIST_FREE(fid->params, param) database_parameter_del(param);
+ EINA_LIST_FREE(fid->ctor_of, cls_name) eina_stringshare_del(cls_name);
database_type_del(fid->get_ret_type);
database_type_del(fid->set_ret_type);
database_expr_del(fid->get_ret_val);
if (fid->set_return_comment) eina_stringshare_del(fid->set_return_comment);
free(fid);
}
+
+static Eina_List*
+_list_sorted_insert_no_dup(Eina_List *l, Eina_Compare_Cb func, const void *data)
+{
+ Eina_List *lnear;
+ int cmp;
+
+ if (!l)
+ return eina_list_append(NULL, data);
+ else
+ lnear = eina_list_search_sorted_near_list(l, func, data, &cmp);
+
+ if (cmp < 0)
+ return eina_list_append_relative_list(l, data, lnear);
+ else if (cmp > 0)
+ return eina_list_prepend_relative_list(l, data, lnear);
+ return l;
+}
+
+void
+database_function_constructor_add(Eolian_Function *func, const Eolian_Class *cls)
+{
+ func->ctor_of = _list_sorted_insert_no_dup
+ (func->ctor_of, EINA_COMPARE_CB(strcmp),
+ eina_stringshare_ref(cls->full_name));
+}
return fid->is_class;
}
+EAPI Eina_Bool
+eolian_function_is_constructor(const Eolian_Function *fid, const Eolian_Class *klass)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(fid, EINA_FALSE);
+ Eina_Stringshare *s = eina_stringshare_ref(klass->full_name);
+ Eina_Bool r = !!eina_list_search_sorted_list
+ (fid->ctor_of, EINA_COMPARE_CB(strcmp), s);
+ eina_stringshare_del(s);
+ return r;
+}
+
EAPI const Eolian_Function_Parameter *
eolian_function_parameter_get_by_name(const Eolian_Function *fid, const char *param_name)
{
if (impl->full_name) eina_stringshare_del(impl->full_name);
free(impl);
}
+
+void
+database_implement_constructor_add(Eolian_Implement *impl, const Eolian_Class *klass)
+{
+ if (eolian_function_is_constructor(impl->foo_id, impl->klass))
+ database_function_constructor_add((Eolian_Function*)impl->foo_id, klass);
+}
ERR("Unable to find function %s", eolian_implement_full_name_get(impl));
goto error;
}
+ else
+ database_implement_constructor_add(impl, class);
}
eina_iterator_free(itr);
itr = eolian_class_constructors_get(class);
ERR("Unable to find function %s", eolian_constructor_full_name_get(ctor));
goto error;
}
+ else
+ database_function_constructor_add((Eolian_Function*)ctor_func, ctor->klass);
}
eina_iterator_free(itr);
Eina_Bool get_only_legacy: 1;
Eina_Bool set_only_legacy: 1;
Eina_Bool is_class :1;
+ Eina_List *ctor_of;
};
struct _Eolian_Function_Parameter
/* functions */
void database_function_del(Eolian_Function *fid);
+void database_function_constructor_add(Eolian_Function *func, const Eolian_Class *klass);
/* func parameters */
void database_parameter_del(Eolian_Function_Parameter *pdesc);
/* implements */
void database_implement_del(Eolian_Implement *impl);
+void database_implement_constructor_add(Eolian_Implement *impl, const Eolian_Class *klass);
/* constructors */
void database_constructor_del(Eolian_Constructor *ctor);