Skip to content
Browse files

* Moved FTJSON stuff out to another project

 * Some refactoring of FTAnimation
  * Added FTAnimation.h meta-header
  * Moved UIView category out to FTAnimation+UIView.h/.m to make it optional
  • Loading branch information...
1 parent 35c0e62 commit 882c1edd3b46b61768db148dc6da29317b427e89 @neror committed Nov 29, 2009
Showing with 387 additions and 10,148 deletions.
  1. +189 −0 Classes/FTAnimation+UIView.m
  2. +6 −165 Classes/FTAnimationManager.m
  3. +0 −308 Classes/FTJSONParser.m
  4. +0 −249 Classes/FTJSONWriter.m
  5. +24 −0 Classes/FTUtils+NSObject.m
  6. +17 −102 FTUtils.xcodeproj/project.pbxproj
  7. +28 −0 Headers/FTAnimation.h
  8. +67 −0 Headers/FTUtils/FTAnimation+UIView.h
  9. +1 −44 Headers/FTUtils/FTAnimationManager.h
  10. +0 −75 Headers/FTUtils/FTJSONParser.h
  11. +0 −76 Headers/FTUtils/FTJSONWriter.h
  12. +24 −0 Headers/FTUtils/FTUtils+NSObject.h
  13. +24 −0 Headers/FTUtils/FTUtils.h
  14. +5 −54 README.mdown
  15. +0 −19 Support/yajl/BUILDING
  16. +0 −13 Support/yajl/BUILDING.win32
  17. +0 −82 Support/yajl/CMakeLists.txt
  18. +0 −29 Support/yajl/COPYING
  19. +0 −80 Support/yajl/ChangeLog
  20. +0 −25 Support/yajl/Makefile
  21. +0 −68 Support/yajl/README
  22. +0 −9 Support/yajl/TODO
  23. +0 −26 Support/yajl/YAJLDoc.cmake
  24. +0 −94 Support/yajl/configure
  25. +0 −55 Support/yajl/reformatter/CMakeLists.txt
  26. +0 −202 Support/yajl/reformatter/json_reformat.c
  27. +0 −563 Support/yajl/rfc4627.txt
  28. +0 −78 Support/yajl/src/CMakeLists.txt
  29. +0 −1,258 Support/yajl/src/YAJL.dxy
  30. +0 −85 Support/yajl/src/api/yajl_common.h
  31. +0 −123 Support/yajl/src/api/yajl_gen.h
  32. +0 −179 Support/yajl/src/api/yajl_parse.h
  33. +0 −196 Support/yajl/src/yajl
  34. +0 −152 Support/yajl/src/yajl.c
  35. +0 −65 Support/yajl/src/yajl_alloc.c
  36. +0 −50 Support/yajl/src/yajl_alloc.h
  37. +0 −119 Support/yajl/src/yajl_buf.c
  38. +0 −73 Support/yajl/src/yajl_buf.h
  39. +0 −85 Support/yajl/src/yajl_bytestack.h
  40. +0 −179 Support/yajl/src/yajl_encode.c
  41. +0 −44 Support/yajl/src/yajl_encode.h
  42. +0 −295 Support/yajl/src/yajl_gen.c
  43. +0 −737 Support/yajl/src/yajl_lex.c
  44. +0 −133 Support/yajl/src/yajl_lex.h
  45. +0 −445 Support/yajl/src/yajl_parser.c
  46. +0 −79 Support/yajl/src/yajl_parser.h
  47. +0 −39 Support/yajl/test/CMakeLists.txt
  48. +0 −6 Support/yajl/test/cases/array.json
  49. +0 −22 Support/yajl/test/cases/array.json.gold
  50. +0 −1 Support/yajl/test/cases/array_close.json
  51. +0 −2 Support/yajl/test/cases/array_close.json.gold
  52. +0 −1 Support/yajl/test/cases/array_open.json
  53. +0 −2 Support/yajl/test/cases/array_open.json.gold
  54. +0 −4 Support/yajl/test/cases/bogus_char.json
  55. +0 −10 Support/yajl/test/cases/bogus_char.json.gold
  56. +0 −1 Support/yajl/test/cases/codepoints_from_unicode_org.json
  57. +0 −2 Support/yajl/test/cases/codepoints_from_unicode_org.json.gold
  58. +0 −11 Support/yajl/test/cases/dc_simple_with_comments.json
  59. +0 −5 Support/yajl/test/cases/dc_simple_with_comments.json.gold
  60. +0 −1 Support/yajl/test/cases/deep_arrays.json
  61. +0 −2,049 Support/yajl/test/cases/deep_arrays.json.gold
  62. +0 −1 Support/yajl/test/cases/difficult_json_c_test_case.json
  63. +0 −36 Support/yajl/test/cases/difficult_json_c_test_case.json.gold
  64. +0 −1 Support/yajl/test/cases/difficult_json_c_test_case_with_comments.json
  65. +0 −36 Support/yajl/test/cases/difficult_json_c_test_case_with_comments.json.gold
  66. +0 −1 Support/yajl/test/cases/doubles.json
  67. +0 −7 Support/yajl/test/cases/doubles.json.gold
  68. +0 −1 Support/yajl/test/cases/empty_array.json
  69. +0 −3 Support/yajl/test/cases/empty_array.json.gold
  70. +0 −1 Support/yajl/test/cases/empty_string.json
  71. +0 −2 Support/yajl/test/cases/empty_string.json.gold
  72. +0 −4 Support/yajl/test/cases/escaped_bulgarian.json
  73. +0 −7 Support/yajl/test/cases/escaped_bulgarian.json.gold
  74. +0 −1 Support/yajl/test/cases/escaped_foobar.json
  75. +0 −2 Support/yajl/test/cases/escaped_foobar.json.gold
  76. +0 −1 Support/yajl/test/cases/false.json
  77. +0 −2 Support/yajl/test/cases/false.json.gold
  78. +0 −1 Support/yajl/test/cases/false_then_garbage.json
  79. +0 −2 Support/yajl/test/cases/false_then_garbage.json.gold
  80. +0 −2 Support/yajl/test/cases/four_byte_utf8.json
  81. +0 −5 Support/yajl/test/cases/four_byte_utf8.json.gold
  82. +0 −4 Support/yajl/test/cases/integers.json
  83. +0 −14 Support/yajl/test/cases/integers.json.gold
  84. +0 −1 Support/yajl/test/cases/invalid_utf8.json
  85. +0 −3 Support/yajl/test/cases/invalid_utf8.json.gold
  86. +0 −1 Support/yajl/test/cases/isolated_surrogate_marker.json
  87. +0 −2 Support/yajl/test/cases/isolated_surrogate_marker.json.gold
  88. +0 −1 Support/yajl/test/cases/leading_zero_in_number.json
  89. +0 −5 Support/yajl/test/cases/leading_zero_in_number.json.gold
  90. +0 −7 Support/yajl/test/cases/lonely_minus_sign.json
  91. +0 −9 Support/yajl/test/cases/lonely_minus_sign.json.gold
  92. +0 −1 Support/yajl/test/cases/lonely_number.json
  93. +0 −2 Support/yajl/test/cases/lonely_number.json.gold
  94. +0 −1 Support/yajl/test/cases/map_close.json
  95. +0 −2 Support/yajl/test/cases/map_close.json.gold
  96. +0 −1 Support/yajl/test/cases/map_open.json
  97. +0 −2 Support/yajl/test/cases/map_open.json.gold
  98. +0 −1 Support/yajl/test/cases/missing_integer_after_decimal_point.json
  99. +0 −2 Support/yajl/test/cases/missing_integer_after_decimal_point.json.gold
  100. +0 −1 Support/yajl/test/cases/missing_integer_after_exponent.json
  101. +0 −2 Support/yajl/test/cases/missing_integer_after_exponent.json.gold
  102. +0 −1 Support/yajl/test/cases/non_utf8_char_in_string.json
  103. +0 −8 Support/yajl/test/cases/non_utf8_char_in_string.json.gold
  104. +0 −1 Support/yajl/test/cases/null.json
  105. +0 −2 Support/yajl/test/cases/null.json.gold
  106. +0 −1 Support/yajl/test/cases/null_then_garbage.json
  107. +0 −2 Support/yajl/test/cases/null_then_garbage.json.gold
  108. +0 −5 Support/yajl/test/cases/nulls_and_bools.json
  109. +0 −9 Support/yajl/test/cases/nulls_and_bools.json.gold
  110. +0 −5 Support/yajl/test/cases/simple.json
  111. +0 −9 Support/yajl/test/cases/simple.json.gold
  112. +0 −11 Support/yajl/test/cases/simple_with_comments.json
  113. +0 −9 Support/yajl/test/cases/simple_with_comments.json.gold
  114. +0 −1 Support/yajl/test/cases/string_invalid_escape.json
  115. +0 −3 Support/yajl/test/cases/string_invalid_escape.json.gold
  116. +0 −1 Support/yajl/test/cases/string_invalid_hex_char.json
  117. +0 −2 Support/yajl/test/cases/string_invalid_hex_char.json.gold
  118. +0 −3 Support/yajl/test/cases/string_with_escapes.json
  119. +0 −7 Support/yajl/test/cases/string_with_escapes.json.gold
  120. +0 −2 Support/yajl/test/cases/string_with_invalid_newline.json
  121. +0 −2 Support/yajl/test/cases/string_with_invalid_newline.json.gold
  122. +0 −1 Support/yajl/test/cases/three_byte_utf8.json
  123. +0 −7 Support/yajl/test/cases/three_byte_utf8.json.gold
  124. +0 −1 Support/yajl/test/cases/true.json
  125. +0 −2 Support/yajl/test/cases/true.json.gold
  126. +0 −1 Support/yajl/test/cases/true_then_garbage.json
  127. +0 −2 Support/yajl/test/cases/true_then_garbage.json.gold
  128. +0 −1 Support/yajl/test/cases/unescaped_bulgarian.json
  129. +0 −4 Support/yajl/test/cases/unescaped_bulgarian.json.gold
  130. +0 −61 Support/yajl/test/run_tests.sh
  131. +0 −291 Support/yajl/test/yajl_test.c
  132. +0 −55 Support/yajl/verify/CMakeLists.txt
  133. +0 −129 Support/yajl/verify/json_verify.c
  134. +0 −1 Support/yajl/yajl_iphone/yajl
  135. +0 −269 Support/yajl/yajl_iphone/yajl_iphone.xcodeproj/project.pbxproj
  136. +0 −55 Tests/TestData/FTJSONTestData.plist
  137. +2 −1 Tests/TestFTAnimationManager.m
  138. +0 −136 Tests/TestFTJSON.m
