Pyolian: some more missing symbols defined

This commit is contained in:
Davide Andreoli 2019-10-10 11:05:12 +02:00
parent 15933eb37b
commit 30ddac0758
3 changed files with 89 additions and 2 deletions

View File

@ -790,6 +790,10 @@ class Class(Object):
def parts(self):
return Iterator(Part, lib.eolian_class_parts_get(self))
@property
def requires(self):
return Iterator(Class, lib.eolian_class_requires_get(self))
class Part(Object):
def __repr__(self):
@ -976,6 +980,12 @@ class Function(Object):
def return_allow_unused(self, ftype):
return bool(lib.eolian_function_return_allow_unused(self, ftype))
def return_is_by_ref(self, ftype):
return bool(lib.eolian_function_return_is_by_ref(self, ftype))
def return_is_move(self, ftype):
return bool(lib.eolian_function_return_is_move(self, ftype))
@cached_property
def method_return_type(self):
return self.return_type_get(Eolian_Function_Type.METHOD)
@ -1026,6 +1036,14 @@ class Function_Parameter(Object):
def is_optional(self):
return bool(lib.eolian_parameter_is_optional(self))
@cached_property
def is_by_ref(self):
return bool(lib.eolian_parameter_is_by_ref(self))
@cached_property
def is_move(self):
return bool(lib.eolian_parameter_is_move(self))
@cached_property
def type(self):
c_type = lib.eolian_parameter_type_get(self)
@ -1158,6 +1176,10 @@ class Type(Object):
def is_ptr(self):
return bool(lib.eolian_type_is_ptr(self))
@cached_property
def is_move(self):
return bool(lib.eolian_type_is_move(self))
class Typedecl(Object):
def __repr__(self):
@ -1255,7 +1277,22 @@ class Struct_Type_Field(Object):
def type(self):
c_type = lib.eolian_typedecl_struct_field_type_get(self)
return Type(c_type) if c_type else None
@cached_property
def c_type(self):
s = lib.eolian_typedecl_struct_field_c_type_get(self)
ret = _str_to_py(s)
lib.eina_stringshare_del(c_void_p(s))
return ret
@cached_property
def is_by_ref(self):
return bool(lib.eolian_typedecl_struct_field_is_by_ref(self))
@cached_property
def is_move(self):
return bool(lib.eolian_typedecl_struct_field_is_move(self))
@cached_property
def documentation(self):
c_doc = lib.eolian_typedecl_struct_field_documentation_get(self)

View File

@ -270,6 +270,11 @@ lib.eolian_class_data_type_get.restype = c_char_p
lib.eolian_class_parent_get.argtypes = (c_void_p,)
lib.eolian_class_parent_get.restype = c_void_p
# EAPI Eina_Iterator *eolian_class_requires_get(const Eolian_Class *klass);
lib.eolian_class_requires_get.argtypes = (c_void_p,)
lib.eolian_class_requires_get.restype = c_void_p
# EAPI Eina_Iterator *eolian_class_extensions_get(const Eolian_Class *klass);
lib.eolian_class_extensions_get.argtypes = (c_void_p,)
lib.eolian_class_extensions_get.restype = c_void_p
@ -349,6 +354,14 @@ lib.eolian_function_is_static.restype = c_bool
lib.eolian_function_is_constructor.argtypes = (c_void_p, c_void_p)
lib.eolian_function_is_constructor.restype = c_bool
# EAPI Eina_Bool eolian_parameter_is_by_ref(const Eolian_Function_Parameter *param_desc);
lib.eolian_parameter_is_by_ref.argtypes = (c_void_p,)
lib.eolian_parameter_is_by_ref.restype = c_bool
# EAPI Eina_Bool eolian_parameter_is_move(const Eolian_Function_Parameter *param_desc);
lib.eolian_parameter_is_move.argtypes = (c_void_p,)
lib.eolian_parameter_is_move.restype = c_bool
# EAPI Eina_Stringshare *eolian_parameter_c_type_get(const Eolian_Function_Parameter *param_desc, Eina_Bool as_return);
lib.eolian_parameter_c_type_get.argtypes = (c_void_p, c_bool)
lib.eolian_parameter_c_type_get.restype = c_void_p # Stringshare TO BE FREED
@ -540,6 +553,18 @@ lib.eolian_typedecl_struct_field_documentation_get.restype = c_void_p
lib.eolian_typedecl_struct_field_type_get.argtypes = (c_void_p,)
lib.eolian_typedecl_struct_field_type_get.restype = c_void_p
# EAPI Eina_Bool eolian_typedecl_struct_field_is_by_ref(const Eolian_Struct_Type_Field *fl);
lib.eolian_typedecl_struct_field_is_by_ref.argtypes = (c_void_p,)
lib.eolian_typedecl_struct_field_is_by_ref.restype = c_bool
# EAPI Eina_Bool eolian_typedecl_struct_field_is_move(const Eolian_Struct_Type_Field *fl);
lib.eolian_typedecl_struct_field_is_move.argtypes = (c_void_p,)
lib.eolian_typedecl_struct_field_is_move.restype = c_bool
# EAPI Eina_Stringshare *eolian_typedecl_struct_field_c_type_get(const Eolian_Struct_Type_Field *fl);
lib.eolian_typedecl_struct_field_c_type_get.argtypes = (c_void_p,)
lib.eolian_typedecl_struct_field_c_type_get.restype = c_void_p # Stringshare TO BE FREED
# EAPI Eina_Iterator *eolian_typedecl_enum_fields_get(const Eolian_Typedecl *tp);
lib.eolian_typedecl_enum_fields_get.argtypes = (c_void_p,)
lib.eolian_typedecl_enum_fields_get.restype = c_void_p
@ -623,6 +648,10 @@ lib.eolian_type_aliased_base_get.restype = c_void_p
lib.eolian_type_class_get.argtypes = (c_void_p,)
lib.eolian_type_class_get.restype = c_void_p
# EAPI Eina_Bool eolian_type_is_move(const Eolian_Type *tp);
lib.eolian_type_is_move.argtypes = (c_void_p,)
lib.eolian_type_is_move.restype = c_bool
# EAPI Eina_Bool eolian_type_is_const(const Eolian_Type *tp);
lib.eolian_type_is_const.argtypes = (c_void_p,)
lib.eolian_type_is_const.restype = c_bool

