Page MenuHomePhabricator

efl_access_text: ptr usage
Closed, ResolvedPublic

Description

There are 3 definitions in efl_access_text.eo that do look wrong.
First:

@property string @protected @beta {
   [[Gets string, start and end offset in text according to given initial offset and granularity.]]
   get {
   }
   keys {
      granularity: Efl.Access.Text_Granularity; [[Text granularity]]
      start_offset: ptr(int); [[Offset indicating start of string according to given granularity.
                                -1 in case of error.]]
      end_offset: ptr(int); [[Offset indicating end of string according to given granularity.
                              -1 in case of error.]]
   }
   values {
      string: mstring @move; [[Newly allocated UTF-8 encoded string. Must be free by a user.]]
   }
}

start offset is used as a "where to start searching" indicator. However, keys should never be ptrs. What this should rather look like is:

@property string @protected @beta {
   [[Gets string, start and end offset in text according to given initial offset and granularity.]]
   get {
   }
   keys {
      granularity: Efl.Access.Text_Granularity; [[Text granularity]]
      initial_offset : int; [[Initial position where to start to search]]
   }
   values {
      start_offset: int; [[Offset indicating start of string according to given granularity.
                                -1 in case of error.]]
      end_offset: int; [[Offset indicating end of string according to given granularity.
                              -1 in case of error.]]
      string: mstring @move; [[Newly allocated UTF-8 encoded string. Must be free by a user.]]
   }
}

Second:

@property attribute @protected @beta {
   [[Indicate if a text attribute with a given name is set]]
   get {
      return: bool; [[$true if attribute name is set, $false otherwise]]
   }
   keys {
      name: string; [[Text attribute name]]
      start_offset: ptr(int); [[Position in text from which given attribute is set.]]
      end_offset: ptr(int); [[Position in text to which given attribute is set.]]
   }
   values {
      value: mstring @move; [[Value of text attribute. Should be free()]]
   }
}

There is absolutly no reason to have a "ptr" arround the int of start end end offset. This can simply be removed.
Third:

@property text_attributes @protected @beta {
   [[Gets list of all text attributes.]]
   get {
   }
   keys {
      start_offset: ptr(int); [[Start offset]]
      end_offset: ptr(int); [[End offset]]
   }
   values {
      attributes: list<Efl.Access.Text_Attribute> @move; [[List of text attributes]]
   }
}

This is the same as 2..

bu5hm4n created this task.Apr 20 2020, 12:41 AM
bu5hm4n renamed this task from efl_access_text: to efl_access_text: ptr usage.
bu5hm4n updated the task description. (Show Details)
bu5hm4n updated the task description. (Show Details)Apr 20 2020, 12:43 AM

Sorry , It looks I did not know about this issue

Are these classes going to be stabilized ?

At some point yes.

Its also not a lot of work, its just the implementations that are either in entry or textblock, which is your domain, so i hoped you could take a quick look.

ali.alzyod closed this task as Resolved.Jun 1 2020, 11:42 PM