Created a binary of Three20 to bundle with the discussion board example

This commit is contained in:
Blake Watters
2011-01-16 21:41:56 -05:00
parent ebe147fd10
commit 69248c5d09
282 changed files with 13742 additions and 834 deletions

View File

@@ -0,0 +1,57 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
@interface NSArray (TTCategory)
/**
* Calls performSelector on all objects that can receive the selector in the array.
* Makes an iterable copy of the array, making it possible for the selector to modify
* the array. Contrast this with makeObjectsPerformSelector which does not allow side effects of
* modifying the array.
*/
- (void)perform:(SEL)selector;
- (void)perform:(SEL)selector withObject:(id)p1;
- (void)perform:(SEL)selector withObject:(id)p1 withObject:(id)p2;
- (void)perform:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3;
/**
* Extensions to makeObjectsPerformSelector to provide support for more than one object
* parameter.
*/
- (void)makeObjectsPerformSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2;
- (void)makeObjectsPerformSelector: (SEL)selector
withObject: (id)p1
withObject: (id)p2
withObject: (id)p3;
/**
* @return nil or an object that matches value with isEqual:
*/
- (id)objectWithValue:(id)value forKey:(id)key;
/**
* @return the first object with the given class.
*/
- (id)objectWithClass:(Class)cls;
/**
* @param selector Required format: - (NSNumber*)method:(id)object;
*/
- (BOOL)containsObject:(id)object withSelector:(SEL)selector;
@end

View File

@@ -0,0 +1,35 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
@interface NSData (TTCategory)
/**
* Calculate the md5 hash of this data using CC_MD5.
*
* @return md5 hash of this data
*/
@property (nonatomic, readonly) NSString* md5Hash;
/**
* Calculate the SHA1 hash of this data using CC_SHA1.
*
* @return SHA1 hash of this data
*/
@property (nonatomic, readonly) NSString* sha1Hash;
@end

View File

@@ -0,0 +1,86 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
@interface NSDate (TTCategory)
/**
* Returns the current date with the time set to midnight.
*/
+ (NSDate*)dateWithToday;
/**
* Returns a copy of the date with the time set to midnight on the same day.
*/
- (NSDate*)dateAtMidnight;
/**
* Formats the date with 'h:mm a' or the localized equivalent.
*/
- (NSString*)formatTime;
/**
* Formats the date with 'EEEE, LLLL d, YYYY' or the localized equivalent.
*/
- (NSString*)formatDate;
/**
* Formats the date according to how old it is.
*
* For dates less than a day old, the format is 'h:mm a', for less than a week old the
* format is 'EEEE', and for anything older the format is 'M/d/yy'.
*/
- (NSString*)formatShortTime;
/**
* Formats the date according to how old it is.
*
* For dates less than a day old, the format is 'h:mm a', for less than a week old the
* format is 'EEE h:mm a', and for anything older the format is 'MMM d h:mm a'.
*/
- (NSString*)formatDateTime;
/**
* Formats dates within 24 hours like '5 minutes ago', or calls formatDateTime if older.
*/
- (NSString*)formatRelativeTime;
/**
* Formats dates within 1 week like '5m' or '2d', or calls formatShortTime if older.
*/
- (NSString*)formatShortRelativeTime;
/**
* Formats the date with 'MMMM d", "Today", or "Yesterday".
*
* You must supply date components for today and yesterday because they are relatively expensive
* to create, so it is best to avoid creating them every time you call this method if you
* are going to be calling it multiple times in a loop.
*/
- (NSString*)formatDay:(NSDateComponents*)today yesterday:(NSDateComponents*)yesterday;
/**
* Formats the date with 'MMMM".
*/
- (NSString*)formatMonth;
/**
* Formats the date with 'yyyy".
*/
- (NSString*)formatYear;
@end

View File

@@ -0,0 +1,26 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
@interface NSMutableArray (TTCategory)
/**
* Adds a string on the condition that it's non-nil and non-empty.
*/
- (void)addNonEmptyString:(NSString*)string;
@end

View File

