mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-30 17:29:37 +00:00
Monotone-Parent: b54cbfbf869e5f43716f3c46ec9c9461fca6684f
Monotone-Revision: 13b85b286011f096c4141829b528972047581e57 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-05-30T20:03:19 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
2007-05-30 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/NSArray+Utilities.m ([NSMutableArray
|
||||
-addRange:newRange]): new method that store a string
|
||||
representation of the NSRange passed as parameter.
|
||||
([NSMutableArray -hasRangeIntersection:testRange]): tests whether
|
||||
any range contained in self intersect with the one passed as parameter.
|
||||
|
||||
* SoObjects/SOGo/NSString+Utilities.m ([-stringByDetectingURLs]):
|
||||
store ranges in an array to prevent them from intersecting with
|
||||
each other during the passes.
|
||||
|
||||
@@ -45,6 +45,9 @@
|
||||
|
||||
- (void) addObjectUniquely: (id) object;
|
||||
|
||||
- (void) addRange: (NSRange) newRange;
|
||||
- (BOOL) hasRangeIntersection: (NSRange) testRange;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* NSARRAY_UTILITIES_H */
|
||||
|
||||
@@ -91,5 +91,34 @@
|
||||
[self addObject: object];
|
||||
}
|
||||
|
||||
- (void) addRange: (NSRange) newRange
|
||||
{
|
||||
[self addObject: NSStringFromRange (newRange)];
|
||||
}
|
||||
|
||||
- (BOOL) hasRangeIntersection: (NSRange) testRange
|
||||
{
|
||||
NSEnumerator *ranges;
|
||||
NSString *currentRangeString;
|
||||
NSRange currentRange;
|
||||
BOOL response;
|
||||
|
||||
response = NO;
|
||||
|
||||
ranges = [self objectEnumerator];
|
||||
currentRangeString = [ranges nextObject];
|
||||
while (!response && currentRangeString)
|
||||
{
|
||||
currentRange = NSRangeFromString (currentRangeString);
|
||||
if (NSLocationInRange (testRange.location, currentRange)
|
||||
|| NSLocationInRange (NSMaxRange (testRange), currentRange))
|
||||
response = YES;
|
||||
else
|
||||
currentRangeString = [ranges nextObject];
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user