forked from enlightenment/efl
eolian: do not require unit for type_class_get
This commit is contained in:
parent
db41734954
commit
707ed05d58
|
@ -44,7 +44,7 @@ inline std::string type_class_name(Eolian_Type const* tp)
|
||||||
tpt = ::eolian_type_type_get(tp);
|
tpt = ::eolian_type_type_get(tp);
|
||||||
if (tpt == EOLIAN_TYPE_CLASS)
|
if (tpt == EOLIAN_TYPE_CLASS)
|
||||||
{
|
{
|
||||||
Eolian_Class const* klass = ::eolian_type_class_get(NULL, tp);
|
Eolian_Class const* klass = ::eolian_type_class_get(tp);
|
||||||
if (klass)
|
if (klass)
|
||||||
{
|
{
|
||||||
Eina_Stringshare* klass_name = ::eolian_class_full_name_get(klass);
|
Eina_Stringshare* klass_name = ::eolian_class_full_name_get(klass);
|
||||||
|
|
|
@ -404,7 +404,7 @@ ffi.cdef [[
|
||||||
const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp);
|
const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, const Eolian_Type *tp);
|
||||||
const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
|
const Eolian_Type *eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl *tp);
|
||||||
|
|
||||||
const Eolian_Class *eolian_type_class_get(const Eolian_Unit *unit, const Eolian_Type *tp);
|
const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
|
||||||
Eina_Bool eolian_type_is_owned(const Eolian_Type *tp);
|
Eina_Bool eolian_type_is_owned(const Eolian_Type *tp);
|
||||||
Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
|
Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
|
||||||
Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp);
|
Eina_Bool eolian_type_is_ptr(const Eolian_Type *tp);
|
||||||
|
@ -853,8 +853,8 @@ M.Type = ffi.metatype("Eolian_Type", {
|
||||||
return v
|
return v
|
||||||
end,
|
end,
|
||||||
|
|
||||||
class_get = function(self, unit)
|
class_get = function(self)
|
||||||
local v = eolian.eolian_type_class_get(unit, self)
|
local v = eolian.eolian_type_class_get(self)
|
||||||
if v == nil then return nil end
|
if v == nil then return nil end
|
||||||
return v
|
return v
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -1985,13 +1985,12 @@ EAPI const Eolian_Type *eolian_type_aliased_base_get(const Eolian_Unit *unit, co
|
||||||
/*
|
/*
|
||||||
* @brief Get the class associated with an EOLIAN_TYPE_CLASS type.
|
* @brief Get the class associated with an EOLIAN_TYPE_CLASS type.
|
||||||
*
|
*
|
||||||
* @param[in] unit the unit to look in
|
|
||||||
* @param[in] tp the type.
|
* @param[in] tp the type.
|
||||||
* @return the class or NULL.
|
* @return the class or NULL.
|
||||||
*
|
*
|
||||||
* @ingroup Eolian
|
* @ingroup Eolian
|
||||||
*/
|
*/
|
||||||
EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Unit *unit, const Eolian_Type *tp);
|
EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @brief Get whether the given type is owned.
|
* @brief Get whether the given type is owned.
|
||||||
|
|
|
@ -312,12 +312,12 @@ eolian_typedecl_aliased_base_get(const Eolian_Unit *unit, const Eolian_Typedecl
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI const Eolian_Class *
|
EAPI const Eolian_Class *
|
||||||
eolian_type_class_get(const Eolian_Unit *unit, const Eolian_Type *tp)
|
eolian_type_class_get(const Eolian_Type *tp)
|
||||||
{
|
{
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(tp, NULL);
|
||||||
if (eolian_type_type_get(tp) != EOLIAN_TYPE_CLASS)
|
if (eolian_type_type_get(tp) != EOLIAN_TYPE_CLASS)
|
||||||
return NULL;
|
return NULL;
|
||||||
return eolian_class_get_by_name(unit, tp->full_name);
|
return tp->klass;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
EAPI Eina_Bool
|
||||||
|
|
|
@ -266,7 +266,7 @@ _validate_type(const Eolian_Unit *src, Eolian_Type *tp)
|
||||||
}
|
}
|
||||||
case EOLIAN_TYPE_CLASS:
|
case EOLIAN_TYPE_CLASS:
|
||||||
{
|
{
|
||||||
tp->klass = (Eolian_Class *)eolian_type_class_get(src, tp);
|
tp->klass = (Eolian_Class *)eolian_class_get_by_name(src, tp->full_name);
|
||||||
if (!tp->klass)
|
if (!tp->klass)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "undefined class %s "
|
snprintf(buf, sizeof(buf), "undefined class %s "
|
||||||
|
|
|
@ -385,7 +385,7 @@ inline void type_def::set(Eolian_Type const* eolian_type, Eolian_Unit const* uni
|
||||||
break;
|
break;
|
||||||
case EOLIAN_TYPE_CLASS:
|
case EOLIAN_TYPE_CLASS:
|
||||||
{
|
{
|
||||||
Eolian_Class const* klass = eolian_type_class_get(unit, eolian_type);
|
Eolian_Class const* klass = eolian_type_class_get(eolian_type);
|
||||||
original_type = klass_name(klass, {qualifiers(eolian_type), {}});
|
original_type = klass_name(klass, {qualifiers(eolian_type), {}});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1087,11 +1087,10 @@ class Type(EolianBaseObject): # OK (4 TODO Unit*)
|
||||||
# c_type = lib.eolian_type_aliased_base_get(self._obj)
|
# c_type = lib.eolian_type_aliased_base_get(self._obj)
|
||||||
# return Type(c_type) if c_type else None
|
# return Type(c_type) if c_type else None
|
||||||
|
|
||||||
# TODO FIXME STRANGE API (need Eolian_Unit*)
|
@cached_property
|
||||||
# @cached_property
|
def class_(self):
|
||||||
# def class_(self):
|
c_cls = lib.eolian_type_class_get(self._obj)
|
||||||
# c_cls = lib.eolian_type_class_get(self._obj)
|
return Class(c_cls) if c_cls else None
|
||||||
# return Class(c_cls) if c_cls else None
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def file(self):
|
def file(self):
|
||||||
|
|
|
@ -560,10 +560,9 @@ lib.eolian_type_next_type_get.restype = c_void_p
|
||||||
# lib.eolian_type_aliased_base_get.argtypes = [c_void_p,]
|
# lib.eolian_type_aliased_base_get.argtypes = [c_void_p,]
|
||||||
# lib.eolian_type_aliased_base_get.restype = c_void_p
|
# lib.eolian_type_aliased_base_get.restype = c_void_p
|
||||||
|
|
||||||
# TODO FIXME STRANGE API (need Eolian_Unit*)
|
# EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Type *tp);
|
||||||
# EAPI const Eolian_Class *eolian_type_class_get(const Eolian_Unit *unit, const Eolian_Type *tp);
|
lib.eolian_type_class_get.argtypes = [c_void_p,]
|
||||||
# lib.eolian_type_class_get.argtypes = [c_void_p,]
|
lib.eolian_type_class_get.restype = c_void_p
|
||||||
# lib.eolian_type_class_get.restype = c_void_p
|
|
||||||
|
|
||||||
# EAPI Eina_Bool eolian_type_is_owned(const Eolian_Type *tp);
|
# EAPI Eina_Bool eolian_type_is_owned(const Eolian_Type *tp);
|
||||||
lib.eolian_type_is_owned.argtypes = [c_void_p,]
|
lib.eolian_type_is_owned.argtypes = [c_void_p,]
|
||||||
|
|
Loading…
Reference in New Issue