├── google_toolbar ├── TigerGcov │ ├── libgcov.a │ └── libgcov_readme.html ├── UnitTesting │ ├── GTMUIViewUnitTestingTest.png │ ├── TestData │ │ ├── GTMUnitTestingImage.tiff │ │ ├── GTMUnitTestingView.tiff │ │ ├── GTMUnitTestingWindow.tiff │ │ ├── GTMUIViewUnitTestingTest.png │ │ ├── GTMUnitTestingTest.nib │ │ │ ├── keyedobjects.nib │ │ │ ├── info.nib │ │ │ └── classes.nib │ │ ├── GTMUnitTestingImage.gtmUTState │ │ └── GTMUIViewUnitTestingTest.gtmUTState │ ├── GTMUIUnitTestingHarness │ │ ├── English.lproj │ │ │ └── MainMenu.nib │ │ │ │ └── keyedobjects.nib │ │ ├── Info.plist │ │ └── main.m │ ├── RunIPhoneUnitTest.sh │ ├── GTMUnitTestingTest.h │ ├── GTMIPhoneUnitTestMain.m │ ├── GTMIPhoneUnitTestDelegate.h │ ├── GTMTestHTTPServer.h │ ├── RunMacOSUnitTests.sh │ ├── GTMUnitTestingUtilities.h │ ├── GTMCALayer+UnitTesting.h │ ├── GTMUIKit+UnitTestingTest.m │ └── GTMUnitTestDevLog.h ├── AppKit │ ├── TestData │ │ ├── GTMNSBezierPath+CGPathTest.tiff │ │ ├── GTMNSBezierPath+RoundRectTest.tiff │ │ ├── GTMNSBezierPath+CGPathTest.ppc64.tiff │ │ ├── GTMNSBezierPath+CGPathTest.x86_64.tiff │ │ ├── GTMNSBezierPath+ShadingTest.10.5.tiff │ │ ├── GTMNSBezierPath+RoundRectTest.ppc64.tiff │ │ └── GTMNSBezierPath+RoundRectTest.x86_64.tiff │ ├── GTMNSBezierPath+CGPath.h │ ├── GTMNSWorkspace+ScreenSaverTest.m │ ├── GTMNSWorkspace+ScreenSaver.h │ ├── GTMDelegatingTableColumn.h │ ├── GTMShading.h │ ├── GTMDelegatingTableColumn.m │ ├── GTMNSBezierPath+RoundRect.h │ ├── GTMNSBezierPath+CGPath.m │ ├── GTMLoginItems.h │ ├── GTMNSBezierPath+RoundRect.m │ ├── GTMNSBezierPath+CGPathTest.m │ └── GTMLinearRGBShading.h ├── Foundation │ ├── TestData │ │ └── GTMHTTPFetcherTestPage.html │ ├── GTMNSAppleEvent+HandlerTest.applescript │ ├── GTMNSDictionary+URLArguments.h │ ├── GTMGarbageCollection.h │ ├── GTMNSDictionary+URLArguments.m │ ├── GTMSystemVersion.h │ ├── GTMNSString+URLArguments.h │ ├── GTMFourCharCode.h │ ├── GTMNSAppleEventDescriptor+Handler.h │ ├── GTMNSString+XML.h │ ├── GTMNSString+URLArguments.m │ ├── GTMSystemVersionTest.m │ ├── GTMNSAppleScript+Handler.h │ ├── GTMNSString+HTML.h │ ├── GTMNSEnumerator+Filter.h │ ├── GTMNSDictionary+URLArgumentsTest.m │ ├── GTMObjC2Runtime.h │ ├── GTMFourCharCode.m │ ├── GTMProgressMonitorInputStream.h │ ├── GTMNSFileManager+Path.h │ ├── GTMStackTraceTest.m │ └── GTMStackTrace.c ├── GTM-Info.plist ├── UnitTest-Info.plist ├── GTMiPhone-Info.plist ├── BuildingAndUsing.txt ├── XcodeConfig │ ├── subconfig │ │ ├── CodeCoverageStatic.xcconfig │ │ ├── CodeCoverage.xcconfig │ │ ├── GCSupported.xcconfig │ │ ├── 64bit.xcconfig │ │ ├── TigerOrLater.xcconfig │ │ ├── LeopardOrLater.xcconfig │ │ ├── iPhone.xcconfig │ │ ├── Unittest.xcconfig │ │ ├── Release.xcconfig │ │ ├── Debug.xcconfig │ │ └── General.xcconfig │ ├── Target │ │ ├── SharedLibrary.xcconfig │ │ ├── LoadableBundle.xcconfig │ │ ├── DebugUnittest.xcconfig │ │ ├── SharedLibraryGCSupported.xcconfig │ │ ├── StaticLibraryGCSupported.xcconfig │ │ ├── StaticLibrary.xcconfig │ │ ├── LoadableBundleGCSupported.xcconfig │ │ └── ReleaseUnittest.xcconfig │ ├── Project │ │ ├── DebugiPhone.xcconfig │ │ ├── ReleaseiPhone.xcconfig │ │ ├── DebugTigerOrLater.xcconfig │ │ ├── ReleaseTigerOrLater.xcconfig │ │ ├── DebugLeopardOrLater.xcconfig │ │ └── ReleaseLeopardOrLater.xcconfig │ └── xcconfigs-readme.txt ├── DebugUtils │ ├── GTMDevLog.m │ └── GTMMethodCheckTest.m ├── GTM_Prefix.pch └── BuildScripts │ └── BuildAllSDKs.sh ├── Classes ├── lib │ ├── Serialization │ │ ├── JSON │ │ │ ├── JSONSerializableSupport.h │ │ │ ├── NSDictionary+JSONSerializableSupport.h │ │ │ ├── NSArray+JSONSerializableSupport.h │ │ │ ├── NSObject+JSONSerializableSupport.h │ │ │ ├── NSArray+JSONSerializableSupport.m │ │ │ ├── NSDictionary+JSONSerializableSupport.m │ │ │ └── JSONSerializable.h │ │ ├── Serialize.h │ │ ├── XML │ │ │ ├── NSNull+XMLSerializableSupport.h │ │ │ ├── NSNumber+XMLSerializableSupport.h │ │ │ ├── NSArray+XMLSerializableSupport.h │ │ │ ├── NSNull+XMLSerializableSupport.m │ │ │ ├── NSDate+XMLSerializableSupport.h │ │ │ ├── XMLSerializableSupport.h │ │ │ ├── NSString+XMLSerializableSupport.h │ │ │ ├── NSDictionary+XMLSerializableSupport.h │ │ │ ├── NSNumber+XMLSerializableSupport.m │ │ │ ├── NSArray+XMLSerializableSupport.m │ │ │ ├── NSDate+XMLSerializableSupport.m │ │ │ ├── NSString+XMLSerializableSupport.m │ │ │ ├── FromXMLElementDelegate.h │ │ │ ├── NSDictionary+XMLSerializableSupport.m │ │ │ ├── NSObject+XMLSerializableSupport.h │ │ │ └── XMLSerializable.h │ │ ├── NSDate+Serialize.h │ │ ├── NSObject+Serialize.h │ │ ├── NSString+Serialize.h │ │ ├── NSDictionary+KeyTranslation.h │ │ ├── NSObject+Serialize.m │ │ ├── NSString+Serialize.m │ │ ├── NSDictionary+KeyTranslation.m │ │ └── NSDate+Serialize.m │ ├── Core │ │ ├── CoreSupport.h │ │ ├── ObjectiveSupport.h │ │ ├── NSData+Additions.h │ │ ├── NSString+GSub.h │ │ ├── NSString+GSub.m │ │ ├── ObjectiveResourceDateFormatter.h │ │ ├── NSObject+PropertySupport.h │ │ ├── Inflections │ │ │ ├── NSString+InflectionSupport.h │ │ │ └── NSString+InflectionSupport.m │ │ ├── ObjectiveResourceDateFormatter.m │ │ └── NSObject+PropertySupport.m │ └── json-framework │ │ ├── JSONFramework.h │ │ ├── NSString+SBJSON.h │ │ ├── NSString+SBJSON.m │ │ ├── NSObject+SBJSON.m │ │ └── NSObject+SBJSON.h ├── unit_tests │ ├── NSDateTest.h │ ├── XMLDeserializeTest.h │ └── NSDateTest.m ├── objective_supportAppDelegate.h └── objective_supportAppDelegate.m ├── .gitignore ├── objective_support_Prefix.pch ├── JSONDeserializeTest.h ├── ObjectiveResourceDateFormatterTest.h ├── TestClassMiddle.h ├── TestClassMiddle.m ├── main.m ├── TestClassTop.m ├── TestClass.m ├── TestClassTop.h ├── TestClass.h ├── README.textile ├── objective_support-Info.plist ├── Info.plist ├── Coverage.plist ├── JSONDeserializeTest.m └── ObjectiveResourceDateFormatterTest.m /google_toolbar/TigerGcov/libgcov.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/TigerGcov/libgcov.a -------------------------------------------------------------------------------- /Classes/lib/Serialization/JSON/JSONSerializableSupport.h: -------------------------------------------------------------------------------- 1 | #import "NSObject+JSONSerializableSupport.h" 2 | #import "NSDictionary+JSONSerializableSupport.h" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # osx noise 2 | .DS_Store 3 | profile 4 | 5 | # xcode noise 6 | build/* 7 | *.pbxuser 8 | *.mode1v3 9 | *.mode2v3 10 | 11 | #svn 12 | *.svn 13 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/GTMUIViewUnitTestingTest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/UnitTesting/GTMUIViewUnitTestingTest.png -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/TestData/GTMUnitTestingImage.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/UnitTesting/TestData/GTMUnitTestingImage.tiff -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/TestData/GTMUnitTestingView.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/UnitTesting/TestData/GTMUnitTestingView.tiff -------------------------------------------------------------------------------- /google_toolbar/AppKit/TestData/GTMNSBezierPath+CGPathTest.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/AppKit/TestData/GTMNSBezierPath+CGPathTest.tiff -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/TestData/GTMUnitTestingWindow.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/UnitTesting/TestData/GTMUnitTestingWindow.tiff -------------------------------------------------------------------------------- /google_toolbar/AppKit/TestData/GTMNSBezierPath+RoundRectTest.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/AppKit/TestData/GTMNSBezierPath+RoundRectTest.tiff -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/TestData/GTMUIViewUnitTestingTest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/UnitTesting/TestData/GTMUIViewUnitTestingTest.png -------------------------------------------------------------------------------- /google_toolbar/AppKit/TestData/GTMNSBezierPath+CGPathTest.ppc64.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/AppKit/TestData/GTMNSBezierPath+CGPathTest.ppc64.tiff -------------------------------------------------------------------------------- /google_toolbar/AppKit/TestData/GTMNSBezierPath+CGPathTest.x86_64.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/AppKit/TestData/GTMNSBezierPath+CGPathTest.x86_64.tiff -------------------------------------------------------------------------------- /google_toolbar/AppKit/TestData/GTMNSBezierPath+ShadingTest.10.5.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/AppKit/TestData/GTMNSBezierPath+ShadingTest.10.5.tiff -------------------------------------------------------------------------------- /google_toolbar/AppKit/TestData/GTMNSBezierPath+RoundRectTest.ppc64.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/AppKit/TestData/GTMNSBezierPath+RoundRectTest.ppc64.tiff -------------------------------------------------------------------------------- /google_toolbar/AppKit/TestData/GTMNSBezierPath+RoundRectTest.x86_64.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/AppKit/TestData/GTMNSBezierPath+RoundRectTest.x86_64.tiff -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/TestData/GTMUnitTestingTest.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/UnitTesting/TestData/GTMUnitTestingTest.nib/keyedobjects.nib -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/GTMUIUnitTestingHarness/English.lproj/MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yfactorial/objectivesupport/HEAD/google_toolbar/UnitTesting/GTMUIUnitTestingHarness/English.lproj/MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /objective_support_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'objective_support' target in the 'objective_support' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /Classes/lib/Core/CoreSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // CoreSupport.h 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | #import "NSString+GSub.h" 10 | #import "NSString+InflectionSupport.h" 11 | #import "NSObject+PropertySupport.h" -------------------------------------------------------------------------------- /Classes/lib/json-framework/JSONFramework.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONFramework.h 3 | // iphoneAndRails1 4 | // 5 | // Created by vickeryj on 12/11/08. 6 | // Copyright 2008 Joshua Vickery. All rights reserved. 7 | // 8 | 9 | #import "SBJSON.h" 10 | #import "NSObject+SBJSON.h" 11 | #import "NSString+SBJSON.h" -------------------------------------------------------------------------------- /Classes/lib/Core/ObjectiveSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // ObjectiveSupport.h 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | #import "CoreSupport.h" 10 | #import "XMLSerializableSupport.h" 11 | #import "JSONSerializableSupport.h" -------------------------------------------------------------------------------- /google_toolbar/Foundation/TestData/GTMHTTPFetcherTestPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Test Page 4 | 5 | 6 | 7 | This is a simple test page 8 | 9 | 10 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/Serialize.h: -------------------------------------------------------------------------------- 1 | // 2 | // Serialize.h 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/19/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "NSObject+Serialize.h" 10 | #import "NSDate+Serialize.h" 11 | #import "NSString+Serialize.h" 12 | -------------------------------------------------------------------------------- /Classes/unit_tests/NSDateTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDateTest.h 3 | // objective_support 4 | // 5 | // Created by James Burka on 2/10/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "GTMSenTestCase.h" 10 | 11 | 12 | @interface NSDateTest : SenTestCase { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSNull+XMLSerializableSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSNull+XMLSerializableSupport.h 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | @interface NSNull (XMLSerializableSupport) 10 | - (NSString *)toXMLValue; 11 | @end 12 | -------------------------------------------------------------------------------- /JSONDeserializeTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONDeserializeTest.h 3 | // objective_support 4 | // 5 | // Created by vickeryj on 2/10/09. 6 | // Copyright 2009 Joshua Vickery. All rights reserved. 7 | // 8 | 9 | #import "GTMSenTestCase.h" 10 | 11 | 12 | @interface JSONDeserializeTest : SenTestCase { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/NSDate+Serialize.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+Deserialize.h 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/19/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | @interface NSDate(Serialize) 10 | 11 | + (NSDate *) deserialize:(id)value; 12 | - (NSString *) serialize; 13 | @end 14 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/NSObject+Serialize.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Deserialize.h 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/19/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | @interface NSObject(Serialize) 10 | 11 | + (id) deserialize:(id)value; 12 | - (id) serialize; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Classes/unit_tests/XMLDeserializeTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // XMLDeserializeTest.h 3 | // objective_support 4 | // 5 | // Created by James Burka on 2/13/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "GTMSenTestCase.h" 10 | 11 | 12 | @interface XMLDeserializeTest : SenTestCase { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSNumber+XMLSerializableSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSNumber+XMLSerializableSupport.h 3 | // objective_support 4 | // 5 | // Created by James Burka on 2/17/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | @interface NSNumber(XMLSerializableSupport) 10 | - (NSString *)toXMLValue; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /ObjectiveResourceDateFormatterTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // ObjectiveResourceDateFormatterTest.h 3 | // objective_support 4 | // 5 | // Created by James Burka on 2/25/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "GTMSenTestCase.h" 10 | 11 | @interface ObjectiveResourceDateFormatterTest : SenTestCase { 12 | 13 | } 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/NSString+Serialize.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Deserialize.h 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/19/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface NSString(Deserialize) 13 | 14 | + (NSString *)deserialize:(id)value; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSArray+XMLSerializableSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+XMLSerializableSupport.h 3 | // 4 | // 5 | // Created by vickeryj on 9/29/08. 6 | // Copyright 2008 Joshua Vickery. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSArray (XMLSerializableSupport) 12 | - (NSString *)toXMLValue; 13 | @end 14 | -------------------------------------------------------------------------------- /TestClassMiddle.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestClassMiddle.h 3 | // objective_support 4 | // 5 | // Created by vickeryj on 3/2/09. 6 | // Copyright 2009 Joshua Vickery. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface TestClassMiddle : NSObject { 13 | 14 | NSArray *testClasses; 15 | 16 | } 17 | 18 | @property(nonatomic, retain) NSArray *testClasses; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSNull+XMLSerializableSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSNull+XMLSerializableSupport.m 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | #import "NSNull+XMLSerializableSupport.h" 10 | 11 | @implementation NSNull (XMLSerializableSupport) 12 | 13 | - (NSString *)toXMLValue { 14 | return @""; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /TestClassMiddle.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestClassMiddle.m 3 | // objective_support 4 | // 5 | // Created by vickeryj on 3/2/09. 6 | // Copyright 2009 Joshua Vickery. All rights reserved. 7 | // 8 | 9 | #import "TestClassMiddle.h" 10 | 11 | 12 | @implementation TestClassMiddle 13 | 14 | @synthesize testClasses; 15 | 16 | - (void) dealloc 17 | { 18 | [testClasses release]; 19 | [super dealloc]; 20 | } 21 | 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /google_toolbar/TigerGcov/libgcov_readme.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | libgcov_readme.html 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSDate+XMLSerializableSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+XMLSerializableSupport.h 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | @interface NSDate (XMLSerializableSupport) 10 | - (NSString *)toXMLValue; 11 | + (NSDate *)fromXMLDateTimeString:(NSString *)xmlString; 12 | + (NSDate *)fromXMLDateString:(NSString *)xmlString; 13 | @end 14 | -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // objective_support 4 | // 5 | // Created by vickeryj on 1/26/09. 6 | // Copyright Joshua Vickery 2009. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) { 12 | 13 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 14 | int retVal = UIApplicationMain(argc, argv, nil, nil); 15 | [pool release]; 16 | return retVal; 17 | } 18 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/NSDictionary+KeyTranslation.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+KeyTranslation.h 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/15/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface NSDictionary(KeyTranslation) 13 | 14 | + (NSString *)translationForKey:(NSString *)key withTranslations:(NSDictionary *)keyTranslations; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/NSObject+Serialize.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Deserialize.m 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/19/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "NSObject+Serialize.h" 10 | 11 | 12 | @implementation NSObject(Serialize) 13 | 14 | + (id)deserialize:(id)value { 15 | return value; 16 | } 17 | 18 | - (id) serialize { 19 | return self; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/XMLSerializableSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // XMLSerializableSupport.h 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | #import "XMLSerializable.h" 10 | #import "CoreSupport.h" 11 | #import "NSObject+XMLSerializableSupport.h" 12 | #import "NSNull+XMLSerializableSupport.h" 13 | #import "NSDate+XMLSerializableSupport.h" 14 | #import "NSString+XMLSerializableSupport.h" -------------------------------------------------------------------------------- /Classes/objective_supportAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // objective_supportAppDelegate.h 3 | // objective_support 4 | // 5 | // Created by vickeryj on 1/26/09. 6 | // Copyright Joshua Vickery 2009. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface objective_supportAppDelegate : NSObject { 12 | UIWindow *window; 13 | } 14 | 15 | @property (nonatomic, retain) IBOutlet UIWindow *window; 16 | 17 | @end 18 | 19 | -------------------------------------------------------------------------------- /Classes/unit_tests/NSDateTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDateTest.m 3 | // objective_support 4 | // 5 | // Created by James Burka on 2/10/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "NSDateTest.h" 10 | #import "NSDate+Serialize.h" 11 | 12 | 13 | @implementation NSDateTest 14 | 15 | -(void) testDeserializationOfNull { 16 | STAssertTrue([NSDate deserialize:[NSNull null]] == nil , @"should be nil"); 17 | } 18 | 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/NSString+Serialize.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Deserialize.m 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/19/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "NSString+Serialize.h" 10 | 11 | 12 | @implementation NSString(Serialize) 13 | 14 | + (NSString *) deserialize:(id)value { 15 | return (value == [NSNull null])? nil : [NSString stringWithFormat:@"%@",value]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/JSON/NSDictionary+JSONSerializableSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+JSONSerialization.h 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/15/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | @interface NSDictionary(JSONSerializableSupport) 10 | 11 | - (NSString *)toJSONAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 12 | withTranslations:(NSDictionary *)keyTranslations; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /TestClassTop.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestClassTop.m 3 | // objective_support 4 | // 5 | // Created by vickeryj on 3/2/09. 6 | // Copyright 2009 Joshua Vickery. All rights reserved. 7 | // 8 | 9 | #import "TestClassTop.h" 10 | #import "TestClassMiddle.h" 11 | 12 | 13 | @implementation TestClassTop 14 | 15 | @synthesize testClassMiddle, testClasses; 16 | 17 | - (void) dealloc 18 | { 19 | [testClassMiddle release]; 20 | [testClasses release]; 21 | [super dealloc]; 22 | } 23 | 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Classes/lib/Core/NSData+Additions.h: -------------------------------------------------------------------------------- 1 | //NSData additions from colloquy project 2 | 3 | @interface NSData (NSDataAdditions) 4 | + (NSData *) dataWithBase64EncodedString:(NSString *) string; 5 | - (id) initWithBase64EncodedString:(NSString *) string; 6 | 7 | - (NSString *) base64Encoding; 8 | - (NSString *) base64EncodingWithLineLength:(unsigned int) lineLength; 9 | 10 | - (BOOL) hasPrefix:(NSData *) prefix; 11 | - (BOOL) hasPrefixBytes:(void *) prefix length:(unsigned int) length; 12 | @end 13 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/JSON/NSArray+JSONSerializableSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+JSONSerializableSupport.h 3 | // objective_support 4 | // 5 | // Created by James Burka on 2/16/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface NSArray(JSONSerializableSupport) 13 | 14 | - (NSString *)toJSONAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 15 | withTranslations:(NSDictionary *)keyTranslations; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /TestClass.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestClass.m 3 | // objective_support 4 | // 5 | // Created by vickeryj on 2/10/09. 6 | // Copyright 2009 Joshua Vickery. All rights reserved. 7 | // 8 | 9 | #import "TestClass.h" 10 | 11 | 12 | @implementation TestClass 13 | 14 | @synthesize name, createdAt , testClassId , weight; 15 | 16 | #pragma mark cleanup 17 | - (void) dealloc 18 | { 19 | [weight release]; 20 | [testClassId release]; 21 | [name release]; 22 | [createdAt release]; 23 | [super dealloc]; 24 | } 25 | 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /TestClassTop.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestClassTop.h 3 | // objective_support 4 | // 5 | // Created by vickeryj on 3/2/09. 6 | // Copyright 2009 Joshua Vickery. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class TestClassMiddle; 12 | 13 | @interface TestClassTop : NSObject { 14 | 15 | TestClassMiddle *testClassMiddle; 16 | NSArray *testClasses; 17 | 18 | } 19 | 20 | @property(nonatomic, retain) TestClassMiddle *testClassMiddle; 21 | @property(nonatomic, retain) NSArray *testClasses; 22 | 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Classes/lib/Core/NSString+GSub.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Substitute.h 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | @interface NSString (GSub) 10 | 11 | /** 12 | * Perform basic substitution of given key -> value pairs 13 | * within this string. 14 | * 15 | * [@"test string substitution" gsub:[NSDictionary withObjectsAndKeys:@"substitution", @"sub"]]; 16 | * //> @"test string sub" 17 | */ 18 | - (NSString *)gsub:(NSDictionary *)keyValues; 19 | @end 20 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/NSDictionary+KeyTranslation.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+KeyTranslation.m 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/15/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "NSDictionary+KeyTranslation.h" 10 | 11 | 12 | @implementation NSDictionary(KeyTranslation) 13 | 14 | + (NSString *)translationForKey:(NSString *)key withTranslations:(NSDictionary *)keyTranslations { 15 | NSString *newKey = [keyTranslations objectForKey:key]; 16 | return (newKey ? newKey : key); 17 | } 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSString+XMLSerializableSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+XMLSerializableSupport.h 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/6/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface NSString(XMLSerializableSupport) 13 | 14 | + (NSString *)fromXmlString:(NSString *)aString; 15 | - (NSString *)toXMLValue; 16 | - (NSString *)toXMLElementAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 17 | withTranslations:(NSDictionary *)keyTranslations; 18 | 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/NSDate+Serialize.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+Deserialize.m 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/19/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "NSDate+Serialize.h" 10 | #import "ObjectiveResourceDateFormatter.h" 11 | 12 | 13 | @implementation NSDate(Serialize) 14 | 15 | + (NSDate *) deserialize:(id)value { 16 | return (value == [NSNull null]) ? nil : [ObjectiveResourceDateFormatter parseDateTime:value]; 17 | } 18 | 19 | - (NSString *) serialize { 20 | return [ObjectiveResourceDateFormatter formatDate:self]; 21 | } 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /TestClass.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestClass.h 3 | // objective_support 4 | // 5 | // Created by vickeryj on 2/10/09. 6 | // Copyright 2009 Joshua Vickery. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface TestClass : NSObject { 13 | 14 | NSString *name; 15 | NSDate *createdAt; 16 | NSNumber *testClassId; 17 | NSDecimalNumber *weight; 18 | 19 | } 20 | 21 | @property(nonatomic, retain) NSDecimalNumber *weight; 22 | @property(nonatomic, retain) NSString *name; 23 | @property(nonatomic, retain) NSDate *createdAt; 24 | @property(nonatomic, retain) NSNumber *testClassId; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSDictionary+XMLSerializableSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+XMLSerializableSupport.h 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | 10 | @interface NSDictionary (XMLSerializableSupport) 11 | 12 | - (NSString *)toXMLElementAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 13 | withTranslations:(NSDictionary *)keyTranslations andType:(NSString *)xmlType; 14 | 15 | - (NSString *)toXMLElementAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 16 | withTranslations:(NSDictionary *)keyTranslations; 17 | @end 18 | -------------------------------------------------------------------------------- /Classes/objective_supportAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // objective_supportAppDelegate.m 3 | // objective_support 4 | // 5 | // Created by vickeryj on 1/26/09. 6 | // Copyright Joshua Vickery 2009. All rights reserved. 7 | // 8 | 9 | #import "objective_supportAppDelegate.h" 10 | 11 | @implementation objective_supportAppDelegate 12 | 13 | @synthesize window; 14 | 15 | 16 | - (void)applicationDidFinishLaunching:(UIApplication *)application { 17 | 18 | // Override point for customization after application launch 19 | [window makeKeyAndVisible]; 20 | } 21 | 22 | 23 | - (void)dealloc { 24 | [window release]; 25 | [super dealloc]; 26 | } 27 | 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/TestData/GTMUnitTestingTest.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBFramework Version 6 | 644 7 | IBLastKnownRelativeProjectPath 8 | ../GTM.xcodeproj 9 | IBOldestOS 10 | 5 11 | IBOpenObjects 12 | 13 | 2 14 | 15 | IBSystem Version 16 | 9C31 17 | targetFramework 18 | IBCocoaFramework 19 | 20 | 21 | -------------------------------------------------------------------------------- /Classes/lib/Core/NSString+GSub.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Substitute.m 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | #import "NSString+GSub.h" 10 | 11 | @implementation NSString (GSub) 12 | 13 | - (NSString *)gsub:(NSDictionary *)keyValues { 14 | 15 | NSMutableString *subbed = [NSMutableString stringWithString:self]; 16 | 17 | for (NSString *key in keyValues) { 18 | NSString *value = [NSString stringWithFormat:@"%@", [keyValues objectForKey:key]]; 19 | NSArray *splits = [subbed componentsSeparatedByString:key]; 20 | [subbed setString:[splits componentsJoinedByString:value]]; 21 | } 22 | return subbed; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /google_toolbar/GTM-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.google.GTM 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | FMWK 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | h2. Overview 2 | 3 | ObjectiveSupport aims to bring some of the popular Rubyisms found in 4 | ActiveSupport to Objective-C. 5 | 6 | This project originated as a component of ObjectiveResource, but 7 | it has since outgrown that role and may prove to be useful on 8 | its own. 9 | 10 | h2. Installation 11 | 12 | # Download (clone) the objectivesupport project 13 | # open the .xcodeproj in XCode for both objectivesuppoe and your iPhone project 14 | # drag the ObjectiveSupport group from the objectivesupport project onto your iPhone project, making sure to check the "copy files" box. 15 | 16 | h2. Testing 17 | 18 | # Build and run the default target, the unit test results will print in the debugger 19 | console 20 | -------------------------------------------------------------------------------- /google_toolbar/UnitTest-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.google.${PRODUCT_NAME} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSNumber+XMLSerializableSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSNumber+XMLSerializableSupport.m 3 | // objective_support 4 | // 5 | // Created by James Burka on 2/17/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "NSObject+XMLSerializableSupport.h" 10 | #import "NSNumber+XMLSerializableSupport.h" 11 | 12 | 13 | @implementation NSNumber(XMLSerializableSupport) 14 | 15 | - (NSString *)toXMLValue { 16 | return [self stringValue]; 17 | } 18 | 19 | - (NSString *)toXMLElementAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 20 | withTranslations:(NSDictionary *)keyTranslations { 21 | return [[self class] buildXmlElementAs:rootName withInnerXml:[self toXMLValue] andType:[[self class] xmlTypeFor:self]]; 22 | } 23 | 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /objective_support-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.yourcompany.${PRODUCT_NAME:identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | APPL 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | NSMainNibFile 20 | MainWindow 21 | 22 | 23 | -------------------------------------------------------------------------------- /Classes/lib/Core/ObjectiveResourceDateFormatter.h: -------------------------------------------------------------------------------- 1 | // 2 | // ObjectiveResourceDateFormatter.h 3 | // iphone-harvest 4 | // 5 | // Created by James Burka on 10/21/08. 6 | // Copyright 2008 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface ObjectiveResourceDateFormatter : NSObject 13 | 14 | typedef enum { 15 | Date = 0, 16 | DateTime, 17 | } ORSDateFormat; 18 | 19 | + (void)setSerializeFormat:(ORSDateFormat)dateFormat; 20 | + (void)setDateFormatString:(NSString *)format; 21 | + (void)setDateTimeFormatString:(NSString *)format; 22 | + (void)setDateTimeZoneFormatString:(NSString *)format; 23 | + (NSString *)formatDate:(NSDate *)date; 24 | + (NSDate *)parseDate:(NSString *)dateString; 25 | + (NSDate *)parseDateTime:(NSString *)dateTimeString; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /google_toolbar/GTMiPhone-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.google.GTMiPhone 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | 24 | 25 | -------------------------------------------------------------------------------- /Classes/lib/Core/NSObject+PropertySupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Properties.h 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/28/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | @interface NSObject (PropertySupport) 10 | 11 | /** 12 | * Get the names of all properties and thier types declared on this class. 13 | * 14 | */ 15 | + (NSDictionary *)propertyNamesAndTypes; 16 | 17 | /** 18 | * Get the names of all properties declared on this class. 19 | */ 20 | + (NSArray *)propertyNames; 21 | 22 | /** 23 | * Get all the properties and their values of this instance. 24 | **/ 25 | - (NSDictionary *)properties; 26 | 27 | /** 28 | * Set this object's property values, overriding any existing 29 | * values. 30 | */ 31 | - (void)setProperties:(NSDictionary *)overrideProperties; 32 | 33 | - (NSString *)className; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /google_toolbar/BuildingAndUsing.txt: -------------------------------------------------------------------------------- 1 | The GTM project provides a Framework target and Unit Testing targets. 2 | 3 | Unit Testing Targets - 4 | 5 | These targets are there to make sure all of GTM is working, and reflect the 6 | hierarchy of the source tree. 7 | 8 | Building the "All UnitTests" target will build all of the unittests for the 9 | current configuration included in the GTM package. We require that "All 10 | UnitTests" builds cleanly before we will accept any code submissions. 11 | 12 | Framework Target - 13 | 14 | These targets are there to make it easy for anyone to quickly add GTM sources 15 | to their own project to start using it or playing around with it. However, 16 | the intent is for a developer to manually add the sources to their project in 17 | the end to reduce the total size of their product (since they only have to 18 | include the parts of GTM they need). 19 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/TestData/GTMUnitTestingImage.gtmUTState: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $GTMArchive 6 | GTMUnitTestingArchive 7 | $GTMVersion 8 | 1 9 | BoolTest 10 | 11 | BytesTest 12 | 13 | Qnl0ZXNUZXN0 14 | 15 | DoubleTest 16 | 1 17 | FloatTest 18 | 1 19 | ImageName 20 | NSApplicationIcon 21 | ImageSize 22 | {128, 128} 23 | Int32Test 24 | 1 25 | Int64Test 26 | 1 27 | IntTest 28 | 1 29 | 30 | 31 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/TestData/GTMUIViewUnitTestingTest.gtmUTState: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $GTMArchive 6 | GTMUnitTestingArchive 7 | $GTMVersion 8 | 1 9 | LayerIsDoublesided 10 | 11 | LayerIsHidden 12 | 13 | LayerIsOpaque 14 | 15 | LayerOpacity 16 | 1 17 | ViewIsHidden 18 | 19 | ViewSubView 0 20 | 21 | LayerIsDoublesided 22 | 23 | LayerIsHidden 24 | 25 | LayerIsOpaque 26 | 27 | LayerOpacity 28 | 1 29 | ViewIsHidden 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/subconfig/CodeCoverageStatic.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // CodeCoverageStatic.xcconfig 3 | // 4 | // Xcode configuration file for building static libs that need code coverage. 5 | // 6 | // Copyright 2006-2008 Google Inc. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 9 | // use this file except in compliance with the License. You may obtain a copy 10 | // of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 16 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 17 | // License for the specific language governing permissions and limitations under 18 | // the License. 19 | // 20 | 21 | 22 | // For measuring code coverage 23 | GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES 24 | GCC_GENERATE_TEST_COVERAGE_FILES = YES 25 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/subconfig/CodeCoverage.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // CodeCoverage.xcconfig 3 | // 4 | // Xcode configuration file for building executables that need code coverage. 5 | // 6 | // Copyright 2006-2008 Google Inc. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 9 | // use this file except in compliance with the License. You may obtain a copy 10 | // of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 16 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 17 | // License for the specific language governing permissions and limitations under 18 | // the License. 19 | // 20 | 21 | // Static Code Coverage 22 | #include "CodeCoverageStatic.xcconfig" 23 | 24 | // Need gcov library 25 | OTHER_LDFLAGS = ${OTHER_LDFLAGS} -lgcov 26 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/subconfig/GCSupported.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // GCSupported.xcconfig 3 | // 4 | // Xcode configuration file for making a build Garbage Collection enabled. 5 | // Use the *GCSupported specific configs in the Target folder. 6 | // 7 | // Copyright 2006-2008 Google Inc. 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 10 | // use this file except in compliance with the License. You may obtain a copy 11 | // of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 17 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 18 | // License for the specific language governing permissions and limitations under 19 | // the License. 20 | // 21 | 22 | // enable garbage collection (but don't require it) 23 | GCC_ENABLE_OBJC_GC = supported 24 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/JSON/NSObject+JSONSerializableSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+JSONSerializableSupport.h 3 | // active_resource 4 | // 5 | // Created by vickeryj on 1/8/09. 6 | // Copyright 2009 Joshua Vickery. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "JSONSerializable.h" 11 | 12 | @interface NSObject (JSONSerializableSupport) 13 | 14 | + (id)fromJSONData:(NSData *)data; 15 | + (id) deserializeJSON:(id)jsonObject asClass:(Class) claz; 16 | - (NSString *)toJSON; 17 | - (NSString *)toJSONExcluding:(NSArray *)exclusions; 18 | - (NSString *)toJSONAs:(NSString *)rootName; 19 | - (NSString *)toJSONAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions; 20 | - (NSString *)toJSONAs:(NSString *)rootName withTranslations:(NSDictionary *)keyTranslations; 21 | - (NSString *)toJSONAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 22 | withTranslations:(NSDictionary *)keyTranslations; 23 | - (NSString *) jsonClassName; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/GTMUIUnitTestingHarness/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.GTMUIUnitTestingHarness 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | NSMainNibFile 24 | MainMenu 25 | NSPrincipalClass 26 | NSApplication 27 | 28 | 29 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/GTMUIUnitTestingHarness/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // GTMUnitTestingTest 4 | // 5 | // Copyright 2006-2008 Google Inc. 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 8 | // use this file except in compliance with the License. You may obtain a copy 9 | // of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 16 | // License for the specific language governing permissions and limitations under 17 | // the License. 18 | // 19 | 20 | 21 | #import 22 | #import "GTMUnitTestingUtilities.h" 23 | 24 | int main(int argc, char *argv[]) { 25 | [GTMUnitTestingUtilities setUpForUIUnitTestsIfBeingTested]; 26 | return NSApplicationMain(argc, (const char **) argv); 27 | } 28 | -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.yourcompany.${PRODUCT_NAME:identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | NSMainNibFile 28 | MainWindow 29 | 30 | 31 | -------------------------------------------------------------------------------- /Coverage.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.yourcompany.${PRODUCT_NAME:identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | NSMainNibFile 28 | MainWindow 29 | 30 | 31 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/JSON/NSArray+JSONSerializableSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+JSONSerializableSupport.m 3 | // objective_support 4 | // 5 | // Created by James Burka on 2/16/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "JSONFramework.h" 10 | #import "NSObject+JSONSerializableSupport.h" 11 | #import "NSArray+JSONSerializableSupport.h" 12 | 13 | 14 | @implementation NSArray(JSONSerializableSupport) 15 | 16 | - (NSString *)toJSONAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 17 | withTranslations:(NSDictionary *)keyTranslations { 18 | 19 | NSMutableString *values = [NSMutableString stringWithString:@"["]; 20 | BOOL comma = NO; 21 | for (id element in self) { 22 | if(comma) { 23 | [values appendString:@","]; 24 | } 25 | else { 26 | comma = YES; 27 | } 28 | [values appendString:[element toJSONAs:[element jsonClassName] excludingInArray:exclusions withTranslations:keyTranslations]]; 29 | 30 | } 31 | [values appendString:@"]"]; 32 | return values; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/RunIPhoneUnitTest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # RunIPhoneUnitTest.sh 3 | # Copyright 2008 Google Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | # use this file except in compliance with the License. You may obtain a copy 7 | # of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | # License for the specific language governing permissions and limitations under 15 | # the License. 16 | # 17 | # Runs all unittests through the iPhone simulator 18 | 19 | export DYLD_ROOT_PATH="$SDKROOT" 20 | export DYLD_FRAMEWORK_PATH="$CONFIGURATION_BUILD_DIR" 21 | export IPHONE_SIMULATOR_ROOT="$SDKROOT" 22 | export CFFIXED_USER_HOME="$USER_LIBRARY_DIR/Application Support/iPhone Simulator/User" 23 | "$TARGET_BUILD_DIR/$EXECUTABLE_PATH" -RegisterForSystemEvents 24 | exit 0 25 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/subconfig/64bit.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // 64bit.xcconfig 3 | // 4 | // Xcode configuration file to include for builds wanting 64bit support. 5 | // 6 | // Copyright 2008 Google Inc. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 9 | // use this file except in compliance with the License. You may obtain a copy 10 | // of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 16 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 17 | // License for the specific language governing permissions and limitations under 18 | // the License. 19 | // 20 | 21 | // Compile all flavors: 32 & 64bit on both PPC and Intel 22 | ARCHS = i386 x86_64 ppc ppc64 23 | 24 | // Warn on implicit data conversions in 64bit builds 25 | GCC_WARN_64_TO_32_BIT_CONVERSION[arch=ppc64] = YES 26 | GCC_WARN_64_TO_32_BIT_CONVERSION[arch=x86_64] = YES 27 | -------------------------------------------------------------------------------- /Classes/lib/Core/Inflections/NSString+InflectionSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+InflectionSupport.h 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | @interface NSString (InflectionSupport) 10 | 11 | /** 12 | * Return the dashed form af this camelCase string: 13 | * 14 | * [@"camelCase" dasherize] //> @"camel-case" 15 | */ 16 | - (NSString *)dasherize; 17 | 18 | /** 19 | * Return the underscored form af this camelCase string: 20 | * 21 | * [@"camelCase" underscore] //> @"camel_case" 22 | */ 23 | - (NSString *)underscore; 24 | 25 | /** 26 | * Return the camelCase form af this dashed/underscored string: 27 | * 28 | * [@"camel-case_string" camelize] //> @"camelCaseString" 29 | */ 30 | - (NSString *)camelize; 31 | 32 | /** 33 | * Return a copy of the string suitable for displaying in a title. Each word is downcased, with the first letter upcased. 34 | */ 35 | - (NSString *)titleize; 36 | 37 | /** 38 | * Return a copy of the string with the first letter capitalized. 39 | */ 40 | - (NSString *)toClassName; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/JSON/NSDictionary+JSONSerializableSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+JSONSerialization.m 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/15/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "JSONFramework.h" 10 | #import "NSDictionary+KeyTranslation.h" 11 | #import "NSDictionary+JSONSerializableSupport.h" 12 | #import "ObjectiveSupport.h" 13 | #import "Serialize.h" 14 | 15 | @implementation NSDictionary(JSONSerializableSupport) 16 | 17 | - (NSString *)toJSONAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 18 | withTranslations:(NSDictionary *)keyTranslations { 19 | 20 | NSMutableDictionary *props = [NSMutableDictionary dictionary]; 21 | for (NSString *key in self) { 22 | if(![exclusions containsObject:key]) { 23 | NSString *convertedKey = [[self class] translationForKey:key withTranslations:keyTranslations]; 24 | [props setObject:[[self objectForKey:key] serialize] forKey:[convertedKey underscore]]; 25 | } 26 | } 27 | return [[NSDictionary dictionaryWithObject:props forKey:rootName]JSONRepresentation]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMNSAppleEvent+HandlerTest.applescript: -------------------------------------------------------------------------------- 1 | -- 2 | -- Copyright 2008 Google Inc. 3 | -- 4 | -- Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | -- use this file except in compliance with the License. You may obtain a copy 6 | -- of the License at 7 | -- 8 | -- http://www.apache.org/licenses/LICENSE-2.0 9 | -- 10 | -- Unless required by applicable law or agreed to in writing, software 11 | -- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | -- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | -- License for the specific language governing permissions and limitations under 14 | -- the License. 15 | -- 16 | 17 | property foo : 1 18 | 19 | on test() 20 | end test 21 | 22 | on testReturnOne() 23 | return 1 24 | end testReturnOne 25 | 26 | on testReturnParam(param) 27 | return param 28 | end testReturnParam 29 | 30 | on testAddParams(param1, param2) 31 | return param1 + param2 32 | end testAddParams 33 | 34 | on testAdd of a onto b given otherValue:d 35 | return a + b + d 36 | end testAdd 37 | 38 | on open 39 | end open 40 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/GTMUnitTestingTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMUnitTestingTest.h 3 | // 4 | // Copyright 2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | // GTMUnitTestingTestController controller so that initWithWindowNibName can 22 | // find the appropriate bundle to load our nib from. See [GTMUnitTestingTest 23 | // -testUnitTestingFramework] for more info 24 | @interface GTMUnitTestingTestController : NSWindowController { 25 | IBOutlet NSTextField *field_; 26 | } 27 | 28 | - (NSTextField *)textField; 29 | @end 30 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSArray+XMLSerializableSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+XMLSerializableSupport.m 3 | // 4 | // 5 | // Created by vickeryj on 9/29/08. 6 | // Copyright 2008 Joshua Vickery. All rights reserved. 7 | // 8 | 9 | #import "NSArray+XMLSerializableSupport.h" 10 | #import "NSObject+XMLSerializableSupport.h" 11 | 12 | 13 | @implementation NSArray (XMLSerializableSupport) 14 | 15 | - (NSString *)toXMLValue { 16 | NSMutableString *result = [NSMutableString string]; 17 | 18 | for (id element in self) { 19 | [result appendString:[element toXMLElement]]; 20 | } 21 | 22 | return result; 23 | } 24 | 25 | - (NSString *)toXMLElementAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 26 | withTranslations:(NSDictionary *)keyTranslations { 27 | NSMutableString *elementValue = [NSMutableString string]; 28 | for (id element in self) { 29 | [elementValue appendString:[element toXMLElementAs:[[element class] xmlElementName] excludingInArray:exclusions withTranslations:keyTranslations]]; 30 | } 31 | return [[self class] buildXmlElementAs:rootName withInnerXml:elementValue andType:@"array"]; 32 | } 33 | 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /google_toolbar/AppKit/GTMNSBezierPath+CGPath.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSBezierPath+CGPath.h 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | /// Category for extracting a CGPathRef from a NSBezierPath 22 | @interface NSBezierPath (GTMBezierPathCGPathAdditions) 23 | 24 | /// Extract a CGPathRef from a NSBezierPath. 25 | // 26 | // Args: 27 | // 28 | // Returns: 29 | // Converted CGPathRef. Must be released by client (CGPathRelease). 30 | // nil if failure. 31 | - (CGPathRef)gtm_createCGPath; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/subconfig/TigerOrLater.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TigerOrLater.xcconfig 3 | // 4 | // Xcode configuration file for projects targeting 10.4 Tiger or later. These 5 | // settings produce a Universal binary compatible with 10.4 for PPC and Intel. 6 | // 7 | // Copyright 2006-2008 Google Inc. 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 10 | // use this file except in compliance with the License. You may obtain a copy 11 | // of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 17 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 18 | // License for the specific language governing permissions and limitations under 19 | // the License. 20 | // 21 | 22 | // Default SDK and minimum OS version is 10.4 23 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk 24 | MACOSX_DEPLOYMENT_TARGET = 10.4 25 | GCC_VERSION = 4.0 26 | 27 | // On Tiger use Obj-C fast dispatch 28 | GCC_FAST_OBJC_DISPATCH = YES 29 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSDate+XMLSerializableSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDate+XMLSerializableSupport.m 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | #import "NSDate+XMLSerializableSupport.h" 10 | #import "NSObject+XMLSerializableSupport.h" 11 | #import "ObjectiveResourceDateFormatter.h" 12 | 13 | @implementation NSDate (XMLSerializableSupport) 14 | 15 | //FIXME we should have one formatter for the entire app 16 | 17 | - (NSString *)toXMLValue { 18 | return [ ObjectiveResourceDateFormatter formatDate:self]; 19 | } 20 | 21 | - (NSString *)toXMLElementAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 22 | withTranslations:(NSDictionary *)keyTranslations { 23 | return [[self class] buildXmlElementAs:rootName withInnerXml:[self toXMLValue] andType:[[self class] xmlTypeFor:self]]; 24 | } 25 | 26 | + (NSDate *)fromXMLDateTimeString:(NSString *)xmlString { 27 | return [ ObjectiveResourceDateFormatter parseDateTime:xmlString]; 28 | } 29 | 30 | + (NSDate *)fromXMLDateString:(NSString *)xmlString { 31 | return [ ObjectiveResourceDateFormatter parseDate:xmlString]; 32 | } 33 | 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /google_toolbar/AppKit/GTMNSWorkspace+ScreenSaverTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSWorkspace+ScreenSaverTest.m 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | #import "GTMSenTestCase.h" 19 | #import "GTMNSWorkspace+ScreenSaver.h" 20 | 21 | @interface GTMNSWorkspace_ScreenSaverTest : GTMTestCase 22 | @end 23 | 24 | 25 | @implementation GTMNSWorkspace_ScreenSaverTest 26 | 27 | - (void)testIsScreenSaverActive { 28 | // Not much of a test, just executes the code. Couldn't think of a 29 | // good way of verifying this one. 30 | [NSWorkspace gtm_isScreenSaverActive]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Target/SharedLibrary.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // SharedLibrary.xcconfig 3 | // 4 | // Xcode configuration file for a shared library. 5 | // 6 | // This is a _Target_ config file, for use in the "Based on" popup of the 7 | // settings dialog for a target. Do not attempt to apply this as the base 8 | // of an Xcode configuration in the project settings dialog. 9 | // 10 | // Copyright 2006-2008 Google Inc. 11 | // 12 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 13 | // use this file except in compliance with the License. You may obtain a copy 14 | // of the License at 15 | // 16 | // http://www.apache.org/licenses/LICENSE-2.0 17 | // 18 | // Unless required by applicable law or agreed to in writing, software 19 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 20 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 21 | // License for the specific language governing permissions and limitations under 22 | // the License. 23 | // 24 | 25 | // Dynamic libs need to be position independent 26 | GCC_DYNAMIC_NO_PIC = NO 27 | 28 | // Dynamic libs should not have their external symbols stripped. 29 | STRIP_STYLE = non-global -------------------------------------------------------------------------------- /google_toolbar/AppKit/GTMNSWorkspace+ScreenSaver.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSWorkspace+ScreenSaver.h 3 | // 4 | // Category for seeing if the screen saver is running. 5 | // Requires linkage with the ScreenSaver.framework. Warning, uses some 6 | // undocumented methods in the ScreenSaver.framework. 7 | // 8 | // Copyright 2006-2008 Google Inc. 9 | // 10 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 11 | // use this file except in compliance with the License. You may obtain a copy 12 | // of the License at 13 | // 14 | // http://www.apache.org/licenses/LICENSE-2.0 15 | // 16 | // Unless required by applicable law or agreed to in writing, software 17 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 18 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 19 | // License for the specific language governing permissions and limitations under 20 | // the License. 21 | // 22 | 23 | #import 24 | 25 | @interface NSWorkspace (GTMScreenSaverAddition) 26 | 27 | // Check if the screen saver is running. 28 | // Returns YES if it is running. 29 | // Requires linking to the ScreenSaver.framework. 30 | + (BOOL)gtm_isScreenSaverActive; 31 | 32 | @end 33 | 34 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/subconfig/LeopardOrLater.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // LeopardOrLater.xcconfig 3 | // 4 | // Xcode configuration file for projects targeting 10.4 Tiger or later. These 5 | // settings produce a Universal binary compatible with 10.4 for PPC and Intel. 6 | // 7 | // Copyright 2006-2008 Google Inc. 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 10 | // use this file except in compliance with the License. You may obtain a copy 11 | // of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 17 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 18 | // License for the specific language governing permissions and limitations under 19 | // the License. 20 | // 21 | 22 | // Default SDK and minimum OS version is 10.5 23 | SDKROOT = ${DEVELOPER_SDK_DIR}/MacOSX10.5.sdk 24 | MACOSX_DEPLOYMENT_TARGET = 10.5 25 | GCC_VERSION = 4.0 26 | 27 | // On Leopard use Obj-C fast dispatch 28 | GCC_FAST_OBJC_DISPATCH = YES 29 | 30 | // For Leopard, pull in 64bit support 31 | #include "64bit.xcconfig" 32 | 33 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Target/LoadableBundle.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // LoadableBundle.xcconfig 3 | // 4 | // Xcode configuration file for a loadable bundle. Usually a Cocoa plugin or 5 | // similar. 6 | // 7 | // This is a _Target_ config file, for use in the "Based on" popup of the 8 | // settings dialog for a target. Do not attempt to apply this as the base 9 | // of an Xcode configuration in the project settings dialog. 10 | // 11 | // Copyright 2006-2008 Google Inc. 12 | // 13 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 14 | // use this file except in compliance with the License. You may obtain a copy 15 | // of the License at 16 | // 17 | // http://www.apache.org/licenses/LICENSE-2.0 18 | // 19 | // Unless required by applicable law or agreed to in writing, software 20 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 21 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 22 | // License for the specific language governing permissions and limitations under 23 | // the License. 24 | // 25 | 26 | // Bundles should not have their external symbols stripped. 27 | STRIP_STYLE = non-global 28 | 29 | // Bundles need to be position independent 30 | GCC_DYNAMIC_NO_PIC = NO 31 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Target/DebugUnittest.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugUnittest.xcconfig 3 | // 4 | // Xcode configuration file for a debug unittest target. 5 | // 6 | // This is a _Target_ config file, for use in the "Based on" popup of the 7 | // settings dialog for a target. Do not attempt to apply this as the base 8 | // of an Xcode configuration in the project settings dialog. 9 | // 10 | // Copyright 2006-2008 Google Inc. 11 | // 12 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 13 | // use this file except in compliance with the License. You may obtain a copy 14 | // of the License at 15 | // 16 | // http://www.apache.org/licenses/LICENSE-2.0 17 | // 18 | // Unless required by applicable law or agreed to in writing, software 19 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 20 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 21 | // License for the specific language governing permissions and limitations under 22 | // the License. 23 | // 24 | 25 | // Unittests are loadable bundles 26 | #include "../subconfig/Unittest.xcconfig" 27 | 28 | // See comments in ReleaseUnittest.xcconfig regarding BUNDLE_LOADER and 29 | // how it should be set if you are running into link errors. -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Target/SharedLibraryGCSupported.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // SharedLibraryGCSupported.xcconfig 3 | // 4 | // Xcode configuration file for a shared library that support garbage 5 | // collection. 6 | // 7 | // This is a _Target_ config file, for use in the "Based on" popup of the 8 | // settings dialog for a target. Do not attempt to apply this as the base 9 | // of an Xcode configuration in the project settings dialog. 10 | // 11 | // Copyright 2006-2008 Google Inc. 12 | // 13 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 14 | // use this file except in compliance with the License. You may obtain a copy 15 | // of the License at 16 | // 17 | // http://www.apache.org/licenses/LICENSE-2.0 18 | // 19 | // Unless required by applicable law or agreed to in writing, software 20 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 21 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 22 | // License for the specific language governing permissions and limitations under 23 | // the License. 24 | // 25 | 26 | // Include the basic Shared Library config 27 | #include "SharedLibrary.xcconfig" 28 | 29 | // Include the GC flag(s) 30 | #include "../subconfig/GCSupported.xcconfig" 31 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Target/StaticLibraryGCSupported.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibraryGCSupported.xcconfig 3 | // 4 | // Xcode configuration file for a static library that supports garbage 5 | // collection. 6 | // 7 | // This is a _Target_ config file, for use in the "Based on" popup of the 8 | // settings dialog for a target. Do not attempt to apply this as the base 9 | // of an Xcode configuration in the project settings dialog. 10 | // 11 | // Copyright 2006-2008 Google Inc. 12 | // 13 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 14 | // use this file except in compliance with the License. You may obtain a copy 15 | // of the License at 16 | // 17 | // http://www.apache.org/licenses/LICENSE-2.0 18 | // 19 | // Unless required by applicable law or agreed to in writing, software 20 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 21 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 22 | // License for the specific language governing permissions and limitations under 23 | // the License. 24 | // 25 | 26 | // Include the basic Static Library config 27 | #include "StaticLibrary.xcconfig" 28 | 29 | // Include the GC flag(s) 30 | #include "../subconfig/GCSupported.xcconfig" 31 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSString+XMLSerializableSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+XMLSerializableSupport.m 3 | // active_resource 4 | // 5 | // Created by James Burka on 1/6/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "NSString+XMLSerializableSupport.h" 10 | #import "NSObject+XMLSerializableSupport.h" 11 | #import "NSString+GSub.h" 12 | 13 | 14 | @implementation NSString(XMLSerializableSupport) 15 | 16 | + (NSString *)fromXmlString:(NSString *)aString { 17 | NSDictionary* escapeChars = [NSDictionary dictionaryWithObjectsAndKeys:@"&",@"&",@"\"",@""",@"'",@"'" 18 | ,@"<",@"<",@">",@">",nil]; 19 | return [aString gsub:escapeChars]; 20 | 21 | } 22 | 23 | - (NSString *)toXMLValue { 24 | NSString *temp = [self gsub:[NSDictionary dictionaryWithObject:@"&" forKey:@"&"]]; 25 | NSDictionary* escapeChars = [NSDictionary dictionaryWithObjectsAndKeys:@""",@"\"",@"'",@"'",@"<",@"<",@">",@">",nil]; 26 | return [temp gsub:escapeChars]; 27 | } 28 | - (NSString *)toXMLElementAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 29 | withTranslations:(NSDictionary *)keyTranslations { 30 | return [[self class] buildXmlElementAs:rootName withInnerXml:[self toXMLValue]]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMNSDictionary+URLArguments.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSDictionary+URLArguments.h 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | /// Utility for building a URL or POST argument string. 22 | @interface NSDictionary (GTMNSDictionaryURLArgumentsAdditions) 23 | 24 | /// Gets a string representation of the dictionary in the form 25 | /// key1=value1&key2&value2&...&keyN=valueN, suitable for use as either 26 | /// URL arguments (after a '?') or POST body. Keys and values will be escaped 27 | /// automatically, so should be unescaped in the dictionary. 28 | - (NSString *)gtm_httpArgumentsString; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Target/StaticLibrary.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibrary.xcconfig 3 | // 4 | // Xcode configuration file for a static library. 5 | // 6 | // This is a _Target_ config file, for use in the "Based on" popup of the 7 | // settings dialog for a target. Do not attempt to apply this as the base 8 | // of an Xcode configuration in the project settings dialog. 9 | // 10 | // Copyright 2006-2008 Google Inc. 11 | // 12 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 13 | // use this file except in compliance with the License. You may obtain a copy 14 | // of the License at 15 | // 16 | // http://www.apache.org/licenses/LICENSE-2.0 17 | // 18 | // Unless required by applicable law or agreed to in writing, software 19 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 20 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 21 | // License for the specific language governing permissions and limitations under 22 | // the License. 23 | // 24 | 25 | // Static libs can be included in bundles so make them position independent 26 | GCC_DYNAMIC_NO_PIC = NO 27 | 28 | // Static libs should not have their internal globals or external symbols 29 | // stripped. 30 | STRIP_STYLE = debugging 31 | -------------------------------------------------------------------------------- /google_toolbar/DebugUtils/GTMDevLog.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMDevLog.m 3 | // 4 | // Copyright 2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #include "GTMUnitTestDevLog.h" 20 | 21 | // This is the logging function that is called by default when building 22 | // GTMFramework. If it can find GTMUnitTestDevLog class it will use it, 23 | // otherwise it falls onto NSLog. 24 | void _GTMUnittestDevLog(NSString *format, ...) { 25 | Class devLogClass = NSClassFromString(@"GTMUnitTestDevLog"); 26 | va_list argList; 27 | va_start(argList, format); 28 | if (devLogClass) { 29 | [devLogClass log:format args:argList]; 30 | } else { 31 | NSLogv(format, argList); 32 | } 33 | va_end(argList); 34 | } 35 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/subconfig/iPhone.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // iPhone.xcconfig 3 | // 4 | // Xcode configuration file for building a Debug target on iPhone 5 | // 6 | // Copyright 2006-2008 Google Inc. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 9 | // use this file except in compliance with the License. You may obtain a copy 10 | // of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 16 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 17 | // License for the specific language governing permissions and limitations under 18 | // the License. 19 | 20 | // Build for ARM 21 | ARCHS = armv6 22 | 23 | // Build only the active architecture 24 | ONLY_ACTIVE_ARCH = YES 25 | 26 | // Code signing. Should be overridden if releasing 27 | CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer 28 | 29 | // Default SDK and minimum OS version is the iphone SDK. 30 | SDKROOT = iphoneos2.0 31 | 32 | MACOSX_DEPLOYMENT_TARGET = 10.5 33 | GCC_VERSION = 4.0 34 | 35 | // On iPhone use Obj-C fast dispatch 36 | GCC_FAST_OBJC_DISPATCH = YES 37 | 38 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/GTMIPhoneUnitTestMain.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMIPhoneUnitTestMain.m 3 | // 4 | // Copyright 2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import "GTMDefines.h" 20 | #if !GTM_IPHONE_SDK 21 | #error GTMIPhoneUnitTestMain for iPhone only 22 | #endif 23 | #import 24 | 25 | // Creates an application that runs all tests from classes extending 26 | // SenTestCase, outputs results and test run time, and terminates right 27 | // afterwards. 28 | int main(int argc, char *argv[]) { 29 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 30 | int retVal = UIApplicationMain(argc, argv, nil, @"GTMIPhoneUnitTestDelegate"); 31 | [pool release]; 32 | return retVal; 33 | } 34 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/subconfig/Unittest.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // Unittest.xcconfig 3 | // 4 | // Xcode configuration file for a basic unittest targets. Use the debug or 5 | // release build specific configs in the Target folder. 6 | // 7 | // Copyright 2006-2008 Google Inc. 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 10 | // use this file except in compliance with the License. You may obtain a copy 11 | // of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 17 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 18 | // License for the specific language governing permissions and limitations under 19 | // the License. 20 | // 21 | 22 | // Unittests are loadable bundles 23 | #include "../Target/LoadableBundle.xcconfig" 24 | 25 | // Force C99 dialect with GNU extensions (needed for OCUnit) 26 | GCC_C_LANGUAGE_STANDARD = gnu99 27 | 28 | // Deploment postprocessing is what triggers Xcode to strip, we don't strip 29 | // unittests 30 | DEPLOYMENT_POSTPROCESSING = NO 31 | 32 | // Most common unittests will be objective-c 33 | WRAPPER_EXTENSION = octest 34 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Target/LoadableBundleGCSupported.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // LoadableBundleGCSupported.xcconfig 3 | // 4 | // Xcode configuration file for a loadable bundle that supports garbage 5 | // collection. Usually a Cocoa plugin or similar. 6 | // 7 | // This is a _Target_ config file, for use in the "Based on" popup of the 8 | // settings dialog for a target. Do not attempt to apply this as the base 9 | // of an Xcode configuration in the project settings dialog. 10 | // 11 | // Copyright 2006-2008 Google Inc. 12 | // 13 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 14 | // use this file except in compliance with the License. You may obtain a copy 15 | // of the License at 16 | // 17 | // http://www.apache.org/licenses/LICENSE-2.0 18 | // 19 | // Unless required by applicable law or agreed to in writing, software 20 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 21 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 22 | // License for the specific language governing permissions and limitations under 23 | // the License. 24 | // 25 | 26 | // Include the basic Loadable Bundle config 27 | #include "LoadableBundle.xcconfig" 28 | 29 | // Include the GC flag(s) 30 | #include "../subconfig/GCSupported.xcconfig" 31 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/GTMIPhoneUnitTestDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMIPhoneUnitTestDelegate.h 3 | // 4 | // Copyright 2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | // Application delegate that runs all test methods in registered classes 20 | // extending SenTestCase. The application is terminated afterwards. 21 | // You can also run the tests directly from your application by invoking 22 | // gtm_runTests and clean up, restore data, etc. before the application 23 | // terminates. 24 | @interface GTMIPhoneUnitTestDelegate : NSObject 25 | // Runs through all the registered classes and runs test methods on any 26 | // that are subclasses of SenTestCase. Prints results and run time to 27 | // the default output. 28 | - (void)runTests; 29 | @end 30 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Project/DebugiPhone.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugiPhoneSimulator.xcconfig 3 | // 4 | // Xcode configuration file for building a Debug target on iPhone 5 | // 6 | // Copyright 2006-2008 Google Inc. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 9 | // use this file except in compliance with the License. You may obtain a copy 10 | // of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 16 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 17 | // License for the specific language governing permissions and limitations under 18 | // the License. 19 | 20 | // 21 | // This is a _Configuration_ Xcode config file for use in the "Based on" popup 22 | // of the project configuration editor. Do _not_ use this as the config base 23 | // and individual Xcode target, there are other configuration files for that 24 | // purpose. 25 | 26 | // Pull in the general settings 27 | #include "../subconfig/General.xcconfig" 28 | 29 | // iPhone settings 30 | #include "../subconfig/iPhone.xcconfig" 31 | 32 | // Release settings 33 | #include "../subconfig/Debug.xcconfig" 34 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Project/ReleaseiPhone.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseAspenSimulator.xcconfig 3 | // 4 | // Xcode configuration file for building a Release target on iPhone 5 | // 6 | // Copyright 2006-2008 Google Inc. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 9 | // use this file except in compliance with the License. You may obtain a copy 10 | // of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 16 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 17 | // License for the specific language governing permissions and limitations under 18 | // the License. 19 | 20 | // 21 | // This is a _Configuration_ Xcode config file for use in the "Based on" popup 22 | // of the project configuration editor. Do _not_ use this as the config base 23 | // and individual Xcode target, there are other configuration files for that 24 | // purpose. 25 | 26 | // Pull in the general settings 27 | #include "../subconfig/General.xcconfig" 28 | 29 | // iPhone Settings. 30 | #include "../subconfig/iPhone.xcconfig" 31 | 32 | // Release settings 33 | #include "../subconfig/Release.xcconfig" 34 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Project/DebugTigerOrLater.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugTigerOrLater.xcconfig 3 | // 4 | // Xcode configuration file for building a Debug target on Tiger or later. 5 | // 6 | // This is a _Configuration_ Xcode config file for use in the "Based on" popup 7 | // of the project configuration editor. Do _not_ use this as the config base 8 | // and individual Xcode target, there are other configuration files for that 9 | // purpose. 10 | // 11 | // Copyright 2006-2008 Google Inc. 12 | // 13 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 14 | // use this file except in compliance with the License. You may obtain a copy 15 | // of the License at 16 | // 17 | // http://www.apache.org/licenses/LICENSE-2.0 18 | // 19 | // Unless required by applicable law or agreed to in writing, software 20 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 21 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 22 | // License for the specific language governing permissions and limitations under 23 | // the License. 24 | // 25 | 26 | // Pull in the general settings 27 | #include "../subconfig/General.xcconfig" 28 | 29 | // Tiger or later 30 | #include "../subconfig/TigerOrLater.xcconfig" 31 | 32 | // Debug settings 33 | #include "../subconfig/Debug.xcconfig" 34 | 35 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Project/ReleaseTigerOrLater.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseTigerOrLater.xcconfig 3 | // 4 | // Xcode configuration file for building a Release target on Tiger or later. 5 | // 6 | // This is a _Configuration_ Xcode config file for use in the "Based on" popup 7 | // of the project configuration editor. Do _not_ use this as the config base 8 | // and individual Xcode target, there are other configuration files for that 9 | // purpose. 10 | // 11 | // Copyright 2006-2008 Google Inc. 12 | // 13 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 14 | // use this file except in compliance with the License. You may obtain a copy 15 | // of the License at 16 | // 17 | // http://www.apache.org/licenses/LICENSE-2.0 18 | // 19 | // Unless required by applicable law or agreed to in writing, software 20 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 21 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 22 | // License for the specific language governing permissions and limitations under 23 | // the License. 24 | // 25 | 26 | // Pull in the general settings 27 | #include "../subconfig/General.xcconfig" 28 | 29 | // Tiger or later 30 | #include "../subconfig/TigerOrLater.xcconfig" 31 | 32 | // Release settings 33 | #include "../subconfig/Release.xcconfig" 34 | -------------------------------------------------------------------------------- /google_toolbar/AppKit/GTMDelegatingTableColumn.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMDelegatingTableColumn.h 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | #import "GTMDefines.h" 21 | 22 | // NOTE: If you're using the 10.5 SDK, just use the new delegate method: 23 | // tableView:dataCellForTableColumn:row: 24 | 25 | @interface GTMDelegatingTableColumn : NSTableColumn 26 | // no instance state or new method, it will just invoke the tableview's delegate 27 | // w/ the method below. 28 | @end 29 | 30 | // the method delegated to 31 | @interface NSObject (GTMDelegatingTableColumnDelegate) 32 | - (id)gtm_tableView:(NSTableView *)tableView 33 | dataCellForTableColumn:(NSTableColumn *)tableColumn 34 | row:(NSInteger)row; 35 | @end 36 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Project/DebugLeopardOrLater.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugLeopardOrLater.xcconfig 3 | // 4 | // Xcode configuration file for building a Debug target on Leopard or later. 5 | // 6 | // This is a _Configuration_ Xcode config file for use in the "Based on" popup 7 | // of the project configuration editor. Do _not_ use this as the config base 8 | // and individual Xcode target, there are other configuration files for that 9 | // purpose. 10 | // 11 | // Copyright 2006-2008 Google Inc. 12 | // 13 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 14 | // use this file except in compliance with the License. You may obtain a copy 15 | // of the License at 16 | // 17 | // http://www.apache.org/licenses/LICENSE-2.0 18 | // 19 | // Unless required by applicable law or agreed to in writing, software 20 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 21 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 22 | // License for the specific language governing permissions and limitations under 23 | // the License. 24 | // 25 | 26 | // Pull in the general settings 27 | #include "../subconfig/General.xcconfig" 28 | 29 | // Leopard or later 30 | #include "../subconfig/LeopardOrLater.xcconfig" 31 | 32 | // Debug settings 33 | #include "../subconfig/Debug.xcconfig" 34 | 35 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Project/ReleaseLeopardOrLater.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseLeopardOrLater.xcconfig 3 | // 4 | // Xcode configuration file for building a Release target on Leopard or later. 5 | // 6 | // This is a _Configuration_ Xcode config file for use in the "Based on" popup 7 | // of the project configuration editor. Do _not_ use this as the config base 8 | // and individual Xcode target, there are other configuration files for that 9 | // purpose. 10 | // 11 | // Copyright 2006-2008 Google Inc. 12 | // 13 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 14 | // use this file except in compliance with the License. You may obtain a copy 15 | // of the License at 16 | // 17 | // http://www.apache.org/licenses/LICENSE-2.0 18 | // 19 | // Unless required by applicable law or agreed to in writing, software 20 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 21 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 22 | // License for the specific language governing permissions and limitations under 23 | // the License. 24 | // 25 | 26 | // Pull in the general settings 27 | #include "../subconfig/General.xcconfig" 28 | 29 | // Leopard or later 30 | #include "../subconfig/LeopardOrLater.xcconfig" 31 | 32 | // Release settings 33 | #include "../subconfig/Release.xcconfig" 34 | -------------------------------------------------------------------------------- /google_toolbar/AppKit/GTMShading.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMShading.h 3 | // 4 | // A protocol for an object that can be used as a shader. 5 | // 6 | // Copyright 2006-2008 Google Inc. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 9 | // use this file except in compliance with the License. You may obtain a copy 10 | // of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 16 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 17 | // License for the specific language governing permissions and limitations under 18 | // the License. 19 | // 20 | 21 | /// \cond Protocols 22 | 23 | @protocol GTMShading 24 | // Returns the shadefunction for using in a shader. 25 | // This shadefunction shoud never be released. It is owned by the implementor 26 | // of the GTMShading protocol. 27 | // 28 | // Returns: 29 | // a shading function. 30 | - (CGFunctionRef)shadeFunction; 31 | 32 | // Returns the colorSpace for using in a shader. 33 | // This colorSpace shoud never be released. It is owned by the implementor 34 | // of the GTMShading protocol. 35 | // 36 | // Returns: 37 | // a color space. 38 | - (CGColorSpaceRef)colorSpace; 39 | @end 40 | 41 | /// \endcond 42 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/FromXMLElementDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // FromXMLElementDelegate.h 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | @interface FromXMLElementDelegate : NSObject { 10 | Class targetClass; 11 | id parsedObject; 12 | NSString *currentPropertyName; 13 | NSMutableString *contentOfCurrentProperty; 14 | NSMutableArray *unclosedProperties; 15 | NSString *currentPropertyType; 16 | } 17 | 18 | @property (nonatomic, retain) Class targetClass; 19 | @property (nonatomic, retain) id parsedObject; 20 | @property (nonatomic, retain) NSString *currentPropertyName; 21 | @property (nonatomic, retain) NSMutableString *contentOfCurrentProperty; 22 | @property (nonatomic, retain) NSMutableArray *unclosedProperties; 23 | @property (nonatomic, retain) NSString *currentPropertyType; 24 | 25 | + (FromXMLElementDelegate *)delegateForClass:(Class)targetClass; 26 | 27 | - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict; 28 | - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string; 29 | - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName; 30 | - (NSString *)convertElementName:(NSString *)anElementName; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSDictionary+XMLSerializableSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+XMLSerializableSupport.m 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | #import "NSObject+XMLSerializableSupport.h" 10 | #import "NSDictionary+KeyTranslation.h" 11 | 12 | @implementation NSDictionary (XMLSerializableSupport) 13 | 14 | 15 | - (NSString *)toXMLElementAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 16 | withTranslations:(NSDictionary *)keyTranslations andType:(NSString *)xmlType { 17 | 18 | NSMutableString* elementValue = [NSMutableString string]; 19 | id value; 20 | NSString *propertyRootName; 21 | for (NSString *key in self) { 22 | // Create XML if key not in exclusion list 23 | if(![exclusions containsObject:key]) { 24 | value = [self valueForKey:key]; 25 | propertyRootName = [[self class] translationForKey:key withTranslations:keyTranslations]; 26 | [elementValue appendString:[value toXMLElementAs:propertyRootName]]; 27 | } 28 | } 29 | return [[self class] buildXmlElementAs:rootName withInnerXml:elementValue andType:xmlType]; 30 | } 31 | 32 | - (NSString *)toXMLElementAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 33 | withTranslations:(NSDictionary *)keyTranslations { 34 | return [self toXMLElementAs:rootName excludingInArray:exclusions withTranslations:keyTranslations andType:nil]; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/GTMTestHTTPServer.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMTestHTTPServer.h 3 | // 4 | // Copyright 2007-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | @class GTMHTTPServer; 22 | 23 | // This is a HTTP Server that can respond to certain requests that look like 24 | // Google service logins. It takes extra url arguments to tell it what to 25 | // return for testing the code using it. See GTMHTTPFetcherTest for an example 26 | // of its usage. 27 | @interface GTMTestHTTPServer : NSObject { 28 | NSString *docRoot_; 29 | GTMHTTPServer *server_; 30 | } 31 | 32 | // Any url that isn't a specific server request (login, etc.), will be fetched 33 | // off |docRoot| (to allow canned repsonses). 34 | - (id)initWithDocRoot:(NSString *)docRoot; 35 | 36 | // fetch the port the server is running on 37 | - (uint16_t)port; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /google_toolbar/GTM_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright 2007-2008 Google Inc. 3 | // 4 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 5 | // use this file except in compliance with the License. You may obtain a copy 6 | // of the License at 7 | // 8 | // http://www.apache.org/licenses/LICENSE-2.0 9 | // 10 | // Unless required by applicable law or agreed to in writing, software 11 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 12 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 13 | // License for the specific language governing permissions and limitations under 14 | // the License. 15 | // 16 | 17 | // We don't require a prefix to use any GTM code, so this prefix is just to 18 | // speed up the basic compiles of *all* of the GTM projects/targets. 19 | 20 | // We don't want to drag GTMDefines into the prefix so we make sure each file 21 | // that directly needs it includes it, so we just use the iphone test directly 22 | // instead of our GTM_IPHONE_SDK symbol. 23 | #ifdef __OBJC__ 24 | #include 25 | #if TARGET_OS_IPHONE // iPhone SDK 26 | #import 27 | #import 28 | #else 29 | #import 30 | #endif 31 | // This turns on unit test logging so that we can track unittests if we are 32 | // doing them. See GTMUnitTestDevLog.h for details. 33 | #define _GTMDevLog _GTMUnittestDevLog 34 | #endif 35 | 36 | 37 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/subconfig/Release.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // Release.xcconfig 3 | // 4 | // General Xcode configuration file for Release targets. 5 | // 6 | // Copyright 2006-2008 Google Inc. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 9 | // use this file except in compliance with the License. You may obtain a copy 10 | // of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 16 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 17 | // License for the specific language governing permissions and limitations under 18 | // the License. 19 | // 20 | 21 | // Optimize for space and size (Apple recommendation) 22 | GCC_OPTIMIZATION_LEVEL = s 23 | 24 | // Deploment postprocessing is what triggers Xcode to strip 25 | DEPLOYMENT_POSTPROCESSING = YES 26 | 27 | // No symbols 28 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 29 | 30 | // Dead code strip does not affect ObjC code but can help for C 31 | DEAD_CODE_STRIPPING = YES 32 | 33 | // NDEBUG is used by things like assert.h, so define it for general compat. 34 | // ASSERT going away in release tends to create unused vars. 35 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 36 | 37 | // When we strip we want to strip all symbols in release, but save externals. 38 | STRIP_STYLE = all 39 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/subconfig/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // Debug.xcconfig 3 | // 4 | // General Xcode configuration file for Debug targets. 5 | // 6 | // Copyright 2006-2008 Google Inc. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 9 | // use this file except in compliance with the License. You may obtain a copy 10 | // of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 16 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 17 | // License for the specific language governing permissions and limitations under 18 | // the License. 19 | // 20 | 21 | // No optimization 22 | GCC_OPTIMIZATION_LEVEL = 0 23 | 24 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 25 | DEPLOYMENT_POSTPROCESSING = NO 26 | 27 | // Dead code stripping off 28 | DEAD_CODE_STRIPPING = NO 29 | 30 | // Debug symbols should be on obviously 31 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 32 | 33 | // Define the DEBUG macro in all debug builds 34 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 35 | 36 | // Turns on special C++ STL checks to "encourage" good STL use 37 | GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 38 | 39 | // Sets Debug info to DWARF 40 | DEBUG_INFORMATION_FORMAT = dwarf 41 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMGarbageCollection.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMGarbageCollection.h 3 | // 4 | // Copyright 2007-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | // This allows us to easily move our code from GC to non GC. 22 | // They are no-ops unless we are require Leopard or above. 23 | // See 24 | // http://developer.apple.com/documentation/Cocoa/Conceptual/GarbageCollection/index.html 25 | // for details. 26 | // General use would be 27 | // CFTypeRef type = ... 28 | // return [GTMNSMakeCollectable(type) autorelease]; 29 | 30 | #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050 31 | 32 | FOUNDATION_STATIC_INLINE id GTMNSMakeCollectable(CFTypeRef cf) { 33 | return NSMakeCollectable(cf); 34 | } 35 | 36 | #else 37 | 38 | FOUNDATION_STATIC_INLINE id GTMNSMakeCollectable(CFTypeRef cf) { 39 | // NSMakeCollectable handles NULLs just fine and returns nil as expected. 40 | return (id)cf; 41 | } 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /google_toolbar/AppKit/GTMDelegatingTableColumn.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMDelegatingTableColumn.m 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import "GTMDelegatingTableColumn.h" 20 | 21 | @implementation GTMDelegatingTableColumn 22 | - (id)dataCellForRow:(NSInteger)row { 23 | id dataCell = nil; 24 | id delegate = [[self tableView] delegate]; 25 | BOOL sendSuper = YES; 26 | if (delegate) { 27 | if ([delegate respondsToSelector:@selector(gtm_tableView:dataCellForTableColumn:row:)]) { 28 | 29 | dataCell = [delegate gtm_tableView:[self tableView] 30 | dataCellForTableColumn:self 31 | row:row]; 32 | sendSuper = NO; 33 | } else { 34 | _GTMDevLog(@"tableView delegate didn't implement gtm_tableView:dataCellForTableColumn:row:"); 35 | } 36 | } 37 | if (sendSuper) { 38 | dataCell = [super dataCellForRow:row]; 39 | } 40 | return dataCell; 41 | } 42 | @end 43 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMNSDictionary+URLArguments.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSDictionary+URLArguments.m 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import "GTMNSDictionary+URLArguments.h" 20 | #import "GTMNSString+URLArguments.h" 21 | #import "GTMMethodCheck.h" 22 | 23 | @implementation NSDictionary (GTMNSDictionaryURLArgumentsAdditions) 24 | 25 | GTM_METHOD_CHECK(NSString, gtm_stringByEscapingForURLArgument); // COV_NF_LINE 26 | 27 | - (NSString *)gtm_httpArgumentsString { 28 | NSMutableArray* arguments = [NSMutableArray arrayWithCapacity:[self count]]; 29 | NSEnumerator* keyEnumerator = [self keyEnumerator]; 30 | NSString* key; 31 | while ((key = [keyEnumerator nextObject])) { 32 | [arguments addObject:[NSString stringWithFormat:@"%@=%@", 33 | [key gtm_stringByEscapingForURLArgument], 34 | [[[self objectForKey:key] description] gtm_stringByEscapingForURLArgument]]]; 35 | } 36 | 37 | return [arguments componentsJoinedByString:@"&"]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMSystemVersion.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMSystemVersion.h 3 | // 4 | // Copyright 2007-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | #import "GTMDefines.h" 21 | 22 | // A class for getting information about what system we are running on 23 | @interface GTMSystemVersion : NSObject 24 | 25 | // Returns the current system version major.minor.bugFix 26 | + (void)getMajor:(long*)major minor:(long*)minor bugFix:(long*)bugFix; 27 | 28 | #if GTM_MACOS_SDK 29 | // Returns YES if running on 10.3, NO otherwise. 30 | + (BOOL)isPanther; 31 | 32 | // Returns YES if running on 10.4, NO otherwise. 33 | + (BOOL)isTiger; 34 | 35 | // Returns YES if running on 10.5, NO otherwise. 36 | + (BOOL)isLeopard; 37 | 38 | // Returns a YES/NO if the system is 10.3 or better 39 | + (BOOL)isPantherOrGreater; 40 | 41 | // Returns a YES/NO if the system is 10.4 or better 42 | + (BOOL)isTigerOrGreater; 43 | 44 | // Returns a YES/NO if the system is 10.5 or better 45 | + (BOOL)isLeopardOrGreater; 46 | #endif // GTM_MACOS_SDK 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /google_toolbar/DebugUtils/GTMMethodCheckTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMMethodCheckTest.m 3 | // Copyright 2006-2008 Google Inc. 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, software 12 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | // License for the specific language governing permissions and limitations under 15 | // the License. 16 | // 17 | 18 | #import "GTMSenTestCase.h" 19 | #import "GTMMethodCheck.h" 20 | 21 | static BOOL gTestCheckVar = NO; 22 | 23 | @interface GTMMethodCheckTest : GTMTestCase 24 | + (void)GTMMethodCheckTestClassMethod; 25 | @end 26 | 27 | @implementation GTMMethodCheckTest 28 | GTM_METHOD_CHECK(GTMMethodCheckTest, GTMMethodCheckTestMethod); // COV_NF_LINE 29 | GTM_METHOD_CHECK(GTMMethodCheckTest, GTMMethodCheckTestClassMethod); // COV_NF_LINE 30 | 31 | - (void)GTMMethodCheckTestMethod { 32 | } 33 | 34 | + (void)GTMMethodCheckTestClassMethod { 35 | } 36 | 37 | + (void)xxGTMMethodCheckMethodTestCheck { 38 | // This gets called because of its special name by GMMethodCheck 39 | // Look at the Macros in GMMethodCheck.h for details. 40 | gTestCheckVar = YES; 41 | } 42 | 43 | - (void)testGTMMethodCheck { 44 | #ifdef DEBUG 45 | // GTMMethodCheck only runs in debug 46 | STAssertTrue(gTestCheckVar, @"Should be true"); 47 | #endif 48 | } 49 | @end 50 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/RunMacOSUnitTests.sh: -------------------------------------------------------------------------------- 1 | # 2 | # RunUnitTests.sh 3 | # Copyright 2008 Google Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | # use this file except in compliance with the License. You may obtain a copy 7 | # of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 | # License for the specific language governing permissions and limitations under 15 | # the License. 16 | # 17 | # Run the unit tests in this test bundle. 18 | # Set up some env variables to make things as likely to crash as possible. 19 | # See http://developer.apple.com/technotes/tn2004/tn2124.html for details. 20 | # 21 | 22 | export MallocScribble=YES 23 | export MallocPreScribble=YES 24 | export MallocGuardEdges=YES 25 | # CFZombieLevel disabled because it doesn't play well with the 26 | # security framework 27 | # export CFZombieLevel=3 28 | export NSAutoreleaseFreedObjectCheckEnabled=YES 29 | export NSZombieEnabled=YES 30 | export OBJC_DEBUG_FRAGILE_SUPERCLASSES=YES 31 | 32 | # If we have debug libraries on the machine, we'll use them 33 | # unless a target has specifically turned them off 34 | if [ ! $GTM_NO_DEBUG_FRAMEWORKS ]; then 35 | if [ -f "/System/Library/Frameworks/CoreFoundation.framework/Versions/Current/CoreFoundation_debug" ]; then 36 | echo ---- Using _debug frameworks ---- 37 | export DYLD_IMAGE_SUFFIX=_debug 38 | fi 39 | fi 40 | 41 | "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests" 42 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/subconfig/General.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // General.xcconfig 3 | // 4 | // Xcode configuration file for general build settings applicable to all 5 | // projects and targets. 6 | // 7 | // Copyright 2006-2008 Google Inc. 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 10 | // use this file except in compliance with the License. You may obtain a copy 11 | // of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 17 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 18 | // License for the specific language governing permissions and limitations under 19 | // the License. 20 | // 21 | 22 | // Build for PPC and Intel 23 | ARCHS = i386 ppc 24 | 25 | // Zerolink prevents link warnings so turn it off 26 | ZERO_LINK = NO 27 | 28 | // Prebinding considered unhelpful in 10.3 and later 29 | PREBINDING = NO 30 | 31 | // Strictest warning policy 32 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof 33 | 34 | // Work around Xcode bugs by using external strip. See: 35 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html 36 | SEPARATE_STRIP = YES 37 | 38 | // Force C99 dialect 39 | GCC_C_LANGUAGE_STANDARD = c99 40 | 41 | // Obj-C exceptions are needed for @synchronized(self) 42 | GCC_ENABLE_OBJC_EXCEPTIONS = YES 43 | 44 | // not sure why apple defaults this on, but it's pretty risky 45 | ALWAYS_SEARCH_USER_PATHS = NO 46 | 47 | // Turn on position dependent code for most cases (overridden where appropriate) 48 | GCC_DYNAMIC_NO_PIC = YES 49 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/GTMUnitTestingUtilities.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMUnitTestingUtilities.h 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | #import 21 | 22 | // Collection of utilities for unit testing 23 | @interface GTMUnitTestingUtilities : NSObject 24 | 25 | // Returns YES if we are currently being unittested. 26 | + (BOOL)areWeBeingUnitTested; 27 | 28 | // Sets up the user interface so that we can run consistent UI unittests on 29 | // it. This includes setting scroll bar types, setting selection colors 30 | // setting color spaces etc so that everything is consistent across machines. 31 | // This should be called in main, before NSApplicationMain is called. 32 | + (void)setUpForUIUnitTests; 33 | 34 | // Syntactic sugar combining the above, and wrapping them in an 35 | // NSAutoreleasePool so that your main can look like this: 36 | // int main(int argc, const char *argv[]) { 37 | // [UnitTestingUtilities setUpForUIUnitTestsIfBeingTested]; 38 | // return NSApplicationMain(argc, argv); 39 | // } 40 | + (void)setUpForUIUnitTestsIfBeingTested; 41 | 42 | @end 43 | 44 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMNSString+URLArguments.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSString+URLArguments.h 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | /// Utilities for encoding and decoding URL arguments. 22 | @interface NSString (GTMNSStringURLArgumentsAdditions) 23 | 24 | /// Returns a string that is escaped properly to be a URL argument. 25 | // 26 | /// This differs from stringByAddingPercentEscapesUsingEncoding: in that it 27 | /// will escape all the reserved characters (per RFC 3986 28 | /// ) which 29 | /// stringByAddingPercentEscapesUsingEncoding would leave. 30 | /// 31 | /// This will also escape '%', so this should not be used on a string that has 32 | /// already been escaped unless double-escaping is the desired result. 33 | - (NSString*)gtm_stringByEscapingForURLArgument; 34 | 35 | /// Returns the unescaped version of a URL argument 36 | // 37 | /// This has the same behavior as stringByReplacingPercentEscapesUsingEncoding:, 38 | /// except that it will also convert '+' to space. 39 | - (NSString*)gtm_stringByUnescapingFromURLArgument; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/xcconfigs-readme.txt: -------------------------------------------------------------------------------- 1 | Xcode Config is sorta a black art, any time you have a set of rules, you 2 | quickly hit a few exceptions. 3 | 4 | The main goal of using these is as follow: 5 | 6 | Edit your Project level build settings by removing as much as possible, and 7 | then set the per Configuration settings to one of the project xcode config 8 | files w/in the Project subfolder here. This will batch setup the project to 9 | build Debug/Release w/ a specific SDK. 10 | 11 | If you are building a Shared Library, Loadable Bundle (Framework) or UnitTest 12 | you will need to apply a further Xcode Config file at the target level. You do 13 | this again by clearing most of the settings on the target, and just setting the 14 | build config for that target to be the match from the Target subfolder here. 15 | 16 | To see an example of this, look at CoverStory 17 | (http://code.google.com/p/coverstory) or Vidnik 18 | (http://code.google.com/p/vidnik). 19 | 20 | 21 | The common exception...If you need to have a few targets build w/ different 22 | SDKs, then you hit the most common of the exceptions. For these, you'd need 23 | the top level config not to set some things, the simplest way to do this seems 24 | to be to remove as many of the settings from the project file, and make new 25 | wrapper xcconfig files that inclue both the project level and target level 26 | setting and set them on the targets (yes, this is like the MetroWerks days 27 | where you can quickly explode in a what seems like N^2 (or worse) number of 28 | config files. With a little luck, future versions of Xcode might have some 29 | support to make mixing SDKs easier. 30 | 31 | Remember: When using the configs at any given layer, make sure you set them for 32 | each build configuration you need (not just the active one). 33 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMFourCharCode.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMFourCharCode 3 | // Wrapper for FourCharCodes 4 | // 5 | // Copyright 2008 Google Inc. 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 8 | // use this file except in compliance with the License. You may obtain a copy 9 | // of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 16 | // License for the specific language governing permissions and limitations under 17 | // the License. 18 | // 19 | 20 | #import 21 | 22 | // FourCharCodes are OSTypes, ResTypes etc. This class wraps them if 23 | // you need to store them in dictionaries etc. 24 | @interface GTMFourCharCode : NSObject { 25 | FourCharCode code_; 26 | } 27 | 28 | // returns a string for a FourCharCode 29 | + (id)stringWithFourCharCode:(FourCharCode)code; 30 | 31 | // String must be 4 chars or less, or you will get nil back. 32 | + (id)fourCharCodeWithString:(NSString*)string; 33 | + (id)fourCharCodeWithFourCharCode:(FourCharCode)code; 34 | 35 | // String must be 4 chars or less, or you will get nil back. 36 | - (id)initWithString:(NSString*)string; 37 | 38 | // Designated Initializer 39 | - (id)initWithFourCharCode:(FourCharCode)code; 40 | 41 | // Returns 'APPL' for "APPL" 42 | - (FourCharCode)fourCharCode; 43 | 44 | // For FourCharCode of 'APPL' returns "APPL". For 1 returns "\0\0\0\1" 45 | - (NSString*)stringValue; 46 | 47 | // For FourCharCode of "APPL" returns an NSNumber with 1095782476 (0x4150504C). 48 | // For 1 returns 1. 49 | - (NSNumber*)numberValue; 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /google_toolbar/XcodeConfig/Target/ReleaseUnittest.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseUnittest.xcconfig 3 | // 4 | // Xcode configuration file for a release unittest target. 5 | // 6 | // This is a _Target_ config file, for use in the "Based on" popup of the 7 | // settings dialog for a target. Do not attempt to apply this as the base 8 | // of an Xcode configuration in the project settings dialog. 9 | // 10 | // Copyright 2006-2008 Google Inc. 11 | // 12 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 13 | // use this file except in compliance with the License. You may obtain a copy 14 | // of the License at 15 | // 16 | // http://www.apache.org/licenses/LICENSE-2.0 17 | // 18 | // Unless required by applicable law or agreed to in writing, software 19 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 20 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 21 | // License for the specific language governing permissions and limitations under 22 | // the License. 23 | // 24 | 25 | // Unittests are loadable bundles 26 | #include "../subconfig/Unittest.xcconfig" 27 | 28 | // When running OCUnit tests in Release mode the unittests BUNDLE_LOADER 29 | // is probably stripped (or at least it will be if they are using our 30 | // config files). In that case the Unittest will fail to link because 31 | // the symbols have been removed from the bundle's loader's symbol table. 32 | // This flag tells the unittest to trust that the values will be available 33 | // at runtime (or error out) and not to force an error at link time. 34 | // Do NOT set BUNDLE_LOADER (Bundle Loader) setting in a release unittest target 35 | // because you will run into interesting link issues 36 | // "indirect symbol table entry n past the end of the symbol table" 37 | OTHER_LDFLAGS = $(OTHER_LDFLAGS) -undefined dynamic_lookup 38 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/NSObject+XMLSerializableSupport.h: -------------------------------------------------------------------------------- 1 | // 2 | // XMLSerializableSupport.h 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | #import "XMLSerializable.h" 10 | 11 | @interface NSObject (XMLSerializableSupport) 12 | 13 | + (NSString *)xmlTypeFor:(NSObject *)value; 14 | + (NSString *)buildXmlElementAs:(NSString *)rootName withInnerXml:(NSString *)value andType:(NSString *)xmlType; 15 | 16 | /** 17 | * Construct a string representation of the given value object, assuming 18 | * the given root element name , the NSObjects's toXmlValue is called. 19 | */ 20 | + (NSString *)buildXMLElementAs:(NSString *)rootName withValue:(NSObject *)value; 21 | 22 | /** 23 | * 24 | * Constructs the actual xml node as a string 25 | * 26 | */ 27 | + (NSString *)buildXmlElementAs:(NSString *)rootName withInnerXml:(NSString *)value; 28 | 29 | /** 30 | * What is the element name for this object when serialized to XML. 31 | * Defaults to lower case and dasherized form of class name. 32 | * I.e. [[Person class] xmlElementName] //> @"person" 33 | */ 34 | + (NSString *)xmlElementName; 35 | 36 | /** 37 | * Construct the XML string representation of this particular object. 38 | * Only construct the markup for the value of this object, don't assume 39 | * any naming. For instance: 40 | * 41 | * [myObject toXMLValue] //> @"xmlSerializedValue" 42 | * 43 | * and not 44 | * 45 | * [myObject toXMLValue] //> @"xmlSerializedValue" 46 | * 47 | * For simple objects like strings, numbers etc this will be the text value of 48 | * the corresponding element. For complex objects this can include further markup: 49 | * 50 | * [myPersonObject toXMLValue] //> @"RyanDaigle" 51 | */ 52 | - (NSString *)toXMLValue; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMNSAppleEventDescriptor+Handler.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSAppleEventDescriptor+Handler.h 3 | // 4 | // Copyright 2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | #import "GTMDefines.h" 21 | 22 | @interface NSAppleEventDescriptor (GTMAppleEventDescriptorHandlerAdditions) 23 | + (id)gtm_descriptorWithPositionalHandler:(NSString*)handler 24 | parametersArray:(NSArray*)params; 25 | + (id)gtm_descriptorWithPositionalHandler:(NSString*)handler 26 | parametersDescriptor:(NSAppleEventDescriptor*)params; 27 | + (id)gtm_descriptorWithLabeledHandler:(NSString*)handler 28 | labels:(AEKeyword*)labels 29 | parameters:(id*)params 30 | count:(NSUInteger)count; 31 | 32 | - (id)gtm_initWithPositionalHandler:(NSString*)handler 33 | parametersArray:(NSArray*)params; 34 | - (id)gtm_initWithPositionalHandler:(NSString*)handler 35 | parametersDescriptor:(NSAppleEventDescriptor*)params; 36 | - (id)gtm_initWithLabeledHandler:(NSString*)handler 37 | labels:(AEKeyword*)labels 38 | parameters:(id*)params 39 | count:(NSUInteger)count; 40 | @end 41 | -------------------------------------------------------------------------------- /Classes/lib/json-framework/NSString+SBJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | /// Adds JSON parsing to NSString 33 | @interface NSString (NSString_SBJSON) 34 | 35 | /// Returns the object represented in the receiver, or nil on error. 36 | - (id)JSONFragmentValue; 37 | 38 | /// Returns the dictionary or array represented in the receiver, or nil on error. 39 | - (id)JSONValue; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMNSString+XML.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSString+XML.h 3 | // 4 | // Copyright 2007-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | /// Utilities for NSStrings containing XML 22 | @interface NSString (GTMNSStringXMLAdditions) 23 | 24 | /// Get a string where characters that need escaping for XML are escaped and invalid characters removed 25 | // 26 | /// This call escapes '&', '<, '>', '\'', '"' per the xml spec and removes all 27 | /// invalid characters as defined by Section 2.2 of the xml spec. 28 | /// 29 | /// For obvious reasons this call is only safe once. 30 | // 31 | // Returns: 32 | // Autoreleased NSString 33 | // 34 | - (NSString *)gtm_stringBySanitizingAndEscapingForXML; 35 | 36 | /// Get a string where characters that invalid characters per the XML spec have been removed 37 | // 38 | /// This call removes all invalid characters as defined by Section 2.2 of the 39 | /// xml spec. If you are writing XML yourself, you probably was to use the 40 | /// above api (gtm_stringBySanitizingAndEscapingForXML) so any entities also 41 | /// get escaped. 42 | // 43 | // Returns: 44 | // Autoreleased NSString 45 | // 46 | - (NSString *)gtm_stringBySanitizingToXMLSpec; 47 | 48 | // There is no stringByUnescapingFromXML because the XML parser will do this. 49 | // The above api is here just incase you need to create XML yourself. 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMNSString+URLArguments.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSString+URLArguments.m 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import "GTMNSString+URLArguments.h" 20 | #import "GTMGarbageCollection.h" 21 | 22 | @implementation NSString (GTMNSStringURLArgumentsAdditions) 23 | 24 | - (NSString*)gtm_stringByEscapingForURLArgument { 25 | // Encode all the reserved characters, per RFC 3986 26 | // () 27 | CFStringRef escaped = 28 | CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, 29 | (CFStringRef)self, 30 | NULL, 31 | (CFStringRef)@"!*'();:@&=+$,/?%#[]", 32 | kCFStringEncodingUTF8); 33 | return [GTMNSMakeCollectable(escaped) autorelease]; 34 | } 35 | 36 | - (NSString*)gtm_stringByUnescapingFromURLArgument { 37 | NSMutableString *resultString = [NSMutableString stringWithString:self]; 38 | [resultString replaceOccurrencesOfString:@"+" 39 | withString:@" " 40 | options:NSLiteralSearch 41 | range:NSMakeRange(0, [resultString length])]; 42 | return [resultString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/GTMCALayer+UnitTesting.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMCALayer+UnitTesting.h 3 | // 4 | // Code for making unit testing of graphics/UI easier. Generally you 5 | // will only want to look at the macros: 6 | // GTMAssertDrawingEqualToFile 7 | // GTMAssertViewRepEqualToFile 8 | // and the protocol GTMUnitTestCALayerDrawer. When using these routines 9 | // make sure you are using device colors and not calibrated/generic colors 10 | // or else your test graphics WILL NOT match across devices/graphics cards. 11 | // 12 | // Copyright 2006-2008 Google Inc. 13 | // 14 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 15 | // use this file except in compliance with the License. You may obtain a copy 16 | // of the License at 17 | // 18 | // http://www.apache.org/licenses/LICENSE-2.0 19 | // 20 | // Unless required by applicable law or agreed to in writing, software 21 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 22 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 23 | // License for the specific language governing permissions and limitations under 24 | // the License. 25 | // 26 | 27 | #import 28 | #import "GTMNSObject+UnitTesting.h" 29 | 30 | // Category for making unit testing of graphics/UI easier. 31 | 32 | // Allows you to take a state of a view. Supports both image and state. 33 | // See GTMNSObject+UnitTesting.h for details. 34 | @interface CALayer (GTMUnitTestingAdditions) 35 | // Returns whether gtm_unitTestEncodeState should recurse into sublayers 36 | // 37 | // Returns: 38 | // should gtm_unitTestEncodeState pick up sublayer state. 39 | - (BOOL)gtm_shouldEncodeStateForSublayers; 40 | @end 41 | 42 | @interface NSObject (GTMCALayerUnitTestingDelegateMethods) 43 | // Delegate method that allows a delegate for a layer to 44 | // decide whether we should recurse 45 | - (BOOL)gtm_shouldEncodeStateForSublayersOfLayer:(CALayer*)layer; 46 | @end 47 | -------------------------------------------------------------------------------- /google_toolbar/AppKit/GTMNSBezierPath+RoundRect.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSBezierPath+RoundRect.h 3 | // 4 | // Category for adding utility functions for creating 5 | // round rectangles. 6 | // 7 | // Copyright 2006-2008 Google Inc. 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 10 | // use this file except in compliance with the License. You may obtain a copy 11 | // of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 17 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 18 | // License for the specific language governing permissions and limitations under 19 | // the License. 20 | // 21 | 22 | #import 23 | #import "GTMDefines.h" 24 | 25 | /// Category for adding utility functions for creating round rectangles. 26 | @interface NSBezierPath (GMBezierPathRoundRectAdditions) 27 | 28 | /// Inscribe a round rectangle inside of rectangle |rect| with a corner radius of |radius| 29 | // 30 | // Args: 31 | // rect: outer rectangle to inscribe into 32 | // radius: radius of the corners. |radius| is clamped internally 33 | // to be no larger than the smaller of half |rect|'s width or height 34 | // 35 | // Returns: 36 | // Auto released NSBezierPath 37 | + (NSBezierPath *)gtm_bezierPathWithRoundRect:(NSRect)rect 38 | cornerRadius:(CGFloat)radius; 39 | 40 | /// Adds a path which is a round rectangle inscribed inside of rectangle |rect| with a corner radius of |radius| 41 | // 42 | // Args: 43 | // rect: outer rectangle to inscribe into 44 | // radius: radius of the corners. |radius| is clamped internally 45 | // to be no larger than the smaller of half |rect|'s width or height 46 | - (void)gtm_appendBezierPathWithRoundRect:(NSRect)rect 47 | cornerRadius:(CGFloat)radius; 48 | @end 49 | -------------------------------------------------------------------------------- /google_toolbar/BuildScripts/BuildAllSDKs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # BuildAllSDKs.sh 3 | # 4 | # This script builds both the Tiger and Leopard versions of the requested 5 | # target in the current basic config (debug, release, debug-gcov). This script 6 | # should be run from the same directory as the GTM Xcode project file. 7 | # 8 | # Copyright 2006-2008 Google Inc. 9 | # 10 | # Licensed under the Apache License, Version 2.0 (the "License"); you may not 11 | # use this file except in compliance with the License. You may obtain a copy 12 | # of the License at 13 | # 14 | # http://www.apache.org/licenses/LICENSE-2.0 15 | # 16 | # Unless required by applicable law or agreed to in writing, software 17 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 18 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 19 | # License for the specific language governing permissions and limitations under 20 | # the License. 21 | 22 | PROJECT_TARGET="$1" 23 | 24 | XCODEBUILD="${DEVELOPER_BIN_DIR}/xcodebuild" 25 | REQUESTED_BUILD_STYLE=$(echo "${BUILD_STYLE}" | sed "s/.*OrLater-\(.*\)/\1/") 26 | # See if we were told to clean instead of build. 27 | PROJECT_ACTION="build" 28 | if [ "${ACTION}" == "clean" ]; then 29 | PROJECT_ACTION="clean" 30 | fi 31 | 32 | # helper for doing a build 33 | function doIt { 34 | local myProject=$1 35 | local myTarget=$2 36 | local myConfig=$3 37 | echo "note: Starting ${PROJECT_ACTION} of ${myTarget} from ${myProject} in ${myConfig}" 38 | ${XCODEBUILD} -project "${myProject}" \ 39 | -target "${myTarget}" \ 40 | -configuration "${myConfig}" \ 41 | "${PROJECT_ACTION}" 42 | buildResult=$? 43 | if [ $buildResult -ne 0 ]; then 44 | echo "Error: ** ${PROJECT_ACTION} Failed **" 45 | exit $buildResult 46 | fi 47 | echo "note: Done ${PROJECT_ACTION}" 48 | } 49 | 50 | # now build tiger and then leopard 51 | doIt GTM.xcodeproj "${PROJECT_TARGET}" "TigerOrLater-${REQUESTED_BUILD_STYLE}" 52 | doIt GTM.xcodeproj "${PROJECT_TARGET}" "LeopardOrLater-${REQUESTED_BUILD_STYLE}" 53 | 54 | # TODO(iphone if right tool chain?) 55 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMSystemVersionTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMSystemVersionTest.m 3 | // 4 | // Copyright 2007-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import "GTMSenTestCase.h" 20 | #import "GTMSystemVersion.h" 21 | 22 | @interface GTMSystemVersionTest : GTMTestCase 23 | @end 24 | 25 | @implementation GTMSystemVersionTest 26 | - (void)testBasics { 27 | long major; 28 | long minor; 29 | long bugFix; 30 | 31 | [GTMSystemVersion getMajor:nil minor:nil bugFix:nil]; 32 | [GTMSystemVersion getMajor:&major minor:&minor bugFix:&bugFix]; 33 | #if GTM_IPHONE_SDK 34 | STAssertTrue(major >= 2 && minor >= 0 && bugFix >= 0, nil); 35 | #else 36 | STAssertTrue(major >= 10 && minor >= 3 && bugFix >= 0, nil); 37 | BOOL isPanther = (major == 10) && (minor == 3); 38 | BOOL isTiger = (major == 10) && (minor == 4); 39 | BOOL isLeopard = (major == 10) && (minor == 5); 40 | BOOL isLater = (major > 10) || ((major == 10) && (minor > 5)); 41 | STAssertEquals([GTMSystemVersion isPanther], isPanther, nil); 42 | STAssertEquals([GTMSystemVersion isPantherOrGreater], 43 | (BOOL)(isPanther || isTiger || isLeopard || isLater), nil); 44 | STAssertEquals([GTMSystemVersion isTiger], isTiger, nil); 45 | STAssertEquals([GTMSystemVersion isTigerOrGreater], 46 | (BOOL)(isTiger || isLeopard || isLater), nil); 47 | STAssertEquals([GTMSystemVersion isLeopard], isLeopard, nil); 48 | STAssertEquals([GTMSystemVersion isLeopardOrGreater], 49 | (BOOL)(isLeopard || isLater), nil); 50 | #endif 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /Classes/lib/json-framework/NSString+SBJSON.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "NSString+SBJSON.h" 31 | #import "SBJSON.h" 32 | 33 | 34 | @implementation NSString (NSString_SBJSON) 35 | 36 | - (id)JSONFragmentValue 37 | { 38 | SBJSON *json = [[SBJSON new] autorelease]; 39 | 40 | NSError *error; 41 | id o = [json fragmentWithString:self error:&error]; 42 | 43 | if (!o) 44 | NSLog(@"%@", error); 45 | return o; 46 | } 47 | 48 | - (id)JSONValue 49 | { 50 | SBJSON *json = [[SBJSON new] autorelease]; 51 | 52 | NSError *error; 53 | id o = [json objectWithString:self error:&error]; 54 | 55 | if (!o) 56 | NSLog(@"%@", error); 57 | return o; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/TestData/GTMUnitTestingTest.nib/classes.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBClasses 6 | 7 | 8 | CLASS 9 | NSView 10 | LANGUAGE 11 | ObjC 12 | SUPERCLASS 13 | NSResponder 14 | 15 | 16 | CLASS 17 | NSApplication 18 | LANGUAGE 19 | ObjC 20 | SUPERCLASS 21 | NSResponder 22 | 23 | 24 | CLASS 25 | NSTextField 26 | LANGUAGE 27 | ObjC 28 | SUPERCLASS 29 | NSControl 30 | 31 | 32 | CLASS 33 | NSMenu 34 | LANGUAGE 35 | ObjC 36 | SUPERCLASS 37 | NSObject 38 | 39 | 40 | CLASS 41 | NSControl 42 | LANGUAGE 43 | ObjC 44 | SUPERCLASS 45 | NSView 46 | 47 | 48 | CLASS 49 | NSObject 50 | LANGUAGE 51 | ObjC 52 | 53 | 54 | CLASS 55 | NSCell 56 | LANGUAGE 57 | ObjC 58 | SUPERCLASS 59 | NSObject 60 | 61 | 62 | CLASS 63 | NSWindow 64 | LANGUAGE 65 | ObjC 66 | SUPERCLASS 67 | NSResponder 68 | 69 | 70 | CLASS 71 | GTMUnitTestingTestController 72 | LANGUAGE 73 | ObjC 74 | OUTLETS 75 | 76 | field_ 77 | NSTextField 78 | 79 | SUPERCLASS 80 | NSWindowController 81 | 82 | 83 | IBVersion 84 | 1 85 | 86 | 87 | -------------------------------------------------------------------------------- /Classes/lib/json-framework/NSObject+SBJSON.m: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import "NSObject+SBJSON.h" 31 | #import "SBJSON.h" 32 | 33 | @implementation NSObject (NSObject_SBJSON) 34 | 35 | - (NSString *)JSONFragment { 36 | SBJSON *generator = [[SBJSON new] autorelease]; 37 | 38 | NSError *error; 39 | NSString *json = [generator stringWithFragment:self error:&error]; 40 | 41 | if (!json) 42 | NSLog(@"%@", error); 43 | return json; 44 | } 45 | 46 | - (NSString *)JSONRepresentation { 47 | SBJSON *generator = [[SBJSON new] autorelease]; 48 | 49 | NSError *error; 50 | NSString *json = [generator stringWithObject:self error:&error]; 51 | 52 | if (!json) 53 | NSLog(@"%@", error); 54 | return json; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/GTMUIKit+UnitTestingTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMUIKit+UnitTestingTest.m 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | #import "GTMUIKit+UnitTesting.h" 21 | #import "GTMSenTestCase.h" 22 | 23 | @interface GTMUIView_UnitTestingTest : SenTestCase 24 | @end 25 | 26 | @implementation GTMUIView_UnitTestingTest 27 | 28 | - (void)testDrawing { 29 | GTMAssertDrawingEqualToFile(self, 30 | CGSizeMake(200,200), 31 | @"GTMUIViewUnitTestingTest", 32 | [UIApplication sharedApplication], 33 | nil); 34 | } 35 | 36 | - (void)testState { 37 | UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)] autorelease]; 38 | UIView *subview = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)] autorelease]; 39 | [view addSubview:subview]; 40 | GTMAssertObjectStateEqualToStateNamed(view, @"GTMUIViewUnitTestingTest", nil); 41 | } 42 | 43 | - (void)gtm_unitTestViewDrawRect:(CGRect)rect contextInfo:(void*)contextInfo { 44 | UIApplication *app = [UIApplication sharedApplication]; 45 | STAssertEqualObjects(app, 46 | contextInfo, 47 | @"Should be a UIApplication"); 48 | CGPoint center = CGPointMake(CGRectGetMidX(rect), 49 | CGRectGetMidY(rect)); 50 | rect = CGRectMake(center.x - 50, center.y - 50, 100, 100); 51 | CGContextRef context = UIGraphicsGetCurrentContext(); 52 | CGContextAddEllipseInRect(context, rect); 53 | CGContextSetLineWidth(context, 5); 54 | [[UIColor redColor] set]; 55 | CGContextStrokePath(context); 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Classes/lib/Core/ObjectiveResourceDateFormatter.m: -------------------------------------------------------------------------------- 1 | // 2 | // ObjectiveResourceDateFormatter.m 3 | // iphone-harvest 4 | // 5 | // Created by James Burka on 10/21/08. 6 | // Copyright 2008 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "ObjectiveResourceDateFormatter.h" 10 | 11 | 12 | @implementation ObjectiveResourceDateFormatter 13 | 14 | static NSString *dateTimeFormatString = @"yyyy-MM-dd'T'HH:mm:ss'Z'"; 15 | static NSString *dateTimeZoneFormatString = @"yyyy-MM-dd'T'HH:mm:ssz"; 16 | static NSString *dateFormatString = @"yyyy-MM-dd"; 17 | static ORSDateFormat _dateFormat; 18 | 19 | + (void)setSerializeFormat:(ORSDateFormat)dateFormat { 20 | _dateFormat = dateFormat; 21 | } 22 | 23 | + (void)setDateFormatString:(NSString *)format { 24 | dateFormatString = format; 25 | } 26 | 27 | + (void)setDateTimeFormatString:(NSString *)format { 28 | dateTimeFormatString = format; 29 | } 30 | 31 | + (void)setDateTimeZoneFormatString:(NSString *)format { 32 | dateTimeZoneFormatString = format; 33 | } 34 | 35 | + (NSString *)formatDate:(NSDate *)date { 36 | 37 | NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; 38 | [formatter setFormatterBehavior:NSDateFormatterBehavior10_4]; 39 | if(_dateFormat == Date) { 40 | [formatter setDateFormat:dateFormatString]; 41 | } 42 | else { 43 | [formatter setDateFormat:dateTimeFormatString]; 44 | } 45 | [formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]]; 46 | return [formatter stringFromDate:date]; 47 | 48 | } 49 | 50 | + (NSDate *)parseDateTime:(NSString *)dateTimeString { 51 | 52 | NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; 53 | NSString *format = ([dateTimeString hasSuffix:@"Z"]) ? dateTimeFormatString : dateTimeZoneFormatString; 54 | [formatter setFormatterBehavior:NSDateFormatterBehavior10_4]; 55 | [formatter setDateFormat:format]; 56 | [formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]]; 57 | return [formatter dateFromString:dateTimeString]; 58 | 59 | } 60 | 61 | + (NSDate *)parseDate:(NSString *)dateString { 62 | 63 | NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; 64 | [formatter setFormatterBehavior:NSDateFormatterBehavior10_4]; 65 | [formatter setDateFormat:dateFormatString]; 66 | [formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]]; 67 | return [formatter dateFromString:dateString]; 68 | 69 | } 70 | 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /Classes/lib/json-framework/NSObject+SBJSON.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2007 Stig Brautaset. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | Neither the name of the author nor the names of its contributors may be used 15 | to endorse or promote products derived from this software without specific 16 | prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | #import 31 | 32 | 33 | /// Adds JSON generation to NSObject subclasses 34 | @interface NSObject (NSObject_SBJSON) 35 | 36 | /** 37 | @brief Returns a string containing the receiver encoded as a JSON fragment. 38 | 39 | This method is added as a category on NSObject but is only actually 40 | supported for the following objects: 41 | @li NSDictionary 42 | @li NSArray 43 | @li NSString 44 | @li NSNumber (also used for booleans) 45 | @li NSNull 46 | */ 47 | - (NSString *)JSONFragment; 48 | 49 | /** 50 | @brief Returns a string containing the receiver encoded in JSON. 51 | 52 | This method is added as a category on NSObject but is only actually 53 | supported for the following objects: 54 | @li NSDictionary 55 | @li NSArray 56 | */ 57 | - (NSString *)JSONRepresentation; 58 | 59 | @end 60 | 61 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMNSAppleScript+Handler.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSAppleScript+Handler.h 3 | // 4 | // Copyright 2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | #import "GTMDefines.h" 21 | 22 | // A category for calling handlers in NSAppleScript 23 | @interface NSAppleScript(GTMAppleScriptHandlerAdditions) 24 | // This method allows us to call a specific handler in an AppleScript. 25 | // parameters are passed in left-right order 0-n. 26 | // 27 | // Args: 28 | // handler - name of the handler to call in the Applescript 29 | // params - the parameters to pass to the handler 30 | // error - in non-nil returns any error that may have occurred. 31 | // 32 | // Returns: 33 | // The result of the handler being called. nil on failure. 34 | - (NSAppleEventDescriptor*)gtm_executePositionalHandler:(NSString*)handler 35 | parameters:(NSArray*)params 36 | error:(NSDictionary**)error; 37 | 38 | 39 | - (NSAppleEventDescriptor*)gtm_executeLabeledHandler:(NSString*)handler 40 | labels:(AEKeyword*)labels 41 | parameters:(id*)params 42 | count:(NSUInteger)count 43 | error:(NSDictionary **)error; 44 | - (NSSet*)gtm_handlers; 45 | - (NSSet*)gtm_properties; 46 | - (BOOL)gtm_setValue:(id)value forProperty:(NSString*)property; 47 | - (id)gtm_valueForProperty:(NSString*)property; 48 | 49 | @end 50 | 51 | @interface NSAppleEventDescriptor(GTMAppleEventDescriptorScriptAdditions) 52 | 53 | // Return an NSAppleScript for a desc of typeScript 54 | // Returns nil on failure. 55 | - (NSAppleScript*)gtm_scriptValue; 56 | 57 | // Return a NSString with [eventClass][eventID] for typeEvent 'evnt' 58 | - (NSString*)gtm_eventValue; 59 | @end 60 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMNSString+HTML.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSString+HTML.h 3 | // Dealing with NSStrings that contain HTML 4 | // 5 | // Copyright 2006-2008 Google Inc. 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 8 | // use this file except in compliance with the License. You may obtain a copy 9 | // of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 16 | // License for the specific language governing permissions and limitations under 17 | // the License. 18 | // 19 | 20 | #import 21 | 22 | /// Utilities for NSStrings containing HTML 23 | @interface NSString (GTMNSStringHTMLAdditions) 24 | 25 | /// Get a string where internal characters that need escaping for HTML are escaped 26 | // 27 | /// For example, '&' become '&'. This will only cover characters from table 28 | /// A.2.2 of http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_Special_characters 29 | /// which is what you want for a unicode encoded webpage. If you have a ascii 30 | /// or non-encoded webpage, please use stringByEscapingAsciiHTML which will 31 | /// encode all characters. 32 | /// 33 | /// For obvious reasons this call is only safe once. 34 | // 35 | // Returns: 36 | // Autoreleased NSString 37 | // 38 | - (NSString *)gtm_stringByEscapingForHTML; 39 | 40 | /// Get a string where internal characters that need escaping for HTML are escaped 41 | // 42 | /// For example, '&' become '&' 43 | /// All non-mapped characters (unicode that don't have a &keyword; mapping) 44 | /// will be converted to the appropriate &#xxx; value. If your webpage is 45 | /// unicode encoded (UTF16 or UTF8) use stringByEscapingHTML instead as it is 46 | /// faster, and produces less bloated and more readable HTML (as long as you 47 | /// are using a unicode compliant HTML reader). 48 | /// 49 | /// For obvious reasons this call is only safe once. 50 | // 51 | // Returns: 52 | // Autoreleased NSString 53 | // 54 | - (NSString *)gtm_stringByEscapingForAsciiHTML; 55 | 56 | /// Get a string where internal characters that are escaped for HTML are unescaped 57 | // 58 | /// For example, '&' becomes '&' 59 | /// Handles and 2 cases as well 60 | /// 61 | // Returns: 62 | // Autoreleased NSString 63 | // 64 | - (NSString *)gtm_stringByUnescapingFromHTML; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /google_toolbar/AppKit/GTMNSBezierPath+CGPath.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSBezierPath+CGPath.m 3 | // 4 | // Category for extracting a CGPathRef from a NSBezierPath 5 | // 6 | // Copyright 2006-2008 Google Inc. 7 | // 8 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 9 | // use this file except in compliance with the License. You may obtain a copy 10 | // of the License at 11 | // 12 | // http://www.apache.org/licenses/LICENSE-2.0 13 | // 14 | // Unless required by applicable law or agreed to in writing, software 15 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 16 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 17 | // License for the specific language governing permissions and limitations under 18 | // the License. 19 | // 20 | #import "GTMNSBezierPath+CGPath.h" 21 | #import "GTMDefines.h" 22 | 23 | @implementation NSBezierPath (GTMBezierPathCGPathAdditions) 24 | 25 | // Extract a CGPathRef from a NSBezierPath. 26 | // 27 | // Args: 28 | // 29 | // Returns: 30 | // Converted CGPathRef. Must be released by client (CGPathRelease). 31 | // nil if failure. 32 | - (CGPathRef)gtm_createCGPath { 33 | CGMutablePathRef thePath = CGPathCreateMutable(); 34 | if (!thePath) return nil; 35 | 36 | NSInteger elementCount = [self elementCount]; 37 | 38 | // The maximum number of points is 3 for a NSCurveToBezierPathElement. 39 | // (controlPoint1, controlPoint2, and endPoint) 40 | NSPoint controlPoints[3]; 41 | 42 | for (NSInteger i = 0; i < elementCount; i++) { 43 | switch ([self elementAtIndex:i associatedPoints:controlPoints]) { 44 | case NSMoveToBezierPathElement: 45 | CGPathMoveToPoint(thePath, &CGAffineTransformIdentity, 46 | controlPoints[0].x, controlPoints[0].y); 47 | break; 48 | case NSLineToBezierPathElement: 49 | CGPathAddLineToPoint(thePath, &CGAffineTransformIdentity, 50 | controlPoints[0].x, controlPoints[0].y); 51 | break; 52 | case NSCurveToBezierPathElement: 53 | CGPathAddCurveToPoint(thePath, &CGAffineTransformIdentity, 54 | controlPoints[0].x, controlPoints[0].y, 55 | controlPoints[1].x, controlPoints[1].y, 56 | controlPoints[2].x, controlPoints[2].y); 57 | break; 58 | case NSClosePathBezierPathElement: 59 | CGPathCloseSubpath(thePath); 60 | break; 61 | default: 62 | _GTMDevLog(@"Unknown element at [NSBezierPath (GTMBezierPathCGPathAdditions) cgPath]"); 63 | break; 64 | }; 65 | } 66 | return thePath; 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMNSEnumerator+Filter.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSEnumerator+Filter.h 3 | // 4 | // Copyright 2007-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | /// A generic category for methods that allow us to filter enumeratable 22 | /// containers, inspired by C++ Standard Library's use of iterators. 23 | /// Like in C++, these assume the underlying container is not modified during 24 | /// the lifetime of the iterator. 25 | /// 26 | @interface NSEnumerator (GTMEnumeratorFilterAdditions) 27 | 28 | /// @argument predicate - the function return BOOL. will be applied to each element 29 | /// @argument argument - optional argument to pass to predicate 30 | /// @returns an enumerator that contains only elements where [element sel:argument] is true 31 | - (NSEnumerator *)gtm_filteredEnumeratorByMakingEachObjectPerformSelector:(SEL)predicate 32 | withObject:(id)argument; 33 | 34 | /// @argument selector - the function return a transformed object. will be applied to each element 35 | /// @argument argument - optional argument to pass to transformer 36 | /// @returns an enumerator that contains the transformed elements 37 | - (NSEnumerator *)gtm_enumeratorByMakingEachObjectPerformSelector:(SEL)selector 38 | withObject:(id)argument; 39 | 40 | /// @argument target - receiver for each method 41 | /// @argument predicate - as in, [target predicate: [self nextObject]], return a BOOL 42 | /// @returns an enumerator that contains only elements where [element sel:argument] is true 43 | - (NSEnumerator *)gtm_filteredEnumeratorByTarget:(id)target 44 | performOnEachSelector:(SEL)predicate; 45 | 46 | /// @argument target - receiver for each method 47 | /// @argument sel - as in, [target selector: [self nextObject]], return a transformed object 48 | /// @returns an enumerator that contains the transformed elements 49 | - (NSEnumerator *)gtm_enumeratorByTarget:(id)target 50 | performOnEachSelector:(SEL)selector; 51 | 52 | @end 53 | 54 | -------------------------------------------------------------------------------- /google_toolbar/AppKit/GTMLoginItems.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMLoginItems.h 3 | // 4 | // Copyright 2007-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | /// Login items key constants, used as keys in |+loginItems| 22 | // 23 | // Item name 24 | extern NSString * const kGTMLoginItemsNameKey; 25 | // Item path 26 | extern NSString * const kGTMLoginItemsPathKey; 27 | // Hidden (NSNumber bool) 28 | extern NSString * const kGTMLoginItemsHiddenKey; 29 | 30 | /// GTMLoginItems 31 | // 32 | /// A helper class to manipulate the user's Login Items. 33 | @interface GTMLoginItems : NSObject 34 | 35 | /// Obtain a complete list of all login items. 36 | // 37 | // Returns: 38 | // Autoreleased array of dictionaries keyed with kGTMLoginItemsPathKey, etc. 39 | // 40 | + (NSArray *)loginItems:(NSError **)errorInfo; 41 | 42 | /// Check if the given path is in the current user's Login Items 43 | // 44 | // Args: 45 | // path: path to the application 46 | // 47 | // Returns: 48 | // YES if the path is in the Login Items 49 | // 50 | + (BOOL)pathInLoginItems:(NSString *)path; 51 | 52 | /// Check if the given name is in the current user's Login Items 53 | // 54 | // Args: 55 | // name: name to the application 56 | // 57 | // Returns: 58 | // YES if the name is in the Login Items 59 | // 60 | + (BOOL)itemWithNameInLoginItems:(NSString *)name; 61 | 62 | /// Add the given path to the current user's Login Items. Does nothing if the 63 | /// path is already there. 64 | // 65 | // Args: 66 | // path: path to add 67 | // hide: Set to YES to have the item launch hidden 68 | // 69 | + (void)addPathToLoginItems:(NSString *)path hide:(BOOL)hide; 70 | 71 | /// Remove the given path from the current user's Login Items. Does nothing if 72 | /// the path is not there. 73 | // 74 | // Args: 75 | // path: the path to remove 76 | // 77 | + (void)removePathFromLoginItems:(NSString *)path; 78 | 79 | /// Remove the given item name from the current user's Login Items. Does nothing 80 | /// if no item with that name is present. 81 | // 82 | // Args: 83 | // name: name of the item to remove 84 | // 85 | + (void)removeItemWithNameFromLoginItems:(NSString *)name; 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /google_toolbar/AppKit/GTMNSBezierPath+RoundRect.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSBezierPath+RoundRect.h 3 | // 4 | // Category for adding utility functions for creating 5 | // round rectangles. 6 | // 7 | // Copyright 2006-2008 Google Inc. 8 | // 9 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 10 | // use this file except in compliance with the License. You may obtain a copy 11 | // of the License at 12 | // 13 | // http://www.apache.org/licenses/LICENSE-2.0 14 | // 15 | // Unless required by applicable law or agreed to in writing, software 16 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 17 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 18 | // License for the specific language governing permissions and limitations under 19 | // the License. 20 | // 21 | 22 | #import "GTMNSBezierPath+RoundRect.h" 23 | 24 | @implementation NSBezierPath (GTMBezierPathRoundRectAdditions) 25 | 26 | 27 | + (NSBezierPath *)gtm_bezierPathWithRoundRect:(NSRect)rect 28 | cornerRadius:(CGFloat)radius { 29 | NSBezierPath *bezier = [NSBezierPath bezierPath]; 30 | [bezier gtm_appendBezierPathWithRoundRect:rect cornerRadius:radius]; 31 | return bezier; 32 | } 33 | 34 | 35 | - (void)gtm_appendBezierPathWithRoundRect:(NSRect)rect 36 | cornerRadius:(CGFloat)radius { 37 | if (!NSIsEmptyRect(rect)) { 38 | if (radius > 0.0) { 39 | // Clamp radius to be no larger than half the rect's width or height. 40 | radius = MIN(radius, 0.5 * MIN(rect.size.width, rect.size.height)); 41 | 42 | NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect)); 43 | NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect)); 44 | NSPoint bottomRight = NSMakePoint(NSMaxX(rect), NSMinY(rect)); 45 | 46 | [self moveToPoint:NSMakePoint(NSMidX(rect), NSMaxY(rect))]; 47 | [self appendBezierPathWithArcFromPoint:topLeft 48 | toPoint:rect.origin 49 | radius:radius]; 50 | [self appendBezierPathWithArcFromPoint:rect.origin 51 | toPoint:bottomRight 52 | radius:radius]; 53 | [self appendBezierPathWithArcFromPoint:bottomRight 54 | toPoint:topRight 55 | radius:radius]; 56 | [self appendBezierPathWithArcFromPoint:topRight 57 | toPoint:topLeft 58 | radius:radius]; 59 | [self closePath]; 60 | } else { 61 | // When radius <= 0.0, use plain rectangle. 62 | [self appendBezierPathWithRect:rect]; 63 | } 64 | } 65 | } 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMNSDictionary+URLArgumentsTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSDictionary+URLArgumentsTest.m 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import "GTMSenTestCase.h" 20 | #import "GTMNSDictionary+URLArguments.h" 21 | #import "GTMDefines.h" 22 | 23 | @interface GTMNSDictionary_URLArgumentsTest : GTMTestCase 24 | @end 25 | 26 | @implementation GTMNSDictionary_URLArgumentsTest 27 | 28 | - (void)testArgumentsString { 29 | STAssertEqualObjects([[NSDictionary dictionary] gtm_httpArgumentsString], @"", 30 | @"- empty dictionary should give an empty string"); 31 | STAssertEqualObjects([[NSDictionary dictionaryWithObject:@"123" forKey:@"abc"] gtm_httpArgumentsString], 32 | @"abc=123", 33 | @"- simple one-pair dictionary should work"); 34 | NSDictionary* arguments = [NSDictionary dictionaryWithObjectsAndKeys: 35 | @"1+1!=3 & 2*6/3=4", @"complex", 36 | @"specialkey", @"a+b", 37 | nil]; 38 | NSString* argumentString = [arguments gtm_httpArgumentsString]; 39 | // check for individual pieces since order is not guaranteed 40 | NSString* component1 = @"a%2Bb=specialkey"; 41 | NSString* component2 = @"complex=1%2B1%21%3D3%20%26%202%2A6%2F3%3D4"; 42 | STAssertNotEquals([argumentString rangeOfString:component1].location, (NSUInteger)NSNotFound, 43 | @"- '%@' not found in '%@'", component1, argumentString); 44 | STAssertNotEquals([argumentString rangeOfString:component2].location, (NSUInteger)NSNotFound, 45 | @"- '%@' not found in '%@'", component2, argumentString); 46 | STAssertNotEquals([argumentString rangeOfString:@"&"].location, (NSUInteger)NSNotFound, 47 | @"- special characters should be escaped"); 48 | STAssertNotEquals([argumentString characterAtIndex:0], (unichar)'&', 49 | @"- there should be no & at the beginning of the string"); 50 | STAssertNotEquals([argumentString characterAtIndex:([argumentString length] - 1)], (unichar)'&', 51 | @"- there should be no & at the end of the string"); 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMObjC2Runtime.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMObjC2Runtime.h 3 | // 4 | // Copyright 2007-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | #import "GTMDefines.h" 21 | 22 | // These functions exist for code that we want to compile on both the < 10.5 23 | // sdks and on the >= 10.5 sdks without warnings. It basically reimplements 24 | // certain parts of the objc2 runtime in terms of the objc1 runtime. It is not 25 | // a complete implementation as I've only implemented the routines I know we 26 | // use. Feel free to add more as necessary. 27 | // These functions are not documented because they conform to the documentation 28 | // for the ObjC2 Runtime. 29 | 30 | #if OBJC_API_VERSION >= 2 // Only have optional and req'd keywords in ObjC2. 31 | #define AT_OPTIONAL @optional 32 | #define AT_REQUIRED @required 33 | #else 34 | #define AT_OPTIONAL 35 | #define AT_REQUIRED 36 | #endif 37 | 38 | // The file objc-runtime.h was moved to runtime.h and in Leopard, objc-runtime.h 39 | // was just a wrapper around runtime.h. For the iPhone SDK, this objc-runtime.h 40 | // is removed in the iPhoneOS2.0 SDK. 41 | // 42 | // The |Object| class was removed in the iPhone2.0 SDK too. 43 | #if GTM_IPHONE_SDK 44 | #import 45 | #else 46 | #import 47 | #import 48 | #endif 49 | 50 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 51 | #import "objc/Protocol.h" 52 | 53 | Class object_getClass(id obj); 54 | const char *class_getName(Class cls); 55 | BOOL class_conformsToProtocol(Class cls, Protocol *protocol); 56 | Class class_getSuperclass(Class cls); 57 | Method *class_copyMethodList(Class cls, unsigned int *outCount); 58 | SEL method_getName(Method m); 59 | void method_exchangeImplementations(Method m1, Method m2); 60 | IMP method_getImplementation(Method method); 61 | IMP method_setImplementation(Method method, IMP imp); 62 | struct objc_method_description protocol_getMethodDescription(Protocol *p, 63 | SEL aSel, 64 | BOOL isRequiredMethod, 65 | BOOL isInstanceMethod); 66 | #endif // OBJC2_UNAVAILABLE 67 | -------------------------------------------------------------------------------- /Classes/lib/Core/NSObject+PropertySupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+Properties.m 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/28/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | #import "objc/runtime.h" 10 | #import "NSObject+PropertySupport.h" 11 | 12 | @interface NSObject() 13 | 14 | + (NSString *) getPropertyType:(NSString *)attributeString; 15 | 16 | @end 17 | 18 | 19 | @implementation NSObject (PropertySupport) 20 | + (NSArray *)propertyNames { 21 | return [[self propertyNamesAndTypes] allKeys]; 22 | } 23 | 24 | + (NSDictionary *)propertyNamesAndTypes { 25 | 26 | NSMutableDictionary *propertyNames = [NSMutableDictionary dictionary]; 27 | 28 | //include superclass properties 29 | Class currentClass = [self class]; 30 | while (currentClass != nil && currentClass != [NSObject class]) { 31 | // Get the raw list of properties 32 | unsigned int outCount; 33 | objc_property_t *propList = class_copyPropertyList(currentClass, &outCount); 34 | 35 | // Collect the property names 36 | int i; 37 | NSString *propName; 38 | for (i = 0; i < outCount; i++) 39 | { 40 | objc_property_t * prop = propList + i; 41 | NSString *type = [NSString stringWithCString:property_getAttributes(*prop) encoding:NSUTF8StringEncoding]; 42 | propName = [NSString stringWithCString:property_getName(*prop) encoding:NSUTF8StringEncoding]; 43 | 44 | NSString *propertyType = [self getPropertyType:type]; 45 | if (nil != propertyType) { 46 | [propertyNames setObject:propertyType forKey:propName]; 47 | } 48 | 49 | } 50 | 51 | free(propList); 52 | currentClass = [currentClass superclass]; 53 | } 54 | return propertyNames; 55 | } 56 | 57 | - (NSDictionary *)properties { 58 | return [self dictionaryWithValuesForKeys:[[self class] propertyNames]]; 59 | } 60 | 61 | - (void)setProperties:(NSDictionary *)overrideProperties { 62 | for (NSString *property in [overrideProperties allKeys]) { 63 | [self setValue:[overrideProperties objectForKey:property] forKey:property]; 64 | } 65 | } 66 | 67 | + (NSString *) getPropertyType:(NSString *)attributeString { 68 | NSString *type = nil; 69 | NSScanner *typeScanner = [NSScanner scannerWithString:attributeString]; 70 | [typeScanner scanUpToCharactersFromSet:[NSCharacterSet characterSetWithCharactersInString:@"@"] intoString:NULL]; 71 | 72 | 73 | if(![typeScanner isAtEnd]) { 74 | // we didn't hit the end, so we have an object type 75 | [typeScanner scanCharactersFromSet:[NSCharacterSet characterSetWithCharactersInString:@"\"@"] intoString:NULL]; 76 | // this gets the actual object type 77 | [typeScanner scanUpToCharactersFromSet:[NSCharacterSet characterSetWithCharactersInString:@"\""] intoString:&type]; 78 | } 79 | return type; 80 | } 81 | 82 | - (NSString *)className { 83 | return NSStringFromClass([self class]); 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /google_toolbar/AppKit/GTMNSBezierPath+CGPathTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSBezierPath+CGPathTest.m 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | #import 22 | #import "GTMNSBezierPath+CGPath.h" 23 | #import "GTMAppKit+UnitTesting.h" 24 | #import "GTMSenTestCase.h" 25 | 26 | @interface GTMNSBezierPath_CGPathTest : GTMTestCase 27 | @end 28 | 29 | @implementation GTMNSBezierPath_CGPathTest 30 | 31 | - (void)testCreateCGPath { 32 | GTMAssertDrawingEqualToImageNamed(self, 33 | NSMakeSize(100, 100), 34 | @"GTMNSBezierPath+CGPathTest", 35 | nil, nil); 36 | } 37 | 38 | 39 | // Draws all of our tests so that we can compare this to our stored image file. 40 | - (void)gtm_unitTestViewDrawRect:(NSRect)rect contextInfo:(void*)contextInfo{ 41 | NSBezierPath *thePath = [NSBezierPath bezierPath]; 42 | NSPoint theStart = NSMakePoint(20.0, 20.0); 43 | 44 | // Test moveto/lineto 45 | [thePath moveToPoint: theStart]; 46 | for (NSUInteger i = 0; i < 10; ++i) { 47 | NSPoint theNewPoint = NSMakePoint(i * 5, i * 10); 48 | [thePath lineToPoint: theNewPoint]; 49 | theNewPoint = NSMakePoint(i * 2, i * 6); 50 | [thePath moveToPoint: theNewPoint]; 51 | } 52 | 53 | // Test moveto/curveto 54 | for (NSUInteger i = 0; i < 10; ++i) { 55 | NSPoint startPoint = NSMakePoint(5.0, 50.0); 56 | NSPoint endPoint = NSMakePoint(55.0, 50.0); 57 | NSPoint controlPoint1 = NSMakePoint(17.5, 50.0 + 5.0 * i); 58 | NSPoint controlPoint2 = NSMakePoint(42.5, 50.0 - 5.0 * i); 59 | [thePath moveToPoint:startPoint]; 60 | [thePath curveToPoint:endPoint controlPoint1:controlPoint1 controlPoint2:controlPoint2]; 61 | } 62 | // test close 63 | [thePath closePath]; 64 | 65 | CGPathRef cgPath = [thePath gtm_createCGPath]; 66 | STAssertNotNULL(cgPath, @"Nil CGPath"); 67 | 68 | CGContextRef cgContext = [[NSGraphicsContext currentContext] graphicsPort]; 69 | STAssertNotNULL(cgContext, @"Nil cgContext"); 70 | 71 | CGContextAddPath(cgContext, cgPath); 72 | CGContextStrokePath(cgContext); 73 | CGPathRelease(cgPath); 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Classes/lib/Core/Inflections/NSString+InflectionSupport.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+InflectionSupport.m 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | #import "NSString+InflectionSupport.h" 10 | 11 | @implementation NSString (InflectionSupport) 12 | 13 | - (NSCharacterSet *)capitals { 14 | return [NSCharacterSet uppercaseLetterCharacterSet]; 15 | } 16 | 17 | - (NSString *)deCamelizeWith:(NSString *)delimiter { 18 | 19 | unichar *buffer = calloc([self length], sizeof(unichar)); 20 | [self getCharacters:buffer ]; 21 | NSMutableString *underscored = [NSMutableString string]; 22 | 23 | NSString *currChar; 24 | for (int i = 0; i < [self length]; i++) { 25 | currChar = [NSString stringWithCharacters:buffer+i length:1]; 26 | if([[self capitals] characterIsMember:buffer[i]]) { 27 | [underscored appendFormat:@"%@%@", delimiter, [currChar lowercaseString]]; 28 | } else { 29 | [underscored appendString:currChar]; 30 | } 31 | } 32 | 33 | free(buffer); 34 | return underscored; 35 | } 36 | 37 | 38 | - (NSString *)dasherize { 39 | return [self deCamelizeWith:@"-"]; 40 | } 41 | 42 | - (NSString *)underscore { 43 | return [self deCamelizeWith:@"_"]; 44 | } 45 | 46 | - (NSCharacterSet *)camelcaseDelimiters { 47 | return [NSCharacterSet characterSetWithCharactersInString:@"-_"]; 48 | } 49 | 50 | - (NSString *)camelize { 51 | 52 | unichar *buffer = calloc([self length], sizeof(unichar)); 53 | [self getCharacters:buffer ]; 54 | NSMutableString *underscored = [NSMutableString string]; 55 | 56 | BOOL capitalizeNext = NO; 57 | NSCharacterSet *delimiters = [self camelcaseDelimiters]; 58 | for (int i = 0; i < [self length]; i++) { 59 | NSString *currChar = [NSString stringWithCharacters:buffer+i length:1]; 60 | if([delimiters characterIsMember:buffer[i]]) { 61 | capitalizeNext = YES; 62 | } else { 63 | if(capitalizeNext) { 64 | [underscored appendString:[currChar uppercaseString]]; 65 | capitalizeNext = NO; 66 | } else { 67 | [underscored appendString:currChar]; 68 | } 69 | } 70 | } 71 | 72 | free(buffer); 73 | return underscored; 74 | 75 | } 76 | 77 | - (NSString *)titleize { 78 | NSArray *words = [self componentsSeparatedByString:@" "]; 79 | NSMutableString *output = [NSMutableString string]; 80 | for (NSString *word in words) { 81 | [output appendString:[[word substringToIndex:1] uppercaseString]]; 82 | [output appendString:[[word substringFromIndex:1] lowercaseString]]; 83 | [output appendString:@" "]; 84 | } 85 | return [output substringToIndex:[self length]]; 86 | } 87 | 88 | - (NSString *)toClassName { 89 | NSString *result = [self camelize]; 90 | return [result stringByReplacingCharactersInRange:NSMakeRange(0,1) 91 | withString:[[result substringWithRange:NSMakeRange(0,1)] uppercaseString]]; 92 | } 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/JSON/JSONSerializable.h: -------------------------------------------------------------------------------- 1 | // 2 | // JSONSerializable.h 3 | // 4 | // Created by James Burka on 1/13/09. 5 | // Copyright 2008 yFactorial, LLC. All rights reserved. 6 | // 7 | 8 | @protocol JSONSerializable 9 | 10 | /** 11 | * Instantiate a single instance of this class from the given JSON data. 12 | */ 13 | + (id)fromJSONData:(NSData *)data; 14 | 15 | /** 16 | * Instantiate a collection of instances of this class from the given JSON data. 17 | */ 18 | //+ (NSArray *)allFromJSONData:(NSData *)data; 19 | 20 | /** 21 | * Get the full JSON representation of this object 22 | * using the default element name: 23 | * 24 | * [myPerson toXMLElement] //> @"Ryan..." 25 | */ 26 | - (NSString *)toJSON; 27 | 28 | 29 | /** 30 | * Gets the full representation of this object minus the elements in the exclusions array 31 | * 32 | * 33 | * 34 | */ 35 | - (NSString *)toJSONExcluding:(NSArray *)exclusions; 36 | 37 | /** 38 | * Get the full XML representation of this object (minus the xml directive) 39 | * using the given element name: 40 | * 41 | * [myPerson toXMLElementAs:@"human"] //> @"Ryan..." 42 | */ 43 | - (NSString *)toJSONAs:(NSString *)rootName; 44 | 45 | /** 46 | * Get the full XML representation of this object (minus the xml directive) 47 | * using the given element name and excluding the given properties. 48 | * 49 | * [myPerson toXMLElementAs:@"human" excludingInArray:[NSArray arrayWithObjects:@"firstName", nil]] 50 | * 51 | * //> @"Daigle 52 | */ 53 | - (NSString *)toJSONAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions; 54 | 55 | /** 56 | * Get the full XML representation of this object (minus the xml directive) 57 | * using the given element name and translating property names with the keyTranslations mapping. 58 | * 59 | * [myPerson toXMLElementAs:@"human" withTranslations:[NSDictionary dictionaryWithObjectsAndKeys:@"lastName", @"surname", nil]] 60 | * 61 | * //> @"RyanDaigle 62 | */ 63 | - (NSString *)toJSONAs:(NSString *)rootName withTranslations:(NSDictionary *)keyTranslations; 64 | 65 | /** 66 | * Get the full XML representation of this object (minus the xml directive) 67 | * using the given element name, excluding the given properties, and translating 68 | * property names with the keyTranslations mapping. 69 | * 70 | * [myPerson toXMLElementAs:@"human" excludingInArray:[NSArray arrayWithObjects:@"firstName", nil] 71 | * withTranslations:[NSDictionary dictionaryWithObjectsAndKeys:@"lastName", @"surname", nil]] 72 | * 73 | * //> @"Daigle 74 | */ 75 | - (NSString *)toJSONAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 76 | withTranslations:(NSDictionary *)keyTranslations; 77 | 78 | @end -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMFourCharCode.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMFourCharCode.m 3 | // Wrapper for FourCharCodes 4 | // 5 | // Copyright 2008 Google Inc. 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 8 | // use this file except in compliance with the License. You may obtain a copy 9 | // of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 15 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 16 | // License for the specific language governing permissions and limitations under 17 | // the License. 18 | // 19 | 20 | #import "GTMDefines.h" 21 | #import "GTMFourCharCode.h" 22 | #import "GTMGarbageCollection.h" 23 | #import 24 | 25 | @implementation GTMFourCharCode 26 | 27 | + (id)stringWithFourCharCode:(FourCharCode)code { 28 | return [GTMNSMakeCollectable(UTCreateStringForOSType(code)) autorelease]; 29 | } 30 | 31 | + (id)fourCharCodeWithString:(NSString*)string { 32 | return [[[self alloc] initWithString:string] autorelease]; 33 | } 34 | 35 | + (id)fourCharCodeWithFourCharCode:(FourCharCode)code { 36 | return [[[self alloc] initWithFourCharCode:code] autorelease]; 37 | } 38 | 39 | - (id)initWithString:(NSString*)string { 40 | NSUInteger length = [string length]; 41 | if (length == 0 || length > 4) { 42 | [self release]; 43 | return nil; 44 | } else { 45 | return [self initWithFourCharCode:UTGetOSTypeFromString((CFStringRef)string)]; 46 | } 47 | } 48 | 49 | - (id)initWithFourCharCode:(FourCharCode)code { 50 | if ((self = [super init])) { 51 | code_ = code; 52 | } 53 | return self; 54 | } 55 | 56 | - (id)initWithCoder:(NSCoder *)aDecoder { 57 | if ((self = [super init])) { 58 | code_ = [aDecoder decodeInt32ForKey:@"FourCharCode"]; 59 | } 60 | return self; 61 | } 62 | 63 | - (void)encodeWithCoder:(NSCoder *)aCoder { 64 | [aCoder encodeInt32:code_ forKey:@"FourCharCode"]; 65 | } 66 | 67 | - (id)copyWithZone:(NSZone *)zone { 68 | return [[[self class] alloc] initWithFourCharCode:code_]; 69 | } 70 | 71 | - (BOOL)isEqual:(id)object { 72 | return [object isKindOfClass:[self class]] && [object fourCharCode] == code_; 73 | } 74 | 75 | - (NSUInteger)hash { 76 | return (NSUInteger)code_; 77 | } 78 | 79 | - (NSString *)description { 80 | return [NSString stringWithFormat:@"%@ - %@ (0x%X)", 81 | [self class], 82 | [self stringValue], 83 | code_]; 84 | } 85 | 86 | - (FourCharCode)fourCharCode { 87 | return code_; 88 | } 89 | 90 | - (NSString*)stringValue { 91 | return [GTMNSMakeCollectable(UTCreateStringForOSType(code_)) autorelease]; 92 | } 93 | 94 | - (NSNumber*)numberValue { 95 | return [NSNumber numberWithUnsignedInt:code_]; 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /Classes/lib/Serialization/XML/XMLSerializable.h: -------------------------------------------------------------------------------- 1 | // 2 | // XMLSerializable.h 3 | // 4 | // 5 | // Created by Ryan Daigle on 7/31/08. 6 | // Copyright 2008 yFactorial, LLC. All rights reserved. 7 | // 8 | 9 | @protocol XMLSerializable 10 | 11 | /** 12 | * Instantiate a single instance of this class from the given XML data. 13 | */ 14 | + (id)fromXMLData:(NSData *)data; 15 | 16 | /** 17 | * Instantiate a collectionof instances of this class from the given XML data. 18 | */ 19 | + (NSArray *)allFromXMLData:(NSData *)data; 20 | 21 | /** 22 | * Get the full XML representation of this object (minus the xml directive) 23 | * using the default element name: 24 | * 25 | * [myPerson toXMLElement] //> @"Ryan..." 26 | */ 27 | - (NSString *)toXMLElement; 28 | 29 | 30 | /** 31 | * Gets the full representation of this object minus the elements in the exclusions array 32 | * 33 | * 34 | * 35 | */ 36 | - (NSString *)toXMLElementExcluding:(NSArray *)exclusions; 37 | 38 | /** 39 | * Get the full XML representation of this object (minus the xml directive) 40 | * using the given element name: 41 | * 42 | * [myPerson toXMLElementAs:@"human"] //> @"Ryan..." 43 | */ 44 | - (NSString *)toXMLElementAs:(NSString *)rootName; 45 | 46 | /** 47 | * Get the full XML representation of this object (minus the xml directive) 48 | * using the given element name and excluding the given properties. 49 | * 50 | * [myPerson toXMLElementAs:@"human" excludingInArray:[NSArray arrayWithObjects:@"firstName", nil]] 51 | * 52 | * //> @"Daigle 53 | */ 54 | - (NSString *)toXMLElementAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions; 55 | 56 | /** 57 | * Get the full XML representation of this object (minus the xml directive) 58 | * using the given element name and translating property names with the keyTranslations mapping. 59 | * 60 | * [myPerson toXMLElementAs:@"human" withTranslations:[NSDictionary dictionaryWithObjectsAndKeys:@"lastName", @"surname", nil]] 61 | * 62 | * //> @"RyanDaigle 63 | */ 64 | - (NSString *)toXMLElementAs:(NSString *)rootName withTranslations:(NSDictionary *)keyTranslations; 65 | 66 | /** 67 | * Get the full XML representation of this object (minus the xml directive) 68 | * using the given element name, excluding the given properties, and translating 69 | * property names with the keyTranslations mapping. 70 | * 71 | * [myPerson toXMLElementAs:@"human" excludingInArray:[NSArray arrayWithObjects:@"firstName", nil] 72 | * withTranslations:[NSDictionary dictionaryWithObjectsAndKeys:@"lastName", @"surname", nil]] 73 | * 74 | * //> @"Daigle 75 | */ 76 | - (NSString *)toXMLElementAs:(NSString *)rootName excludingInArray:(NSArray *)exclusions 77 | withTranslations:(NSDictionary *)keyTranslations; 78 | 79 | @end -------------------------------------------------------------------------------- /JSONDeserializeTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // JSONDeserializeTest.m 3 | // objective_support 4 | // 5 | // Created by vickeryj on 2/10/09. 6 | // Copyright 2009 Joshua Vickery. All rights reserved. 7 | // 8 | 9 | #import "JSONDeserializeTest.h" 10 | #import "NSObject+JSONSerializableSupport.h" 11 | #import "TestClass.h" 12 | #import "ObjectiveResourceDateFormatter.h" 13 | 14 | @implementation JSONDeserializeTest 15 | 16 | -(void) testDeserializationOfNullDate { 17 | NSString *testJSON = @"{\"test_class\":{\"created_at\":null,\"name\":\"Hourly Test\"}}"; 18 | TestClass *testClass = [TestClass fromJSONData:[testJSON dataUsingEncoding:NSUTF8StringEncoding]]; 19 | STAssertTrue(testClass.createdAt == nil , @"should be nil"); 20 | NSArray *toIgnore = [NSArray arrayWithObjects:@"testClassId",@"weight",nil]; 21 | STAssertEqualStrings([testClass toJSONExcluding:toIgnore], testJSON, @"reserialization of object should match original string"); 22 | } 23 | 24 | -(void) testDeserializationOfModel { 25 | [ObjectiveResourceDateFormatter setSerializeFormat:DateTime]; 26 | NSString *testJSON = @"{\"test_class\":{\"created_at\":\"2009-02-16T10:43:50Z\",\"weight\":2.1,\"name\":\"Hourly Test\",\"id\":1}}"; 27 | TestClass *testClass = [TestClass fromJSONData:[testJSON dataUsingEncoding:NSUTF8StringEncoding]]; 28 | NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; 29 | [formatter setFormatterBehavior:NSDateFormatterBehavior10_4]; 30 | [formatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss'Z'"]; 31 | [formatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"GMT"]]; 32 | NSDate* dateToTest = [formatter dateFromString:@"2009-02-16T10:43:50Z"]; 33 | STAssertTrue([testClass.createdAt isEqualToDate:dateToTest], @"should be 2009-02-16T10:43:50Z"); 34 | STAssertEqualStrings([testClass toJSONAs:@"test_class" excludingInArray:[NSArray array] 35 | withTranslations:[NSDictionary dictionaryWithObject:@"id" forKey:@"testClassId"]], 36 | testJSON, @"reserialization of object should match original string"); 37 | } 38 | 39 | -(void) testDeserializationOfArray { 40 | [ObjectiveResourceDateFormatter setSerializeFormat:DateTime]; 41 | NSString *testJson = @"[{\"test_class\":{\"created_at\":\"2009-02-16T10:43:50Z\",\"name\":\"Hourly Test\",\"id\":1}},{\"test_class\":{\"created_at\":\"2009-02-16T10:43:50Z\",\"name\":\"Hourly Test\",\"id\":2}}]"; 42 | NSArray *testClasses = [NSArray fromJSONData:[testJson dataUsingEncoding:NSUTF8StringEncoding]]; 43 | STAssertTrue([testClasses count] == 2 , @"should be 2 items"); 44 | STAssertTrue([((TestClass *)[testClasses objectAtIndex:0]).testClassId intValue]== 1,@"should be 1"); 45 | STAssertEqualStrings([testClasses toJSONAs:@"test_class" excludingInArray:[NSArray arrayWithObject:@"weight"] 46 | withTranslations:[NSDictionary dictionaryWithObject:@"id" forKey:@"testClassId"]], testJson, @"reserialization of object should match original string"); 47 | 48 | 49 | } 50 | 51 | 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMProgressMonitorInputStream.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMProgressMonitorInputStream.m 3 | // 4 | // Copyright 2007-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | // The monitored input stream calls back into the monitor delegate 22 | // with the number of bytes and total size 23 | // 24 | // - (void)inputStream:(GTMProgressMonitorInputStream *)stream 25 | // hasDeliveredByteCount:(unsigned long long)numberOfBytesRead 26 | // ofTotalByteCount:(unsigned long long)dataLength; 27 | 28 | @interface GTMProgressMonitorInputStream : NSInputStream { 29 | 30 | NSInputStream *inputStream_; // encapsulated stream that does the work 31 | 32 | unsigned long long dataSize_; // size of data in the source 33 | unsigned long long numBytesRead_; // bytes read from the input stream so far 34 | 35 | __weak id monitorDelegate_; // WEAK, not retained 36 | SEL monitorSelector_; 37 | 38 | __weak id monitorSource_; // WEAK, not retained 39 | } 40 | 41 | // Length is passed to the progress callback; it may be zero if the progress 42 | // callback can handle that (mainly meant so the monitor delegate can update the 43 | // bounds/position for a progress indicator. 44 | + (id)inputStreamWithStream:(NSInputStream *)input 45 | length:(unsigned long long)length; 46 | 47 | - (id)initWithStream:(NSInputStream *)input 48 | length:(unsigned long long)length; 49 | 50 | // The monitor is called when bytes have been read 51 | // 52 | // monitorDelegate should respond to a selector with a signature matching: 53 | // 54 | // - (void)inputStream:(GTMProgressMonitorInputStream *)stream 55 | // hasDeliveredBytes:(unsigned long long)numReadSoFar 56 | // ofTotalBytes:(unsigned long long)total 57 | // 58 | // |total| will be the length passed when this GTMProgressMonitorInputStream was 59 | // created. 60 | 61 | - (void)setMonitorDelegate:(id)monitorDelegate // not retained 62 | selector:(SEL)monitorSelector; 63 | - (id)monitorDelegate; 64 | - (SEL)monitorSelector; 65 | 66 | // The source argument lets the delegate know the source of this input stream. 67 | // this class does nothing w/ this, it's just here to provide context to your 68 | // monitorDelegate. 69 | - (void)setMonitorSource:(id)source; // not retained 70 | - (id)monitorSource; 71 | 72 | @end 73 | 74 | -------------------------------------------------------------------------------- /google_toolbar/AppKit/GTMLinearRGBShading.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMLinearRGBShading.h 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | #import "GTMShading.h" 21 | #import "GTMCalculatedRange.h" 22 | 23 | /// A shading that does returns smooth linear values for RGB. 24 | // 25 | /// Thus if you create a shading from 0.0->red to 1.0->blue you will get 26 | /// \verbatim 27 | /// - 0.5->purple 28 | /// - 0.75->eggplant 29 | /// - 0.25->magenta 30 | /// \endverbatim 31 | 32 | @interface GTMLinearRGBShading : GTMCalculatedRange { 33 | @private 34 | CGFunctionRef function_; // function used to calculated shading (STRONG) 35 | CGColorSpaceRef colorSpace_; // colorspace used for shading (STRONG) 36 | BOOL isCalibrated_; // are we using calibrated or device RGB. 37 | CGFloat colorValue_[4]; // the RGBA color values 38 | } 39 | 40 | /// Generate a shading with color |begin| at position 0.0 and color |end| at 1.0. 41 | // 42 | // Args: 43 | // begin: color at beginning of range 44 | // end: color at end of range 45 | // colorSpaceName: name of colorspace to draw into must be either 46 | // NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace 47 | // 48 | // Returns: 49 | // a GTMLinearRGBShading 50 | + (id)shadingFromColor:(NSColor *)begin toColor:(NSColor *)end 51 | fromSpaceNamed:(NSString*)colorSpaceName; 52 | 53 | /// Generate a shading with a collection of colors at various positions. 54 | // 55 | // Args: 56 | // colors: a C style array containg the colors we are adding 57 | // colorSpaceName: name of colorspace to draw into must be either 58 | // NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace 59 | // positions: a C style array containg the positions we want to 60 | // add the colors at 61 | // numberOfColors: how many colors/positions we are adding 62 | // 63 | // Returns: 64 | // a GTMLinearRGBShading 65 | + (id)shadingWithColors:(NSColor **)colors 66 | fromSpaceNamed:(NSString*)colorSpaceName 67 | atPositions:(CGFloat *)positions 68 | count:(NSUInteger)numberOfColors; 69 | 70 | /// Designated initializer 71 | // Args: 72 | // colorSpaceName - name of the colorspace to use must be either 73 | // NSCalibratedRGBColorSpace or NSDeviceRGBColorSpace 74 | - (id)initWithColorSpaceName:(NSString*)colorSpaceName; 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMNSFileManager+Path.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMNSFileManager+Path.h 3 | // 4 | // Copyright 2006-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | 21 | 22 | /// A few useful methods for dealing with paths. 23 | @interface NSFileManager (GMFileManagerPathAdditions) 24 | 25 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 26 | 27 | /// For the Unix-y at heart, this is "mkdir -p". It tries to create 28 | /// the directory specified by |path|, and any intervening directories that 29 | /// are needed. Each directory that is created is created with |attributes| 30 | /// (see other NSFileManager doco for the details on |attributes|). 31 | /// 32 | /// If you are building for 10.5 or later, you should just use the new api: 33 | /// createDirectoryAtPath:withIntermediateDirectories:attributes:error: 34 | /// 35 | /// Args: 36 | /// path - the path of the directory to create. 37 | /// attributes - these are defined in the "Constants" section of Apple's 38 | /// NSFileManager doco 39 | /// 40 | /// Returns: 41 | /// YES if |path| exists or was able to be created successfully 42 | /// NO otherwise 43 | /// 44 | - (BOOL)gtm_createFullPathToDirectory:(NSString *)path 45 | attributes:(NSDictionary *)attributes; 46 | 47 | #endif // MAC_OS_X_VERSION_MIN_REQUIRED < 1050 48 | 49 | /// Return an the paths for all resources in |directoryPath| that have the 50 | /// |extension| file extension. 51 | /// 52 | /// Args: 53 | /// extension - the file extension (excluding the leading ".") to match. 54 | /// If nil, all files are matched. 55 | /// directoryPath - the directory to look in. NOTE: Subdirectories are NOT 56 | /// traversed. 57 | /// 58 | /// Returns: 59 | /// An NSArray of absolute file paths that have |extension|. nil is returned 60 | /// if |directoryPath| doesn't exist or can't be opened, and returns an empty 61 | /// array if |directoryPath| is empty. ".", "..", and resource forks are never returned. 62 | /// 63 | - (NSArray *)gtm_filePathsWithExtension:(NSString *)extension 64 | inDirectory:(NSString *)directoryPath; 65 | 66 | /// Same as -filePathsWithExtension:inDirectory: except |extensions| is an 67 | /// NSArray of extensions to match. 68 | /// 69 | - (NSArray *)gtm_filePathsWithExtensions:(NSArray *)extensions 70 | inDirectory:(NSString *)directoryPath; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /google_toolbar/UnitTesting/GTMUnitTestDevLog.h: -------------------------------------------------------------------------------- 1 | // 2 | // GTMUnitTestDevLog.h 3 | // 4 | // Copyright 2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import "GTMDefines.h" 20 | #import 21 | 22 | // GTMUnitTestDevLog tracks what messages are logged to verify that you only 23 | // log what you expect to log during the running of unittests. This allows you 24 | // to log with impunity from your actual core implementations and still be able 25 | // to find unexpected logs in your output when running unittests. 26 | // In your unittests you tell GTMUnitTestDevLog what messages you expect your 27 | // test to spit out, and it will cause any that don't match to appear as errors 28 | // in your unittest run output. You can match on exact strings or standard 29 | // regexps. 30 | 31 | @interface GTMUnitTestDevLog : NSObject 32 | // Log a message 33 | + (void)log:(NSString*)format, ...; 34 | + (void)log:(NSString*)format args:(va_list)args; 35 | 36 | // Turn tracking on/off 37 | + (void)enableTracking; 38 | + (void)disableTracking; 39 | + (BOOL)isTrackingEnabled; 40 | 41 | // Note that you are expecting a string that has an exact match. No need to 42 | // escape any pattern characters. 43 | + (void)expectString:(NSString *)format, ...; 44 | 45 | // Note that you are expecting a pattern. Pattern characters that you want 46 | // exact matches on must be escaped. See [GTMRegex escapedPatternForString]. 47 | // Patterns match across newlines (kGTMRegexOptionSupressNewlineSupport) making 48 | // it easier to match output from the descriptions of NS collection types such 49 | // as NSArray and NSDictionary. 50 | + (void)expectPattern:(NSString *)format, ...; 51 | 52 | // Note that you are expecting exactly 'n' strings 53 | + (void)expect:(NSUInteger)n casesOfString:(NSString *)format, ...; 54 | 55 | // Note that you are expecting exactly 'n' patterns 56 | + (void)expect:(NSUInteger)n casesOfPattern:(NSString*)format, ...; 57 | + (void)expect:(NSUInteger)n casesOfPattern:(NSString*)format args:(va_list)args; 58 | 59 | // Call when you want to verify that you have matched all the logs you expect 60 | // to match. If your unittests inherit from GTMTestcase (like they should) you 61 | // will get this called for free. 62 | + (void)verifyNoMoreLogsExpected; 63 | 64 | // Resets the expected logs so that you don't have anything expected. 65 | // In general should not be needed, unless you have a variable logging case 66 | // of some sort. 67 | + (void)resetExpectedLogs; 68 | @end 69 | 70 | 71 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMStackTraceTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // GTMStackTraceTest.m 3 | // 4 | // Copyright 2007-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #import 20 | #import 21 | #import "GTMStackTrace.h" 22 | #import "GTMSenTestCase.h" 23 | 24 | @interface GTMStackTraceTest : GTMTestCase 25 | @end 26 | 27 | @implementation GTMStackTraceTest 28 | 29 | - (void)testStackTraceBasic { 30 | NSString *stacktrace = GTMStackTrace(); 31 | NSArray *stacklines = [stacktrace componentsSeparatedByString:@"\n"]; 32 | 33 | STAssertGreaterThan([stacklines count], (NSUInteger)3, 34 | @"stack trace must have > 3 lines"); 35 | STAssertLessThan([stacklines count], (NSUInteger)25, 36 | @"stack trace must have < 25 lines"); 37 | 38 | NSString *firstFrame = [stacklines objectAtIndex:0]; 39 | NSRange range = [firstFrame rangeOfString:@"GTMStackTrace"]; 40 | STAssertNotEquals(range.location, (NSUInteger)NSNotFound, 41 | @"First frame should contain GTMStackTrace, stack trace: %@", 42 | stacktrace); 43 | } 44 | 45 | - (void)testProgramCountersBasic { 46 | void *pcs[10]; 47 | int depth = 10; 48 | depth = GTMGetStackProgramCounters(pcs, depth); 49 | 50 | STAssertGreaterThan(depth, 3, @"stack trace must have > 3 lines"); 51 | STAssertLessThanOrEqual(depth, 10, @"stack trace must have < 10 lines"); 52 | 53 | // pcs is an array of program counters from the stack. pcs[0] should match 54 | // the call into GTMGetStackProgramCounters, which is tough for us to check. 55 | // However, we can verify that pcs[1] is equal to our current return address 56 | // for our current function. 57 | void *current_pc = __builtin_return_address(0); 58 | STAssertEquals(pcs[1], current_pc, @"pcs[1] should equal the current PC"); 59 | } 60 | 61 | - (void)testProgramCountersMore { 62 | void *pcs0[0]; 63 | int depth0 = 0; 64 | depth0 = GTMGetStackProgramCounters(pcs0, depth0); 65 | STAssertEquals(depth0, 0, @"stack trace must have 0 lines"); 66 | 67 | void *pcs1[1]; 68 | int depth1 = 1; 69 | depth1 = GTMGetStackProgramCounters(pcs1, depth1); 70 | STAssertEquals(depth1, 1, @"stack trace must have 1 lines"); 71 | 72 | void *pcs2[2]; 73 | int depth2 = 2; 74 | depth2 = GTMGetStackProgramCounters(pcs2, depth2); 75 | STAssertEquals(depth2, 2, @"stack trace must have 2 lines"); 76 | void *current_pc = __builtin_return_address(0); 77 | STAssertEquals(pcs2[1], current_pc, @"pcs[1] should equal the current PC"); 78 | } 79 | 80 | @end 81 | -------------------------------------------------------------------------------- /ObjectiveResourceDateFormatterTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // ObjectiveResourceDateFormatterTest.m 3 | // objective_support 4 | // 5 | // Created by James Burka on 2/25/09. 6 | // Copyright 2009 Burkaprojects. All rights reserved. 7 | // 8 | 9 | #import "ObjectiveResourceDateFormatterTest.h" 10 | #import "ObjectiveResourceDateFormatter.h" 11 | 12 | @implementation ObjectiveResourceDateFormatterTest 13 | 14 | -(void) testDefaultDate { 15 | [ObjectiveResourceDateFormatter setDateFormatString:@"yyyy-MM-dd"]; 16 | [ObjectiveResourceDateFormatter setSerializeFormat:Date]; 17 | NSDate* aDate = [ObjectiveResourceDateFormatter parseDate:@"2009-02-25"]; 18 | STAssertEqualStrings([ObjectiveResourceDateFormatter formatDate:aDate],@"2009-02-25",@"Should match original"); 19 | } 20 | 21 | -(void) testDefaultDateTime { 22 | [ObjectiveResourceDateFormatter setDateTimeFormatString:@"yyyy-MM-dd'T'HH:mm:ss'Z'"]; 23 | [ObjectiveResourceDateFormatter setSerializeFormat:DateTime]; 24 | NSDate* aDate = [ObjectiveResourceDateFormatter parseDateTime:@"2009-02-25T12:00:00Z"]; 25 | STAssertEqualStrings([ObjectiveResourceDateFormatter formatDate:aDate],@"2009-02-25T12:00:00Z",@"Should match original"); 26 | } 27 | 28 | -(void) testTimeZoneSupport { 29 | [ObjectiveResourceDateFormatter setDateTimeZoneFormatString:@"yyyy-MM-dd'T'HH:mm:ssz"]; 30 | [ObjectiveResourceDateFormatter setSerializeFormat:DateTime]; 31 | NSDate* aDate = [ObjectiveResourceDateFormatter parseDateTime:@"2009-02-25T23:45:00-5:00"]; 32 | STAssertEqualStrings([ObjectiveResourceDateFormatter formatDate:aDate],@"2009-02-26T04:45:00Z",@"Should match original in GMT"); 33 | } 34 | 35 | -(void) testCustomDateFormat { 36 | [ObjectiveResourceDateFormatter setSerializeFormat:Date]; 37 | [ObjectiveResourceDateFormatter setDateFormatString:@"MM-dd-yyyy"]; 38 | NSDate* aDate = [ObjectiveResourceDateFormatter parseDate:@"02-25-2009"]; 39 | STAssertEqualStrings([ObjectiveResourceDateFormatter formatDate:aDate],@"02-25-2009",@"Should match original"); 40 | } 41 | 42 | -(void) testCustomDateTimeFormat { 43 | [ObjectiveResourceDateFormatter setDateTimeFormatString:@"MM-dd-yyyy'T'HH:mm:ss'Z'"]; 44 | [ObjectiveResourceDateFormatter setSerializeFormat:DateTime]; 45 | NSDate* aDate = [ObjectiveResourceDateFormatter parseDateTime:@"02-25-2009T23:45:00Z"]; 46 | STAssertEqualStrings([ObjectiveResourceDateFormatter formatDate:aDate],@"02-25-2009T23:45:00Z",@"Should match original"); 47 | } 48 | 49 | -(void) testCustomDateTimeWithTimeZoneFormat { 50 | [ObjectiveResourceDateFormatter setSerializeFormat:DateTime]; 51 | [ObjectiveResourceDateFormatter setDateTimeZoneFormatString:@"MM-dd-yyyy'T'HH:mm:ssz"]; 52 | NSDate* aDate = [ObjectiveResourceDateFormatter parseDateTime:@"02-25-2009T23:45:00-5:00"]; 53 | STAssertEqualStrings([ObjectiveResourceDateFormatter formatDate:aDate],@"2009-02-26T04:45:00Z",@"Should match default format in GMT"); 54 | } 55 | 56 | - (void)tearDown { 57 | // reset defaults 58 | [ObjectiveResourceDateFormatter setDateFormatString:@"yyyy-MM-dd"]; 59 | [ObjectiveResourceDateFormatter setDateTimeZoneFormatString:@"yyyy-MM-dd'T'HH:mm:ssz"]; 60 | [ObjectiveResourceDateFormatter setDateTimeFormatString:@"yyyy-MM-dd'T'HH:mm:ss'Z'"]; 61 | [ObjectiveResourceDateFormatter setSerializeFormat:DateTime]; 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /google_toolbar/Foundation/GTMStackTrace.c: -------------------------------------------------------------------------------- 1 | // 2 | // GTMStackTrace.m 3 | // 4 | // Copyright 2007-2008 Google Inc. 5 | // 6 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | // use this file except in compliance with the License. You may obtain a copy 8 | // of the License at 9 | // 10 | // http://www.apache.org/licenses/LICENSE-2.0 11 | // 12 | // Unless required by applicable law or agreed to in writing, software 13 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | // License for the specific language governing permissions and limitations under 16 | // the License. 17 | // 18 | 19 | #include 20 | #include 21 | #include 22 | #include "GTMStackTrace.h" 23 | 24 | // Structure representing a small portion of a stack, starting from the saved 25 | // frame pointer, and continuing through the saved program counter. 26 | struct StackFrame { 27 | void *saved_fp; 28 | #if defined (__ppc__) || defined(__ppc64__) 29 | void *padding; 30 | #endif 31 | void *saved_pc; 32 | }; 33 | 34 | // __builtin_frame_address(0) is a gcc builtin that returns a pointer to the 35 | // current frame pointer. We then use the frame pointer to walk the stack 36 | // picking off program counters and other saved frame pointers. This works 37 | // great on i386, but PPC requires a little more work because the PC (or link 38 | // register) isn't always stored on the stack. 39 | // 40 | int GTMGetStackProgramCounters(void *outPcs[], int size) { 41 | if (!outPcs || (size < 1)) return 0; 42 | 43 | struct StackFrame *fp; 44 | #if defined (__ppc__) || defined(__ppc64__) 45 | outPcs[0] = __builtin_return_address(0); 46 | fp = (struct StackFrame *)__builtin_frame_address(1); 47 | #elif defined (__i386__) || defined(__x86_64__) 48 | fp = (struct StackFrame *)__builtin_frame_address(0); 49 | #else 50 | #error architecture not supported 51 | #endif 52 | 53 | int level = 0; 54 | while (level < size) { 55 | if (fp == NULL) { 56 | level--; 57 | break; 58 | } 59 | outPcs[level] = fp->saved_pc; 60 | level++; 61 | fp = (struct StackFrame *)fp->saved_fp; 62 | } 63 | 64 | return level; 65 | } 66 | 67 | CFStringRef GTMStackTraceCreate(void) { 68 | // The maximum number of stack frames that we will walk. We limit this so 69 | // that super-duper recursive functions (or bugs) don't send us for an 70 | // infinite loop. 71 | static const int kMaxStackTraceDepth = 100; 72 | void *pcs[kMaxStackTraceDepth]; 73 | int depth = kMaxStackTraceDepth; 74 | depth = GTMGetStackProgramCounters(pcs, depth); 75 | 76 | CFMutableStringRef trace = CFStringCreateMutable(kCFAllocatorDefault, 0); 77 | 78 | for (int i = 0; i < depth; i++) { 79 | Dl_info info = { NULL, NULL, NULL, NULL }; 80 | dladdr(pcs[i], &info); 81 | const char *symbol = info.dli_sname; 82 | const char *fname = info.dli_fname; 83 | 84 | CFStringAppendFormat(trace, NULL, 85 | CFSTR("#%-2d 0x%08lx %s () [%s]\n"), 86 | i, pcs[i], 87 | (symbol ? symbol : "??"), 88 | (fname ? fname : "??")); 89 | } 90 | 91 | return trace; 92 | } 93 | --------------------------------------------------------------------------------