View
189 Classes/FTAnimation+UIView.m
@@ -0,0 +1,189 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
+#import "FTAnimation+UIView.h"
+#import "FTUtils.h"
+#import "FTUtils+NSObject.h"
+
+
+@implementation UIView (FTAnimationAdditions)
+
+#pragma mark Slide Animations
+
+- (void)slideInFrom:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate
+ startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *slideInAnim = [[FTAnimationManager sharedManager] slideInAnimationFor:self direction:direction
+ duration:duration delegate:delegate
+ startSelector:startSelector stopSelector:stopSelector];
+ [self.layer addAnimation:slideInAnim forKey:kFTAnimationSlideIn];
+}
+
+- (void)slideInFrom:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate {
+ [self slideInFrom:direction duration:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+- (void)slideOutTo:(FTAnimationDirection)direction duration:(NSTimeInterval)duration
+ delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *slideOutAnim = [[FTAnimationManager sharedManager] slideOutAnimationFor:self direction:direction
+ duration:duration delegate:delegate
+ startSelector:startSelector stopSelector:stopSelector];
+ [self.layer addAnimation:slideOutAnim forKey:kFTAnimationSlideOut];
+}
+
+
+- (void)slideOutTo:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate {
+ [self slideOutTo:direction duration:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+#pragma mark Back In/Out Animations
+
+- (void)backOutTo:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate
+ startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *backOutAnim = [[FTAnimationManager sharedManager] backOutAnimationFor:self withFade:fade direction:direction
+ duration:duration delegate:delegate
+ startSelector:startSelector stopSelector:stopSelector];
+ [self.layer addAnimation:backOutAnim forKey:kFTAnimationBackOut];
+}
+
+- (void)backOutTo:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate {
+ [self backOutTo:direction withFade:fade duration:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+- (void)backInFrom:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate
+ startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *backInAnim = [[FTAnimationManager sharedManager] backInAnimationFor:self withFade:fade direction:direction
+ duration:duration delegate:delegate
+ startSelector:startSelector stopSelector:stopSelector];
+ [self.layer addAnimation:backInAnim forKey:kFTAnimationBackIn];
+}
+
+- (void)backInFrom:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate {
+ [self backInFrom:direction withFade:fade duration:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+#pragma mark -
+#pragma mark Fade Animations
+
+- (void)fadeIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *anim = [[FTAnimationManager sharedManager] fadeAnimationFor:self duration:duration delegate:delegate
+ startSelector:startSelector stopSelector:stopSelector fadeOut:NO];
+ [self.layer addAnimation:anim forKey:kFTAnimationFadeIn];
+}
+
+- (void)fadeIn:(NSTimeInterval)duration delegate:(id)delegate {
+ [self fadeIn:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+- (void)fadeOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *anim = [[FTAnimationManager sharedManager] fadeAnimationFor:self duration:duration delegate:delegate
+ startSelector:startSelector stopSelector:stopSelector fadeOut:YES];
+ [self.layer addAnimation:anim forKey:kFTAnimationFadeOut];
+}
+
+- (void)fadeOut:(NSTimeInterval)duration delegate:(id)delegate {
+ [self fadeOut:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+- (void)fadeBackgroundColorIn:(NSTimeInterval)duration delegate:(id)delegate
+ startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *anim = [[FTAnimationManager sharedManager] fadeBackgroundColorAnimationFor:self duration:duration
+ delegate:delegate startSelector:startSelector
+ stopSelector:stopSelector fadeOut:NO];
+ [self.layer addAnimation:anim forKey:kFTAnimationFadeBackgroundIn];
+}
+
+- (void)fadeBackgroundColorIn:(NSTimeInterval)duration delegate:(id)delegate {
+ [self fadeBackgroundColorIn:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+- (void)fadeBackgroundColorOut:(NSTimeInterval)duration delegate:(id)delegate
+ startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *anim = [[FTAnimationManager sharedManager] fadeBackgroundColorAnimationFor:self duration:duration
+ delegate:delegate startSelector:startSelector
+ stopSelector:stopSelector fadeOut:YES];
+ [self.layer addAnimation:anim forKey:kFTAnimationFadeBackgroundOut];
+}
+
+- (void)fadeBackgroundColorOut:(NSTimeInterval)duration delegate:(id)delegate {
+ [self fadeBackgroundColorOut:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+#pragma mark -
+#pragma mark Pop Animations
+
+- (void)popIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *anim = [[FTAnimationManager sharedManager] popInAnimationFor:self duration:duration delegate:delegate
+ startSelector:startSelector stopSelector:stopSelector];
+ [self.layer addAnimation:anim forKey:kFTAnimationPopIn];
+}
+
+- (void)popIn:(NSTimeInterval)duration delegate:(id)delegate {
+ [self popIn:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+- (void)popOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *anim = [[FTAnimationManager sharedManager] popOutAnimationFor:self duration:duration delegate:delegate
+ startSelector:startSelector stopSelector:stopSelector];
+ [self.layer addAnimation:anim forKey:kFTAnimationPopOut];
+}
+
+- (void)popOut:(NSTimeInterval)duration delegate:(id)delegate {
+ [self popOut:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+#pragma mark -
+#pragma mark Fall In and Fly Out
+
+- (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate {
+ [self fallIn:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+- (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *anim = [[FTAnimationManager sharedManager] fallInAnimationFor:self duration:duration delegate:delegate
+ startSelector:startSelector stopSelector:stopSelector];
+ [self.layer addAnimation:anim forKey:kFTAnimationFallIn];
+}
+
+- (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate {
+ [self fallOut:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+- (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *anim = [[FTAnimationManager sharedManager] fallOutAnimationFor:self duration:duration delegate:delegate
+ startSelector:startSelector stopSelector:stopSelector];
+ [self.layer addAnimation:anim forKey:kFTAnimationFallOut];
+}
+
+- (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate {
+ [self flyOut:duration delegate:delegate startSelector:nil stopSelector:nil];
+}
+
+- (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
+ CAAnimation *anim = [[FTAnimationManager sharedManager] flyOutAnimationFor:self duration:duration delegate:delegate
+ startSelector:startSelector stopSelector:stopSelector];
+ [self.layer addAnimation:anim forKey:kFTAnimationFlyOut];
+}
+
+
+@end
View
171 Classes/FTAnimationManager.m
@@ -20,8 +20,12 @@ of this software and associated documentation files (the "Software"), to deal
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-*/
+*/
+
#import "FTAnimationManager.h"
+#import "FTUtils.h"
+#import "FTUtils+NSObject.h"
+
NSString *const kFTAnimationName = @"kFTAnimationName";
NSString *const kFTAnimationType = @"kFTAnimationType";
@@ -470,7 +474,7 @@ - (void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)finished {
+ (FTAnimationManager *)sharedManager {
@synchronized(self) {
if (sharedAnimationManager == nil) {
- sharedAnimationManager = [[self alloc] init]; // assignment not done here
+ sharedAnimationManager = [[self alloc] init];
}
}
return sharedAnimationManager;
@@ -502,166 +506,3 @@ - (void)setStopSelector:(SEL)selector withTarget:(id)target {
@end
-
-#pragma mark -
-
-@implementation UIView (FTAnimationAdditions)
-
-#pragma mark Slide Animations
-
-- (void)slideInFrom:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate
- startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *slideInAnim = [[FTAnimationManager sharedManager] slideInAnimationFor:self direction:direction
- duration:duration delegate:delegate
- startSelector:startSelector stopSelector:stopSelector];
- [self.layer addAnimation:slideInAnim forKey:kFTAnimationSlideIn];
-}
-
-- (void)slideInFrom:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate {
- [self slideInFrom:direction duration:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-- (void)slideOutTo:(FTAnimationDirection)direction duration:(NSTimeInterval)duration
- delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *slideOutAnim = [[FTAnimationManager sharedManager] slideOutAnimationFor:self direction:direction
- duration:duration delegate:delegate
- startSelector:startSelector stopSelector:stopSelector];
- [self.layer addAnimation:slideOutAnim forKey:kFTAnimationSlideOut];
-}
-
-
-- (void)slideOutTo:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate {
- [self slideOutTo:direction duration:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-#pragma mark Back In/Out Animations
-
-- (void)backOutTo:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate
- startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *backOutAnim = [[FTAnimationManager sharedManager] backOutAnimationFor:self withFade:fade direction:direction
- duration:duration delegate:delegate
- startSelector:startSelector stopSelector:stopSelector];
- [self.layer addAnimation:backOutAnim forKey:kFTAnimationBackOut];
-}
-
-- (void)backOutTo:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate {
- [self backOutTo:direction withFade:fade duration:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-- (void)backInFrom:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate
- startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *backInAnim = [[FTAnimationManager sharedManager] backInAnimationFor:self withFade:fade direction:direction
- duration:duration delegate:delegate
- startSelector:startSelector stopSelector:stopSelector];
- [self.layer addAnimation:backInAnim forKey:kFTAnimationBackIn];
-}
-
-- (void)backInFrom:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate {
- [self backInFrom:direction withFade:fade duration:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-#pragma mark -
-#pragma mark Fade Animations
-
-- (void)fadeIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *anim = [[FTAnimationManager sharedManager] fadeAnimationFor:self duration:duration delegate:delegate
- startSelector:startSelector stopSelector:stopSelector fadeOut:NO];
- [self.layer addAnimation:anim forKey:kFTAnimationFadeIn];
-}
-
-- (void)fadeIn:(NSTimeInterval)duration delegate:(id)delegate {
- [self fadeIn:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-- (void)fadeOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *anim = [[FTAnimationManager sharedManager] fadeAnimationFor:self duration:duration delegate:delegate
- startSelector:startSelector stopSelector:stopSelector fadeOut:YES];
- [self.layer addAnimation:anim forKey:kFTAnimationFadeOut];
-}
-
-- (void)fadeOut:(NSTimeInterval)duration delegate:(id)delegate {
- [self fadeOut:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-- (void)fadeBackgroundColorIn:(NSTimeInterval)duration delegate:(id)delegate
- startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *anim = [[FTAnimationManager sharedManager] fadeBackgroundColorAnimationFor:self duration:duration
- delegate:delegate startSelector:startSelector
- stopSelector:stopSelector fadeOut:NO];
- [self.layer addAnimation:anim forKey:kFTAnimationFadeBackgroundIn];
-}
-
-- (void)fadeBackgroundColorIn:(NSTimeInterval)duration delegate:(id)delegate {
- [self fadeBackgroundColorIn:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-- (void)fadeBackgroundColorOut:(NSTimeInterval)duration delegate:(id)delegate
- startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *anim = [[FTAnimationManager sharedManager] fadeBackgroundColorAnimationFor:self duration:duration
- delegate:delegate startSelector:startSelector
- stopSelector:stopSelector fadeOut:YES];
- [self.layer addAnimation:anim forKey:kFTAnimationFadeBackgroundOut];
-}
-
-- (void)fadeBackgroundColorOut:(NSTimeInterval)duration delegate:(id)delegate {
- [self fadeBackgroundColorOut:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-#pragma mark -
-#pragma mark Pop Animations
-
-- (void)popIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *anim = [[FTAnimationManager sharedManager] popInAnimationFor:self duration:duration delegate:delegate
- startSelector:startSelector stopSelector:stopSelector];
- [self.layer addAnimation:anim forKey:kFTAnimationPopIn];
-}
-
-- (void)popIn:(NSTimeInterval)duration delegate:(id)delegate {
- [self popIn:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-- (void)popOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *anim = [[FTAnimationManager sharedManager] popOutAnimationFor:self duration:duration delegate:delegate
- startSelector:startSelector stopSelector:stopSelector];
- [self.layer addAnimation:anim forKey:kFTAnimationPopOut];
-}
-
-- (void)popOut:(NSTimeInterval)duration delegate:(id)delegate {
- [self popOut:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-#pragma mark -
-#pragma mark Fall In and Fly Out
-
-- (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate {
- [self fallIn:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-- (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *anim = [[FTAnimationManager sharedManager] fallInAnimationFor:self duration:duration delegate:delegate
- startSelector:startSelector stopSelector:stopSelector];
- [self.layer addAnimation:anim forKey:kFTAnimationFallIn];
-}
-
-- (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate {
- [self fallOut:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-- (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *anim = [[FTAnimationManager sharedManager] fallOutAnimationFor:self duration:duration delegate:delegate
- startSelector:startSelector stopSelector:stopSelector];
- [self.layer addAnimation:anim forKey:kFTAnimationFallOut];
-}
-
-- (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate {
- [self flyOut:duration delegate:delegate startSelector:nil stopSelector:nil];
-}
-
-- (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector {
- CAAnimation *anim = [[FTAnimationManager sharedManager] flyOutAnimationFor:self duration:duration delegate:delegate
- startSelector:startSelector stopSelector:stopSelector];
- [self.layer addAnimation:anim forKey:kFTAnimationFlyOut];
-}
-
-
-@end
View
308 Classes/FTJSONParser.m
@@ -1,308 +0,0 @@
-/*
- The MIT License
-
- Copyright (c) 2009 Free Time Studios and Nathan Eror
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-#import "FTJSONParser.h"
-
-#define SAFE_RELEASE_HANDLE if(handle_ != NULL) { yajl_free(handle_), handle_ = NULL; }
-
-NSString *const FTJSONParserErrorDomain = @"FTJSONParserError";
-
-//Forward declaration, the struct is defined at the bottom of the file
-static yajl_callbacks ftjsonCallbacks;
-
-@interface FTJSONParser (YAJLParserCallbacks)
-
-- (BOOL)objectIsDictionary:(id)obj;
-
-- (void)startCollectionWithKey:(NSString *)key collection:(id)collection;
-
-- (void)startDictionaryWithKey:(NSString *)key;
-- (void)endDictionary;
-
-- (void)startArrayWithKey:(NSString *)key;
-- (void)endArray;
-
-- (void)addObject:(id)obj forKey:(NSString *)key;
-
-@end
-
-@implementation FTJSONParser (YAJLParserCallbacks)
-
-- (BOOL)objectIsDictionary:(id)obj {
- //NSDictionary is the only class that implements allKeys
- return [obj respondsToSelector:@selector(allKeys)];
-}
-
-- (void)addObject:(id)obj forKey:(NSString *)key {
- id stackTop = [collectionObjectStack_ lastObject];
- if([self objectIsDictionary:stackTop]) {
- [stackTop setObject:obj forKey:key];
- } else {
- [stackTop addObject:obj];
- }
-}
-
-- (void)startCollectionWithKey:(NSString *)key collection:(id)collection {
- id stackTop = [collectionObjectStack_ lastObject];
- if(stackTop == nil) {
- rootObject_ = [collection retain];
- } else {
- if([self objectIsDictionary:stackTop]) {
- [stackTop setObject:collection forKey:key];
- } else {
- [stackTop addObject:collection];
- }
- }
- [collectionObjectStack_ addObject:collection];
-}
-
-- (void)startDictionaryWithKey:(NSString *)key {
- if([collectionObjectStack_ count] == 0) {
- isDictionary_ = YES;
- }
- [self startCollectionWithKey:key collection:[NSMutableDictionary dictionary]];
-}
-
-- (void)endDictionary {
- NSAssert([self objectIsDictionary:[collectionObjectStack_ lastObject]], @"I need to pop a dictionary off of the type stack!");
- [collectionObjectStack_ removeLastObject];
-}
-
-- (void)startArrayWithKey:(NSString *)key {
- if([collectionObjectStack_ count] == 0) {
- isDictionary_ = NO;
- }
- [self startCollectionWithKey:key collection:[NSMutableArray array]];
-}
-- (void)endArray {
- NSAssert(![self objectIsDictionary:[collectionObjectStack_ lastObject]], @"I need to pop an array off of the type stack!");
- [collectionObjectStack_ removeLastObject];
-}
-
-@end
-
-
-@implementation FTJSONParser
-
-@synthesize delegate = delegate_;
-@synthesize isDictionary = isDictionary_;
-@synthesize allowComments = allowComments_;
-@synthesize forceUTF8 = forceUTF8_;
-@synthesize status = parsingStatus_;
-
-#pragma mark init/dealloc
-
-- (id) init {
- self = [super init];
- if (self != nil) {
- collectionObjectStack_ = [[NSMutableArray alloc] init];
- allowComments_ = YES;
- forceUTF8_ = YES;
- }
- return self;
-}
-
-- (void) dealloc {
- FTRELEASE(rootObject_);
- FTRELEASE(collectionObjectStack_);
- [super dealloc];
-}
-
-#pragma mark Result and Status Accessors
-
-- (NSDictionary *)dictionary {
- if(isDictionary_) {
- return [NSDictionary dictionaryWithDictionary:rootObject_];
- }
- return nil;
-}
-- (NSArray *)array {
- if(isDictionary_) {
- return [NSArray arrayWithObject:rootObject_];
- }
- return [NSArray arrayWithArray:rootObject_];
-}
-
-- (NSString *)statusString {
- return [NSString stringWithCString:yajl_status_to_string((yajl_status)parsingStatus_) encoding:NSUTF8StringEncoding];
-}
-
-#pragma mark Error Handling Helpers
-
-- (NSString *)getYAJLErrorStringFor:(NSData *)data {
- unsigned char *yajlError = yajl_get_error(handle_, 0, [data bytes], [data length]);
- //Put the error string into an NSString and lop off the trailing newline
- NSString *errorString = [NSString stringWithUTF8String:(const char *)yajlError];
- yajl_free_error(handle_, yajlError);
- return errorString;
-}
-
-#pragma mark Parse NSData Stream
-
-- (BOOL)prepareParser {
- SAFE_RELEASE_HANDLE
- yajl_parser_config parserConfig = {allowComments_, forceUTF8_};
- handle_ = yajl_alloc(&ftjsonCallbacks, &parserConfig, NULL, self);
- return (handle_ != NULL);
-}
-
-- (FTJSONParsingStatus)parseChunk:(NSData *)dataChunk error:(NSError **)error {
- parsingStatus_ = (FTJSONParsingStatus)yajl_parse(handle_, [dataChunk bytes], [dataChunk length]);
- if (parsingStatus_ != kFTJSONParsingStatusInsufficientData && parsingStatus_ != kFTJSONParsingStatusOK) {
- if(error != NULL) {
- *error = [NSError errorWithDomain:FTJSONParserErrorDomain
- code:parsingStatus_
- userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
- [self getYAJLErrorStringFor:dataChunk], NSLocalizedFailureReasonErrorKey, nil]];
- }
- }
- return parsingStatus_;
-}
-
-- (void)finishedParsing {
- parsingStatus_ = yajl_parse_complete(handle_);
- SAFE_RELEASE_HANDLE
-}
-
-#pragma mark Parse Stream From URL
-
-- (BOOL)parseUrl:(NSURL *)url {
- return !![NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:url] delegate:self];
-}
-
-#pragma mark NSURLConnection Delegate Methods
-
-- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
- [self prepareParser];
-}
-
-- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
- NSError *error = nil;
- [self parseChunk:data error:&error];
- if (parsingStatus_ != kFTJSONParsingStatusInsufficientData && parsingStatus_ != kFTJSONParsingStatusOK) {
- [connection cancel];
- if (delegate_ != nil && [delegate_ respondsToSelector:@selector(jsonRequestFailed:)]) {
- [delegate_ jsonRequestFailed:error];
- }
- }
-}
-
-- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
- [self finishedParsing];
- if (delegate_ != nil && [delegate_ respondsToSelector:@selector(jsonRequestFailed:)]) {
- [delegate_ jsonRequestFailed:error];
- }
-
-}
-
-- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
- [self finishedParsing];
- if (delegate_ != nil && [delegate_ respondsToSelector:@selector(jsonRequestFinished:)]) {
- [delegate_ jsonRequestFinished:self];
- }
-}
-
-#pragma mark Parse a plain ole' NSString
-
-- (FTJSONParsingStatus)parseString:(NSString *)jsonString error:(NSError **)error {
- NSData *data = [NSData dataWithBytes:[jsonString UTF8String] length:[jsonString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]];
- [self prepareParser];
- [self parseChunk:data error:error];
- [self finishedParsing];
- return parsingStatus_;
-}
-
-@end
-
-#pragma mark -
-#pragma mark YAJL Callbacks
-
-static NSString *currentKey;
-
-static int ftjson_null(void *ctx) {
- [(FTJSONParser *)ctx addObject:nil forKey:currentKey];
- return 1;
-}
-
-static int ftjson_boolean(void *ctx, int boolean) {
- [(FTJSONParser *)ctx addObject:[NSNumber numberWithBool:boolean] forKey:currentKey];
- return 1;
-}
-
-static int ftjson_integer(void *ctx, long value) {
- [(FTJSONParser *)ctx addObject:[NSNumber numberWithLong:value] forKey:currentKey];
- return 1;
-
-}
-
-static int ftjson_double(void *ctx, double value) {
- [(FTJSONParser *)ctx addObject:[NSNumber numberWithDouble:value] forKey:currentKey];
- return 1;
-}
-
-static int ftjson_string(void *ctx, const unsigned char *stringVal, unsigned int stringLen) {
- NSString *value = [[NSString alloc] initWithBytes:stringVal length:stringLen encoding:NSUTF8StringEncoding];
- [(FTJSONParser *)ctx addObject:value forKey:currentKey];
- [value release];
- return 1;
-}
-
-static int ftjson_map_key(void *ctx, const unsigned char *stringVal, unsigned int stringLen) {
- FTRELEASE(currentKey);
- currentKey = [[NSString alloc] initWithBytes:stringVal length:stringLen encoding:NSUTF8StringEncoding];
- return 1;
-}
-
-static int ftjson_start_map(void *ctx) {
- [(FTJSONParser *)ctx startDictionaryWithKey:currentKey];
- return 1;
-}
-
-static int ftjson_end_map(void *ctx) {
- [(FTJSONParser *)ctx endDictionary];
- return 1;
-}
-
-static int ftjson_start_array(void *ctx) {
- [(FTJSONParser *)ctx startArrayWithKey:currentKey];
- return 1;
-}
-
-static int ftjson_end_array(void *ctx) {
- [(FTJSONParser *)ctx endArray];
- return 1;
-}
-
-static yajl_callbacks ftjsonCallbacks = {
- ftjson_null,
- ftjson_boolean,
- ftjson_integer,
- ftjson_double,
- NULL,
- ftjson_string,
- ftjson_start_map,
- ftjson_map_key,
- ftjson_end_map,
- ftjson_start_array,
- ftjson_end_array
-};
View
249 Classes/FTJSONWriter.m
@@ -1,249 +0,0 @@
-/*
- The MIT License
-
- Copyright (c) 2009 Free Time Studios and Nathan Eror
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-#import "FTJSONWriter.h"
-
-#define SAFE_RELEASE_HANDLE \
- if(handle_ != NULL) { \
- yajl_gen_free(handle_); \
- handle_ = NULL; \
- }
-
-#define CHECK_STATUS_NO_ERROR(_status, _method_call) \
- _status = _method_call; \
- if(_status != kFTJSONEncStatusOK) { \
- return _status; \
- }
-
-#define THROW_ERROR_FOR_STATUS(_status, _err) \
- if (_status != kFTJSONEncStatusOK) { \
- if(_err != NULL) { \
- *_err = [NSError errorWithDomain:FTJSONWriterErrorDomain \
- code:_status \
- userInfo:[NSDictionary dictionaryWithObjectsAndKeys: \
- [NSString stringWithUTF8String:friendlyErrorMessages[_status]], \
- NSLocalizedFailureReasonErrorKey, nil] \
- ]; \
- } \
- return _status; \
- }
-
-
-#define GEN_FUNC_OR_ERROR(_err, _status, _func, ...) \
- _status = (FTJSONEncodingStatus)_func(__VA_ARGS__); \
- THROW_ERROR_FOR_STATUS(_status, _err)
-
-static const char *friendlyErrorMessages[] = {
- "OK!",
- "All keys must be strings.",
- "Max stack depth exceeded.",
- "A generator function was called while the generator was in an error state.",
- "Generation complete.",
- "Could not encode into a JSON string"
-};
-
-NSString *const FTJSONWriterErrorDomain = @"FTJSONWriterError";
-
-@interface FTJSONWriter (PrivateEncodingMethods)
-
-- (FTJSONEncodingStatus)flushBuffer:(NSError **)error;
-- (FTJSONType)guessType:(id)value;
-- (FTJSONEncodingStatus)encodeString:(NSString *)value error:(NSError **)error;
-- (FTJSONEncodingStatus)encodeNSValue:(NSNumber *)value forType:(FTJSONType)type error:(NSError **)error;
-- (FTJSONEncodingStatus)encodeObject:(id)value forType:(FTJSONType)type error:(NSError **)error;
-- (FTJSONEncodingStatus)encodeObject:(id)value forKey:(NSString *)key error:(NSError **)error;
-
-@end
-
-@implementation FTJSONWriter (PrivateEncodingMethods)
-
-- (FTJSONEncodingStatus)flushBuffer:(NSError **)error {
- const unsigned char *buffer;
- unsigned int length;
- FTJSONEncodingStatus status;
- GEN_FUNC_OR_ERROR(error, status, yajl_gen_get_buf, handle_, &buffer, &length)
- [encodedString_ appendString:[NSString stringWithUTF8String:(const char *)buffer]];
- yajl_gen_clear(handle_);
- return status;
-}
-
-- (FTJSONType)guessType:(id)value {
- return kFTJSONTypeUnknown;
-}
-
-- (FTJSONEncodingStatus)encodeNSValue:(NSNumber *)value forType:(FTJSONType)type error:(NSError **)error {
- FTJSONEncodingStatus status = kFTJSONEncStatusCannotEncode;
- switch (type) {
- case kFTJSONTypeInteger:
- GEN_FUNC_OR_ERROR(error, status, yajl_gen_integer, handle_, [value longValue])
- break;
- case kFTJSONTypeDouble:
- GEN_FUNC_OR_ERROR(error, status, yajl_gen_double, handle_, [value doubleValue])
- break;
- case kFTJSONTypeBOOL:
- GEN_FUNC_OR_ERROR(error, status, yajl_gen_bool, handle_, [value boolValue])
- break;
- }
- return status;
-}
-
-- (FTJSONEncodingStatus)encodeString:(NSString *)value error:(NSError **)error {
- FTJSONEncodingStatus status;
- const char *str = [value UTF8String];
- GEN_FUNC_OR_ERROR(error, status, yajl_gen_string, handle_, (const unsigned char *)str, strlen(str))
- return status;
-}
-
-- (FTJSONEncodingStatus)encodeObject:(id)obj forType:(FTJSONType)type error:(NSError **)error {
- switch (type) {
- case kFTJSONTypeDictionary:
- return [self encodeDictionary:obj error:error];
- case kFTJSONTypeArray:
- return [self encodeArray:obj error:error];
- case kFTJSONTypeString:
- return [self encodeString:obj error:error];
- case kFTJSONTypeInteger:
- case kFTJSONTypeDouble:
- case kFTJSONTypeBOOL:
- return [self encodeNSValue:obj forType:type error:error];
- }
- THROW_ERROR_FOR_STATUS(kFTJSONEncStatusCannotEncode, error)
-}
-
-- (FTJSONEncodingStatus)encodeObject:(id)obj forKey:(NSString *)key error:(NSError **)error {
- FTJSONType type = kFTJSONTypeUnknown;
-
- if(delegate_ != nil && [delegate_ respondsToSelector:@selector(typeOfValue:forKey:)]) {
- type = [delegate_ typeOfValue:obj forKey:key];
- }
-
- if(type == kFTJSONTypeUnknown)
- {
- if([obj isKindOfClass:[NSValue class]])
- {
- const char *objCType = [obj objCType];
- if(strncmp(objCType, "i", 1)==0 || strncmp(objCType, "l", 1)==0 || strncmp(objCType, "q", 1)==0 ||
- strncmp(objCType, "I", 1)==0 || strncmp(objCType, "L", 1)==0 || strncmp(objCType, "Q", 1)==0)
- {
- type = kFTJSONTypeInteger;
- }
- else if(strncmp(objCType, "f", 1)==0 || strncmp(objCType, "d", 1)==0)
- {
- type = kFTJSONTypeDouble;
- }
- else if(strncmp(objCType, "B", 1)==0 || (strncmp(objCType, "c", 1)==0 && ([obj charValue]==0 || [obj charValue]==1))) {
- type = kFTJSONTypeBOOL;
- }
- }
- else if([obj respondsToSelector:@selector(initWithArray:)])
- {
- type = kFTJSONTypeArray;
- }
- else if([obj respondsToSelector:@selector(initWithDictionary:)] ||
- [obj respondsToSelector:@selector(addEntriesFromDictionary:)])
- {
- type = kFTJSONTypeDictionary;
- }
- else
- {
- //This is a fall through default and the NSString handler becuase
- //[NSString -descrption] just returns its receiver
- obj = [obj description];
- type = kFTJSONTypeString;
- }
- }
- return [self encodeObject:obj forType:type error:error];
-}
-
-@end
-
-@implementation FTJSONWriter
-
-@synthesize beautify = beautify_;
-@synthesize indentString = indentString_;
-@synthesize delegate = delegate_;
-@dynamic encodedString;
-
-- (id) init {
- self = [super init];
- if (self != nil) {
- beautify_ = NO;
- self.indentString = @" ";
- }
- return self;
-}
-
-- (void) dealloc {
- SAFE_RELEASE_HANDLE
- FTRELEASE(encodedString_);
- FTRELEASE(indentString_);
- [super dealloc];
-}
-
-- (NSString *)encodedString {
- return [NSString stringWithString:encodedString_];
-}
-
-- (BOOL)prepareWriter {
- FTRELEASE(encodedString_);
- encodedString_ = [[NSMutableString alloc] init];
- SAFE_RELEASE_HANDLE
- yajl_gen_config yajlGeneratorConf = {beautify_, [indentString_ UTF8String]};
- handle_ = yajl_gen_alloc(&yajlGeneratorConf, NULL);
- return (handle_ != NULL);
-}
-
-- (FTJSONEncodingStatus)encodeDictionary:(NSDictionary *)dictionary error:(NSError **)error {
- NSAssert(handle_, @"The writer must be prepared before encoding can begin.");
-
- FTJSONEncodingStatus status;
- GEN_FUNC_OR_ERROR(error, status, yajl_gen_map_open, handle_)
- for(id key in dictionary) {
- //Force Dictionary keys to NSStrings. We can use description since
- //it just returns the receiver when called on NSString
- CHECK_STATUS_NO_ERROR(status, [self encodeObject:[key description] forKey:nil error:error])
- CHECK_STATUS_NO_ERROR(status, [self encodeObject:[dictionary objectForKey:key] forKey:key error:error])
- }
- GEN_FUNC_OR_ERROR(error, status, yajl_gen_map_close, handle_)
- return [self flushBuffer:error];
-}
-
-- (FTJSONEncodingStatus)encodeArray:(NSArray *)array error:(NSError **)error {
- NSAssert(handle_, @"The writer must be prepared before encoding can begin.");
-
- FTJSONEncodingStatus status;
- GEN_FUNC_OR_ERROR(error, status, yajl_gen_array_open, handle_)
- for(NSString *item in array) {
- [self encodeObject:item forKey:nil error:error];
- }
- GEN_FUNC_OR_ERROR(error, status, yajl_gen_array_close, handle_)
- return [self flushBuffer:error];
-}
-
-- (FTJSONEncodingStatus)encodeObject:(id)obj error:(NSError **)error {
- FTJSONEncodingStatus status;
- CHECK_STATUS_NO_ERROR(status, [self encodeObject:obj forKey:nil error:error])
- return [self flushBuffer:error];
-}
-
-@end
View
24 Classes/FTUtils+NSObject.m
@@ -1,3 +1,27 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
#import "FTUtils+NSObject.h"
#import <QuartzCore/QuartzCore.h>
View
119 FTUtils.xcodeproj/project.pbxproj
@@ -8,60 +8,33 @@
/* Begin PBXBuildFile section */
AA747D9F0F9514B9006C5449 /* FTUtils_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = AA747D9E0F9514B9006C5449 /* FTUtils_Prefix.pch */; };
+ DF1E44EF10C29C1500F80FC0 /* FTAnimation+UIView.m in Sources */ = {isa = PBXBuildFile; fileRef = DF1E44EE10C29C1500F80FC0 /* FTAnimation+UIView.m */; };
+ DF1E44F010C29C1500F80FC0 /* FTAnimation+UIView.h in Headers */ = {isa = PBXBuildFile; fileRef = DF1E44ED10C29C1500F80FC0 /* FTAnimation+UIView.h */; };
+ DF1E44F110C29C1500F80FC0 /* FTAnimation+UIView.m in Sources */ = {isa = PBXBuildFile; fileRef = DF1E44EE10C29C1500F80FC0 /* FTAnimation+UIView.m */; };
+ DF1E44F510C29D7500F80FC0 /* FTAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = DF1E44F410C29D7500F80FC0 /* FTAnimation.h */; };
DF287AAE0FE19638001E9F62 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF287AA20FE19638001E9F62 /* CoreGraphics.framework */; };
DF287AAF0FE19638001E9F62 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF287AA30FE19638001E9F62 /* Foundation.framework */; };
DF287AB00FE19638001E9F62 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF287AA40FE19638001E9F62 /* QuartzCore.framework */; };
DF287AB10FE19638001E9F62 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF287AA50FE19638001E9F62 /* UIKit.framework */; };
DF2962EE0FE18E0000B9D71D /* FTAnimationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = DF2962E40FE18E0000B9D71D /* FTAnimationManager.h */; };
- DF2962EF0FE18E0000B9D71D /* FTJSONParser.h in Headers */ = {isa = PBXBuildFile; fileRef = DF2962E50FE18E0000B9D71D /* FTJSONParser.h */; };
- DF2962F00FE18E0000B9D71D /* FTJSONWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = DF2962E60FE18E0000B9D71D /* FTJSONWriter.h */; };
DF2962F20FE18E0000B9D71D /* FTAnimationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DF2962E90FE18E0000B9D71D /* FTAnimationManager.m */; };
- DF2962F30FE18E0000B9D71D /* FTJSONParser.m in Sources */ = {isa = PBXBuildFile; fileRef = DF2962EA0FE18E0000B9D71D /* FTJSONParser.m */; };
- DF2962F40FE18E0000B9D71D /* FTJSONWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = DF2962EB0FE18E0000B9D71D /* FTJSONWriter.m */; };
- DF29631F0FE18F3F00B9D71D /* libyajl_iphone.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DF29631E0FE18F3D00B9D71D /* libyajl_iphone.a */; };
DFE4EF141035CC4D006A7598 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DFE4EF131035CC4D006A7598 /* OCMock.framework */; };
DFE4EF1C1035CC97006A7598 /* OCMock.framework in Copy OCMock */ = {isa = PBXBuildFile; fileRef = DFE4EF131035CC4D006A7598 /* OCMock.framework */; };
DFE4EF241035CCC1006A7598 /* TestFTAnimationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DF2962E10FE18E0000B9D71D /* TestFTAnimationManager.m */; };
- DFE4EF251035CCC1006A7598 /* TestFTJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = DF2962E20FE18E0000B9D71D /* TestFTJSON.m */; };
- DFE4EF261035CCC5006A7598 /* FTJSONTestData.plist in Resources */ = {isa = PBXBuildFile; fileRef = DF2962E00FE18E0000B9D71D /* FTJSONTestData.plist */; };
DFE4EFE21035CCCD006A7598 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF287AA20FE19638001E9F62 /* CoreGraphics.framework */; };
DFE4EFE31035CCCD006A7598 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF287AA30FE19638001E9F62 /* Foundation.framework */; };
DFE4EFE41035CCCD006A7598 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF287AA40FE19638001E9F62 /* QuartzCore.framework */; };
DFE4EFE51035CCCD006A7598 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DF287AA50FE19638001E9F62 /* UIKit.framework */; };
DFF7F0601035CE350067ED5B /* FTAnimationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = DF2962E90FE18E0000B9D71D /* FTAnimationManager.m */; };
- DFF7F0611035CE350067ED5B /* FTJSONParser.m in Sources */ = {isa = PBXBuildFile; fileRef = DF2962EA0FE18E0000B9D71D /* FTJSONParser.m */; };
- DFF7F0621035CE350067ED5B /* FTJSONWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = DF2962EB0FE18E0000B9D71D /* FTJSONWriter.m */; };
- DFF7F0641035CE440067ED5B /* libyajl_iphone.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DF29631E0FE18F3D00B9D71D /* libyajl_iphone.a */; };
DFFBF80A10ADF405008DB0B9 /* FTUtils+NSObject.m in Sources */ = {isa = PBXBuildFile; fileRef = DFFBF80910ADF405008DB0B9 /* FTUtils+NSObject.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
- DF287F340FE19DAA001E9F62 /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = DF2963170FE18F3D00B9D71D /* yajl_iphone.xcodeproj */;
- proxyType = 1;
- remoteGlobalIDString = D2AAC045055464E500DB518D;
- remoteInfo = libyajl;
- };
- DF29631D0FE18F3D00B9D71D /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = DF2963170FE18F3D00B9D71D /* yajl_iphone.xcodeproj */;
- proxyType = 2;
- remoteGlobalIDString = D2AAC046055464E500DB518D;
- remoteInfo = libyajl;
- };
- DFF7F0651035CE540067ED5B /* PBXContainerItemProxy */ = {
- isa = PBXContainerItemProxy;
- containerPortal = DF2963170FE18F3D00B9D71D /* yajl_iphone.xcodeproj */;
- proxyType = 1;
- remoteGlobalIDString = D2AAC045055464E500DB518D;
- remoteInfo = libyajl;
- };
DFFBF86110ADF7A1008DB0B9 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
- remoteGlobalIDString = DFE4EF0A1035CBCB006A7598 /* UnitTests */;
+ remoteGlobalIDString = DFE4EF0A1035CBCB006A7598;
remoteInfo = UnitTests;
};
/* End PBXContainerItemProxy section */
@@ -83,21 +56,17 @@
/* Begin PBXFileReference section */
AA747D9E0F9514B9006C5449 /* FTUtils_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTUtils_Prefix.pch; sourceTree = SOURCE_ROOT; };
D2AAC07E0554694100DB518D /* libFTUtils.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFTUtils.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ DF1E44ED10C29C1500F80FC0 /* FTAnimation+UIView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "FTAnimation+UIView.h"; path = "FTUtils/FTAnimation+UIView.h"; sourceTree = "<group>"; };
+ DF1E44EE10C29C1500F80FC0 /* FTAnimation+UIView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "FTAnimation+UIView.m"; sourceTree = "<group>"; };
+ DF1E44F410C29D7500F80FC0 /* FTAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTAnimation.h; sourceTree = "<group>"; };
DF2879B50FE192A1001E9F62 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DF287AA20FE19638001E9F62 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
DF287AA30FE19638001E9F62 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
DF287AA40FE19638001E9F62 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
DF287AA50FE19638001E9F62 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
- DF2962E00FE18E0000B9D71D /* FTJSONTestData.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = FTJSONTestData.plist; sourceTree = "<group>"; };
DF2962E10FE18E0000B9D71D /* TestFTAnimationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestFTAnimationManager.m; sourceTree = "<group>"; };
- DF2962E20FE18E0000B9D71D /* TestFTJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestFTJSON.m; sourceTree = "<group>"; };
DF2962E40FE18E0000B9D71D /* FTAnimationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTAnimationManager.h; path = FTUtils/FTAnimationManager.h; sourceTree = "<group>"; };
- DF2962E50FE18E0000B9D71D /* FTJSONParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTJSONParser.h; path = FTUtils/FTJSONParser.h; sourceTree = "<group>"; };
- DF2962E60FE18E0000B9D71D /* FTJSONWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FTJSONWriter.h; path = FTUtils/FTJSONWriter.h; sourceTree = "<group>"; };
DF2962E90FE18E0000B9D71D /* FTAnimationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FTAnimationManager.m; sourceTree = "<group>"; };
- DF2962EA0FE18E0000B9D71D /* FTJSONParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FTJSONParser.m; sourceTree = "<group>"; };
- DF2962EB0FE18E0000B9D71D /* FTJSONWriter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FTJSONWriter.m; sourceTree = "<group>"; };
- DF2963170FE18F3D00B9D71D /* yajl_iphone.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = yajl_iphone.xcodeproj; path = Support/yajl/yajl_iphone/yajl_iphone.xcodeproj; sourceTree = SOURCE_ROOT; };
DF6D06470FE1A6F200CC44C6 /* README.mdown */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.mdown; sourceTree = "<group>"; };
DFE4EF0B1035CBCB006A7598 /* UnitTests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = UnitTests.octest; sourceTree = BUILT_PRODUCTS_DIR; };
DFE4EF0C1035CBCB006A7598 /* UnitTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UnitTests-Info.plist"; sourceTree = "<group>"; };
@@ -112,7 +81,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- DF29631F0FE18F3F00B9D71D /* libyajl_iphone.a in Frameworks */,
DF287AAE0FE19638001E9F62 /* CoreGraphics.framework in Frameworks */,
DF287AAF0FE19638001E9F62 /* Foundation.framework in Frameworks */,
DF287AB00FE19638001E9F62 /* QuartzCore.framework in Frameworks */,
@@ -129,7 +97,6 @@
DFE4EFE41035CCCD006A7598 /* QuartzCore.framework in Frameworks */,
DFE4EFE51035CCCD006A7598 /* UIKit.framework in Frameworks */,
DFE4EF141035CC4D006A7598 /* OCMock.framework in Frameworks */,
- DFF7F0641035CE440067ED5B /* libyajl_iphone.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -184,40 +151,29 @@
DF2962DE0FE18E0000B9D71D /* Tests */ = {
isa = PBXGroup;
children = (
- DF2962DF0FE18E0000B9D71D /* TestData */,
DF2962E10FE18E0000B9D71D /* TestFTAnimationManager.m */,
- DF2962E20FE18E0000B9D71D /* TestFTJSON.m */,
);
path = Tests;
sourceTree = "<group>";
};
- DF2962DF0FE18E0000B9D71D /* TestData */ = {
- isa = PBXGroup;
- children = (
- DF2962E00FE18E0000B9D71D /* FTJSONTestData.plist */,
- );
- path = TestData;
- sourceTree = "<group>";
- };
DF2962E30FE18E0000B9D71D /* Headers */ = {
isa = PBXGroup;
children = (
DFFBF82610ADF55A008DB0B9 /* FTUtils.h */,
- DF2962E40FE18E0000B9D71D /* FTAnimationManager.h */,
- DF2962E50FE18E0000B9D71D /* FTJSONParser.h */,
- DF2962E60FE18E0000B9D71D /* FTJSONWriter.h */,
DFFBF80810ADF405008DB0B9 /* FTUtils+NSObject.h */,
+ DF1E44F410C29D7500F80FC0 /* FTAnimation.h */,
+ DF2962E40FE18E0000B9D71D /* FTAnimationManager.h */,
+ DF1E44ED10C29C1500F80FC0 /* FTAnimation+UIView.h */,
);
path = Headers;
sourceTree = "<group>";
};
DF2962E80FE18E0000B9D71D /* Classes */ = {
isa = PBXGroup;
children = (
- DF2962E90FE18E0000B9D71D /* FTAnimationManager.m */,
- DF2962EA0FE18E0000B9D71D /* FTJSONParser.m */,
- DF2962EB0FE18E0000B9D71D /* FTJSONWriter.m */,
DFFBF80910ADF405008DB0B9 /* FTUtils+NSObject.m */,
+ DF2962E90FE18E0000B9D71D /* FTAnimationManager.m */,
+ DF1E44EE10C29C1500F80FC0 /* FTAnimation+UIView.m */,
);
path = Classes;
sourceTree = "<group>";
@@ -226,19 +182,10 @@
isa = PBXGroup;
children = (
DFE4EF131035CC4D006A7598 /* OCMock.framework */,
- DF2963170FE18F3D00B9D71D /* yajl_iphone.xcodeproj */,
);
name = Support;
sourceTree = "<group>";
};
- DF29631A0FE18F3D00B9D71D /* Products */ = {
- isa = PBXGroup;
- children = (
- DF29631E0FE18F3D00B9D71D /* libyajl_iphone.a */,
- );
- name = Products;
- sourceTree = "<group>";
- };
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@@ -248,8 +195,8 @@
files = (
AA747D9F0F9514B9006C5449 /* FTUtils_Prefix.pch in Headers */,
DF2962EE0FE18E0000B9D71D /* FTAnimationManager.h in Headers */,
- DF2962EF0FE18E0000B9D71D /* FTJSONParser.h in Headers */,
- DF2962F00FE18E0000B9D71D /* FTJSONWriter.h in Headers */,
+ DF1E44F010C29C1500F80FC0 /* FTAnimation+UIView.h in Headers */,
+ DF1E44F510C29D7500F80FC0 /* FTAnimation.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -267,7 +214,6 @@
buildRules = (
);
dependencies = (
- DF287F350FE19DAA001E9F62 /* PBXTargetDependency */,
DFFBF86210ADF7A1008DB0B9 /* PBXTargetDependency */,
);
name = FTUtils;
@@ -288,7 +234,6 @@
buildRules = (
);
dependencies = (
- DFF7F0661035CE540067ED5B /* PBXTargetDependency */,
);
name = UnitTests;
productName = UnitTests;
@@ -306,12 +251,6 @@
mainGroup = 0867D691FE84028FC02AAC07 /* FTUtils */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
- projectReferences = (
- {
- ProductGroup = DF29631A0FE18F3D00B9D71D /* Products */;
- ProjectRef = DF2963170FE18F3D00B9D71D /* yajl_iphone.xcodeproj */;
- },
- );
projectRoot = "";
targets = (
D2AAC07D0554694100DB518D /* FTUtils */,
@@ -320,22 +259,11 @@
};
/* End PBXProject section */
-/* Begin PBXReferenceProxy section */
- DF29631E0FE18F3D00B9D71D /* libyajl_iphone.a */ = {
- isa = PBXReferenceProxy;
- fileType = archive.ar;
- path = libyajl_iphone.a;
- remoteRef = DF29631D0FE18F3D00B9D71D /* PBXContainerItemProxy */;
- sourceTree = BUILT_PRODUCTS_DIR;
- };
-/* End PBXReferenceProxy section */
-
/* Begin PBXResourcesBuildPhase section */
DFE4EF061035CBCB006A7598 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- DFE4EF261035CCC5006A7598 /* FTJSONTestData.plist in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -363,8 +291,7 @@
buildActionMask = 2147483647;
files = (
DF2962F20FE18E0000B9D71D /* FTAnimationManager.m in Sources */,
- DF2962F30FE18E0000B9D71D /* FTJSONParser.m in Sources */,
- DF2962F40FE18E0000B9D71D /* FTJSONWriter.m in Sources */,
+ DF1E44F110C29C1500F80FC0 /* FTAnimation+UIView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -373,27 +300,15 @@
buildActionMask = 2147483647;
files = (
DFE4EF241035CCC1006A7598 /* TestFTAnimationManager.m in Sources */,
- DFE4EF251035CCC1006A7598 /* TestFTJSON.m in Sources */,
DFF7F0601035CE350067ED5B /* FTAnimationManager.m in Sources */,
- DFF7F0611035CE350067ED5B /* FTJSONParser.m in Sources */,
- DFF7F0621035CE350067ED5B /* FTJSONWriter.m in Sources */,
DFFBF80A10ADF405008DB0B9 /* FTUtils+NSObject.m in Sources */,
+ DF1E44EF10C29C1500F80FC0 /* FTAnimation+UIView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
- DF287F350FE19DAA001E9F62 /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- name = libyajl;
- targetProxy = DF287F340FE19DAA001E9F62 /* PBXContainerItemProxy */;
- };
- DFF7F0661035CE540067ED5B /* PBXTargetDependency */ = {
- isa = PBXTargetDependency;
- name = libyajl;
- targetProxy = DFF7F0651035CE540067ED5B /* PBXContainerItemProxy */;
- };
DFFBF86210ADF7A1008DB0B9 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = DFE4EF0A1035CBCB006A7598 /* UnitTests */;
View
28 Headers/FTAnimation.h
@@ -0,0 +1,28 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
+#import "FTUtils.h"
+#import "FTUtils+NSObject.h"
+#import "FTAnimationManager.h"
+#import "FTAnimation+UIView.h"
View
67 Headers/FTUtils/FTAnimation+UIView.h
@@ -0,0 +1,67 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
+#import "FTAnimationManager.h"
+
+@interface UIView (FTAnimationAdditions)
+
+- (void)slideInFrom:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)slideInFrom:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate
+ startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+- (void)slideOutTo:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)slideOutTo:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate
+ startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+
+- (void)backOutTo:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)backOutTo:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate
+ startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+- (void)backInFrom:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)backInFrom:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate
+ startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+
+- (void)fadeIn:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)fadeIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+- (void)fadeOut:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)fadeOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+
+- (void)fadeBackgroundColorIn:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)fadeBackgroundColorIn:(NSTimeInterval)duration delegate:(id)delegate
+ startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+- (void)fadeBackgroundColorOut:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)fadeBackgroundColorOut:(NSTimeInterval)duration delegate:(id)delegate
+ startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+
+- (void)popIn:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)popIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+- (void)popOut:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)popOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+
+- (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+- (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+- (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate;
+- (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
+
+@end
View
45 Headers/FTUtils/FTAnimationManager.h
@@ -21,11 +21,10 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
+
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>
-#import "FTUtils.h"
-#import "FTUtils+NSObject.h"
typedef enum _FTAnimationDirection {
kFTAnimationTop = 0,
@@ -139,48 +138,6 @@ static inline CGPoint FTAnimationOffscreenCenterPoint(CGRect viewFrame, CGPoint
@end
-@interface UIView (FTAnimationAdditions)
-
-- (void)slideInFrom:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)slideInFrom:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate
- startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-- (void)slideOutTo:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)slideOutTo:(FTAnimationDirection)direction duration:(NSTimeInterval)duration delegate:(id)delegate
- startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-
-- (void)backOutTo:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)backOutTo:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate
- startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-- (void)backInFrom:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)backInFrom:(FTAnimationDirection)direction withFade:(BOOL)fade duration:(NSTimeInterval)duration delegate:(id)delegate
- startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-
-- (void)fadeIn:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)fadeIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-- (void)fadeOut:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)fadeOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-
-- (void)fadeBackgroundColorIn:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)fadeBackgroundColorIn:(NSTimeInterval)duration delegate:(id)delegate
- startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-- (void)fadeBackgroundColorOut:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)fadeBackgroundColorOut:(NSTimeInterval)duration delegate:(id)delegate
- startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-
-- (void)popIn:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)popIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-- (void)popOut:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)popOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-
-- (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)fallIn:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-- (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)fallOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-- (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate;
-- (void)flyOut:(NSTimeInterval)duration delegate:(id)delegate startSelector:(SEL)startSelector stopSelector:(SEL)stopSelector;
-
-@end
-
@interface CAAnimation (FTAnimationAdditions)
- (void)setStartSelector:(SEL)selector withTarget:(id)target;
View
75 Headers/FTUtils/FTJSONParser.h
@@ -1,75 +0,0 @@
-/*
- The MIT License
-
- Copyright (c) 2009 Free Time Studios and Nathan Eror
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-#import <Foundation/Foundation.h>
-#import <yajl/yajl_common.h>
-#import <yajl/yajl_parse.h>
-#import "FTUtils.h"
-
-extern NSString *const FTJSONParserErrorDomain;
-
-typedef enum {
- kFTJSONParsingStatusOK = yajl_status_ok,
- kFTJSONParsingStatusClientCanceled = yajl_status_client_canceled,
- kFTJSONParsingStatusInsufficientData = yajl_status_insufficient_data,
- kFTJSONParsingStatusError = yajl_status_error
-} FTJSONParsingStatus;
-
-@class FTJSONParser;
-
-@protocol FTJSONParserDelegate
-
-@optional
-
-- (void)jsonRequestFinished:(FTJSONParser *)result;
-- (void)jsonRequestFailed:(NSError *)error;
-
-@end
-
-@interface FTJSONParser : NSObject {
- NSMutableArray *collectionObjectStack_;
- id rootObject_;
- id delegate_;
- BOOL isDictionary_;
- yajl_handle handle_;
- FTJSONParsingStatus parsingStatus_;
-
- BOOL allowComments_;
- BOOL forceUTF8_;
-}
-
-@property(assign) id<FTJSONParserDelegate> delegate;
-@property(readonly) BOOL isDictionary;
-@property(readonly) FTJSONParsingStatus status;
-@property(assign) BOOL allowComments;
-@property(assign) BOOL forceUTF8;
-
-- (FTJSONParsingStatus)parseString:(NSString *)jsonString error:(NSError **)error;
-- (BOOL)parseUrl:(NSURL *)url;
-
-- (NSDictionary *)dictionary;
-- (NSArray *)array;
-
-- (NSString *)statusString;
-
-@end
View
76 Headers/FTUtils/FTJSONWriter.h
@@ -1,76 +0,0 @@
-/*
- The MIT License
-
- Copyright (c) 2009 Free Time Studios and Nathan Eror
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-*/
-#import <Foundation/Foundation.h>
-#import <yajl/yajl_common.h>
-#import <yajl/yajl_gen.h>
-#import "FTUtils.h"
-
-extern NSString *const FTJSONWriterErrorDomain;
-
-typedef enum {
- kFTJSONTypeUnknown = 0,
- kFTJSONTypeDictionary,
- kFTJSONTypeArray,
- kFTJSONTypeInteger,
- kFTJSONTypeDouble,
- kFTJSONTypeString,
- kFTJSONTypeBOOL
-} FTJSONType;
-
-typedef enum {
- kFTJSONEncStatusOK = yajl_gen_status_ok,
- kFTJSONEncStatusKeysMustBeStrings = yajl_gen_keys_must_be_strings,
- kFTJSONEncStatusMaxDepthExceeded = yajl_max_depth_exceeded,
- kFTJSONEncStatusCalledInErrorState = yajl_gen_in_error_state,
- kFTJSONEncStatusGenerationComplete = yajl_gen_generation_complete,
- kFTJSONEncStatusCannotEncode
-} FTJSONEncodingStatus;
-
-@protocol FTJSONWriterDelegate
-
-- (FTJSONType)typeOfValue:(id)value forKey:(NSString *)key;
-
-@end
-
-
-@interface FTJSONWriter : NSObject {
- yajl_gen handle_;
- NSMutableString *encodedString_;
- id delegate_;
- BOOL beautify_;
- NSString *indentString_;
-}
-
-@property(assign) id<FTJSONWriterDelegate> delegate;
-@property(assign) BOOL beautify;
-@property(nonatomic,retain) NSString *indentString;
-@property(readonly) NSString *encodedString;
-
-- (BOOL)prepareWriter;
-
-- (FTJSONEncodingStatus)encodeObject:(id)obj error:(NSError **)error;
-- (FTJSONEncodingStatus)encodeDictionary:(NSDictionary *)dictionary error:(NSError **)error;
-- (FTJSONEncodingStatus)encodeArray:(NSArray *)array error:(NSError **)error;
-
-@end
View
24 Headers/FTUtils/FTUtils+NSObject.h
@@ -1,3 +1,27 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
#import <Foundation/Foundation.h>
@interface NSObject (FTUtilsAdditions)
View
24 Headers/FTUtils/FTUtils.h
@@ -1,3 +1,27 @@
+/*
+ The MIT License
+
+ Copyright (c) 2009 Free Time Studios and Nathan Eror
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+*/
+
#pragma mark -
#pragma mark Logging
// FTLOGEXT logging macro from: http://iphoneincubator.com/blog/debugging/the-evolution-of-a-replacement-for-nslog
View
59 README.mdown
@@ -1,16 +1,18 @@
FTUtils iPhone Utility Code Library
===================================
-The code in FTUtils is common utility code extracted from [Free Time Studios](http://www.freetimestudios.com/) iPhone projects. Currently, there are two primary utilities (`FTAnimationManager` and `FTJSON`) and some simple preprocessor macros. Most of the library is unit tested using [Google Toolbox for Mac](http://code.google.com/p/google-toolbox-for-mac/ "google-toolbox-for-mac - Google Code"). The documentation is still under development. Hopefully, the following will help in its stead.
+The code in FTUtils is common utility code extracted from [Free Time Studios](http://www.freetimestudios.com/) iPhone projects. Currently, there is only one primary utility (`FTAnimationManager`) and some simple preprocessor macros. Some unit tests exist for the code, but more are needed. The documentation is also still under development.
Using FTUtils
-------------
-Because of an external dependency on yajl, FTUtils is most easily used as a static library in your iPhone project. If you are only planning to use the `FTAnaimationManager` and not the JSON component, the static library method is not necessary. You can simply copy `FTUtils.h`, `FTAnimationManager.h` and `FTAnimationManager.m` into your project. Be sure to add the QuartzCore framework to your project as well (step 5 below).
+FTUtils is most easily used by simply copying `FTUtils.h`, `FTAnimationManager.h` and `FTAnimationManager.m` into your project. Be sure to add the QuartzCore framework to your project as well (step 5 below). The preferred way to integrate FTUtils into your projects is by adding it as a static library. This will keep it separate from your code.
The following is the process to add the FTUtils static library to your Xcode project (these steps were borrowed from the [three20 project](http://github.com/joehewitt/three20/tree/master "joehewitt's three20 at master - GitHub") and modified):
1. Clone the ftutils git repository: `git clone git://github.com/neror/ftutils.git`. Make sure you store the repository in a permanent place because Xcode will need to reference the files every time you compile your project.
+
+ 1(a). If you are already using git to manage your source files, you can also add the ftutils repository as a submodule to your project.
2. Locate the "FTUtils.xcodeproj" file under "ftutils". Drag FTUtils.xcodeproj and drop it onto the root of your Xcode project's "Groups and Files" sidebar. A dialog will appear -- make sure "Copy items" is unchecked and "Reference Type" is "Relative to Project" before clicking "Add".
@@ -28,10 +30,8 @@ You're ready to go! Just import the headers in your code for the parts of the li
#import <FTUtils/FTUtils.h>
#import <FTUtils/FTAnimationManager.h>
- #import <FTUtils/FTJSONParser.h>
- #import <FTUtils/FTJSONWriter.h>
-Enjoy! And extra super special thanks to [Joe Hewitt](http://www.joehewitt.com/ "Joe Hewitt") for writing those steps out for his [three20 project](http://github.com/joehewitt/three20/tree/master "joehewitt's three20 at master - GitHub")! I don't think I have the patience to pull it off.
+Enjoy! And extra super special thanks to [Joe Hewitt](http://www.joehewitt.com/ "Joe Hewitt") for writing these steps out for his [three20 project](http://github.com/joehewitt/three20/tree/master "joehewitt's three20 at master - GitHub")! I don't think I have the patience to pull it off.
FTAnimationManager
------------------
@@ -52,60 +52,11 @@ modify it to your satisfaction and/or add it to a `CAAnimationGroup` and add it
See the code for details.
-FTJSON
-------
-
-The JSON library is an Objective-C wrapper around the fast and tiny [yajl](http://lloyd.github.com/yajl/ "yajl") library. yajl is distributed with this project, but it didn't come from us. Please give all credit to Lloyd Hilaiel for any blazing speed you might encounter when parsing JSON.
-
-FTJSONParser
-------------
-
-Like yajl, `FTJSONParser` is an event driven JSON parser. It can be used to parse JSON directly from the network via a GET request or to parse an `NSString` already in memory. The parser properly decodes JSON types into `NSDictionary`, `NSArray` or `NSValue` objects. Its usage is simple:
-
- NSString *json = @"{\"id\": 2, \"name\":\"Nathan\", \"superuser\":true}";
- FTJSONParser *parser = [[[FTJSONParser alloc] init] autorelease];
- [parser parseString:json error:NULL];
- NSDictionary *result = [parser dictionary];
-
-The result from the previous code block is equivalent to:
-
- NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithInt:2], @"id",
- @"Nathan", @"name",
- [NSNumber numberWithBOOL:YES], @"superuser",
- nil];
-
-
-FTJSONWriter
-------------
-
-The JSON writer does its best to encode what you give it. The primary requirement is that the root object passed to `encodeObject:error:` be either an NSArray or NSDictionary. The encoder does the "right thing" with `NSValue`, `NSDictionary`, and `NSArray` objects when it encounters them. Numbers, booleans, strings, dictionaries, and arrays are encoded into their respective JSON types. There are plans to make the encoder more flexible so that it may accept arbitrary objects. Here is an example of how to use `FTJSONWriter`:
-
- NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithInt:2], @"id",
- @"Nathan", @"name",
- [NSNumber numberWithBOOL:YES], @"superuser",
- nil];
- FTJSONWriter *jsonWriter = [[[FTJSONWriter alloc] init] autorelease];
- [jsonWriter prepareWriter];
- [jsonWriter encodeObject:data error:NULL];
- NSLog(@"Encoded String:\n%@", [jsonWriter encodedString]);
-
-This will result in JSON like the following:
-
- {"id":2, "name":"Nathan", "superuser":true}
-
Contributors
------------
FTUtils was written by [Nathan Eror](http://www.neror.com/ "neror.com") ([@neror](http://twitter.com/neror)) for use in iPhone games built and distributed by [Free Time Studios](http://www.freetimestudios.com/ "Free Time Studios") ([@freetimestudios](http://twitter.com/freetimestudios)).
-FTUtils also makes use of some other open source libraries:
-
- * [yajl](http://lloyd.github.com/yajl/ "yajl") - from Lloyd Hilaiel
- * [Google Toolbox for Mac](http://code.google.com/p/google-toolbox-for-mac/) - from [Google
- ](http://www.google.com/)
-
License
-------
The MIT License
View
19 Support/yajl/BUILDING
@@ -1,19 +0,0 @@
-Short story (If you already have ruby and cmake):
-
-./configure && make install
-
-When things go wrong:
-
-attain CMake (http://www.cmake.org) and ruby (http://ruby-lang.org) and
-try again.
-
-OR, attain CMake and build by hand:
-
-1. mkdir build
-2. cd build
-3. cmake ..
-4. make
-5. build output left in yajl-X.Y.Z
-
-best,
-lloyd
View
13 Support/yajl/BUILDING.win32
@@ -1,13 +0,0 @@
-YAJL has been successfully built using Visual Studio 8. CMake is used to
-build the software and by specifying a generator explicitly at cmake:
-
-1. acquire cmake (http://www.cmake.org)
-2. mkdir build
-3. cd build
-4. cmake ..
-5. devenv YetAnotherJSONParser.sln
-6. build the ALL_BUILD target
-7. build output is left in build/yajl-X.Y.Z
-
-Earlier versions of visual studio have not been tested, but should
-work without any major issues.
View
82 Support/yajl/CMakeLists.txt
@@ -1,82 +0,0 @@
-# Copyright 2007-2009, Lloyd Hilaiel.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# 3. Neither the name of Lloyd Hilaiel nor the names of its
-# contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
-# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-
-PROJECT(YetAnotherJSONParser)
-
-SET (YAJL_MAJOR 1)
-SET (YAJL_MINOR 0)
-SET (YAJL_MICRO 6)
-
-SET (YAJL_DIST_NAME "yajl-${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO}")
-
-IF (NOT CMAKE_BUILD_TYPE)
- SET(CMAKE_BUILD_TYPE "Release")
-ENDIF (NOT CMAKE_BUILD_TYPE)
-
-SET(CMAKE_C_FLAGS "-Wall")
-IF (WIN32)
- SET(linkFlags "/PDB:NONE /INCREMENTAL:NO /OPT:NOREF /OPT:NOICF")
- SET(CMAKE_EXE_LINKER_FLAGS "${linkFlags}"
- CACHE STRING "YAJL linker flags" FORCE)
- SET(CMAKE_EXE_LINKER_FLAGS_DEBUG ""
- CACHE STRING "YAJL debug linker flags" FORCE)
- SET(CMAKE_EXE_LINKER_FLAGS_RELEASE
- CACHE STRING "YAJL release linker flags" FORCE)
- SET(CMAKE_SHARED_LINKER_FLAGS "${linkFlags}"
- CACHE STRING "YAJL shared linker flags" FORCE)
- SET(CMAKE_MODULE_LINKER_FLAGS "${linkFlags}"
- CACHE STRING "YAJL module linker flags" FORCE)
-
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4255 /wd4130 /wd4100 /wd4711")
- SET(CMAKE_C_FLAGS_DEBUG "/D DEBUG /Od /Z7")
- SET(CMAKE_C_FLAGS_RELEASE "/D NDEBUG /O2")
-ELSE (WIN32)
- SET(CMAKE_C_FLAGS
- "${CMAKE_C_FLAGS} -fPIC -ansi -pedantic -Wpointer-arith -Wno-format-y2k -Wstrict-prototypes -Wmissing-declarations -Wnested-externs -Wextra -Wundef -Wwrite-strings -Wold-style-definition -Wno-missing-field-initializers -Wredundant-decls -Wno-unused-parameter -Wno-sign-compare -Wmissing-prototypes")
-
- SET(CMAKE_C_FLAGS_DEBUG "-DDEBUG -g")
- SET(CMAKE_C_FLAGS_RELEASE "-DNDEBUG -O2 -Wuninitialized")
-ENDIF (WIN32)
-
-
-ADD_SUBDIRECTORY(src)
-ADD_SUBDIRECTORY(test)
-ADD_SUBDIRECTORY(reformatter)
-ADD_SUBDIRECTORY(verify)
-
-INCLUDE(YAJLDoc.cmake)
-
-# a test target
-ADD_CUSTOM_TARGET(test
- ./run_tests.sh
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
-
View
29 Support/yajl/COPYING
@@ -1,29 +0,0 @@
-Copyright 2007-2009, Lloyd Hilaiel.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. Neither the name of Lloyd Hilaiel nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
View
80 Support/yajl/ChangeLog
@@ -1,80 +0,0 @@
-1.0.5
- * lth several performance improvements related to function
- inlinin'
-
-1.0.4
- * lth fix broken utf8 validation for three & four byte represenations.
- thanks to http://github.com/brianmario and
- http://github.com/technoweenie
-
-1.0.3
- * lth fix syntax error in cplusplus extern "C" statements for wider
- compiler support
-
-1.0.2
- * lth update doxygen documentation with new sample code, passing NULL
- for allocation functions added in 1.0.0
-
-1.0.1
- * lth resolve crash in json_reformatter due to incorrectly ordered
- parameters.
-
-1.0.0
- * lth add 'make install' rules, thaks to Andrei Soroker for the
- contribution.
- * lth client may override allocation routines at generator or parser
- allocation time
- * tjw add yajl_parse_complete routine to allow client to explicitly
- specify end-of-input, solving the "lonely number" case, where
- json text consists only of an element with no explicit syntactic
- end.
- * tjw many new test cases
- * tjw cleanup of code for symmetry and ease of reading
- * lth integration of patches from Robert Varga which cleanup
- compilation warnings on 64 bit linux
-
-0.4.0
- * lth buffer overflow bug in yajl_gen_double s/%lf/%g/ - thanks to
- Eric Bergstrome
- * lth yajl_number callback to allow passthrough of arbitrary precision
- numbers to client. Thanks to Hatem Nassrat.
- * lth yajl_integer now deals in long, instead of long long. This
- combined with yajl_number improves compiler compatibility while
- maintaining precision.
- * lth better ./configure && make experience (still requires cmake and
- ruby)
- * lth fix handling of special characters hex 0F and 1F in yajl_encode
- (thanks to Robert Geiger)
- * lth allow leading zeros in exponents (thanks to Hatem Nassrat)
-
-0.3.0
- * lth doxygen documentation (html & man) generated as part of the
- build
- * lth many documentation updates.
- * lth fix to work with older versions of cmake (don't use LOOSE_LOOP
- constructs)
- * lth work around different behavior of freebsd 4 scanf. initialize
- parameter to scanf to zero.
- * lth all tests run 32x with ranging buffer sizes to stress stream
- parsing
- * lth yajl_test accepts -b option to allow read buffer size to be
- set
- * lth option to validate UTF8 added to parser (argument in
- yajl_parser_cfg)
- * lth fix buffer overrun when chunk ends inside \u escaped text
- * lth support client cancelation
-
-0.2.2
- * lth on windows build debug with C7 symbols and no pdb files.
-
-0.2.1
- * fix yajl_reformat and yajl_verify to work on arbitrarily sized
- inputs.
- * fix win32 build break, clean up all errors and warnings.
- * fix optimized build flags.
-
-0.2.0
- * optionally support comments in input text
-
-0.1.0
- * Initial release
View
25 Support/yajl/Makefile
@@ -1,25 +0,0 @@
-.PHONY: all clean distclean install package test distro
-all: distro doc test
-
-distro:
- @cd build && make
-
-doc:
- @cd build && make doc