Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove TUIFastIndexPath

  • Loading branch information...
commit 67191529fe86dcbd1c2f0181ea5dff054e6d0496 1 parent 70bed0d
@jspahrsummers jspahrsummers authored
View
12 TwUI.xcodeproj/project.pbxproj
@@ -31,7 +31,6 @@
5EE983C613BE7834005F430D /* TUIColor.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C4A13BE6E1900C85CB5 /* TUIColor.m */; };
5EE983C713BE7834005F430D /* TUIControl+TargetAction.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C4B13BE6E1900C85CB5 /* TUIControl+TargetAction.m */; };
5EE983C813BE7834005F430D /* TUIControl.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C4D13BE6E1900C85CB5 /* TUIControl.m */; };
- 5EE983C913BE7834005F430D /* TUIFastIndexPath.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C4F13BE6E1900C85CB5 /* TUIFastIndexPath.m */; };
5EE983CB13BE7834005F430D /* TUIGeometry.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C5313BE6E1900C85CB5 /* TUIGeometry.m */; };
5EE983CE13BE7834005F430D /* TUIImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C5913BE6E1900C85CB5 /* TUIImageView.m */; };
5EE983CF13BE7834005F430D /* TUILabel.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C5D13BE6E1900C85CB5 /* TUILabel.m */; };
@@ -145,7 +144,6 @@
CB5E322813BE70CA004B7899 /* TUIColor.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C4A13BE6E1900C85CB5 /* TUIColor.m */; };
CB5E322913BE70CA004B7899 /* TUIControl+TargetAction.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C4B13BE6E1900C85CB5 /* TUIControl+TargetAction.m */; };
CB5E322B13BE70CA004B7899 /* TUIControl.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C4D13BE6E1900C85CB5 /* TUIControl.m */; };
- CB5E322D13BE70CA004B7899 /* TUIFastIndexPath.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C4F13BE6E1900C85CB5 /* TUIFastIndexPath.m */; };
CB5E323113BE70CA004B7899 /* TUIGeometry.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C5313BE6E1900C85CB5 /* TUIGeometry.m */; };
CB5E323713BE70CA004B7899 /* TUIImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C5913BE6E1900C85CB5 /* TUIImageView.m */; };
CB5E323913BE70CA004B7899 /* TUIKit.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C5B13BE6E1900C85CB5 /* TUIKit.m */; };
@@ -199,8 +197,6 @@
CBB74CA213BE6E1900C85CB5 /* TUIControl+TargetAction.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C4B13BE6E1900C85CB5 /* TUIControl+TargetAction.m */; };
CBB74CA313BE6E1900C85CB5 /* TUIControl.h in Headers */ = {isa = PBXBuildFile; fileRef = CBB74C4C13BE6E1900C85CB5 /* TUIControl.h */; settings = {ATTRIBUTES = (Public, ); }; };
CBB74CA413BE6E1900C85CB5 /* TUIControl.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C4D13BE6E1900C85CB5 /* TUIControl.m */; };
- CBB74CA513BE6E1900C85CB5 /* TUIFastIndexPath.h in Headers */ = {isa = PBXBuildFile; fileRef = CBB74C4E13BE6E1900C85CB5 /* TUIFastIndexPath.h */; settings = {ATTRIBUTES = (Public, ); }; };
- CBB74CA613BE6E1900C85CB5 /* TUIFastIndexPath.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C4F13BE6E1900C85CB5 /* TUIFastIndexPath.m */; };
CBB74CA913BE6E1900C85CB5 /* TUIGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = CBB74C5213BE6E1900C85CB5 /* TUIGeometry.h */; settings = {ATTRIBUTES = (Public, ); }; };
CBB74CAA13BE6E1900C85CB5 /* TUIGeometry.m in Sources */ = {isa = PBXBuildFile; fileRef = CBB74C5313BE6E1900C85CB5 /* TUIGeometry.m */; };
CBB74CAF13BE6E1900C85CB5 /* TUIImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = CBB74C5813BE6E1900C85CB5 /* TUIImageView.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -500,8 +496,6 @@
CBB74C4B13BE6E1900C85CB5 /* TUIControl+TargetAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TUIControl+TargetAction.m"; sourceTree = "<group>"; };
CBB74C4C13BE6E1900C85CB5 /* TUIControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TUIControl.h; sourceTree = "<group>"; };
CBB74C4D13BE6E1900C85CB5 /* TUIControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TUIControl.m; sourceTree = "<group>"; };
- CBB74C4E13BE6E1900C85CB5 /* TUIFastIndexPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TUIFastIndexPath.h; sourceTree = "<group>"; };
- CBB74C4F13BE6E1900C85CB5 /* TUIFastIndexPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TUIFastIndexPath.m; sourceTree = "<group>"; };
CBB74C5213BE6E1900C85CB5 /* TUIGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TUIGeometry.h; sourceTree = "<group>"; };
CBB74C5313BE6E1900C85CB5 /* TUIGeometry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TUIGeometry.m; sourceTree = "<group>"; };
CBB74C5813BE6E1900C85CB5 /* TUIImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TUIImageView.h; sourceTree = "<group>"; };
@@ -793,8 +787,6 @@
CBB74C4B13BE6E1900C85CB5 /* TUIControl+TargetAction.m */,
CBB74C4C13BE6E1900C85CB5 /* TUIControl.h */,
CBB74C4D13BE6E1900C85CB5 /* TUIControl.m */,
- CBB74C4E13BE6E1900C85CB5 /* TUIFastIndexPath.h */,
- CBB74C4F13BE6E1900C85CB5 /* TUIFastIndexPath.m */,
CBB74C5213BE6E1900C85CB5 /* TUIGeometry.h */,
CBB74C5313BE6E1900C85CB5 /* TUIGeometry.m */,
D0C7650415B6156A00E7AC2C /* TUIHostView.h */,
@@ -964,7 +956,6 @@
30D39A0D156D8F71006ECDAE /* TUIProgressBar.h in Headers */,
CBB74CA013BE6E1900C85CB5 /* TUIColor.h in Headers */,
CBB74CA313BE6E1900C85CB5 /* TUIControl.h in Headers */,
- CBB74CA513BE6E1900C85CB5 /* TUIFastIndexPath.h in Headers */,
CBB74CA913BE6E1900C85CB5 /* TUIGeometry.h in Headers */,
88D81CFF1577EF0D009D453B /* TUIStyledView.h in Headers */,
887C227B15C1C7BB006EC31D /* NSFont+TUIExtensions.h in Headers */,
@@ -1280,7 +1271,6 @@
5EE983C613BE7834005F430D /* TUIColor.m in Sources */,
5EE983C713BE7834005F430D /* TUIControl+TargetAction.m in Sources */,
5EE983C813BE7834005F430D /* TUIControl.m in Sources */,
- 5EE983C913BE7834005F430D /* TUIFastIndexPath.m in Sources */,
5EE983CB13BE7834005F430D /* TUIGeometry.m in Sources */,
5EE983CE13BE7834005F430D /* TUIImageView.m in Sources */,
5EE983CF13BE7834005F430D /* TUILabel.m in Sources */,
@@ -1353,7 +1343,6 @@
CBB74CA113BE6E1900C85CB5 /* TUIColor.m in Sources */,
CBB74CA213BE6E1900C85CB5 /* TUIControl+TargetAction.m in Sources */,
CBB74CA413BE6E1900C85CB5 /* TUIControl.m in Sources */,
- CBB74CA613BE6E1900C85CB5 /* TUIFastIndexPath.m in Sources */,
CBB74CAA13BE6E1900C85CB5 /* TUIGeometry.m in Sources */,
CBB74CB013BE6E1900C85CB5 /* TUIImageView.m in Sources */,
CBB74CB213BE6E1900C85CB5 /* TUIKit.m in Sources */,
@@ -1440,7 +1429,6 @@
CB5E322813BE70CA004B7899 /* TUIColor.m in Sources */,
CB5E322913BE70CA004B7899 /* TUIControl+TargetAction.m in Sources */,
CB5E322B13BE70CA004B7899 /* TUIControl.m in Sources */,
- CB5E322D13BE70CA004B7899 /* TUIFastIndexPath.m in Sources */,
CB5E323113BE70CA004B7899 /* TUIGeometry.m in Sources */,
CB5E323713BE70CA004B7899 /* TUIImageView.m in Sources */,
CB5E323913BE70CA004B7899 /* TUIKit.m in Sources */,
View
47 lib/UIKit/TUIFastIndexPath.h
@@ -1,47 +0,0 @@
-/*
- Copyright 2011 Twitter, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this work except in compliance with the License.
- You may obtain a copy of the License in the LICENSE file, or at:
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-#import <Foundation/Foundation.h>
-
-#ifndef TUIFastIndexPath_DANGEROUS_ISEQUAL
-// maybe default this to 0?
-#define TUIFastIndexPath_DANGEROUS_ISEQUAL 1
-#endif
-
-#define TUIFastIndexPathFromNSIndexPath(indexPath) (((indexPath) != nil) ? [TUIFastIndexPath indexPathForRow:(indexPath).row inSection:(indexPath).section] : nil)
-#define NSIndexPathFromTUIFastIndexPath(indexPath) (((indexPath) != nil) ? [NSIndexPath indexPathForRow:(indexPath).row inSection:(indexPath).section] : nil)
-
-/**
- Note TUITableView uses this extensively, if you use want to use NSIndexPath to talk to table views you should turn TUIFastIndexPath_DANGEROUS_ISEQUAL to 0
- */
-@interface TUIFastIndexPath : NSObject <NSCopying, NSCoding> // only supports 2-index sec/row, fast versions of -hash, -isEqual, etc
-{
-@public
- NSUInteger section;
- NSUInteger row;
-}
-
-+ (TUIFastIndexPath *)indexPathForRow:(NSUInteger)row inSection:(NSUInteger)section;
-
-// duck type to NSIndexPath
-@property(nonatomic, readonly) NSUInteger section;
-@property(nonatomic, readonly) NSUInteger row;
-
-- (NSComparisonResult)compare:(TUIFastIndexPath *)i;
-- (BOOL)isEqual:(TUIFastIndexPath *)i;
-
-
-@end
View
137 lib/UIKit/TUIFastIndexPath.m
@@ -1,137 +0,0 @@
-/*
- Copyright 2011 Twitter, Inc.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this work except in compliance with the License.
- You may obtain a copy of the License in the LICENSE file, or at:
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- */
-
-#import "TUIFastIndexPath.h"
-
-/**
- Twitter for Mac timelines only use 1-section table views, with <1000 tweets in a list at a time
- This pre-allocated hunk of instances is all we ever really need to touch. Was a measurable win for us.
- */
-#define CACHE_COMMON_INDEX_PATHS 1024*10
-
-static struct TUIFastIndexPath_staticStruct {
- Class isa;
- NSInteger section;
- NSInteger row;
-} CommonIndexPaths[CACHE_COMMON_INDEX_PATHS];
-
-@interface TUIFastIndexPath_staticClass : TUIFastIndexPath
-@end
-
-@implementation TUIFastIndexPath_staticClass
-@end
-
-@implementation TUIFastIndexPath
-
-+ (void)initialize
-{
- if(self == [TUIFastIndexPath class]) {
- Class staticCls = [TUIFastIndexPath_staticClass class];
- for(int i = 0; i < CACHE_COMMON_INDEX_PATHS; ++i) {
- struct TUIFastIndexPath_staticStruct *f = &CommonIndexPaths[i];
- f->isa = staticCls;
- f->section = 0;
- f->row = i;
- }
- }
-}
-
-+ (TUIFastIndexPath *)indexPathForRow:(NSUInteger)row inSection:(NSUInteger)section
-{
- if(section == 0) {
- if(row < CACHE_COMMON_INDEX_PATHS) {
- return (__bridge TUIFastIndexPath *)&CommonIndexPaths[row];
- }
- }
-
- // actually have to make one
- TUIFastIndexPath *f = [[TUIFastIndexPath alloc] init];
- f->row = row;
- f->section = section;
- return f;
-}
-
-- (id)copyWithZone:(NSZone *)zone
-{
- return self; // change me if we ever do mutable index paths
-}
-
-- (id)initWithCoder:(NSCoder *)coder
-{
- self = [self init];
- section = [coder decodeIntegerForKey:@"s"];
- row = [coder decodeIntegerForKey:@"r"];
- return self;
-}
-
-- (void)encodeWithCoder:(NSCoder *)coder
-{
- [coder encodeInteger:section forKey:@"s"];
- [coder encodeInteger:row forKey:@"r"];
-}
-
-- (NSString *)description
-{
- return [NSString stringWithFormat:@"[%ld,%ld]", section, row];
-}
-
-- (NSUInteger)section
-{
- return section;
-}
-
-- (NSUInteger)row
-{
- return row;
-}
-
-- (NSUInteger)hash
-{
- return ((section << 28) ^ row); // assume we're going to have a lot more rows than sections
-}
-
-- (NSComparisonResult)compare:(TUIFastIndexPath *)i
-{
- NSUInteger s = i->section;
- NSUInteger r = i->row;
- if(section < s)
- return NSOrderedAscending;
- if(section > s)
- return NSOrderedDescending;
- if(row < r)
- return NSOrderedAscending;
- if(row > r)
- return NSOrderedDescending;
- return NSOrderedSame;
-}
-
-- (BOOL)isEqual:(TUIFastIndexPath *)i
-{
- if(!i)
- return NO;
-#if TUIFastIndexPath_DANGEROUS_ISEQUAL
- return ((row == i->row) && (section == i->section)); // assume it's a TUIFastIndexPath - this may be stupid for your app
-#else
- if([i isKindOfClass:[TUIFastIndexPath class]]
- return ((row == i->row) && (section == i->section));
- else if([i isKindOfClass:[NSIndexPath class]]) // we never hit this in T2
- return ((row == i.row) && (section == i.section));
- else
- return NO;
-#endif
-}
-
-@end
View
1  lib/UIKit/TUIKit.h
@@ -29,7 +29,6 @@
#import "TUIButton.h"
#import "TUICGAdditions.h"
#import "TUIColor.h"
-#import "TUIFastIndexPath.h"
#import "TUIHostView.h"
#import "TUIImageView.h"
#import "TUILabel.h"
Please sign in to comment.
Something went wrong with that request. Please try again.