forked from enlightenment/efl
eolian: expose short_name/namespaces via object
This commit is contained in:
parent
569a27d787
commit
0f0009cb4f
|
@ -569,11 +569,41 @@ EAPI int eolian_object_column_get(const Eolian_Object *obj);
|
|||
* @see eolian_object_file_get
|
||||
* @see eolian_object_line_get
|
||||
* @see eolian_object_column_get
|
||||
* @see eolian_object_short_name_get
|
||||
* @see eolian_object_namespaces_get
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI const char *eolian_object_name_get(const Eolian_Object *obj);
|
||||
|
||||
/*
|
||||
* @brief Get the short name of an object.
|
||||
*
|
||||
* This means a name without namespaces. If the object's name is not
|
||||
* namespaced in the first place, this is equivalent to getting the full name.
|
||||
* So for `Foo.Bar.baz` this is `baz`, for `foo` it's again just `foo`.
|
||||
*
|
||||
* @see eolian_object_name_get
|
||||
* @see eolian_object_namespaces_get
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI const char *eolian_object_short_name_get(const Eolian_Object *obj);
|
||||
|
||||
/*
|
||||
* @brief Get a list of namespaces for the object.
|
||||
*
|
||||
* Each item of the iterator is the next more inner namespace. So for
|
||||
* example if the full name is `Foo.Bar.baz`, the iterator will first
|
||||
* give you `Foo` and then `Bar`.
|
||||
*
|
||||
* @see eolian_object_name_get
|
||||
* @see eolian_object_short_name_get
|
||||
*
|
||||
* @ingroup Eolian
|
||||
*/
|
||||
EAPI Eina_Iterator *eolian_object_namespaces_get(const Eolian_Object *obj);
|
||||
|
||||
/*
|
||||
* @brief Scan the given directory for .eo and .eot files.
|
||||
*
|
||||
|
|
|
@ -15,13 +15,13 @@ eolian_class_full_name_get(const Eolian_Class *cl)
|
|||
EAPI Eina_Stringshare *
|
||||
eolian_class_name_get(const Eolian_Class *cl)
|
||||
{
|
||||
return database_object_short_name_get((const Eolian_Object *)cl);
|
||||
return eolian_object_short_name_get((const Eolian_Object *)cl);
|
||||
}
|
||||
|
||||
EAPI Eina_Iterator *
|
||||
eolian_class_namespaces_get(const Eolian_Class *cl)
|
||||
{
|
||||
return database_object_namespaces_get((const Eolian_Object *)cl);
|
||||
return eolian_object_namespaces_get((const Eolian_Object *)cl);
|
||||
}
|
||||
|
||||
EAPI Eolian_Class_Type
|
||||
|
@ -114,7 +114,7 @@ eolian_class_function_get_by_name(const Eolian_Class *cl, const char *func_name,
|
|||
}
|
||||
|
||||
_eolian_log("function '%s' not found in class '%s'", func_name,
|
||||
database_object_short_name_get(&cl->base));
|
||||
eolian_object_short_name_get(&cl->base));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,14 +97,14 @@ _buf_add_suffix(Eina_Strbuf *buf, const char *suffix)
|
|||
static void
|
||||
_append_name(const Eolian_Object *obj, Eina_Strbuf *buf)
|
||||
{
|
||||
Eina_Iterator *itr = database_object_namespaces_get(obj);
|
||||
Eina_Iterator *itr = eolian_object_namespaces_get(obj);
|
||||
const char *sp;
|
||||
EINA_ITERATOR_FOREACH(itr, sp)
|
||||
{
|
||||
eina_strbuf_append(buf, sp);
|
||||
eina_strbuf_append_char(buf, '_');
|
||||
}
|
||||
eina_strbuf_append(buf, database_object_short_name_get(obj));
|
||||
eina_strbuf_append(buf, eolian_object_short_name_get(obj));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -268,13 +268,13 @@ eolian_typedecl_c_type_get(const Eolian_Typedecl *tp)
|
|||
EAPI Eina_Stringshare *
|
||||
eolian_type_name_get(const Eolian_Type *tp)
|
||||
{
|
||||
return database_object_short_name_get((const Eolian_Object *)tp);
|
||||
return eolian_object_short_name_get((const Eolian_Object *)tp);
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
eolian_typedecl_name_get(const Eolian_Typedecl *tp)
|
||||
{
|
||||
return database_object_short_name_get((const Eolian_Object *)tp);
|
||||
return eolian_object_short_name_get((const Eolian_Object *)tp);
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
|
@ -294,13 +294,13 @@ eolian_typedecl_full_name_get(const Eolian_Typedecl *tp)
|
|||
EAPI Eina_Iterator *
|
||||
eolian_type_namespaces_get(const Eolian_Type *tp)
|
||||
{
|
||||
return database_object_namespaces_get((const Eolian_Object *)tp);
|
||||
return eolian_object_namespaces_get((const Eolian_Object *)tp);
|
||||
}
|
||||
|
||||
EAPI Eina_Iterator *
|
||||
eolian_typedecl_namespaces_get(const Eolian_Typedecl *tp)
|
||||
{
|
||||
return database_object_namespaces_get((const Eolian_Object *)tp);
|
||||
return eolian_object_namespaces_get((const Eolian_Object *)tp);
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
|
|
|
@ -36,7 +36,7 @@ eolian_variable_value_get(const Eolian_Variable *var)
|
|||
EAPI Eina_Stringshare *
|
||||
eolian_variable_name_get(const Eolian_Variable *var)
|
||||
{
|
||||
return database_object_short_name_get((const Eolian_Object *)var);
|
||||
return eolian_object_short_name_get((const Eolian_Object *)var);
|
||||
}
|
||||
|
||||
EAPI Eina_Stringshare *
|
||||
|
@ -49,7 +49,7 @@ eolian_variable_full_name_get(const Eolian_Variable *var)
|
|||
EAPI Eina_Iterator *
|
||||
eolian_variable_namespaces_get(const Eolian_Variable *var)
|
||||
{
|
||||
return database_object_namespaces_get((const Eolian_Object *)var);
|
||||
return eolian_object_namespaces_get((const Eolian_Object *)var);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
|
|
|
@ -1353,7 +1353,7 @@ parse_function_pointer(Eo_Lexer *ls)
|
|||
meth->klass = NULL;
|
||||
meth->type = EOLIAN_FUNCTION_POINTER;
|
||||
meth->get_scope = meth->set_scope = EOLIAN_SCOPE_PUBLIC;
|
||||
meth->base.name = eina_stringshare_add(database_object_short_name_get(&def->base));
|
||||
meth->base.name = eina_stringshare_add(eolian_object_short_name_get(&def->base));
|
||||
|
||||
def->function_pointer = meth;
|
||||
eolian_object_ref(&meth->base);
|
||||
|
|
|
@ -18,6 +18,41 @@ database_object_add(Eolian_Unit *unit, const Eolian_Object *obj)
|
|||
((Eina_List *)eina_hash_find(unit->state->objects_f, obj->file), obj));
|
||||
}
|
||||
|
||||
EAPI Eolian_Object_Type
|
||||
eolian_object_type_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj) return EOLIAN_OBJECT_UNKNOWN;
|
||||
return obj->type;
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
eolian_object_file_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj) return NULL;
|
||||
return obj->file;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
eolian_object_line_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj) return 0;
|
||||
return obj->line;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
eolian_object_column_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj) return 0;
|
||||
return obj->column;
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
eolian_object_name_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj) return NULL;
|
||||
return obj->name;
|
||||
}
|
||||
|
||||
typedef struct _Eolian_Namespace_List
|
||||
{
|
||||
Eina_Iterator itr;
|
||||
|
@ -46,8 +81,18 @@ _nmsp_container_get(Eina_Iterator *it EINA_UNUSED)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Eina_Iterator *
|
||||
database_object_namespaces_get(const Eolian_Object *obj)
|
||||
EAPI const char *
|
||||
eolian_object_short_name_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj || !obj->name) return NULL;
|
||||
const char *ldot = strrchr(obj->name, '.');
|
||||
if (ldot)
|
||||
return ldot + 1;
|
||||
return obj->name;
|
||||
}
|
||||
|
||||
EAPI Eina_Iterator *
|
||||
eolian_object_namespaces_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj || !obj->name || !strchr(obj->name, '.')) return NULL;
|
||||
|
||||
|
@ -67,16 +112,6 @@ database_object_namespaces_get(const Eolian_Object *obj)
|
|||
return &it->itr;
|
||||
}
|
||||
|
||||
const char *
|
||||
database_object_short_name_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj || !obj->name) return NULL;
|
||||
const char *ldot = strrchr(obj->name, '.');
|
||||
if (ldot)
|
||||
return ldot + 1;
|
||||
return obj->name;
|
||||
}
|
||||
|
||||
void database_doc_del(Eolian_Documentation *doc)
|
||||
{
|
||||
if (!doc) return;
|
||||
|
@ -572,41 +607,6 @@ eolian_state_free(Eolian_State *state)
|
|||
free(state);
|
||||
}
|
||||
|
||||
EAPI Eolian_Object_Type
|
||||
eolian_object_type_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj) return EOLIAN_OBJECT_UNKNOWN;
|
||||
return obj->type;
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
eolian_object_file_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj) return NULL;
|
||||
return obj->file;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
eolian_object_line_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj) return 0;
|
||||
return obj->line;
|
||||
}
|
||||
|
||||
EAPI int
|
||||
eolian_object_column_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj) return 0;
|
||||
return obj->column;
|
||||
}
|
||||
|
||||
EAPI const char *
|
||||
eolian_object_name_get(const Eolian_Object *obj)
|
||||
{
|
||||
if (!obj) return NULL;
|
||||
return obj->name;
|
||||
}
|
||||
|
||||
#define EO_SUFFIX ".eo"
|
||||
#define EOT_SUFFIX ".eot"
|
||||
|
||||
|
|
|
@ -317,9 +317,6 @@ Eina_Bool database_validate(Eolian_State *state, const Eolian_Unit *src);
|
|||
|
||||
void database_object_add(Eolian_Unit *unit, const Eolian_Object *obj);
|
||||
|
||||
Eina_Iterator *database_object_namespaces_get(const Eolian_Object *obj);
|
||||
const char *database_object_short_name_get(const Eolian_Object *obj);
|
||||
|
||||
void database_doc_del(Eolian_Documentation *doc);
|
||||
|
||||
void database_unit_init(Eolian_State *state, Eolian_Unit *unit, const char *file);
|
||||
|
|
Loading…
Reference in New Issue