View File

@ -392,6 +392,13 @@ class TestEolianClass(object):
assert len(list(cls.implements)) > 5
assert isinstance(list(cls.implements)[0], eolian.Implement)
def test_mixins_requires(self, eolian_db):
cls = eolian_db.class_by_name_get('Efl.Loop_Timer')
assert len(list(cls.requires)) == 0
cls = eolian_db.class_by_name_get('Efl.File')
assert len(list(cls.requires)) == 1
assert list(cls.requires)[0].name == 'Efl.Object'
class TestEolianFunction(object):
def test_function(self, eolian_db):
@ -416,7 +423,9 @@ class TestEolianFunction(object):
assert len(list(f.getter_values)) == 1
assert len(list(f.getter_values)) == 1
assert len(list(f.parameters)) == 1
assert f.return_allow_unused(eolian.Eolian_Function_Type.METHOD) is True
assert f.return_allow_unused(eolian.Eolian_Function_Type.PROP_GET) is True
assert f.return_is_by_ref(eolian.Eolian_Function_Type.PROP_GET) is False
assert f.return_is_move(eolian.Eolian_Function_Type.PROP_GET) is False
assert f.object_is_const is False
assert f.class_.name == 'Efl.Loop_Timer'
assert isinstance(f.implement, eolian.Implement)
@ -429,6 +438,8 @@ class TestEolianFunction(object):
assert p.name == 'add'
assert p.default_value is None
assert p.is_optional is False
assert p.is_by_ref is False
assert p.is_move is False
assert p.type.name == 'double'
assert p.c_type_get(False) == 'double'
assert p.c_type_get(True) == 'double'
@ -583,6 +594,9 @@ class TestEolianTypedecl(object):
assert field.name == 'b'
assert isinstance(field.type, eolian.Type)
assert isinstance(field.documentation, eolian.Documentation)
assert field.c_type == "uint8_t"
assert field.is_by_ref is False
assert field.is_move is False
def test_typedecl_alias(self, eolian_db):
alias = eolian_db.alias_by_name_get('Eina.Error')
@ -611,6 +625,7 @@ class TestEolianType(object):
assert t.next_type is None # TODO find a better test
assert t.is_const is False
assert t.is_ptr is False
assert t.is_move is False
assert list(t.namespaces) == []
assert t.class_ is None
assert t == t.aliased_base # TODO find a better test
@ -626,6 +641,9 @@ class TestEolianType(object):
assert t.type == eolian.Eolian_Type_Type.REGULAR
assert t.builtin_type == eolian.Eolian_Type_Builtin_Type.INVALID
assert t.file == 'efl_gfx_entity.eo' # TODO is this correct ?
assert t.is_const is False
assert t.is_ptr is False
assert t.is_move is False
assert list(t.namespaces) == ['Eina']
assert t.class_ is None
assert t == t.aliased_base
@ -645,6 +663,9 @@ class TestEolianType(object):
assert t.type == eolian.Eolian_Type_Type.CLASS
assert t.builtin_type == eolian.Eolian_Type_Builtin_Type.INVALID
assert t.file == 'efl_content.eo' # TODO is this correct ?
assert t.is_const is False
assert t.is_ptr is False
assert t.is_move is False
assert list(t.namespaces) == ['Efl', 'Gfx']
assert t == t.aliased_base