eolian: expose API to retrieve the class of an event

This information has been stored and used in Eolian until now
but not exposed to the API user. While there are roundabout ways
to retrieve the class for an event, this one is direct and costs
us nothing.
This commit is contained in:
Daniel Kolesa 2018-11-04 18:32:05 +01:00
parent d0c96539f2
commit 82688c5ece
3 changed files with 24 additions and 0 deletions

View File

@ -378,6 +378,7 @@ ffi.cdef [[
Eina_Iterator *eolian_class_constructors_get(const Eolian_Class *klass);
Eina_Iterator *eolian_class_events_get(const Eolian_Class *klass);
const Eolian_Type *eolian_event_type_get(const Eolian_Event *event);
const Eolian_Class *eolian_event_class_get(const Eolian_Event *event);
const Eolian_Documentation *eolian_event_documentation_get(const Eolian_Event *event);
Eolian_Object_Scope eolian_event_scope_get(const Eolian_Event *event);
Eina_Bool eolian_event_is_beta(const Eolian_Event *event);
@ -1259,6 +1260,12 @@ ffi.metatype("Eolian_Event", {
return v
end,
class_get = function(self)
local v = eolian.eolian_event_class_get(self)
if v == nil then return nil end
return v
end,
documentation_get = function(self)
local v = eolian.eolian_event_documentation_get(self)
if v == nil then return nil end

View File

@ -2063,6 +2063,16 @@ eolian_event_name_get(const Eolian_Event *event)
*/
EAPI const Eolian_Type *eolian_event_type_get(const Eolian_Event *event);
/*
* @brief Get the class of an event.
*
* @param[in] event the event handle
* @return the class or NULL
*
* @ingroup Eolian
*/
EAPI const Eolian_Class *eolian_event_class_get(const Eolian_Event *event);
/*
* @brief Get the documentation of an event.
*

View File

@ -14,6 +14,13 @@ eolian_event_type_get(const Eolian_Event *event)
return event->type;
}
EAPI const Eolian_Class *
eolian_event_class_get(const Eolian_Event *event)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(event, NULL);
return event->klass;
}
EAPI const Eolian_Documentation *
eolian_event_documentation_get(const Eolian_Event *event)
{