forked from enlightenment/efl
Pyolian: let ctypes automatically convert types
Not a big improvement and not so much automatically... but for sure a bit less to type :)
This commit is contained in:
parent
ef3e487b0c
commit
35316db2f0
|
@ -308,6 +308,11 @@ class EolianBaseObject(object):
|
|||
def __hash__(self):
|
||||
return self._obj.value
|
||||
|
||||
@property
|
||||
def _as_parameter_(self):
|
||||
""" Used by ctypes to convert instances when calling C functions """
|
||||
return self._obj
|
||||
|
||||
|
||||
### Main Eolian Unit ########################################################
|
||||
|
||||
|
@ -317,71 +322,71 @@ class Eolian_Unit(EolianBaseObject):
|
|||
|
||||
@property
|
||||
def children(self):
|
||||
return Iterator(Eolian_Unit, lib.eolian_unit_children_get(self._obj))
|
||||
return Iterator(Eolian_Unit, lib.eolian_unit_children_get(self))
|
||||
|
||||
@cached_property
|
||||
def file(self):
|
||||
return _str_to_py(lib.eolian_unit_file_get(self._obj))
|
||||
return _str_to_py(lib.eolian_unit_file_get(self))
|
||||
|
||||
@cached_property
|
||||
def state(self):
|
||||
c_state = lib.eolian_unit_state_get(self._obj)
|
||||
c_state = lib.eolian_unit_state_get(self)
|
||||
return Eolian_State(c_state) if c_state else None
|
||||
|
||||
@property
|
||||
def objects(self):
|
||||
return Iterator(Object, lib.eolian_unit_objects_get(self._obj))
|
||||
return Iterator(Object, lib.eolian_unit_objects_get(self))
|
||||
|
||||
def object_by_name_get(self, name):
|
||||
c_obj = lib.eolian_unit_object_by_name_get(self._obj, _str_to_bytes(name))
|
||||
c_obj = lib.eolian_unit_object_by_name_get(self, _str_to_bytes(name))
|
||||
return Object(c_obj) if c_obj else None
|
||||
|
||||
@property
|
||||
def classes(self):
|
||||
return Iterator(Class, lib.eolian_unit_classes_get(self._obj))
|
||||
return Iterator(Class, lib.eolian_unit_classes_get(self))
|
||||
|
||||
def class_by_name_get(self, class_name):
|
||||
c_cls = lib.eolian_unit_class_by_name_get(self._obj, _str_to_bytes(class_name))
|
||||
c_cls = lib.eolian_unit_class_by_name_get(self, _str_to_bytes(class_name))
|
||||
return Class(c_cls) if c_cls else None
|
||||
|
||||
@property
|
||||
def constants(self):
|
||||
return Iterator(Variable, lib.eolian_unit_constants_get(self._obj))
|
||||
return Iterator(Variable, lib.eolian_unit_constants_get(self))
|
||||
|
||||
def constant_by_name_get(self, name):
|
||||
c_var = lib.eolian_unit_constant_by_name_get(self._obj, _str_to_bytes(name))
|
||||
c_var = lib.eolian_unit_constant_by_name_get(self, _str_to_bytes(name))
|
||||
return Variable(c_var) if c_var else None
|
||||
|
||||
@property
|
||||
def globals(self):
|
||||
return Iterator(Variable, lib.eolian_unit_globals_get(self._obj))
|
||||
return Iterator(Variable, lib.eolian_unit_globals_get(self))
|
||||
|
||||
def global_by_name_get(self, name):
|
||||
c_var = lib.eolian_unit_global_by_name_get(self._obj, _str_to_bytes(name))
|
||||
c_var = lib.eolian_unit_global_by_name_get(self, _str_to_bytes(name))
|
||||
return Variable(c_var) if c_var else None
|
||||
|
||||
@property
|
||||
def enums(self):
|
||||
return Iterator(Typedecl, lib.eolian_unit_enums_get(self._obj))
|
||||
return Iterator(Typedecl, lib.eolian_unit_enums_get(self))
|
||||
|
||||
def enum_by_name_get(self, name):
|
||||
c_tdecl = lib.eolian_unit_enum_by_name_get(self._obj, _str_to_bytes(name))
|
||||
c_tdecl = lib.eolian_unit_enum_by_name_get(self, _str_to_bytes(name))
|
||||
return Typedecl(c_tdecl) if c_tdecl else None
|
||||
|
||||
@property
|
||||
def structs(self):
|
||||
return Iterator(Typedecl, lib.eolian_unit_structs_get(self._obj))
|
||||
return Iterator(Typedecl, lib.eolian_unit_structs_get(self))
|
||||
|
||||
def struct_by_name_get(self, name):
|
||||
c_tdecl = lib.eolian_unit_struct_by_name_get(self._obj, _str_to_bytes(name))
|
||||
c_tdecl = lib.eolian_unit_struct_by_name_get(self, _str_to_bytes(name))
|
||||
return Typedecl(c_tdecl) if c_tdecl else None
|
||||
|
||||
@property
|
||||
def aliases(self):
|
||||
return Iterator(Typedecl, lib.eolian_unit_aliases_get(self._obj))
|
||||
return Iterator(Typedecl, lib.eolian_unit_aliases_get(self))
|
||||
|
||||
def alias_by_name_get(self, name):
|
||||
c_tdecl = lib.eolian_unit_alias_by_name_get(self._obj, _str_to_bytes(name))
|
||||
c_tdecl = lib.eolian_unit_alias_by_name_get(self, _str_to_bytes(name))
|
||||
return Typedecl(c_tdecl) if c_tdecl else None
|
||||
|
||||
|
||||
|
@ -411,78 +416,78 @@ class Eolian_State(Eolian_Unit):
|
|||
|
||||
def __del__(self):
|
||||
if not _already_halted: # do not free after eolian_shutdown
|
||||
lib.eolian_state_free(self._obj)
|
||||
lib.eolian_state_free(self)
|
||||
|
||||
def __repr__(self):
|
||||
return "<eolian.Eolian_State, %d units loaded>" % len(list(self.units))
|
||||
|
||||
def file_parse(self, filepath):
|
||||
c_unit = lib.eolian_state_file_parse(self._obj, _str_to_bytes(filepath))
|
||||
c_unit = lib.eolian_state_file_parse(self, _str_to_bytes(filepath))
|
||||
return Eolian_Unit(c_unit) if c_unit else None
|
||||
|
||||
@property
|
||||
def eo_file_paths(self):
|
||||
return Iterator(_str_to_py, lib.eolian_state_eo_file_paths_get(self._obj))
|
||||
return Iterator(_str_to_py, lib.eolian_state_eo_file_paths_get(self))
|
||||
|
||||
@property
|
||||
def eot_file_paths(self):
|
||||
return Iterator(_str_to_py, lib.eolian_state_eot_file_paths_get(self._obj))
|
||||
return Iterator(_str_to_py, lib.eolian_state_eot_file_paths_get(self))
|
||||
|
||||
@property
|
||||
def eo_files(self):
|
||||
return Iterator(_str_to_py, lib.eolian_state_eo_files_get(self._obj))
|
||||
return Iterator(_str_to_py, lib.eolian_state_eo_files_get(self))
|
||||
|
||||
@property
|
||||
def eot_files(self):
|
||||
return Iterator(_str_to_py, lib.eolian_state_eot_files_get(self._obj))
|
||||
return Iterator(_str_to_py, lib.eolian_state_eot_files_get(self))
|
||||
|
||||
def directory_add(self, dir_path):
|
||||
return bool(lib.eolian_state_directory_add(self._obj, _str_to_bytes(dir_path)))
|
||||
return bool(lib.eolian_state_directory_add(self, _str_to_bytes(dir_path)))
|
||||
|
||||
def system_directory_add(self):
|
||||
return bool(lib.eolian_state_system_directory_add(self._obj))
|
||||
return bool(lib.eolian_state_system_directory_add(self))
|
||||
|
||||
def all_eo_files_parse(self):
|
||||
return bool(lib.eolian_state_all_eo_files_parse(self._obj))
|
||||
return bool(lib.eolian_state_all_eo_files_parse(self))
|
||||
|
||||
def all_eot_files_parse(self):
|
||||
return bool(lib.eolian_state_all_eot_files_parse(self._obj))
|
||||
return bool(lib.eolian_state_all_eot_files_parse(self))
|
||||
|
||||
def unit_by_file_get(self, file_name):
|
||||
c_unit = lib.eolian_state_unit_by_file_get(self._obj, _str_to_bytes(file_name))
|
||||
c_unit = lib.eolian_state_unit_by_file_get(self, _str_to_bytes(file_name))
|
||||
return Eolian_Unit(c_unit) if c_unit else None
|
||||
|
||||
@property
|
||||
def units(self):
|
||||
return Iterator(Eolian_Unit, lib.eolian_state_units_get(self._obj))
|
||||
return Iterator(Eolian_Unit, lib.eolian_state_units_get(self))
|
||||
|
||||
def objects_by_file_get(self, file_name):
|
||||
return Iterator(Object,
|
||||
lib.eolian_state_objects_by_file_get(self._obj, _str_to_bytes(file_name)))
|
||||
lib.eolian_state_objects_by_file_get(self, _str_to_bytes(file_name)))
|
||||
|
||||
def class_by_file_get(self, file_name):
|
||||
c_cls = lib.eolian_state_class_by_file_get(self._obj, _str_to_bytes(file_name))
|
||||
c_cls = lib.eolian_state_class_by_file_get(self, _str_to_bytes(file_name))
|
||||
return Class(c_cls) if c_cls else None
|
||||
|
||||
def constants_by_file_get(self, file_name):
|
||||
return Iterator(Variable,
|
||||
lib.eolian_state_constants_by_file_get(self._obj, _str_to_bytes(file_name)))
|
||||
lib.eolian_state_constants_by_file_get(self, _str_to_bytes(file_name)))
|
||||
|
||||
def globals_by_file_get(self, file_name):
|
||||
return Iterator(Variable,
|
||||
lib.eolian_state_globals_by_file_get(self._obj, _str_to_bytes(file_name)))
|
||||
lib.eolian_state_globals_by_file_get(self, _str_to_bytes(file_name)))
|
||||
|
||||
def aliases_by_file_get(self, file_name):
|
||||
return Iterator(Typedecl,
|
||||
lib.eolian_state_aliases_by_file_get(self._obj, _str_to_bytes(file_name)))
|
||||
lib.eolian_state_aliases_by_file_get(self, _str_to_bytes(file_name)))
|
||||
|
||||
def structs_by_file_get(self, file_name):
|
||||
return Iterator(Typedecl,
|
||||
lib.eolian_state_structs_by_file_get(self._obj, _str_to_bytes(file_name)))
|
||||
lib.eolian_state_structs_by_file_get(self, _str_to_bytes(file_name)))
|
||||
|
||||
def enums_by_file_get(self, file_name):
|
||||
return Iterator(Typedecl,
|
||||
lib.eolian_state_enums_by_file_get(self._obj, _str_to_bytes(file_name)))
|
||||
lib.eolian_state_enums_by_file_get(self, _str_to_bytes(file_name)))
|
||||
|
||||
|
||||
### Namespace Utility Class #################################################
|
||||
|
@ -586,20 +591,20 @@ class Object(EolianBaseObject):
|
|||
|
||||
@cached_property
|
||||
def unit(self):
|
||||
c_unit = lib.eolian_object_unit_get(self._obj)
|
||||
c_unit = lib.eolian_object_unit_get(self)
|
||||
return Eolian_Unit(c_unit) if c_unit else None
|
||||
|
||||
@cached_property
|
||||
def name(self):
|
||||
return _str_to_py(lib.eolian_object_name_get(self._obj))
|
||||
return _str_to_py(lib.eolian_object_name_get(self))
|
||||
|
||||
@cached_property
|
||||
def short_name(self):
|
||||
return _str_to_py(lib.eolian_object_short_name_get(self._obj))
|
||||
return _str_to_py(lib.eolian_object_short_name_get(self))
|
||||
|
||||
@property
|
||||
def namespaces(self):
|
||||
return Iterator(_str_to_py, lib.eolian_object_namespaces_get(self._obj))
|
||||
return Iterator(_str_to_py, lib.eolian_object_namespaces_get(self))
|
||||
|
||||
@cached_property
|
||||
def namespace(self):
|
||||
|
@ -607,15 +612,15 @@ class Object(EolianBaseObject):
|
|||
|
||||
@cached_property
|
||||
def file(self):
|
||||
return _str_to_py(lib.eolian_object_file_get(self._obj))
|
||||
return _str_to_py(lib.eolian_object_file_get(self))
|
||||
|
||||
@cached_property
|
||||
def line(self):
|
||||
return int(lib.eolian_object_line_get(self._obj))
|
||||
return int(lib.eolian_object_line_get(self))
|
||||
|
||||
@cached_property
|
||||
def column(self):
|
||||
return int(lib.eolian_object_column_get(self._obj))
|
||||
return int(lib.eolian_object_column_get(self))
|
||||
|
||||
|
||||
class Class(Object):
|
||||
|
@ -624,66 +629,66 @@ class Class(Object):
|
|||
|
||||
@cached_property
|
||||
def c_name(self):
|
||||
s = lib.eolian_class_c_name_get(self._obj)
|
||||
s = lib.eolian_class_c_name_get(self)
|
||||
ret = _str_to_py(s)
|
||||
lib.eina_stringshare_del(c_void_p(s))
|
||||
return ret
|
||||
|
||||
@cached_property
|
||||
def c_get_function_name(self):
|
||||
s = lib.eolian_class_c_get_function_name_get(self._obj)
|
||||
s = lib.eolian_class_c_get_function_name_get(self)
|
||||
ret = _str_to_py(s)
|
||||
lib.eina_stringshare_del(c_void_p(s))
|
||||
return ret
|
||||
|
||||
@cached_property
|
||||
def type(self):
|
||||
return Eolian_Class_Type(lib.eolian_class_type_get(self._obj))
|
||||
return Eolian_Class_Type(lib.eolian_class_type_get(self))
|
||||
|
||||
@cached_property
|
||||
def data_type(self):
|
||||
return _str_to_py(lib.eolian_class_data_type_get(self._obj))
|
||||
return _str_to_py(lib.eolian_class_data_type_get(self))
|
||||
|
||||
@cached_property
|
||||
def c_data_type(self):
|
||||
s = lib.eolian_class_c_data_type_get(self._obj)
|
||||
s = lib.eolian_class_c_data_type_get(self)
|
||||
ret = _str_to_py(s)
|
||||
lib.eina_stringshare_del(c_void_p(s))
|
||||
return ret
|
||||
|
||||
@cached_property
|
||||
def legacy_prefix(self):
|
||||
return _str_to_py(lib.eolian_class_legacy_prefix_get(self._obj))
|
||||
return _str_to_py(lib.eolian_class_legacy_prefix_get(self))
|
||||
|
||||
@cached_property
|
||||
def eo_prefix(self):
|
||||
return _str_to_py(lib.eolian_class_eo_prefix_get(self._obj))
|
||||
return _str_to_py(lib.eolian_class_eo_prefix_get(self))
|
||||
|
||||
@cached_property
|
||||
def event_prefix(self):
|
||||
return _str_to_py(lib.eolian_class_event_prefix_get(self._obj))
|
||||
return _str_to_py(lib.eolian_class_event_prefix_get(self))
|
||||
|
||||
@cached_property
|
||||
def documentation(self):
|
||||
c_doc = lib.eolian_class_documentation_get(self._obj)
|
||||
c_doc = lib.eolian_class_documentation_get(self)
|
||||
return Documentation(c_doc) if c_doc else None
|
||||
|
||||
@property
|
||||
def constructors(self):
|
||||
return Iterator(Constructor, lib.eolian_class_constructors_get(self._obj))
|
||||
return Iterator(Constructor, lib.eolian_class_constructors_get(self))
|
||||
|
||||
@property
|
||||
def events(self):
|
||||
return Iterator(Event, lib.eolian_class_events_get(self._obj))
|
||||
return Iterator(Event, lib.eolian_class_events_get(self))
|
||||
|
||||
def event_by_name_get(self, event_name):
|
||||
c_event = lib.eolian_class_event_by_name_get(self._obj,
|
||||
c_event = lib.eolian_class_event_by_name_get(self,
|
||||
_str_to_bytes(event_name))
|
||||
return Event(c_event) if c_event else None
|
||||
|
||||
@property
|
||||
def inherits(self):
|
||||
return Iterator(Class, lib.eolian_class_inherits_get(self._obj))
|
||||
return Iterator(Class, lib.eolian_class_inherits_get(self))
|
||||
|
||||
@cached_property
|
||||
def inherits_full(self):
|
||||
|
@ -714,21 +719,21 @@ class Class(Object):
|
|||
|
||||
@cached_property
|
||||
def ctor_enable(self):
|
||||
return bool(lib.eolian_class_ctor_enable_get(self._obj))
|
||||
return bool(lib.eolian_class_ctor_enable_get(self))
|
||||
|
||||
@cached_property
|
||||
def dtor_enable(self):
|
||||
return bool(lib.eolian_class_dtor_enable_get(self._obj))
|
||||
return bool(lib.eolian_class_dtor_enable_get(self))
|
||||
|
||||
def function_by_name_get(self, func_name,
|
||||
ftype=Eolian_Function_Type.UNRESOLVED):
|
||||
f = lib.eolian_class_function_by_name_get(self._obj,
|
||||
f = lib.eolian_class_function_by_name_get(self,
|
||||
_str_to_bytes(func_name),
|
||||
ftype)
|
||||
return Function(f) if f else None
|
||||
|
||||
def functions_get(self, ftype):
|
||||
return Iterator(Function, lib.eolian_class_functions_get(self._obj, ftype))
|
||||
return Iterator(Function, lib.eolian_class_functions_get(self, ftype))
|
||||
|
||||
@property
|
||||
def methods(self):
|
||||
|
@ -740,11 +745,11 @@ class Class(Object):
|
|||
|
||||
@property
|
||||
def implements(self):
|
||||
return Iterator(Implement, lib.eolian_class_implements_get(self._obj))
|
||||
return Iterator(Implement, lib.eolian_class_implements_get(self))
|
||||
|
||||
@property
|
||||
def parts(self):
|
||||
return Iterator(Part, lib.eolian_class_parts_get(self._obj))
|
||||
return Iterator(Part, lib.eolian_class_parts_get(self))
|
||||
|
||||
|
||||
class Part(Object):
|
||||
|
@ -753,11 +758,11 @@ class Part(Object):
|
|||
|
||||
@cached_property
|
||||
def class_(self):
|
||||
return Class(lib.eolian_part_class_get(self._obj))
|
||||
return Class(lib.eolian_part_class_get(self))
|
||||
|
||||
@cached_property
|
||||
def documentation(self):
|
||||
c_doc = lib.eolian_part_documentation_get(self._obj)
|
||||
c_doc = lib.eolian_part_documentation_get(self)
|
||||
return Documentation(c_doc) if c_doc else None
|
||||
|
||||
|
||||
|
@ -767,15 +772,15 @@ class Constructor(Object):
|
|||
|
||||
@cached_property
|
||||
def function(self):
|
||||
return Function(lib.eolian_constructor_function_get(self._obj))
|
||||
return Function(lib.eolian_constructor_function_get(self))
|
||||
|
||||
@cached_property
|
||||
def is_optional(self):
|
||||
return bool(lib.eolian_constructor_is_optional(self._obj))
|
||||
return bool(lib.eolian_constructor_is_optional(self))
|
||||
|
||||
@cached_property
|
||||
def class_(self):
|
||||
return Class(lib.eolian_constructor_class_get(self._obj))
|
||||
return Class(lib.eolian_constructor_class_get(self))
|
||||
|
||||
|
||||
class Event(Object):
|
||||
|
@ -784,36 +789,36 @@ class Event(Object):
|
|||
|
||||
@cached_property
|
||||
def c_name(self):
|
||||
s = lib.eolian_event_c_name_get(self._obj)
|
||||
s = lib.eolian_event_c_name_get(self)
|
||||
ret = _str_to_py(s)
|
||||
lib.eina_stringshare_del(c_void_p(s))
|
||||
return ret
|
||||
|
||||
@cached_property
|
||||
def type(self):
|
||||
c_type = lib.eolian_event_type_get(self._obj)
|
||||
c_type = lib.eolian_event_type_get(self)
|
||||
return Type(c_type) if c_type else None
|
||||
|
||||
@cached_property
|
||||
def documentation(self):
|
||||
c_doc = lib.eolian_event_documentation_get(self._obj)
|
||||
c_doc = lib.eolian_event_documentation_get(self)
|
||||
return Documentation(c_doc) if c_doc else None
|
||||
|
||||
@cached_property
|
||||
def scope(self):
|
||||
return Eolian_Object_Scope(lib.eolian_event_scope_get(self._obj))
|
||||
return Eolian_Object_Scope(lib.eolian_event_scope_get(self))
|
||||
|
||||
@cached_property
|
||||
def is_beta(self):
|
||||
return bool(lib.eolian_event_is_beta(self._obj))
|
||||
return bool(lib.eolian_event_is_beta(self))
|
||||
|
||||
@cached_property
|
||||
def is_hot(self):
|
||||
return bool(lib.eolian_event_is_hot(self._obj))
|
||||
return bool(lib.eolian_event_is_hot(self))
|
||||
|
||||
@cached_property
|
||||
def is_restart(self):
|
||||
return bool(lib.eolian_event_is_restart(self._obj))
|
||||
return bool(lib.eolian_event_is_restart(self))
|
||||
|
||||
|
||||
class Function(Object):
|
||||
|
@ -821,7 +826,7 @@ class Function(Object):
|
|||
return "<eolian.Function '{0.name}'>".format(self)
|
||||
|
||||
def full_c_name_get(self, ftype, use_legacy=False):
|
||||
s = lib.eolian_function_full_c_name_get(self._obj, ftype, use_legacy)
|
||||
s = lib.eolian_function_full_c_name_get(self, ftype, use_legacy)
|
||||
ret = _str_to_py(s)
|
||||
lib.eina_stringshare_del(c_void_p(s))
|
||||
return ret
|
||||
|
@ -852,10 +857,10 @@ class Function(Object):
|
|||
|
||||
@cached_property
|
||||
def type(self):
|
||||
return Eolian_Function_Type(lib.eolian_function_type_get(self._obj))
|
||||
return Eolian_Function_Type(lib.eolian_function_type_get(self))
|
||||
|
||||
def scope_get(self, ftype):
|
||||
return Eolian_Object_Scope(lib.eolian_function_scope_get(self._obj, ftype))
|
||||
return Eolian_Object_Scope(lib.eolian_function_scope_get(self, ftype))
|
||||
|
||||
@cached_property
|
||||
def method_scope(self):
|
||||
|
@ -870,43 +875,43 @@ class Function(Object):
|
|||
return self.scope_get(Eolian_Function_Type.PROP_SET)
|
||||
|
||||
def legacy_get(self, ftype):
|
||||
return _str_to_py(lib.eolian_function_legacy_get(self._obj, ftype))
|
||||
return _str_to_py(lib.eolian_function_legacy_get(self, ftype))
|
||||
|
||||
def is_legacy_only(self, ftype):
|
||||
return bool(lib.eolian_function_is_legacy_only(self._obj, ftype))
|
||||
return bool(lib.eolian_function_is_legacy_only(self, ftype))
|
||||
|
||||
@cached_property
|
||||
def is_class(self):
|
||||
return bool(lib.eolian_function_is_class(self._obj))
|
||||
return bool(lib.eolian_function_is_class(self))
|
||||
|
||||
@cached_property
|
||||
def is_beta(self):
|
||||
return bool(lib.eolian_function_is_beta(self._obj))
|
||||
return bool(lib.eolian_function_is_beta(self))
|
||||
|
||||
@cached_property
|
||||
def object_is_const(self):
|
||||
return bool(lib.eolian_function_object_is_const(self._obj))
|
||||
return bool(lib.eolian_function_object_is_const(self))
|
||||
|
||||
@cached_property
|
||||
def class_(self):
|
||||
c_cls = lib.eolian_function_class_get(self._obj)
|
||||
c_cls = lib.eolian_function_class_get(self)
|
||||
return Class(c_cls) if c_cls else None
|
||||
|
||||
def is_constructor(self, klass):
|
||||
return bool(lib.eolian_function_is_constructor(self._obj, klass._obj))
|
||||
return bool(lib.eolian_function_is_constructor(self, klass._obj))
|
||||
|
||||
# @cached_property
|
||||
# def is_function_pointer(self):
|
||||
# return bool(lib.eolian_function_is_function_pointer(self._obj))
|
||||
# return bool(lib.eolian_function_is_function_pointer(self))
|
||||
|
||||
@property
|
||||
def parameters(self):
|
||||
return Iterator(Function_Parameter,
|
||||
lib.eolian_function_parameters_get(self._obj))
|
||||
lib.eolian_function_parameters_get(self))
|
||||
|
||||
def values_get(self, ftype): # TODO rename in property_values_get (or implement a proper Property class?)
|
||||
return Iterator(Function_Parameter,
|
||||
lib.eolian_property_values_get(self._obj, ftype))
|
||||
lib.eolian_property_values_get(self, ftype))
|
||||
|
||||
@property
|
||||
def getter_values(self): # TODO rename ...
|
||||
|
@ -918,7 +923,7 @@ class Function(Object):
|
|||
|
||||
def keys_get(self, ftype): # TODO rename in property_keys_get (or implement a proper Property class?)
|
||||
return Iterator(Function_Parameter,
|
||||
lib.eolian_property_keys_get(self._obj, ftype))
|
||||
lib.eolian_property_keys_get(self, ftype))
|
||||
|
||||
@property
|
||||
def getter_keys(self): # TODO rename ...
|
||||
|
@ -929,7 +934,7 @@ class Function(Object):
|
|||
return self.keys_get(Eolian_Function_Type.PROP_SET)
|
||||
|
||||
def return_type_get(self, ftype):
|
||||
c_type = lib.eolian_function_return_type_get(self._obj, ftype)
|
||||
c_type = lib.eolian_function_return_type_get(self, ftype)
|
||||
return Type(c_type) if c_type else None
|
||||
|
||||
def return_default_value(self, ftye):
|
||||
|
@ -937,11 +942,11 @@ class Function(Object):
|
|||
return Expression(c_expr) if c_expr else None
|
||||
|
||||
def return_documentation(self, ftype):
|
||||
c_doc = lib.eolian_function_return_documentation_get(self._obj, ftype)
|
||||
c_doc = lib.eolian_function_return_documentation_get(self, ftype)
|
||||
return Documentation(c_doc) if c_doc else None
|
||||
|
||||
def return_is_warn_unused(self, ftype):
|
||||
return bool(lib.eolian_function_return_is_warn_unused(self._obj, ftype))
|
||||
return bool(lib.eolian_function_return_is_warn_unused(self, ftype))
|
||||
|
||||
@cached_property
|
||||
def method_return_type(self):
|
||||
|
@ -959,19 +964,19 @@ class Function(Object):
|
|||
def prop_readable(self):
|
||||
# TODO: maybe there is a better way to do this...
|
||||
ftype = Eolian_Function_Type.PROP_GET
|
||||
scope = lib.eolian_function_scope_get(self._obj, ftype)
|
||||
scope = lib.eolian_function_scope_get(self, ftype)
|
||||
return True if scope != Eolian_Object_Scope.UNKNOWN else False
|
||||
|
||||
@cached_property
|
||||
def prop_writable(self):
|
||||
# TODO: maybe there is a better way to do this...
|
||||
ftype = Eolian_Function_Type.PROP_SET
|
||||
scope = lib.eolian_function_scope_get(self._obj, ftype)
|
||||
scope = lib.eolian_function_scope_get(self, ftype)
|
||||
return True if scope != Eolian_Object_Scope.UNKNOWN else False
|
||||
|
||||
@cached_property
|
||||
def implement(self):
|
||||
c_impl = lib.eolian_function_implement_get(self._obj)
|
||||
c_impl = lib.eolian_function_implement_get(self)
|
||||
return Implement(c_impl) if c_impl else None
|
||||
|
||||
|
||||
|
@ -982,33 +987,33 @@ class Function_Parameter(Object):
|
|||
|
||||
@cached_property
|
||||
def direction(self):
|
||||
return Eolian_Parameter_Dir(lib.eolian_parameter_direction_get(self._obj))
|
||||
return Eolian_Parameter_Dir(lib.eolian_parameter_direction_get(self))
|
||||
|
||||
@cached_property
|
||||
def documentation(self):
|
||||
c_doc = lib.eolian_parameter_documentation_get(self._obj)
|
||||
c_doc = lib.eolian_parameter_documentation_get(self)
|
||||
return Documentation(c_doc) if c_doc else None
|
||||
|
||||
@cached_property
|
||||
def is_nonull(self):
|
||||
return bool(lib.eolian_parameter_is_nonull(self._obj))
|
||||
return bool(lib.eolian_parameter_is_nonull(self))
|
||||
|
||||
@cached_property
|
||||
def is_nullable(self):
|
||||
return bool(lib.eolian_parameter_is_nullable(self._obj))
|
||||
return bool(lib.eolian_parameter_is_nullable(self))
|
||||
|
||||
@cached_property
|
||||
def is_optional(self):
|
||||
return bool(lib.eolian_parameter_is_optional(self._obj))
|
||||
return bool(lib.eolian_parameter_is_optional(self))
|
||||
|
||||
@cached_property
|
||||
def type(self):
|
||||
c_type = lib.eolian_parameter_type_get(self._obj)
|
||||
c_type = lib.eolian_parameter_type_get(self)
|
||||
return Type(c_type) if c_type else None
|
||||
|
||||
@cached_property
|
||||
def default_value(self):
|
||||
c_expr = lib.eolian_parameter_default_value_get(self._obj)
|
||||
c_expr = lib.eolian_parameter_default_value_get(self)
|
||||
return Expression(c_expr) if c_expr else None
|
||||
|
||||
|
||||
|
@ -1018,39 +1023,39 @@ class Implement(Object):
|
|||
|
||||
@cached_property
|
||||
def class_(self):
|
||||
c_cls = lib.eolian_implement_class_get(self._obj)
|
||||
c_cls = lib.eolian_implement_class_get(self)
|
||||
return Class(c_cls) if c_cls else None
|
||||
|
||||
@cached_property
|
||||
def function(self):
|
||||
c_func = lib.eolian_implement_function_get(self._obj, None)
|
||||
c_func = lib.eolian_implement_function_get(self, None)
|
||||
return Function(c_func) if c_func else None
|
||||
|
||||
def documentation_get(self, ftype=Eolian_Function_Type.METHOD):
|
||||
# something strange in this eolian api :/ (see 'documentation' property
|
||||
c_doc = lib.eolian_implement_documentation_get(self._obj, ftype)
|
||||
c_doc = lib.eolian_implement_documentation_get(self, ftype)
|
||||
return Documentation(c_doc) if c_doc else None
|
||||
# TODO implement util properties for documentation_get
|
||||
|
||||
def is_auto(self, ftype=Eolian_Function_Type.METHOD):
|
||||
return bool(lib.eolian_implement_is_auto(self._obj, ftype))
|
||||
return bool(lib.eolian_implement_is_auto(self, ftype))
|
||||
# TODO implement util properties for is_auto
|
||||
|
||||
def is_empty(self, ftype=Eolian_Function_Type.METHOD):
|
||||
return bool(lib.eolian_implement_is_empty(self._obj, ftype))
|
||||
return bool(lib.eolian_implement_is_empty(self, ftype))
|
||||
# TODO implement util properties for is_empty
|
||||
|
||||
def is_pure_virtual(self, ftype=Eolian_Function_Type.METHOD):
|
||||
return bool(lib.eolian_implement_is_pure_virtual(self._obj, ftype))
|
||||
return bool(lib.eolian_implement_is_pure_virtual(self, ftype))
|
||||
# TODO implement util properties for is_pure_virtual
|
||||
|
||||
@cached_property
|
||||
def is_prop_set(self):
|
||||
return bool(lib.eolian_implement_is_prop_set(self._obj))
|
||||
return bool(lib.eolian_implement_is_prop_set(self))
|
||||
|
||||
@cached_property
|
||||
def is_prop_get(self):
|
||||
return bool(lib.eolian_implement_is_prop_get(self._obj))
|
||||
return bool(lib.eolian_implement_is_prop_get(self))
|
||||
|
||||
@property
|
||||
def is_property(self):
|
||||
|
@ -1068,18 +1073,18 @@ class Type(Object):
|
|||
|
||||
@cached_property
|
||||
def free_func(self):
|
||||
return _str_to_py(lib.eolian_type_free_func_get(self._obj))
|
||||
return _str_to_py(lib.eolian_type_free_func_get(self))
|
||||
|
||||
@cached_property
|
||||
def type(self):
|
||||
return Eolian_Type_Type(lib.eolian_type_type_get(self._obj))
|
||||
return Eolian_Type_Type(lib.eolian_type_type_get(self))
|
||||
|
||||
@cached_property
|
||||
def builtin_type(self):
|
||||
return Eolian_Type_Builtin_Type(lib.eolian_type_builtin_type_get(self._obj))
|
||||
return Eolian_Type_Builtin_Type(lib.eolian_type_builtin_type_get(self))
|
||||
|
||||
def c_type_get(self, ctype):
|
||||
s = lib.eolian_type_c_type_get(self._obj, ctype)
|
||||
s = lib.eolian_type_c_type_get(self, ctype)
|
||||
ret = _str_to_py(s)
|
||||
lib.eina_stringshare_del(c_void_p(s))
|
||||
return ret
|
||||
|
@ -1098,40 +1103,40 @@ class Type(Object):
|
|||
|
||||
@cached_property
|
||||
def typedecl(self):
|
||||
c_tdecl = lib.eolian_type_typedecl_get(self._obj)
|
||||
c_tdecl = lib.eolian_type_typedecl_get(self)
|
||||
return Typedecl(c_tdecl) if c_tdecl else None
|
||||
|
||||
@cached_property
|
||||
def base_type(self):
|
||||
c_type = lib.eolian_type_base_type_get(self._obj)
|
||||
c_type = lib.eolian_type_base_type_get(self)
|
||||
return Type(c_type) if c_type else None
|
||||
|
||||
@cached_property
|
||||
def next_type(self):
|
||||
c_type = lib.eolian_type_next_type_get(self._obj)
|
||||
c_type = lib.eolian_type_next_type_get(self)
|
||||
return Type(c_type) if c_type else None
|
||||
|
||||
@cached_property
|
||||
def aliased_base(self):
|
||||
c_type = lib.eolian_type_aliased_base_get(self._obj)
|
||||
c_type = lib.eolian_type_aliased_base_get(self)
|
||||
return Type(c_type) if c_type else None
|
||||
|
||||
@cached_property
|
||||
def class_(self):
|
||||
c_cls = lib.eolian_type_class_get(self._obj)
|
||||
c_cls = lib.eolian_type_class_get(self)
|
||||
return Class(c_cls) if c_cls else None
|
||||
|
||||
@cached_property
|
||||
def is_owned(self):
|
||||
return bool(lib.eolian_type_is_owned(self._obj))
|
||||
return bool(lib.eolian_type_is_owned(self))
|
||||
|
||||
@cached_property
|
||||
def is_const(self):
|
||||
return bool(lib.eolian_type_is_const(self._obj))
|
||||
return bool(lib.eolian_type_is_const(self))
|
||||
|
||||
@cached_property
|
||||
def is_ptr(self):
|
||||
return bool(lib.eolian_type_is_ptr(self._obj))
|
||||
return bool(lib.eolian_type_is_ptr(self))
|
||||
|
||||
|
||||
class Typedecl(Object):
|
||||
|
@ -1140,63 +1145,63 @@ class Typedecl(Object):
|
|||
|
||||
@cached_property
|
||||
def type(self):
|
||||
return Eolian_Typedecl_Type(lib.eolian_typedecl_type_get(self._obj))
|
||||
return Eolian_Typedecl_Type(lib.eolian_typedecl_type_get(self))
|
||||
|
||||
@cached_property
|
||||
def c_type(self):
|
||||
s = lib.eolian_typedecl_c_type_get(self._obj)
|
||||
s = lib.eolian_typedecl_c_type_get(self)
|
||||
ret = _str_to_py(s)
|
||||
lib.eina_stringshare_del(c_void_p(s))
|
||||
return ret
|
||||
|
||||
@cached_property
|
||||
def free_func(self):
|
||||
return _str_to_py(lib.eolian_typedecl_free_func_get(self._obj))
|
||||
return _str_to_py(lib.eolian_typedecl_free_func_get(self))
|
||||
|
||||
@cached_property
|
||||
def is_extern(self):
|
||||
return bool(lib.eolian_typedecl_is_extern(self._obj))
|
||||
return bool(lib.eolian_typedecl_is_extern(self))
|
||||
|
||||
@property
|
||||
def enum_fields(self):
|
||||
return Iterator(Enum_Type_Field,
|
||||
lib.eolian_typedecl_enum_fields_get(self._obj))
|
||||
lib.eolian_typedecl_enum_fields_get(self))
|
||||
|
||||
def enum_field_get(self, field):
|
||||
c_field = lib.eolian_typedecl_enum_field_get(self._obj, _str_to_bytes(field))
|
||||
c_field = lib.eolian_typedecl_enum_field_get(self, _str_to_bytes(field))
|
||||
return Enum_Type_Field(c_field) if c_field else None
|
||||
|
||||
@property
|
||||
def struct_fields(self):
|
||||
return Iterator(Struct_Type_Field,
|
||||
lib.eolian_typedecl_struct_fields_get(self._obj))
|
||||
lib.eolian_typedecl_struct_fields_get(self))
|
||||
|
||||
def struct_field_get(self, field):
|
||||
c_field = lib.eolian_typedecl_struct_field_get(self._obj, _str_to_bytes(field))
|
||||
c_field = lib.eolian_typedecl_struct_field_get(self, _str_to_bytes(field))
|
||||
return Struct_Type_Field(c_field) if c_field else None
|
||||
|
||||
@cached_property
|
||||
def base_type(self):
|
||||
c_type = lib.eolian_typedecl_base_type_get(self._obj)
|
||||
c_type = lib.eolian_typedecl_base_type_get(self)
|
||||
return Type(c_type) if c_type else None
|
||||
|
||||
@cached_property
|
||||
def aliased_base(self):
|
||||
c_type = lib.eolian_typedecl_aliased_base_get(self._obj)
|
||||
c_type = lib.eolian_typedecl_aliased_base_get(self)
|
||||
return Type(c_type) if c_type else None
|
||||
|
||||
@cached_property
|
||||
def documentation(self):
|
||||
c_doc = lib.eolian_typedecl_documentation_get(self._obj)
|
||||
c_doc = lib.eolian_typedecl_documentation_get(self)
|
||||
return Documentation(c_doc) if c_doc else None
|
||||
|
||||
@cached_property
|
||||
def enum_legacy_prefix(self):
|
||||
return _str_to_py(lib.eolian_typedecl_enum_legacy_prefix_get(self._obj))
|
||||
return _str_to_py(lib.eolian_typedecl_enum_legacy_prefix_get(self))
|
||||
|
||||
@cached_property
|
||||
def function_pointer(self):
|
||||
c_func = lib.eolian_typedecl_function_pointer_get(self._obj)
|
||||
c_func = lib.eolian_typedecl_function_pointer_get(self)
|
||||
return Function(c_func) if c_func else None
|
||||
|
||||
|
||||
|
@ -1206,19 +1211,19 @@ class Enum_Type_Field(Object):
|
|||
|
||||
@cached_property
|
||||
def c_name(self):
|
||||
s = lib.eolian_typedecl_enum_field_c_name_get(self._obj)
|
||||
s = lib.eolian_typedecl_enum_field_c_name_get(self)
|
||||
ret = _str_to_py(s)
|
||||
lib.eina_stringshare_del(c_void_p(s))
|
||||
return ret
|
||||
|
||||
@cached_property
|
||||
def value(self):
|
||||
c_expr = lib.eolian_typedecl_enum_field_value_get(self._obj, True)
|
||||
c_expr = lib.eolian_typedecl_enum_field_value_get(self, True)
|
||||
return Expression(c_expr) if c_expr else None
|
||||
|
||||
@cached_property
|
||||
def documentation(self):
|
||||
c_doc = lib.eolian_typedecl_enum_field_documentation_get(self._obj)
|
||||
c_doc = lib.eolian_typedecl_enum_field_documentation_get(self)
|
||||
return Documentation(c_doc) if c_doc else None
|
||||
|
||||
|
||||
|
@ -1228,12 +1233,12 @@ class Struct_Type_Field(Object):
|
|||
|
||||
@cached_property
|
||||
def type(self):
|
||||
c_type = lib.eolian_typedecl_struct_field_type_get(self._obj)
|
||||
c_type = lib.eolian_typedecl_struct_field_type_get(self)
|
||||
return Type(c_type) if c_type else None
|
||||
|
||||
@cached_property
|
||||
def documentation(self):
|
||||
c_doc = lib.eolian_typedecl_struct_field_documentation_get(self._obj)
|
||||
c_doc = lib.eolian_typedecl_struct_field_documentation_get(self)
|
||||
return Documentation(c_doc) if c_doc else None
|
||||
|
||||
|
||||
|
@ -1243,40 +1248,40 @@ class Expression(Object):
|
|||
|
||||
@cached_property
|
||||
def type(self):
|
||||
return Eolian_Expression_Type(lib.eolian_expression_type_get(self._obj))
|
||||
return Eolian_Expression_Type(lib.eolian_expression_type_get(self))
|
||||
|
||||
# TODO: EAPI Eolian_Value eolian_expression_value_get(const Eolian_Expression *expr);
|
||||
|
||||
@cached_property
|
||||
def serialize(self):
|
||||
s = lib.eolian_expression_serialize(self._obj)
|
||||
s = lib.eolian_expression_serialize(self)
|
||||
ret = _str_to_py(s)
|
||||
lib.eina_stringshare_del(c_void_p(s))
|
||||
return ret
|
||||
|
||||
@cached_property
|
||||
def binary_operator(self):
|
||||
c_op = lib.eolian_expression_binary_operator_get(self._obj)
|
||||
c_op = lib.eolian_expression_binary_operator_get(self)
|
||||
return Eolian_Binary_Operator(c_op) if c_op is not None else None
|
||||
|
||||
@cached_property
|
||||
def binary_lhs(self):
|
||||
c_expr = lib.eolian_expression_binary_lhs_get(self._obj)
|
||||
c_expr = lib.eolian_expression_binary_lhs_get(self)
|
||||
return Expression(c_expr) if c_expr else None
|
||||
|
||||
@cached_property
|
||||
def binary_rhs(self):
|
||||
c_expr = lib.eolian_expression_binary_rhs_get(self._obj)
|
||||
c_expr = lib.eolian_expression_binary_rhs_get(self)
|
||||
return Expression(c_expr) if c_expr else None
|
||||
|
||||
@cached_property
|
||||
def unary_operator(self):
|
||||
c_op = lib.eolian_expression_unary_operator_get(self._obj)
|
||||
c_op = lib.eolian_expression_unary_operator_get(self)
|
||||
return Eolian_Unary_Operator(c_op) if c_op is not None else None
|
||||
|
||||
@cached_property
|
||||
def unary_expression(self):
|
||||
c_expr = lib.eolian_expression_unary_expression_get(self._obj)
|
||||
c_expr = lib.eolian_expression_unary_expression_get(self)
|
||||
return Expression(c_expr) if c_expr is not None else None
|
||||
|
||||
|
||||
|
@ -1286,25 +1291,25 @@ class Variable(Object):
|
|||
|
||||
@cached_property
|
||||
def type(self):
|
||||
return Eolian_Variable_Type(lib.eolian_variable_type_get(self._obj))
|
||||
return Eolian_Variable_Type(lib.eolian_variable_type_get(self))
|
||||
|
||||
@cached_property
|
||||
def value(self):
|
||||
c_expr = lib.eolian_variable_value_get(self._obj)
|
||||
c_expr = lib.eolian_variable_value_get(self)
|
||||
return Expression(c_expr) if c_expr else None
|
||||
|
||||
@cached_property
|
||||
def base_type(self):
|
||||
c_type = lib.eolian_variable_base_type_get(self._obj)
|
||||
c_type = lib.eolian_variable_base_type_get(self)
|
||||
return Type(c_type) if c_type else None
|
||||
|
||||
@cached_property
|
||||
def is_extern(self):
|
||||
return bool(lib.eolian_variable_is_extern(self._obj))
|
||||
return bool(lib.eolian_variable_is_extern(self))
|
||||
|
||||
@cached_property
|
||||
def documentation(self):
|
||||
c_doc = lib.eolian_variable_documentation_get(self._obj)
|
||||
c_doc = lib.eolian_variable_documentation_get(self)
|
||||
return Documentation(c_doc) if c_doc else None
|
||||
|
||||
|
||||
|
@ -1324,15 +1329,15 @@ class Documentation(Object): # OK (1 TODO Unit*)
|
|||
|
||||
@cached_property
|
||||
def summary(self):
|
||||
return _str_to_py(lib.eolian_documentation_summary_get(self._obj))
|
||||
return _str_to_py(lib.eolian_documentation_summary_get(self))
|
||||
|
||||
@cached_property
|
||||
def description(self):
|
||||
return _str_to_py(lib.eolian_documentation_description_get(self._obj))
|
||||
return _str_to_py(lib.eolian_documentation_description_get(self))
|
||||
|
||||
@cached_property
|
||||
def since(self):
|
||||
return _str_to_py(lib.eolian_documentation_since_get(self._obj))
|
||||
return _str_to_py(lib.eolian_documentation_since_get(self))
|
||||
|
||||
@cached_property
|
||||
def summary_tokens(self):
|
||||
|
|
Loading…
Reference in New Issue