-
Notifications
You must be signed in to change notification settings - Fork 3
/
JPExtraNSRangeFunction.h
executable file
·27 lines (26 loc) · 1.07 KB
/
JPExtraNSRangeFunction.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* Part of JPGeneral repository, Jon889: https://github.com/Jon889/JPGeneral
Copyright (c) 2011 Jonathan Bailey
May be modified and used in any project as long as all comments, including this one, remain.*/
NS_INLINE BOOL NSRangeFullyContainsRange (NSRange container, NSRange containee) {
if (containee.location < container.location || containee.location + containee.length > container.location + container.length) {
return NO;
} else {
return YES;
}
}
//Renaming function to match CG Function style, and put them all in one place
NS_INLINE NSUInteger NSRangeMax(NSRange range) {
return NSMaxRange(range);
}
NS_INLINE BOOL NSRangeContainsLocation(NSUInteger loc, NSRange range) {
return NSLocationInRange(loc, range);
}
NS_INLINE BOOL NSRangeEqualToRange(NSRange range1, NSRange range2) {
return NSEqualRanges(range1, range2);
}
NS_INLINE BOOL NSRangeUnion(NSRange range1, NSRange range2) {
return NSUnionRange(range1, range2);
}
NS_INLINE BOOL NSRangeIntersection(NSRange range1, NSRange range2) {
return NSIntersectionRange(range1, range2);
}