summaryrefslogtreecommitdiff
path: root/src/scripts/pyolian/eolian.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/scripts/pyolian/eolian.py')
-rw-r--r--src/scripts/pyolian/eolian.py840
1 files changed, 416 insertions, 424 deletions
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index c15f167433..556f47720d 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -207,14 +207,6 @@ class Eolian_Unary_Operator(IntEnum):
NOT = 3 # ! int, float, bool
BNOT = 4 # ~ int
-class Eolian_Declaration_Type(IntEnum):
- UNKNOWN = 0
- CLASS = 1
- ALIAS = 2
- STRUCT = 3
- ENUM = 4
- VAR = 5
-
class Eolian_Doc_Token_Type(IntEnum):
UNKNOWN = 0
TEXT = 1
@@ -225,18 +217,6 @@ class Eolian_Doc_Token_Type(IntEnum):
MARK_TODO = 6
MARKUP_MONOSPACE = 7
-class Eolian_Doc_Ref_Type(IntEnum):
- INVALID = 0
- CLASS = 1
- FUNC = 2
- EVENT = 3
- ALIAS = 4
- STRUCT = 5
- STRUCT_FIELD = 6
- ENUM = 7
- ENUM_FIELD = 8
- VAR = 9
-
### internal Classes ########################################################
@@ -283,7 +263,7 @@ class EolianBaseObject(object):
if c_obj_pointer is None:
return super().__new__(cls)
- # cache based on the c pointer value (assume the eolian db is stabe)
+ # cache based on the c pointer value (assume the eolian db is stable)
if isinstance(c_obj_pointer, c_void_p):
key = c_obj_pointer.value
elif isinstance(c_obj_pointer, int):
@@ -312,160 +292,202 @@ class EolianBaseObject(object):
if isinstance(other, EolianBaseObject):
return self._obj.value == other._obj.value
elif isinstance(other, str):
- if hasattr(self, 'full_name'):
- return self.full_name == other
- elif hasattr(self, 'name'):
+ if hasattr(self, 'name'):
return self.name == other
+ elif hasattr(self, 'short_name'):
+ return self.short_name == other
return False
+ def __gt__(self, other):
+ if isinstance(other, EolianBaseObject):
+ if hasattr(self, 'name'):
+ return self.name > other.name
+ elif hasattr(self, 'short_name'):
+ return self.short_name > other.short_name
+
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 ########################################################
class Eolian_Unit(EolianBaseObject):
- def class_get_by_name(self, class_name):
- c_cls = lib.eolian_class_get_by_name(self._obj, _str_to_bytes(class_name))
- return Class(c_cls) if c_cls else None
-
- def class_get_by_file(self, file_name):
- c_cls = lib.eolian_class_get_by_file(self._obj, _str_to_bytes(file_name))
- return Class(c_cls) if c_cls else None
+ def __repr__(self):
+ return "<eolian.Eolian_Unit '{0.file}'>".format(self)
@property
- def all_classes(self):
- return Iterator(Class, lib.eolian_all_classes_get(self._obj))
+ def children(self):
+ return Iterator(Eolian_Unit, lib.eolian_unit_children_get(self))
- @property
- def all_namespaces(self):
- # TODO find a better way to find namespaces (maybe inside eolian?)
- nspaces = set()
- for obj in self.all_classes:
- nspaces.add(Namespace(self, obj.namespace))
- for obj in self.typedecl_all_aliases:
- nspaces.add(Namespace(self, obj.namespace))
- for obj in self.typedecl_all_structs:
- nspaces.add(Namespace(self, obj.namespace))
- for obj in self.typedecl_all_enums:
- nspaces.add(Namespace(self, obj.namespace))
- return sorted(nspaces)
+ @cached_property
+ def file(self):
+ return _str_to_py(lib.eolian_unit_file_get(self))
- def namespace_get_by_name(self, name):
- return Namespace(self, name)
+ @cached_property
+ def state(self):
+ c_state = lib.eolian_unit_state_get(self)
+ return Eolian_State(c_state) if c_state else None
@property
- def typedecl_all_enums(self):
- return Iterator(Typedecl, lib.eolian_typedecl_all_enums_get(self._obj))
+ def objects(self):
+ return Iterator(Object, lib.eolian_unit_objects_get(self))
- def typedecl_enum_get_by_name(self, name):
- c_tdecl = lib.eolian_typedecl_enum_get_by_name(self._obj, _str_to_bytes(name))
- return Typedecl(c_tdecl) if c_tdecl else None
+ def object_by_name_get(self, name):
+ c_obj = lib.eolian_unit_object_by_name_get(self, _str_to_bytes(name))
+ return Object(c_obj) if c_obj else None
- def typedecl_enums_get_by_file(self, fname):
- return Iterator(Typedecl,
- lib.eolian_typedecl_enums_get_by_file(self._obj, _str_to_bytes(fname)))
+ @property
+ def classes(self):
+ 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, _str_to_bytes(class_name))
+ return Class(c_cls) if c_cls else None
@property
- def typedecl_all_structs(self):
- return Iterator(Typedecl, lib.eolian_typedecl_all_structs_get(self._obj))
+ def constants(self):
+ return Iterator(Variable, lib.eolian_unit_constants_get(self))
- def typedecl_struct_get_by_name(self, name):
- c_tdecl = lib.eolian_typedecl_struct_get_by_name(self._obj, _str_to_bytes(name))
- return Typedecl(c_tdecl) if c_tdecl else None
+ def constant_by_name_get(self, name):
+ c_var = lib.eolian_unit_constant_by_name_get(self, _str_to_bytes(name))
+ return Variable(c_var) if c_var else None
- def typedecl_structs_get_by_file(self, fname):
- return Iterator(Typedecl,
- lib.eolian_typedecl_structs_get_by_file(self._obj, _str_to_bytes(fname)))
+ @property
+ def globals(self):
+ 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, _str_to_bytes(name))
+ return Variable(c_var) if c_var else None
@property
- def typedecl_all_aliases(self):
- return Iterator(Typedecl, lib.eolian_typedecl_all_aliases_get(self._obj))
+ def enums(self):
+ return Iterator(Typedecl, lib.eolian_unit_enums_get(self))
- def typedecl_alias_get_by_name(self, name):
- c_tdecl = lib.eolian_typedecl_alias_get_by_name(self._obj, _str_to_bytes(name))
+ def enum_by_name_get(self, name):
+ c_tdecl = lib.eolian_unit_enum_by_name_get(self, _str_to_bytes(name))
return Typedecl(c_tdecl) if c_tdecl else None
- def typedecl_aliases_get_by_file(self, fname):
- return Iterator(Typedecl,
- lib.eolian_typedecl_aliases_get_by_file(self._obj, _str_to_bytes(fname)))
-
@property
- def variable_all_constants(self):
- return Iterator(Variable, lib.eolian_variable_all_constants_get(self._obj))
-
- def variable_constant_get_by_name(self, name):
- c_var = lib.eolian_variable_constant_get_by_name(self._obj, _str_to_bytes(name))
- return Variable(c_var) if c_var else None
+ def structs(self):
+ return Iterator(Typedecl, lib.eolian_unit_structs_get(self))
- def variable_constants_get_by_file(self, fname):
- return Iterator(Variable,
- lib.eolian_variable_constants_get_by_file(self._obj, _str_to_bytes(fname)))
+ def struct_by_name_get(self, 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 variable_all_globals(self):
- return Iterator(Variable, lib.eolian_variable_all_globals_get(self._obj))
+ def aliases(self):
+ return Iterator(Typedecl, lib.eolian_unit_aliases_get(self))
- def variable_global_get_by_name(self, name):
- c_var = lib.eolian_variable_global_get_by_name(self._obj, _str_to_bytes(name))
- return Variable(c_var) if c_var else None
+ def alias_by_name_get(self, name):
+ c_tdecl = lib.eolian_unit_alias_by_name_get(self, _str_to_bytes(name))
+ return Typedecl(c_tdecl) if c_tdecl else None
- def variable_globals_get_by_file(self, fname):
- return Iterator(Variable,
- lib.eolian_variable_globals_get_by_file(self._obj, _str_to_bytes(fname)))
@property
- def all_declarations(self):
- return Iterator(Declaration, lib.eolian_all_declarations_get(self._obj))
-
- def declaration_get_by_name(self, name):
- c_decl = lib.eolian_declaration_get_by_name(self._obj, _str_to_bytes(name))
- return Declaration(c_decl) if c_decl else None
+ def all_namespaces(self):
+ # TODO find a better way to find namespaces (maybe inside eolian?)
+ nspaces = set()
+ for obj in self.classes:
+ nspaces.add(Namespace(self, obj.namespace))
+ for obj in self.aliases:
+ nspaces.add(Namespace(self, obj.namespace))
+ for obj in self.structs:
+ nspaces.add(Namespace(self, obj.namespace))
+ for obj in self.enums:
+ nspaces.add(Namespace(self, obj.namespace))
+ return sorted(nspaces)
- def declarations_get_by_file(self, fname):
- return Iterator(Declaration,
- lib.eolian_declarations_get_by_file(self._obj, _str_to_bytes(fname)))
+ def namespace_get_by_name(self, name):
+ return Namespace(self, name)
-class Eolian(Eolian_Unit):
- def __init__(self):
- self._obj = lib.eolian_new() # Eolian *
+class Eolian_State(Eolian_Unit):
+ def __init__(self, c_state=None):
+ if c_state is None:
+ c_state = lib.eolian_state_new() # Eolian_State *
+ EolianBaseObject.__init__(self, c_state)
def __del__(self):
if not _already_halted: # do not free after eolian_shutdown
- lib.eolian_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_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 all_eo_file_paths(self):
- return Iterator(_str_to_py, lib.eolian_all_eo_file_paths_get(self._obj))
+ def eo_file_paths(self):
+ return Iterator(_str_to_py, lib.eolian_state_eo_file_paths_get(self))
@property
- def all_eot_file_paths(self):
- return Iterator(_str_to_py, lib.eolian_all_eot_file_paths_get(self._obj))
+ def eot_file_paths(self):
+ return Iterator(_str_to_py, lib.eolian_state_eot_file_paths_get(self))
@property
- def all_eo_files(self):
- return Iterator(_str_to_py, lib.eolian_all_eo_files_get(self._obj))
+ def eo_files(self):
+ return Iterator(_str_to_py, lib.eolian_state_eo_files_get(self))
@property
- def all_eot_files(self):
- return Iterator(_str_to_py, lib.eolian_all_eot_files_get(self._obj))
+ def eot_files(self):
+ return Iterator(_str_to_py, lib.eolian_state_eot_files_get(self))
- def directory_scan(self, dir_path):
- return bool(lib.eolian_directory_scan(self._obj, _str_to_bytes(dir_path)))
+ def directory_add(self, dir_path):
+ return bool(lib.eolian_state_directory_add(self, _str_to_bytes(dir_path)))
- def system_directory_scan(self):
- return bool(lib.eolian_system_directory_scan(self._obj))
+ def system_directory_add(self):
+ return bool(lib.eolian_state_system_directory_add(self))
def all_eo_files_parse(self):
- return bool(lib.eolian_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_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, _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))
+
+ def objects_by_file_get(self, file_name):
+ return Iterator(Object,
+ 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, _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, _str_to_bytes(file_name)))
+
+ def globals_by_file_get(self, file_name):
+ return Iterator(Variable,
+ 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, _str_to_bytes(file_name)))
+
+ def structs_by_file_get(self, file_name):
+ return Iterator(Typedecl,
+ 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, _str_to_bytes(file_name)))
### Namespace Utility Class #################################################
@@ -479,7 +501,11 @@ class Namespace(object):
return "<eolian.Namespace '{0._name}'>".format(self)
def __eq__(self, other):
- return self.name == other.name
+ if isinstance(other, Namespace):
+ return self.name == other.name
+ if isinstance(other, str):
+ return self.name == other
+ raise TypeError('Namespace can only compare with Namespace or str')
def __lt__(self, other):
return self.name < other.name
@@ -499,120 +525,170 @@ class Namespace(object):
return self._name.split('.')
@property
+ def sub_namespaces(self):
+ base = self._name + '.'
+ deep = self._name.count('.') + 1
+ return [ ns for ns in self._unit.all_namespaces
+ if ns.name.startswith(base) and ns.name.count('.') == deep ]
+
+
+ @property
def classes(self):
- return [ c for c in self._unit.all_classes
- if c.namespace == self._name ]
+ return sorted([ c for c in self._unit.classes
+ if c.namespace == self._name ])
@property
def regulars(self):
- return [ c for c in self._unit.all_classes
- if c.type == Eolian_Class_Type.REGULAR and
- c.namespace == self._name]
+ return sorted([ c for c in self._unit.classes
+ if c.type == Eolian_Class_Type.REGULAR and
+ c.namespace == self._name])
+
+ @property
+ def abstracts(self):
+ return sorted([ c for c in self._unit.classes
+ if c.type == Eolian_Class_Type.ABSTRACT and
+ c.namespace == self._name])
@property
def mixins(self):
- return [ c for c in self._unit.all_classes
- if c.type == Eolian_Class_Type.MIXIN and
- c.namespace == self._name]
+ return sorted([ c for c in self._unit.classes
+ if c.type == Eolian_Class_Type.MIXIN and
+ c.namespace == self._name])
@property
def interfaces(self):
- return [ c for c in self._unit.all_classes
- if c.type == Eolian_Class_Type.INTERFACE and
- c.namespace == self._name]
+ return sorted([ c for c in self._unit.classes
+ if c.type == Eolian_Class_Type.INTERFACE and
+ c.namespace == self._name])
@property
def aliases(self):
- return [ td for td in self._unit.typedecl_all_aliases
- if td.namespace == self._name]
+ return sorted([ td for td in self._unit.aliases
+ if td.namespace == self._name])
@property
def structs(self):
- return [ td for td in self._unit.typedecl_all_structs
- if td.namespace == self._name]
+ return sorted([ td for td in self._unit.structs
+ if td.namespace == self._name])
@property
def enums(self):
- return [ td for td in self._unit.typedecl_all_enums
- if td.namespace == self._name]
+ return sorted([ td for td in self._unit.enums
+ if td.namespace == self._name])
### Eolian Classes ##########################################################
-class Class(EolianBaseObject):
+class Object(EolianBaseObject):
+ def __new__(cls, c_obj_pointer):
+ if cls is Object:
+ c_type = lib.eolian_object_type_get(c_obj_pointer)
+ cls = _eolian_type_class_mapping[c_type]
+ return super().__new__(cls)
+
def __repr__(self):
- return "<eolian.Class '{0.full_name}', {0.type!s}>".format(self)
+ return "<eolian.Object '{0.name}', {0.type!s}>".format(self)
+
+ @cached_property
+ def unit(self):
+ 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_class_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))
+
+ @property
+ def namespaces(self):
+ return Iterator(_str_to_py, lib.eolian_object_namespaces_get(self))
+
+ @cached_property
+ def namespace(self):
+ return '.'.join(self.namespaces)
@cached_property
- def full_name(self):
- return _str_to_py(lib.eolian_class_full_name_get(self._obj))
+ def file(self):
+ return _str_to_py(lib.eolian_object_file_get(self))
+
+ @cached_property
+ def line(self):
+ return int(lib.eolian_object_line_get(self))
+
+ @cached_property
+ def column(self):
+ return int(lib.eolian_object_column_get(self))
+
+
+class Class(Object):
+ def __repr__(self):
+ return "<eolian.Class '{0.name}', {0.type!s}>".format(self)
@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_get_by_name(self, event_name):
- c_event = lib.eolian_class_event_get_by_name(self._obj,
+ def event_by_name_get(self, event_name):
+ 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):
@@ -641,35 +717,23 @@ class Class(EolianBaseObject):
if len(inherits) > 0:
return inherits[0]
- @property
- def namespaces(self):
- return Iterator(_str_to_py, lib.eolian_class_namespaces_get(self._obj))
-
- @cached_property
- def namespace(self):
- return '.'.join(self.namespaces)
-
- @cached_property
- def file(self):
- return _str_to_py(lib.eolian_class_file_get(self._obj))
-
@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_get_by_name(self, func_name,
+ def function_by_name_get(self, func_name,
ftype=Eolian_Function_Type.UNRESOLVED):
- f = lib.eolian_class_function_get_by_name(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):
@@ -681,104 +745,88 @@ class Class(EolianBaseObject):
@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(EolianBaseObject):
+class Part(Object):
def __repr__(self):
return "<eolian.Part '{0.name}'>".format(self)
@cached_property
- def name(self):
- return _str_to_py(lib.eolian_part_name_get(self._obj))
-
- @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
-class Constructor(EolianBaseObject):
+class Constructor(Object):
def __repr__(self):
- return "<eolian.Constructor '{0.full_name}', optional={0.is_optional}>".format(self)
-
- @cached_property
- def full_name(self):
- return _str_to_py(lib.eolian_constructor_full_name_get(self._obj))
+ return "<eolian.Constructor '{0.name}', optional={0.is_optional}>".format(self)
@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(EolianBaseObject):
+class Event(Object):
def __repr__(self):
return "<eolian.Event '{0.name}', c_name='{0.c_name}'>".format(self)
@cached_property
- def name(self):
- return _str_to_py(lib.eolian_event_name_get(self._obj))
-
- @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(EolianBaseObject):
+class Function(Object):
def __repr__(self):
return "<eolian.Function '{0.name}'>".format(self)
- @cached_property
- def name(self):
- return _str_to_py(lib.eolian_function_name_get(self._obj))
-
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
@@ -809,10 +857,10 @@ class Function(EolianBaseObject):
@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):
@@ -827,43 +875,43 @@ class Function(EolianBaseObject):
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 ...
@@ -875,7 +923,7 @@ class Function(EolianBaseObject):
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 ...
@@ -886,7 +934,7 @@ class Function(EolianBaseObject):
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):
@@ -894,11 +942,11 @@ class Function(EolianBaseObject):
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):
@@ -916,106 +964,98 @@ class Function(EolianBaseObject):
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
-class Function_Parameter(EolianBaseObject):
+class Function_Parameter(Object):
def __repr__(self):
return "<eolian.Function_Parameter '{0.name}', type={0.type}," \
" optional={0.is_optional}, nullable={0.is_nullable}>".format(self)
@cached_property
- def name(self):
- return _str_to_py(lib.eolian_parameter_name_get(self._obj))
-
- @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
-class Implement(EolianBaseObject):
+class Implement(Object):
def __repr__(self):
- return "<eolian.Implement '{0.full_name}'>".format(self)
-
- @cached_property
- def full_name(self):
- return _str_to_py(lib.eolian_implement_full_name_get(self._obj))
+ return "<eolian.Implement '{0.name}'>".format(self)
@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):
@@ -1026,348 +1066,263 @@ class Implement(EolianBaseObject):
return not self.is_property
-class Type(EolianBaseObject): # OK (4 TODO Unit*)
+class Type(Object):
def __repr__(self):
- # return "<eolian.Type '{0.full_name}', type: {0.type!s}, c_type: '{0.c_type}'>".format(self)
- return "<eolian.Type '{0.full_name}', type={0.type!s}>".format(self)
+ # return "<eolian.Type '{0.name}', type: {0.type!s}, c_type: '{0.c_type}'>".format(self)
+ return "<eolian.Type '{0.name}', type={0.type!s}>".format(self)
@cached_property
- def name(self):
- return _str_to_py(lib.eolian_type_name_get(self._obj))
+ def free_func(self):
+ return _str_to_py(lib.eolian_type_free_func_get(self))
@cached_property
- def full_name(self):
- return _str_to_py(lib.eolian_type_full_name_get(self._obj))
-
- @property
- def namespaces(self):
- return Iterator(_str_to_py, lib.eolian_type_namespaces_get(self._obj))
+ def type(self):
+ return Eolian_Type_Type(lib.eolian_type_type_get(self))
@cached_property
- def namespace(self):
- return '.'.join(self.namespaces)
+ def builtin_type(self):
+ return Eolian_Type_Builtin_Type(lib.eolian_type_builtin_type_get(self))
- @cached_property
- def free_func(self):
- return _str_to_py(lib.eolian_type_free_func_get(self._obj))
+ def c_type_get(self, 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
@cached_property
- def type(self):
- return Eolian_Type_Type(lib.eolian_type_type_get(self._obj))
+ def c_type_default(self):
+ return self.c_type_get(Eolian_C_Type_Type.DEFAULT)
@cached_property
- def builtin_type(self):
- return Eolian_Type_Builtin_Type(lib.eolian_type_builtin_type_get(self._obj))
+ def c_type_param(self):
+ return self.c_type_get(Eolian_C_Type_Type.PARAM)
- # TODO FIXME STRANGE API (need Eolian_Unit*)
@cached_property
- def c_type(self):
- # return _str_to_py(lib.eolian_type_c_type_get(self._obj))
- return 'FIXME'
+ def c_type_return(self):
+ return self.c_type_get(Eolian_C_Type_Type.RETURN)
- # TODO FIXME STRANGE API (need Eolian_Unit*)
- # @cached_property
- # def typedecl(self):
- # c_tdecl = lib.eolian_type_typedecl_get(self._obj)
- # return Typedecl(c_tdecl) if c_tdecl else None
+ @cached_property
+ def typedecl(self):
+ 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
- # TODO FIXME STRANGE API (need Eolian_Unit*)
- # @cached_property
- # def aliased_base(self):
- # c_type = lib.eolian_type_aliased_base_get(self._obj)
- # return Type(c_type) if c_type else None
-
- # TODO FIXME STRANGE API (need Eolian_Unit*)
- # @cached_property
- # def class_(self):
- # c_cls = lib.eolian_type_class_get(self._obj)
- # return Class(c_cls) if c_cls else None
+ @cached_property
+ def aliased_base(self):
+ c_type = lib.eolian_type_aliased_base_get(self)
+ return Type(c_type) if c_type else None
@cached_property
- def file(self):
- return _str_to_py(lib.eolian_type_file_get(self._obj))
+ def class_(self):
+ 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(EolianBaseObject): # OK (2 TODO Unit*)
+class Typedecl(Object):
def __repr__(self):
- return "<eolian.Typedecl '{0.full_name}', type={0.type!s}>".format(self)
-
- @cached_property
- def name(self):
- return _str_to_py(lib.eolian_typedecl_name_get(self._obj))
-
- @cached_property
- def full_name(self):
- return _str_to_py(lib.eolian_typedecl_full_name_get(self._obj))
-
- @cached_property
- def file(self):
- return _str_to_py(lib.eolian_typedecl_file_get(self._obj))
+ return "<eolian.Typedecl '{0.name}', type={0.type!s}>".format(self)
@cached_property
def type(self):
- return Eolian_Typedecl_Type(lib.eolian_typedecl_type_get(self._obj))
-
- # TODO FIX THIS, need Eolian_Unit* param ???
- # @cached_property
- # def c_type(self):
- # return _str_to_py(lib.eolian_typedecl_c_type_get(self._obj))
-
- @property
- def namespaces(self):
- return Iterator(_str_to_py, lib.eolian_typedecl_namespaces_get(self._obj))
+ return Eolian_Typedecl_Type(lib.eolian_typedecl_type_get(self))
@cached_property
- def namespace(self):
- return '.'.join(self.namespaces)
+ def c_type(self):
+ 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
- # TODO FIX THIS, need Eolian_Unit* param ???
- # @cached_property
- # def aliased_base(self):
- # c_type = lib.eolian_typedecl_aliased_base_get(self._obj)
- # return Type(c_type) if c_type else None
+ @cached_property
+ def aliased_base(self):
+ 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
-class Enum_Type_Field(EolianBaseObject):
+class Enum_Type_Field(Object):
def __repr__(self):
return "<eolian.Enum_Type_Field '{0.name}', c_name='{0.c_name}'>".format(self)
@cached_property
- def name(self):
- return _str_to_py(lib.eolian_typedecl_enum_field_name_get(self._obj))
-
- @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
-class Struct_Type_Field(EolianBaseObject):
+class Struct_Type_Field(Object):
def __repr__(self):
return "<eolian.Struct_Type_Field '{0.name}', type={0.type!s}>".format(self)
@cached_property
- def name(self):
- return _str_to_py(lib.eolian_typedecl_struct_field_name_get(self._obj))
-
- @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
-class Expression(EolianBaseObject):
+class Expression(Object):
def __repr__(self):
return "<eolian.Expression type={0.type!s}, serialize='{0.serialize}'>".format(self)
@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
-class Variable(EolianBaseObject):
+class Variable(Object):
def __repr__(self):
- return "<eolian.Variable '{0.full_name}', type={0.type!s}, file={0.file}>".format(self)
-
- @cached_property
- def name(self):
- return _str_to_py(lib.eolian_variable_name_get(self._obj))
-
- @cached_property
- def full_name(self):
- return _str_to_py(lib.eolian_variable_full_name_get(self._obj))
-
- @property
- def namespaces(self):
- return Iterator(_str_to_py, lib.eolian_variable_namespaces_get(self._obj))
-
- @cached_property
- def namespace(self):
- return '.'.join(self.namespaces)
+ return "<eolian.Variable '{0.name}', type={0.type!s}, file={0.file}>".format(self)
@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 file(self):
- return _str_to_py(lib.eolian_variable_file_get(self._obj))
-
- @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
-class Declaration(EolianBaseObject):
- def __repr__(self):
- return "<eolian.Declaration '{0.name}'>".format(self)
-
- @cached_property
- def name(self):
- return _str_to_py(lib.eolian_declaration_name_get(self._obj))
-
- @cached_property
- def type(self):
- return Eolian_Declaration_Type(lib.eolian_declaration_type_get(self._obj))
-
- @cached_property
- def class_(self):
- c_cls = lib.eolian_declaration_class_get(self._obj)
- return Class(c_cls) if c_cls else None
-
- @cached_property
- def data_type(self):
- c_typedec = lib.eolian_declaration_data_type_get(self._obj)
- return Typedecl(c_typedec) if c_typedec else None
-
- @cached_property
- def variable(self):
- c_var = lib.eolian_declaration_variable_get(self._obj)
- return Variable(c_var) if c_var else None
-
-
class _Eolian_Doc_Token_Struct(ctypes.Structure):
_fields_ = [("type", c_int),
("text", c_char_p),
("text_end", c_char_p)]
-class Documentation(EolianBaseObject): # OK (1 TODO Unit*)
- # def __repr__(self):
- # return "<eolian.Documentation '{0.name}'>".format(self)
+class Documentation(Object): # OK (1 TODO Unit*)
+ def __repr__(self):
+ t = self.summary if len(self.summary) < 40 else self.summary[:40] + '...'
+ return "<eolian.Documentation summary='{}'>".format(t)
# this is too much for py, just use string.split('\n\n') instead
# def string_split(self, string):
@@ -1375,15 +1330,15 @@ class Documentation(EolianBaseObject): # 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):
@@ -1463,6 +1418,43 @@ def _str_to_py(s):
print('WARNING !!!!!!!!! Unknown type: %s' % type(s))
+### internal Object type -> Class mapping ###################################
+
+class _Eolian_Object_Type(IntEnum):
+ UNKNOWN = 0
+ CLASS = 1
+ TYPEDECL = 2
+ STRUCT_FIELD = 3
+ ENUM_FIELD = 4
+ TYPE = 5
+ VARIABLE = 6
+ EXPRESSION = 7
+ FUNCTION = 8
+ FUNCTION_PARAMETER = 9
+ EVENT = 10
+ PART = 11
+ IMPLEMENT = 12
+ CONSTRUCTOR = 13
+ DOCUMENTATION = 14
+
+_eolian_type_class_mapping = {
+ _Eolian_Object_Type.UNKNOWN: Object,
+ _Eolian_Object_Type.CLASS: Class,
+ _Eolian_Object_Type.TYPEDECL: Typedecl,
+ _Eolian_Object_Type.STRUCT_FIELD: Struct_Type_Field,
+ _Eolian_Object_Type.ENUM_FIELD: Enum_Type_Field,
+ _Eolian_Object_Type.TYPE: Type,
+ _Eolian_Object_Type.VARIABLE: Variable,
+ _Eolian_Object_Type.EXPRESSION: Expression,
+ _Eolian_Object_Type.FUNCTION: Function,
+ _Eolian_Object_Type.FUNCTION_PARAMETER: Function_Parameter,
+ _Eolian_Object_Type.EVENT: Event,
+ _Eolian_Object_Type.PART: Part,
+ _Eolian_Object_Type.IMPLEMENT: Implement,
+ _Eolian_Object_Type.CONSTRUCTOR: Constructor,
+ _Eolian_Object_Type.DOCUMENTATION: Documentation,
+}
+
### module init/shutdown ####################################################
def _cleanup():
global _already_halted