@@ -0,0 +1,26 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
@interface NSMutableDictionary (TTCategory)
/**
* Adds a string on the condition that it's non-nil and non-empty.
*/
- (void)setNonEmptyString:(NSString*)string forKey:(id)key;
@end

View File

@@ -0,0 +1,34 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
@interface NSObject (TTAdditions)
/**
* Additional performSelector signatures that support up to 7 arguments.
*/
- (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3;
- (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3
withObject:(id)p4;
- (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3
withObject:(id)p4 withObject:(id)p5;
- (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3
withObject:(id)p4 withObject:(id)p5 withObject:(id)p6;
- (id)performSelector:(SEL)selector withObject:(id)p1 withObject:(id)p2 withObject:(id)p3
withObject:(id)p4 withObject:(id)p5 withObject:(id)p6 withObject:(id)p7;
@end

View File

@@ -0,0 +1,107 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
#import "Three20Core/TTCorePreprocessorMacros.h" // For __TTDEPRECATED_METHOD
/**
* Doxygen does not handle categories very well, so please refer to the .m file in general
* for the documentation that is reflected on api.three20.info.
*/
@interface NSString (TTAdditions)
/**
* Determines if the string contains only whitespace and newlines.
*/
- (BOOL)isWhitespaceAndNewlines;
/**
* Determines if the string is empty or contains only whitespace.
*/
- (BOOL)isEmptyOrWhitespace;
/**
* Parses a URL query string into a dictionary.
*
* @deprecated Use queryContentsUsingEncoding: instead.
*/
- (NSDictionary*)queryDictionaryUsingEncoding:(NSStringEncoding)encoding __TTDEPRECATED_METHOD;
/**
* Parses a URL query string into a dictionary where the values are arrays.
*/
- (NSDictionary*)queryContentsUsingEncoding:(NSStringEncoding)encoding;
/**
* Parses a URL, adds query parameters to its query, and re-encodes it as a new URL.
*/
- (NSString*)stringByAddingQueryDictionary:(NSDictionary*)query;
/**
* Returns a string with all HTML tags removed.
*/
- (NSString*)stringByRemovingHTMLTags;
/**
* Compares two strings expressing software versions.
*
* The comparison is (except for the development version provisions noted below) lexicographic
* string comparison. So as long as the strings being compared use consistent version formats,
* a variety of schemes are supported. For example "3.02" < "3.03" and "3.0.2" < "3.0.3". If you
* mix such schemes, like trying to compare "3.02" and "3.0.3", the result may not be what you
* expect.
*
* Development versions are also supported by adding an "a" character and more version info after
* it. For example "3.0a1" or "3.01a4". The way these are handled is as follows: if the parts
* before the "a" are different, the parts after the "a" are ignored. If the parts before the "a"
* are identical, the result of the comparison is the result of NUMERICALLY comparing the parts
* after the "a". If the part after the "a" is empty, it is treated as if it were "0". If one
* string has an "a" and the other does not (e.g. "3.0" and "3.0a1") the one without the "a"
* is newer.
*
* Examples (?? means undefined):
* "3.0" = "3.0"
* "3.0a2" = "3.0a2"
* "3.0" > "2.5"
* "3.1" > "3.0"
* "3.0a1" < "3.0"
* "3.0a1" < "3.0a4"
* "3.0a2" < "3.0a19" <-- numeric, not lexicographic
* "3.0a" < "3.0a1"
* "3.02" < "3.03"
* "3.0.2" < "3.0.3"
* "3.00" ?? "3.0"
* "3.02" ?? "3.0.3"
* "3.02" ?? "3.0.2"
*/
- (NSComparisonResult)versionStringCompare:(NSString *)other;
/**
* Calculate the md5 hash of this string using CC_MD5.
*
* @return md5 hash of this string
*/
@property (nonatomic, readonly) NSString* md5Hash;
/**
* Calculate the SHA1 hash of this string using CommonCrypto CC_SHA1.
*
* @return NSString with SHA1 hash of this string
*/
@property (nonatomic, readonly) NSString* sha1Hash;
@end

View File

@@ -0,0 +1,57 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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.
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// Code Management
/**
* Borrowed from Apple's AvailabiltyInternal.h header. There's no reason why we shouldn't be
* able to use this macro, as it's a gcc-supported flag.
* Here's what we based it off of.
* __AVAILABILITY_INTERNAL_DEPRECATED __attribute__((deprecated))
*/
#define __TTDEPRECATED_METHOD __attribute__((deprecated))
///////////////////////////////////////////////////////////////////////////////////////////////////
// Flags
/**
* For when the flag might be a set of bits, this will ensure that the exact set of bits in
* the flag have been set in the value.
*/
#define IS_MASK_SET(value, flag) (((value) & (flag)) == (flag))
///////////////////////////////////////////////////////////////////////////////////////////////////
// Time
#define TT_MINUTE 60
#define TT_HOUR (60 * TT_MINUTE)
#define TT_DAY (24 * TT_HOUR)
#define TT_5_DAYS (5 * TT_DAY)
#define TT_WEEK (7 * TT_DAY)
#define TT_MONTH (30.5 * TT_DAY)
#define TT_YEAR (365 * TT_DAY)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Safe releases
#define TT_RELEASE_SAFELY(__POINTER) { [__POINTER release]; __POINTER = nil; }
#define TT_INVALIDATE_TIMER(__TIMER) { [__TIMER invalidate]; __TIMER = nil; }
// Release a CoreFoundation object safely.
#define TT_RELEASE_CF_SAFELY(__REF) { if (nil != (__REF)) { CFRelease(__REF); __REF = nil; } }

View File

@@ -0,0 +1,108 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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.
//
/**
* Three20 Debugging tools.
*
* Provided in this header are a set of debugging tools. This is meant quite literally, in that
* all of the macros below will only function when the DEBUG preprocessor macro is specified.
*
* TTDASSERT(<statement>);
* If <statement> is false, the statement will be written to the log and if you are running in
* the simulator with a debugger attached, the app will break on the assertion line.
*
* TTDPRINT(@"formatted log text %d", param1);
* Print the given formatted text to the log.
*
* TTDPRINTMETHODNAME();
* Print the current method name to the log.
*
* TTDCONDITIONLOG(<statement>, @"formatted log text %d", param1);
* If <statement> is true, then the formatted text will be written to the log.
*
* TTDINFO/TTDWARNING/TTDERROR(@"formatted log text %d", param1);
* Will only write the formatted text to the log if TTMAXLOGLEVEL is greater than the respective
* TTD* method's log level. See below for log levels.
*
* The default maximum log level is TTLOGLEVEL_WARNING.
*/
#define TTLOGLEVEL_INFO 5
#define TTLOGLEVEL_WARNING 3
#define TTLOGLEVEL_ERROR 1
#ifndef TTMAXLOGLEVEL
#define TTMAXLOGLEVEL TTLOGLEVEL_WARNING
#endif
// The general purpose logger. This ignores logging levels.
#ifdef DEBUG
#define TTDPRINT(xx, ...) NSLog(@"%s(%d): " xx, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define TTDPRINT(xx, ...) ((void)0)
#endif // #ifdef DEBUG
// Prints the current method's name.
#define TTDPRINTMETHODNAME() TTDPRINT(@"%s", __PRETTY_FUNCTION__)
// Debug-only assertions.
#ifdef DEBUG
#import <TargetConditionals.h>
#if TARGET_IPHONE_SIMULATOR
int TTIsInDebugger();
// We leave the __asm__ in this macro so that when a break occurs, we don't have to step out of
// a "breakInDebugger" function.
#define TTDASSERT(xx) { if(!(xx)) { TTDPRINT(@"TTDASSERT failed: %s", #xx); \
if(TTIsInDebugger()) { __asm__("int $3\n" : : ); }; } \
} ((void)0)
#else
#define TTDASSERT(xx) { if(!(xx)) { TTDPRINT(@"TTDASSERT failed: %s", #xx); } } ((void)0)
#endif // #if TARGET_IPHONE_SIMULATOR
#else
#define TTDASSERT(xx) ((void)0)
#endif // #ifdef DEBUG
// Log-level based logging macros.
#if TTLOGLEVEL_ERROR <= TTMAXLOGLEVEL
#define TTDERROR(xx, ...) TTDPRINT(xx, ##__VA_ARGS__)
#else
#define TTDERROR(xx, ...) ((void)0)
#endif // #if TTLOGLEVEL_ERROR <= TTMAXLOGLEVEL
#if TTLOGLEVEL_WARNING <= TTMAXLOGLEVEL
#define TTDWARNING(xx, ...) TTDPRINT(xx, ##__VA_ARGS__)
#else
#define TTDWARNING(xx, ...) ((void)0)
#endif // #if TTLOGLEVEL_WARNING <= TTMAXLOGLEVEL
#if TTLOGLEVEL_INFO <= TTMAXLOGLEVEL
#define TTDINFO(xx, ...) TTDPRINT(xx, ##__VA_ARGS__)
#else
#define TTDINFO(xx, ...) ((void)0)
#endif // #if TTLOGLEVEL_INFO <= TTMAXLOGLEVEL
#ifdef DEBUG
#define TTDCONDITIONLOG(condition, xx, ...) { if ((condition)) { \
TTDPRINT(xx, ##__VA_ARGS__); \
} \
} ((void)0)
#else
#define TTDCONDITIONLOG(condition, xx, ...) ((void)0)
#endif // #ifdef DEBUG

View File

@@ -0,0 +1,33 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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.
//
/**
* These flags are used primarily by TTDCONDITIONLOG.
* Example:
*
* TTDCONDITIONLOG(TTDFLAG_NAVIGATOR, @"TTNavigator activated");
*
* This will only write to the log if the TTDFLAG_NAVIGATOR is set to non-zero.
*/
#define TTDFLAG_VIEWCONTROLLERS 0
#define TTDFLAG_CONTROLLERGARBAGECOLLECTION 0
#define TTDFLAG_NAVIGATOR 0
#define TTDFLAG_TABLEVIEWMODIFICATIONS 0
#define TTDFLAG_LAUNCHERVIEW 0
#define TTDFLAG_URLREQUEST 0
#define TTDFLAG_URLCACHE 0
#define TTDFLAG_XMLPARSER 0
#define TTDFLAG_ETAGS 0

View File

@@ -0,0 +1,47 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
#import <UIKit/UIKit.h>
/**
* Standard entity tables for use with XML parsers.
*
* Supported entity tables: ISO 8859-1.
*
* Each table is a dictionary of entity names to NSData objects containing the character.
*/
@interface TTEntityTables : NSObject {
NSDictionary* _iso88591;
}
/**
* Entity table for ISO 8859-1.
*/
@property (nonatomic, readonly) NSDictionary* iso88591;
@end
@interface TTEntityTables (TTSingleton)
// Access the singleton instance: [[TTEntityTables sharedInstance] <methods>]
+ (TTEntityTables*)sharedInstance;
// Release the shared instance.
+ (void)releaseSharedInstance;
@end

View File

@@ -0,0 +1,52 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
/**
* Creates a mutable array which does not retain references to the objects it contains.
*
* Typically used with arrays of delegates.
*/
NSMutableArray* TTCreateNonRetainingArray();
/**
* Creates a mutable dictionary which does not retain references to the values it contains.
*
* Typically used with dictionaries of delegates.
*/
NSMutableDictionary* TTCreateNonRetainingDictionary();
/**
* Tests if an object is an array which is not empty.
*/
BOOL TTIsArrayWithItems(id object);
/**
* Tests if an object is a set which is not empty.
*/
BOOL TTIsSetWithItems(id object);
/**
* Tests if an object is a string which is not empty.
*/
BOOL TTIsStringWithAnyText(id object);
/**
* Swap the two method implementations on the given class.
* Uses method_exchangeImplementations to accomplish this.
*/
void TTSwapMethods(Class cls, SEL originalSel, SEL newSel);

View File

@@ -0,0 +1,46 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
/**
* Gets the current system locale chosen by the user.
*
* This is necessary because [NSLocale currentLocale] always returns en_US.
*/
NSLocale* TTCurrentLocale();
/**
* @return A localized string from the Three20 bundle.
*/
NSString* TTLocalizedString(NSString* key, NSString* comment);
/**
* @return A localized description for NSURLErrorDomain errors.
*
* Error codes handled:
* - NSURLErrorTimedOut
* - NSURLErrorNotConnectedToInternet
* - All other NSURLErrorDomain errors fall through to "Connection Error".
*/
NSString* TTDescriptionForError(NSError* error);
/**
* @return The given number formatted as XX,XXX,XXX.XX
*
* TODO(jverkoey 04/19/2010): This should likely be locale-aware.
*/
NSString* TTFormatInteger(NSInteger num);

View File

@@ -0,0 +1,55 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
/**
* @return YES if the URL begins with "bundle://"
*/
BOOL TTIsBundleURL(NSString* URL);
/**
* @return YES if the URL begins with "documents://"
*/
BOOL TTIsDocumentsURL(NSString* URL);
/**
* Used by TTPathForBundleResource to construct the bundle path.
*
* Retains the given bundle.
*
* @default nil (See TTGetDefaultBundle for what this means)
*/
void TTSetDefaultBundle(NSBundle* bundle);
/**
* Retrieves the default bundle.
*
* If the default bundle is nil, returns [NSBundle mainBundle].
*
* @see TTSetDefaultBundle
*/
NSBundle* TTGetDefaultBundle();
/**
* @return The main bundle path concatenated with the given relative path.
*/
NSString* TTPathForBundleResource(NSString* relativePath);
/**
* @return The documents path concatenated with the given relative path.
*/
NSString* TTPathForDocumentsResource(NSString* relativePath);

View File

@@ -0,0 +1,40 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
#import <UIKit/UIKit.h>
/**
* @return a rectangle with dx and dy subtracted from the width and height, respectively.
*
* Example result: CGRectMake(x, y, w - dx, h - dy)
*/
CGRect TTRectContract(CGRect rect, CGFloat dx, CGFloat dy);
/**
* @return a rectangle whose origin has been offset by dx, dy, and whose size has been
* contracted by dx, dy.
*
* Example result: CGRectMake(x + dx, y + dy, w - dx, h - dy)
*/
CGRect TTRectShift(CGRect rect, CGFloat dx, CGFloat dy);
/**
* @return a rectangle with the given insets.
*
* Example result: CGRectMake(x + left, y + top, w - (left + right), h - (top + bottom))
*/
CGRect TTRectInset(CGRect rect, UIEdgeInsets insets);

View File

@@ -0,0 +1,33 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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>
#if __IPHONE_4_0 && __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED
@interface TTMarkupStripper : NSObject <NSXMLParserDelegate> {
#else
@interface TTMarkupStripper : NSObject {
#endif
@private
NSMutableArray* _strings;
}
/**
* Strips markup from the given string and returns the result.
*/
- (NSString*)parse:(NSString*)string;
@end

View File

@@ -0,0 +1,26 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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 "Three20Core/Three20Core.h"
// Additions
#import "Three20Core/NSArrayAdditions.h"
#import "Three20Core/NSDataAdditions.h"
#import "Three20Core/NSDateAdditions.h"
#import "Three20Core/NSMutableArrayAdditions.h"
#import "Three20Core/NSMutableDictionaryAdditions.h"
#import "Three20Core/NSObjectAdditions.h"
#import "Three20Core/NSStringAdditions.h"

View File

@@ -0,0 +1,34 @@
//
// Copyright 2009-2010 Facebook
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License 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.
//
// Core
// - Global
#import "Three20Core/TTCorePreprocessorMacros.h"
#import "Three20Core/TTGlobalCore.h"
#import "Three20Core/TTGlobalCoreLocale.h"
#import "Three20Core/TTGlobalCorePaths.h"
#import "Three20Core/TTGlobalCoreRects.h"
// - Debug
#import "Three20Core/TTDebug.h"
// - Entity Tables
#import "Three20Core/TTEntityTables.h"
// - Classes
#import "Three20Core/TTMarkupStripper.h"