2014-09-23 12:48:16 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-07-10 05:13:46 -07:00
|
|
|
#include <Eina.h>
|
|
|
|
#include "eolian_database.h"
|
2017-10-30 22:20:09 -07:00
|
|
|
#include "eolian_priv.h"
|
2014-07-10 05:13:46 -07:00
|
|
|
|
|
|
|
EAPI Eolian_Class_Type
|
|
|
|
eolian_class_type_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EOLIAN_CLASS_UNKNOWN_TYPE);
|
|
|
|
return cl->type;
|
|
|
|
}
|
|
|
|
|
2015-06-03 08:16:53 -07:00
|
|
|
EAPI const Eolian_Documentation *
|
|
|
|
eolian_class_documentation_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
|
|
|
return cl->doc;
|
|
|
|
}
|
|
|
|
|
2014-07-10 06:04:13 -07:00
|
|
|
EAPI Eina_Stringshare*
|
2014-07-10 05:13:46 -07:00
|
|
|
eolian_class_legacy_prefix_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
|
|
|
return cl->legacy_prefix;
|
|
|
|
}
|
|
|
|
|
2014-07-10 06:04:13 -07:00
|
|
|
EAPI Eina_Stringshare*
|
2014-07-10 05:13:46 -07:00
|
|
|
eolian_class_eo_prefix_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
|
|
|
return cl->eo_prefix;
|
|
|
|
}
|
|
|
|
|
2016-05-17 09:14:47 -07:00
|
|
|
EAPI Eina_Stringshare*
|
|
|
|
eolian_class_event_prefix_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
|
|
|
return cl->ev_prefix;
|
|
|
|
}
|
|
|
|
|
2014-07-10 06:04:13 -07:00
|
|
|
EAPI Eina_Stringshare*
|
2014-07-10 05:13:46 -07:00
|
|
|
eolian_class_data_type_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
|
|
|
return cl->data_type;
|
|
|
|
}
|
|
|
|
|
2014-07-23 00:24:59 -07:00
|
|
|
EAPI Eina_Iterator *
|
2014-07-23 06:13:21 -07:00
|
|
|
eolian_class_inherits_get(const Eolian_Class *cl)
|
2014-07-10 05:13:46 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
2014-07-23 05:44:42 -07:00
|
|
|
return (cl->inherits ? eina_list_iterator_new(cl->inherits) : NULL);
|
2014-07-10 05:13:46 -07:00
|
|
|
}
|
|
|
|
|
2014-09-01 07:35:50 -07:00
|
|
|
EAPI Eina_Iterator *
|
2014-07-23 06:13:21 -07:00
|
|
|
eolian_class_implements_get(const Eolian_Class *cl)
|
2014-07-10 05:13:46 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
2014-07-23 05:44:42 -07:00
|
|
|
return (cl->implements ? eina_list_iterator_new(cl->implements) : NULL);
|
2014-07-10 05:13:46 -07:00
|
|
|
}
|
|
|
|
|
2014-09-01 07:35:50 -07:00
|
|
|
EAPI Eina_Iterator *
|
|
|
|
eolian_class_constructors_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
|
|
|
return (cl->constructors ? eina_list_iterator_new(cl->constructors) : NULL);
|
|
|
|
}
|
|
|
|
|
2014-07-10 05:13:46 -07:00
|
|
|
EAPI const Eolian_Function *
|
2018-03-16 06:25:44 -07:00
|
|
|
eolian_class_function_by_name_get(const Eolian_Class *cl, const char *func_name, Eolian_Function_Type f_type)
|
2014-07-10 05:13:46 -07:00
|
|
|
{
|
|
|
|
Eina_List *itr;
|
|
|
|
Eolian_Function *fid;
|
|
|
|
if (!cl) return NULL;
|
|
|
|
|
|
|
|
if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_METHOD)
|
|
|
|
EINA_LIST_FOREACH(cl->methods, itr, fid)
|
|
|
|
{
|
2018-03-08 10:30:40 -08:00
|
|
|
if (!strcmp(fid->base.name, func_name))
|
2014-07-10 05:13:46 -07:00
|
|
|
return fid;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (f_type == EOLIAN_UNRESOLVED || f_type == EOLIAN_PROPERTY ||
|
|
|
|
f_type == EOLIAN_PROP_SET || f_type == EOLIAN_PROP_GET)
|
|
|
|
{
|
|
|
|
EINA_LIST_FOREACH(cl->properties, itr, fid)
|
|
|
|
{
|
2017-01-12 07:56:49 -08:00
|
|
|
if (!database_function_is_type(fid, f_type))
|
|
|
|
continue;
|
2018-03-08 10:30:40 -08:00
|
|
|
if (!strcmp(fid->base.name, func_name))
|
2014-07-10 05:13:46 -07:00
|
|
|
return fid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-20 09:05:22 -07:00
|
|
|
eolian_state_log(cl->base.unit->state, "function '%s' not found in class '%s'",
|
|
|
|
func_name, eolian_object_short_name_get(&cl->base));
|
2014-07-10 05:13:46 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-07-23 00:24:59 -07:00
|
|
|
EAPI Eina_Iterator *
|
2014-07-23 06:13:21 -07:00
|
|
|
eolian_class_functions_get(const Eolian_Class *cl, Eolian_Function_Type foo_type)
|
2014-07-10 05:13:46 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
|
|
|
switch (foo_type)
|
|
|
|
{
|
|
|
|
case EOLIAN_PROPERTY:
|
2014-07-23 05:44:42 -07:00
|
|
|
return (cl->properties ? eina_list_iterator_new(cl->properties) : NULL);
|
2014-07-10 05:13:46 -07:00
|
|
|
case EOLIAN_METHOD:
|
2014-07-23 05:44:42 -07:00
|
|
|
return (cl->methods ? eina_list_iterator_new(cl->methods) : NULL);
|
2014-07-10 05:13:46 -07:00
|
|
|
default: return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-23 00:24:59 -07:00
|
|
|
EAPI Eina_Iterator *
|
2014-07-23 06:13:21 -07:00
|
|
|
eolian_class_events_get(const Eolian_Class *cl)
|
2014-07-10 05:13:46 -07:00
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
2014-07-23 05:44:42 -07:00
|
|
|
return (cl->events ? eina_list_iterator_new(cl->events) : NULL);
|
2014-07-10 05:13:46 -07:00
|
|
|
}
|
|
|
|
|
2017-11-22 21:49:49 -08:00
|
|
|
EAPI Eina_Iterator *
|
|
|
|
eolian_class_parts_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
|
|
|
return (cl->parts ? eina_list_iterator_new(cl->parts) : NULL);
|
|
|
|
}
|
|
|
|
|
2014-07-10 05:13:46 -07:00
|
|
|
EAPI Eina_Bool
|
|
|
|
eolian_class_ctor_enable_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
|
|
|
|
return cl->class_ctor_enable;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
eolian_class_dtor_enable_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, EINA_FALSE);
|
|
|
|
return cl->class_dtor_enable;
|
|
|
|
}
|
2014-10-02 03:00:06 -07:00
|
|
|
|
|
|
|
EAPI Eina_Stringshare *
|
|
|
|
eolian_class_c_get_function_name_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
|
|
|
Eina_Stringshare *ret;
|
|
|
|
Eina_Strbuf *buf = eina_strbuf_new();
|
|
|
|
char *bufp;
|
2018-03-08 10:30:40 -08:00
|
|
|
eina_strbuf_append(buf, cl->base.name);
|
2014-10-02 03:00:06 -07:00
|
|
|
switch (cl->type)
|
|
|
|
{
|
|
|
|
case EOLIAN_CLASS_INTERFACE:
|
|
|
|
eina_strbuf_append(buf, "_interface_get");
|
|
|
|
break;
|
|
|
|
case EOLIAN_CLASS_MIXIN:
|
|
|
|
eina_strbuf_append(buf, "_mixin_get");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
eina_strbuf_append(buf, "_class_get");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
eina_strbuf_replace_all(buf, ".", "_");
|
|
|
|
bufp = eina_strbuf_string_steal(buf);
|
|
|
|
eina_str_tolower(&bufp);
|
|
|
|
ret = eina_stringshare_add(bufp);
|
|
|
|
free(bufp);
|
2014-10-03 01:26:27 -07:00
|
|
|
eina_strbuf_free(buf);
|
2014-10-02 03:00:06 -07:00
|
|
|
return ret;
|
|
|
|
}
|
2016-10-12 05:56:22 -07:00
|
|
|
|
|
|
|
EAPI Eina_Stringshare *
|
|
|
|
eolian_class_c_name_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
|
|
|
Eina_Stringshare *ret;
|
|
|
|
Eina_Strbuf *buf = eina_strbuf_new();
|
|
|
|
char *bufp;
|
2018-03-08 10:30:40 -08:00
|
|
|
eina_strbuf_append(buf, cl->base.name);
|
2016-10-12 05:56:22 -07:00
|
|
|
switch (cl->type)
|
|
|
|
{
|
|
|
|
case EOLIAN_CLASS_INTERFACE:
|
|
|
|
eina_strbuf_append(buf, "_INTERFACE");
|
|
|
|
break;
|
|
|
|
case EOLIAN_CLASS_MIXIN:
|
|
|
|
eina_strbuf_append(buf, "_MIXIN");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
eina_strbuf_append(buf, "_CLASS");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
eina_strbuf_replace_all(buf, ".", "_");
|
|
|
|
bufp = eina_strbuf_string_steal(buf);
|
|
|
|
eina_str_toupper(&bufp);
|
|
|
|
ret = eina_stringshare_add(bufp);
|
|
|
|
free(bufp);
|
|
|
|
eina_strbuf_free(buf);
|
|
|
|
return ret;
|
|
|
|
}
|
2016-10-13 05:54:12 -07:00
|
|
|
|
|
|
|
EAPI Eina_Stringshare *
|
|
|
|
eolian_class_c_data_type_get(const Eolian_Class *cl)
|
|
|
|
{
|
|
|
|
char buf[512];
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(cl, NULL);
|
|
|
|
if (!cl->data_type)
|
2018-03-08 10:30:40 -08:00
|
|
|
snprintf(buf, sizeof(buf), "%s_Data", cl->base.name);
|
2016-10-13 05:54:12 -07:00
|
|
|
else if (!strcmp(cl->data_type, "null"))
|
|
|
|
return eina_stringshare_add("void");
|
|
|
|
else
|
|
|
|
snprintf(buf, sizeof(buf), "%s", cl->data_type);
|
|
|
|
for (char *p = strchr(buf, '.'); p; p = strchr(p, '.'))
|
|
|
|
*p = '_';
|
|
|
|
return eina_stringshare_add(buf);
|
|
|
|
}
|