Re: Adding VO-pressable links to NSTextField
Re: Adding VO-pressable links to NSTextField
- Subject: Re: Adding VO-pressable links to NSTextField
- From: Boris Dušek <email@hidden>
- Date: Fri, 15 Aug 2014 21:47:03 +0200
> But to the std::map (in our case std::map<NSRange, LinkProxyObject*> - the point is in NSDictionary you can search only for exact match of key - i.e. if you have a link at range (100, 7) and VO requests AXAttributedStringForRange for (102, 10), you would have no way to get at the link at (100, 7) without walking all values in the NSDictionary (valueForKey:(102, whatever) would return nil, under reasonable assumption there are no overlapping links), and you do need to add part of that link at (102, 5) to the returned attributed string for (102, 10). But with std::map, you can ask for first value (in our case link) whose key (in our case the range) satisfies an inequality (I mean the lower_bound and upper_bound member functions), so with this you could get all links that intersect with a certain range in O(log N) (N is the length of the whole text), if for the comparison function of the std::map you use numerical comparison of the location of the range. But if we are speaking about some text that fits into one screen, I think you should not bother with this yet (however make your own performance measurements :-).
well, now I realize you could do it efficiently without the std::map if you specified [parameter rangeValue] for the inRange: parameter and query selfAttString directly for the border cases…
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden