appjam 0.1.8.8 → 0.1.8.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +22 -62
- data/lib/appjam/generators/gist.yml +1 -1
- data/lib/appjam/generators/templates/blank/EiffelApplication.xcodeproj/project.pbxproj +1166 -482
- data/lib/appjam/generators/templates/blank/EiffelApplication.xcodeproj/project.xcworkspace/xcuserdata/eiffel.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/EiffelApplication-Prefix.pch.tt +26 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenu.h +52 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenu.m +412 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenuItem.h +44 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/AwesomeMenuItem.m +97 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton-highlighted.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton-highlighted@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-addbutton@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem-highlighted.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem-highlighted@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/bg-menuitem@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus-highlighted.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus-highlighted@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-plus@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-star.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/AwesomeMenu/Images/icon-star@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/CMPopTipView/CMPopTipView.h +167 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/CMPopTipView/CMPopTipView.m +639 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/FXLabel/FXLabel.h +97 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/FXLabel/FXLabel.m +1080 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MBProgressHUD/MBProgressHUD.h +451 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/MBProgressHUD/MBProgressHUD.m +865 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FacingView.h +42 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FacingView.m +56 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FoldView.h +90 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/FoldView.m +316 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/MultiFoldView.h +104 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/MultiFoldView.m +516 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldConstants.h +49 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldNavigationController.h +18 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldNavigationController.m +88 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_left.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_left@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_right.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldResources.bundle/swipe_guide_right@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldSwipeHintView.h +25 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldSwipeHintView.m +76 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldView.h +131 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/PaperFoldView.m +941 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/Resources/swipe_guide.psd +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/Resources/swipe_guide2.psd +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/ShadowView.h +46 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/ShadowView.m +82 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/TouchThroughUIView.h +39 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/TouchThroughUIView.m +72 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/UIView+Screenshot.h +42 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/PaperFold/UIView+Screenshot.m +100 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/NSBubbleData.h +34 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/NSBubbleData.m +140 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleHeaderTableViewCell.h +17 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleHeaderTableViewCell.m +57 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableView.h +30 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableView.m +233 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableViewCell.h +19 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableViewCell.m +122 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTableViewDataSource.h +24 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTypingTableViewCell.h +20 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/UIBubbleTypingTableViewCell.m +56 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleMine.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleMine@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleSomeone.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/bubbleSomeone@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/missingAvatar.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/missingAvatar@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingMine.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingMine@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingSomeone.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIBubbleTableView/images/typingSomeone@2x.png +0 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIGlossyButton.h +124 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIGlossyButton.m +545 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIView+LayerEffects.h +22 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/components/UIGlossyButton/UIView+LayerEffects.m +32 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFIncrementalStore.h +344 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFIncrementalStore.m +848 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFRESTClient.h +135 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/AFIncrementalStore/AFRESTClient.m +441 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/NSString+InflectorKit.h +40 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/NSString+InflectorKit.m +36 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/TTTStringInflector.h +76 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/InflectorKit/TTTStringInflector.m +270 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/MKAnnotationView+WebCache.h +95 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/MKAnnotationView+WebCache.m +78 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDImageCache.h +144 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDImageCache.m +311 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageCompat.h +40 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageCompat.m +54 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDecoder.h +18 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDecoder.m +70 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloader.h +102 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloader.m +226 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloaderOperation.h +25 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageDownloaderOperation.m +339 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageManager.h +167 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageManager.m +244 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImageOperation.h +15 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImagePrefetcher.h +58 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/SDWebImagePrefetcher.m +127 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIButton+WebCache.h +173 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIButton+WebCache.m +129 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIImageView+WebCache.h +140 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/frameworks/SDWebImage/UIImageView+WebCache.m +84 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/CPAnimationProgram.h +28 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/CPAnimationSequence.h +28 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/CPAnimationStep.h +49 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/private/CPAnimationProgram.m +100 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/private/CPAnimationSequence.m +85 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CPAnimationSequence/private/CPAnimationStep.m +122 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaAsyncSocket/GCDAsyncSocket.h +1074 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaAsyncSocket/GCDAsyncSocket.m +7430 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDData.h +14 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDData.m +158 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDNumber.h +12 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDNumber.m +88 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDRange.h +56 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Categories/DDRange.m +104 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPAuthenticationRequest.h +45 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPAuthenticationRequest.m +195 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPConnection.h +119 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPConnection.m +2708 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPLogging.h +136 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPMessage.h +48 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPMessage.m +113 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPResponse.h +149 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPServer.h +205 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/HTTPServer.m +772 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.h +65 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartFormDataParser.m +529 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.h +33 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeader.m +86 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.h +23 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Mime/MultipartMessageHeaderField.m +211 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.h +75 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPAsyncFileResponse.m +405 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDataResponse.h +13 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDataResponse.m +79 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.h +52 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPDynamicFileResponse.m +292 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.h +9 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPErrorResponse.m +38 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPFileResponse.h +25 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPFileResponse.m +237 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.h +12 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/Responses/HTTPRedirectResponse.m +73 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/WebSocket.h +105 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Core/WebSocket.m +791 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.h +7 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVConnection.m +160 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.h +11 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DAVResponse.m +372 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.h +7 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/DELETEResponse.m +49 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.h +8 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/CocoaHTTPServer/Extensions/WebDAV/PUTResponse.m +69 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHpple.h +54 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHpple.m +102 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHppleElement.h +103 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHppleElement.m +200 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/XPathQuery.h +10 -0
- data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/XPathQuery.m +197 -0
- data/lib/appjam/version.rb +1 -1
- metadata +164 -3
@@ -0,0 +1,79 @@
|
|
1
|
+
#import "HTTPDataResponse.h"
|
2
|
+
#import "HTTPLogging.h"
|
3
|
+
|
4
|
+
#if ! __has_feature(objc_arc)
|
5
|
+
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
|
6
|
+
#endif
|
7
|
+
|
8
|
+
// Log levels : off, error, warn, info, verbose
|
9
|
+
// Other flags: trace
|
10
|
+
static const int httpLogLevel = HTTP_LOG_LEVEL_OFF; // | HTTP_LOG_FLAG_TRACE;
|
11
|
+
|
12
|
+
|
13
|
+
@implementation HTTPDataResponse
|
14
|
+
|
15
|
+
- (id)initWithData:(NSData *)dataParam
|
16
|
+
{
|
17
|
+
if((self = [super init]))
|
18
|
+
{
|
19
|
+
HTTPLogTrace();
|
20
|
+
|
21
|
+
offset = 0;
|
22
|
+
data = dataParam;
|
23
|
+
}
|
24
|
+
return self;
|
25
|
+
}
|
26
|
+
|
27
|
+
- (void)dealloc
|
28
|
+
{
|
29
|
+
HTTPLogTrace();
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
- (UInt64)contentLength
|
34
|
+
{
|
35
|
+
UInt64 result = (UInt64)[data length];
|
36
|
+
|
37
|
+
HTTPLogTrace2(@"%@[%p]: contentLength - %llu", THIS_FILE, self, result);
|
38
|
+
|
39
|
+
return result;
|
40
|
+
}
|
41
|
+
|
42
|
+
- (UInt64)offset
|
43
|
+
{
|
44
|
+
HTTPLogTrace();
|
45
|
+
|
46
|
+
return offset;
|
47
|
+
}
|
48
|
+
|
49
|
+
- (void)setOffset:(UInt64)offsetParam
|
50
|
+
{
|
51
|
+
HTTPLogTrace2(@"%@[%p]: setOffset:%lu", THIS_FILE, self, (unsigned long)offset);
|
52
|
+
|
53
|
+
offset = (NSUInteger)offsetParam;
|
54
|
+
}
|
55
|
+
|
56
|
+
- (NSData *)readDataOfLength:(NSUInteger)lengthParameter
|
57
|
+
{
|
58
|
+
HTTPLogTrace2(@"%@[%p]: readDataOfLength:%lu", THIS_FILE, self, (unsigned long)lengthParameter);
|
59
|
+
|
60
|
+
NSUInteger remaining = [data length] - offset;
|
61
|
+
NSUInteger length = lengthParameter < remaining ? lengthParameter : remaining;
|
62
|
+
|
63
|
+
void *bytes = (void *)([data bytes] + offset);
|
64
|
+
|
65
|
+
offset += length;
|
66
|
+
|
67
|
+
return [NSData dataWithBytesNoCopy:bytes length:length freeWhenDone:NO];
|
68
|
+
}
|
69
|
+
|
70
|
+
- (BOOL)isDone
|
71
|
+
{
|
72
|
+
BOOL result = (offset == [data length]);
|
73
|
+
|
74
|
+
HTTPLogTrace2(@"%@[%p]: isDone - %@", THIS_FILE, self, (result ? @"YES" : @"NO"));
|
75
|
+
|
76
|
+
return result;
|
77
|
+
}
|
78
|
+
|
79
|
+
@end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import "HTTPResponse.h"
|
3
|
+
#import "HTTPAsyncFileResponse.h"
|
4
|
+
|
5
|
+
/**
|
6
|
+
* This class is designed to assist with dynamic content.
|
7
|
+
* Imagine you have a file that you want to make dynamic:
|
8
|
+
*
|
9
|
+
* <html>
|
10
|
+
* <body>
|
11
|
+
* <h1>ComputerName Control Panel</h1>
|
12
|
+
* ...
|
13
|
+
* <li>System Time: SysTime</li>
|
14
|
+
* </body>
|
15
|
+
* </html>
|
16
|
+
*
|
17
|
+
* Now you could generate the entire file in Objective-C,
|
18
|
+
* but this would be a horribly tedious process.
|
19
|
+
* Beside, you want to design the file with professional tools to make it look pretty.
|
20
|
+
*
|
21
|
+
* So all you have to do is escape your dynamic content like this:
|
22
|
+
*
|
23
|
+
* ...
|
24
|
+
* <h1>%%ComputerName%% Control Panel</h1>
|
25
|
+
* ...
|
26
|
+
* <li>System Time: %%SysTime%%</li>
|
27
|
+
*
|
28
|
+
* And then you create an instance of this class with:
|
29
|
+
*
|
30
|
+
* - separator = @"%%"
|
31
|
+
* - replacementDictionary = { "ComputerName"="Black MacBook", "SysTime"="2010-04-30 03:18:24" }
|
32
|
+
*
|
33
|
+
* This class will then perform the replacements for you, on the fly, as it reads the file data.
|
34
|
+
* This class is also asynchronous, so it will perform the file IO using its own GCD queue.
|
35
|
+
*
|
36
|
+
* All keys for the replacementDictionary must be NSString's.
|
37
|
+
* Values for the replacementDictionary may be NSString's, or any object that
|
38
|
+
* returns what you want when its description method is invoked.
|
39
|
+
**/
|
40
|
+
|
41
|
+
@interface HTTPDynamicFileResponse : HTTPAsyncFileResponse
|
42
|
+
{
|
43
|
+
NSData *separator;
|
44
|
+
NSDictionary *replacementDict;
|
45
|
+
}
|
46
|
+
|
47
|
+
- (id)initWithFilePath:(NSString *)filePath
|
48
|
+
forConnection:(HTTPConnection *)connection
|
49
|
+
separator:(NSString *)separatorStr
|
50
|
+
replacementDictionary:(NSDictionary *)dictionary;
|
51
|
+
|
52
|
+
@end
|
@@ -0,0 +1,292 @@
|
|
1
|
+
#import "HTTPDynamicFileResponse.h"
|
2
|
+
#import "HTTPConnection.h"
|
3
|
+
#import "HTTPLogging.h"
|
4
|
+
|
5
|
+
#if ! __has_feature(objc_arc)
|
6
|
+
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
|
7
|
+
#endif
|
8
|
+
|
9
|
+
// Log levels : off, error, warn, info, verbose
|
10
|
+
// Other flags: trace
|
11
|
+
static const int httpLogLevel = HTTP_LOG_LEVEL_WARN; // | HTTP_LOG_FLAG_TRACE;
|
12
|
+
|
13
|
+
#define NULL_FD -1
|
14
|
+
|
15
|
+
|
16
|
+
@implementation HTTPDynamicFileResponse
|
17
|
+
|
18
|
+
- (id)initWithFilePath:(NSString *)fpath
|
19
|
+
forConnection:(HTTPConnection *)parent
|
20
|
+
separator:(NSString *)separatorStr
|
21
|
+
replacementDictionary:(NSDictionary *)dict
|
22
|
+
{
|
23
|
+
if ((self = [super initWithFilePath:fpath forConnection:parent]))
|
24
|
+
{
|
25
|
+
HTTPLogTrace();
|
26
|
+
|
27
|
+
separator = [separatorStr dataUsingEncoding:NSUTF8StringEncoding];
|
28
|
+
replacementDict = dict;
|
29
|
+
}
|
30
|
+
return self;
|
31
|
+
}
|
32
|
+
|
33
|
+
- (BOOL)isChunked
|
34
|
+
{
|
35
|
+
HTTPLogTrace();
|
36
|
+
|
37
|
+
return YES;
|
38
|
+
}
|
39
|
+
|
40
|
+
- (UInt64)contentLength
|
41
|
+
{
|
42
|
+
// This method shouldn't be called since we're using a chunked response.
|
43
|
+
// We override it just to be safe.
|
44
|
+
|
45
|
+
HTTPLogTrace();
|
46
|
+
|
47
|
+
return 0;
|
48
|
+
}
|
49
|
+
|
50
|
+
- (void)setOffset:(UInt64)offset
|
51
|
+
{
|
52
|
+
// This method shouldn't be called since we're using a chunked response.
|
53
|
+
// We override it just to be safe.
|
54
|
+
|
55
|
+
HTTPLogTrace();
|
56
|
+
}
|
57
|
+
|
58
|
+
- (BOOL)isDone
|
59
|
+
{
|
60
|
+
BOOL result = (readOffset == fileLength) && (readBufferOffset == 0);
|
61
|
+
|
62
|
+
HTTPLogTrace2(@"%@[%p]: isDone - %@", THIS_FILE, self, (result ? @"YES" : @"NO"));
|
63
|
+
|
64
|
+
return result;
|
65
|
+
}
|
66
|
+
|
67
|
+
- (void)processReadBuffer
|
68
|
+
{
|
69
|
+
HTTPLogTrace();
|
70
|
+
|
71
|
+
// At this point, the readBuffer has readBufferOffset bytes available.
|
72
|
+
// This method is in charge of updating the readBufferOffset.
|
73
|
+
|
74
|
+
NSUInteger bufLen = readBufferOffset;
|
75
|
+
NSUInteger sepLen = [separator length];
|
76
|
+
|
77
|
+
// We're going to start looking for the separator at the beginning of the buffer,
|
78
|
+
// and stop when we get to the point where the separator would no longer fit in the buffer.
|
79
|
+
|
80
|
+
NSUInteger offset = 0;
|
81
|
+
NSUInteger stopOffset = (bufLen > sepLen) ? bufLen - sepLen + 1 : 0;
|
82
|
+
|
83
|
+
// In order to do the replacement, we need to find the starting and ending separator.
|
84
|
+
// For example:
|
85
|
+
//
|
86
|
+
// %%USER_NAME%%
|
87
|
+
//
|
88
|
+
// Where "%%" is the separator.
|
89
|
+
|
90
|
+
BOOL found1 = NO;
|
91
|
+
BOOL found2 = NO;
|
92
|
+
|
93
|
+
NSUInteger s1 = 0;
|
94
|
+
NSUInteger s2 = 0;
|
95
|
+
|
96
|
+
const void *sep = [separator bytes];
|
97
|
+
|
98
|
+
while (offset < stopOffset)
|
99
|
+
{
|
100
|
+
const void *subBuffer = readBuffer + offset;
|
101
|
+
|
102
|
+
if (memcmp(subBuffer, sep, sepLen) == 0)
|
103
|
+
{
|
104
|
+
if (!found1)
|
105
|
+
{
|
106
|
+
// Found the first separator
|
107
|
+
|
108
|
+
found1 = YES;
|
109
|
+
s1 = offset;
|
110
|
+
offset += sepLen;
|
111
|
+
|
112
|
+
HTTPLogVerbose(@"%@[%p]: Found s1 at %lu", THIS_FILE, self, (unsigned long)s1);
|
113
|
+
}
|
114
|
+
else
|
115
|
+
{
|
116
|
+
// Found the second separator
|
117
|
+
|
118
|
+
found2 = YES;
|
119
|
+
s2 = offset;
|
120
|
+
offset += sepLen;
|
121
|
+
|
122
|
+
HTTPLogVerbose(@"%@[%p]: Found s2 at %lu", THIS_FILE, self, (unsigned long)s2);
|
123
|
+
}
|
124
|
+
|
125
|
+
if (found1 && found2)
|
126
|
+
{
|
127
|
+
// We found our separators.
|
128
|
+
// Now extract the string between the two separators.
|
129
|
+
|
130
|
+
NSRange fullRange = NSMakeRange(s1, (s2 - s1 + sepLen));
|
131
|
+
NSRange strRange = NSMakeRange(s1 + sepLen, (s2 - s1 - sepLen));
|
132
|
+
|
133
|
+
// Wish we could use the simple subdataWithRange method.
|
134
|
+
// But that method copies the bytes...
|
135
|
+
// So for performance reasons, we need to use the methods that don't copy the bytes.
|
136
|
+
|
137
|
+
void *strBuf = readBuffer + strRange.location;
|
138
|
+
NSUInteger strLen = strRange.length;
|
139
|
+
|
140
|
+
NSString *key = [[NSString alloc] initWithBytes:strBuf length:strLen encoding:NSUTF8StringEncoding];
|
141
|
+
if (key)
|
142
|
+
{
|
143
|
+
// Is there a given replacement for this key?
|
144
|
+
|
145
|
+
id value = [replacementDict objectForKey:key];
|
146
|
+
if (value)
|
147
|
+
{
|
148
|
+
// Found the replacement value.
|
149
|
+
// Now perform the replacement in the buffer.
|
150
|
+
|
151
|
+
HTTPLogVerbose(@"%@[%p]: key(%@) -> value(%@)", THIS_FILE, self, key, value);
|
152
|
+
|
153
|
+
NSData *v = [[value description] dataUsingEncoding:NSUTF8StringEncoding];
|
154
|
+
NSUInteger vLength = [v length];
|
155
|
+
|
156
|
+
if (fullRange.length == vLength)
|
157
|
+
{
|
158
|
+
// Replacement is exactly the same size as what it is replacing
|
159
|
+
|
160
|
+
// memcpy(void *restrict dst, const void *restrict src, size_t n);
|
161
|
+
|
162
|
+
memcpy(readBuffer + fullRange.location, [v bytes], vLength);
|
163
|
+
}
|
164
|
+
else // (fullRange.length != vLength)
|
165
|
+
{
|
166
|
+
NSInteger diff = (NSInteger)vLength - (NSInteger)fullRange.length;
|
167
|
+
|
168
|
+
if (diff > 0)
|
169
|
+
{
|
170
|
+
// Replacement is bigger than what it is replacing.
|
171
|
+
// Make sure there is room in the buffer for the replacement.
|
172
|
+
|
173
|
+
if (diff > (readBufferSize - bufLen))
|
174
|
+
{
|
175
|
+
NSUInteger inc = MAX(diff, 256);
|
176
|
+
|
177
|
+
readBufferSize += inc;
|
178
|
+
readBuffer = reallocf(readBuffer, readBufferSize);
|
179
|
+
}
|
180
|
+
}
|
181
|
+
|
182
|
+
// Move the data that comes after the replacement.
|
183
|
+
//
|
184
|
+
// If replacement is smaller than what it is replacing,
|
185
|
+
// then we are shifting the data toward the beginning of the buffer.
|
186
|
+
//
|
187
|
+
// If replacement is bigger than what it is replacing,
|
188
|
+
// then we are shifting the data toward the end of the buffer.
|
189
|
+
//
|
190
|
+
// memmove(void *dst, const void *src, size_t n);
|
191
|
+
//
|
192
|
+
// The memmove() function copies n bytes from src to dst.
|
193
|
+
// The two areas may overlap; the copy is always done in a non-destructive manner.
|
194
|
+
|
195
|
+
void *src = readBuffer + fullRange.location + fullRange.length;
|
196
|
+
void *dst = readBuffer + fullRange.location + vLength;
|
197
|
+
|
198
|
+
NSUInteger remaining = bufLen - (fullRange.location + fullRange.length);
|
199
|
+
|
200
|
+
memmove(dst, src, remaining);
|
201
|
+
|
202
|
+
// Now copy the replacement into its location.
|
203
|
+
//
|
204
|
+
// memcpy(void *restrict dst, const void *restrict src, size_t n)
|
205
|
+
//
|
206
|
+
// The memcpy() function copies n bytes from src to dst.
|
207
|
+
// If the two areas overlap, behavior is undefined.
|
208
|
+
|
209
|
+
memcpy(readBuffer + fullRange.location, [v bytes], vLength);
|
210
|
+
|
211
|
+
// And don't forget to update our indices.
|
212
|
+
|
213
|
+
bufLen += diff;
|
214
|
+
offset += diff;
|
215
|
+
stopOffset += diff;
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
found1 = found2 = NO;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
else
|
225
|
+
{
|
226
|
+
offset++;
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
// We've gone through our buffer now, and performed all the replacements that we could.
|
231
|
+
// It's now time to update the amount of available data we have.
|
232
|
+
|
233
|
+
if (readOffset == fileLength)
|
234
|
+
{
|
235
|
+
// We've read in the entire file.
|
236
|
+
// So there can be no more replacements.
|
237
|
+
|
238
|
+
data = [[NSData alloc] initWithBytes:readBuffer length:bufLen];
|
239
|
+
readBufferOffset = 0;
|
240
|
+
}
|
241
|
+
else
|
242
|
+
{
|
243
|
+
// There are a couple different situations that we need to take into account here.
|
244
|
+
//
|
245
|
+
// Imagine the following file:
|
246
|
+
// My name is %%USER_NAME%%
|
247
|
+
//
|
248
|
+
// Situation 1:
|
249
|
+
// The first chunk of data we read was "My name is %%".
|
250
|
+
// So we found the first separator, but not the second.
|
251
|
+
// In this case we can only return the data that precedes the first separator.
|
252
|
+
//
|
253
|
+
// Situation 2:
|
254
|
+
// The first chunk of data we read was "My name is %".
|
255
|
+
// So we didn't find any separators, but part of a separator may be included in our buffer.
|
256
|
+
|
257
|
+
NSUInteger available;
|
258
|
+
if (found1)
|
259
|
+
{
|
260
|
+
// Situation 1
|
261
|
+
available = s1;
|
262
|
+
}
|
263
|
+
else
|
264
|
+
{
|
265
|
+
// Situation 2
|
266
|
+
available = stopOffset;
|
267
|
+
}
|
268
|
+
|
269
|
+
// Copy available data
|
270
|
+
|
271
|
+
data = [[NSData alloc] initWithBytes:readBuffer length:available];
|
272
|
+
|
273
|
+
// Remove the copied data from the buffer.
|
274
|
+
// We do this by shifting the remaining data toward the beginning of the buffer.
|
275
|
+
|
276
|
+
NSUInteger remaining = bufLen - available;
|
277
|
+
|
278
|
+
memmove(readBuffer, readBuffer + available, remaining);
|
279
|
+
readBufferOffset = remaining;
|
280
|
+
}
|
281
|
+
|
282
|
+
[connection responseHasAvailableData:self];
|
283
|
+
}
|
284
|
+
|
285
|
+
- (void)dealloc
|
286
|
+
{
|
287
|
+
HTTPLogTrace();
|
288
|
+
|
289
|
+
|
290
|
+
}
|
291
|
+
|
292
|
+
@end
|