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,49 @@
|
|
1
|
+
#import "DELETEResponse.h"
|
2
|
+
#import "HTTPLogging.h"
|
3
|
+
|
4
|
+
// HTTP methods: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
|
5
|
+
// HTTP headers: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
|
6
|
+
// HTTP status codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
7
|
+
|
8
|
+
static const int httpLogLevel = HTTP_LOG_LEVEL_WARN;
|
9
|
+
|
10
|
+
@implementation DELETEResponse
|
11
|
+
|
12
|
+
- (id) initWithFilePath:(NSString*)path {
|
13
|
+
if ((self = [super init])) {
|
14
|
+
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:path];
|
15
|
+
if ([[NSFileManager defaultManager] removeItemAtPath:path error:NULL]) {
|
16
|
+
_status = exists ? 200 : 204;
|
17
|
+
} else {
|
18
|
+
HTTPLogError(@"Failed deleting \"%@\"", path);
|
19
|
+
_status = 404;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
return self;
|
23
|
+
}
|
24
|
+
|
25
|
+
- (UInt64) contentLength {
|
26
|
+
return 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
- (UInt64) offset {
|
30
|
+
return 0;
|
31
|
+
}
|
32
|
+
|
33
|
+
- (void)setOffset:(UInt64)offset {
|
34
|
+
;
|
35
|
+
}
|
36
|
+
|
37
|
+
- (NSData*) readDataOfLength:(NSUInteger)length {
|
38
|
+
return nil;
|
39
|
+
}
|
40
|
+
|
41
|
+
- (BOOL) isDone {
|
42
|
+
return YES;
|
43
|
+
}
|
44
|
+
|
45
|
+
- (NSInteger) status {
|
46
|
+
return _status;
|
47
|
+
}
|
48
|
+
|
49
|
+
@end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
#import "HTTPResponse.h"
|
2
|
+
|
3
|
+
@interface PUTResponse : NSObject <HTTPResponse> {
|
4
|
+
NSInteger _status;
|
5
|
+
}
|
6
|
+
- (id) initWithFilePath:(NSString*)path headers:(NSDictionary*)headers bodyData:(NSData*)body;
|
7
|
+
- (id) initWithFilePath:(NSString*)path headers:(NSDictionary*)headers bodyFile:(NSString*)body;
|
8
|
+
@end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
#import "PUTResponse.h"
|
2
|
+
#import "HTTPLogging.h"
|
3
|
+
|
4
|
+
// HTTP methods: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
|
5
|
+
// HTTP headers: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
|
6
|
+
// HTTP status codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
|
7
|
+
|
8
|
+
static const int httpLogLevel = HTTP_LOG_LEVEL_WARN;
|
9
|
+
|
10
|
+
@implementation PUTResponse
|
11
|
+
|
12
|
+
- (id) initWithFilePath:(NSString*)path headers:(NSDictionary*)headers body:(id)body {
|
13
|
+
if ((self = [super init])) {
|
14
|
+
if ([headers objectForKey:@"Content-Range"]) {
|
15
|
+
HTTPLogError(@"Content-Range not supported for upload to \"%@\"", path);
|
16
|
+
_status = 400;
|
17
|
+
} else {
|
18
|
+
BOOL overwrite = [[NSFileManager defaultManager] fileExistsAtPath:path];
|
19
|
+
BOOL success;
|
20
|
+
if ([body isKindOfClass:[NSString class]]) {
|
21
|
+
[[NSFileManager defaultManager] removeItemAtPath:path error:NULL];
|
22
|
+
success = [[NSFileManager defaultManager] moveItemAtPath:body toPath:path error:NULL];
|
23
|
+
} else {
|
24
|
+
success = [body writeToFile:path atomically:YES];
|
25
|
+
}
|
26
|
+
if (success) {
|
27
|
+
_status = overwrite ? 200 : 201;
|
28
|
+
} else {
|
29
|
+
HTTPLogError(@"Failed writing upload to \"%@\"", path);
|
30
|
+
_status = 403;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
return self;
|
35
|
+
}
|
36
|
+
|
37
|
+
- (id) initWithFilePath:(NSString*)path headers:(NSDictionary*)headers bodyData:(NSData*)body {
|
38
|
+
return [self initWithFilePath:path headers:headers body:body];
|
39
|
+
}
|
40
|
+
|
41
|
+
- (id) initWithFilePath:(NSString*)path headers:(NSDictionary*)headers bodyFile:(NSString*)body {
|
42
|
+
return [self initWithFilePath:path headers:headers body:body];
|
43
|
+
}
|
44
|
+
|
45
|
+
- (UInt64) contentLength {
|
46
|
+
return 0;
|
47
|
+
}
|
48
|
+
|
49
|
+
- (UInt64) offset {
|
50
|
+
return 0;
|
51
|
+
}
|
52
|
+
|
53
|
+
- (void) setOffset:(UInt64)offset {
|
54
|
+
;
|
55
|
+
}
|
56
|
+
|
57
|
+
- (NSData*) readDataOfLength:(NSUInteger)length {
|
58
|
+
return nil;
|
59
|
+
}
|
60
|
+
|
61
|
+
- (BOOL) isDone {
|
62
|
+
return YES;
|
63
|
+
}
|
64
|
+
|
65
|
+
- (NSInteger) status {
|
66
|
+
return _status;
|
67
|
+
}
|
68
|
+
|
69
|
+
@end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
//
|
2
|
+
// TFHpple.h
|
3
|
+
// Hpple
|
4
|
+
//
|
5
|
+
// Created by Geoffrey Grosenbach on 1/31/09.
|
6
|
+
//
|
7
|
+
// Copyright (c) 2009 Topfunky Corporation, http://topfunky.com
|
8
|
+
//
|
9
|
+
// MIT LICENSE
|
10
|
+
//
|
11
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
12
|
+
// a copy of this software and associated documentation files (the
|
13
|
+
// "Software"), to deal in the Software without restriction, including
|
14
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
15
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
16
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
17
|
+
// the following conditions:
|
18
|
+
//
|
19
|
+
// The above copyright notice and this permission notice shall be
|
20
|
+
// included in all copies or substantial portions of the Software.
|
21
|
+
//
|
22
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
23
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
24
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
25
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
26
|
+
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
27
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
28
|
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
29
|
+
|
30
|
+
|
31
|
+
#import <Foundation/Foundation.h>
|
32
|
+
|
33
|
+
#import "TFHppleElement.h"
|
34
|
+
|
35
|
+
@interface TFHpple : NSObject {
|
36
|
+
@private
|
37
|
+
NSData * data;
|
38
|
+
BOOL isXML;
|
39
|
+
}
|
40
|
+
|
41
|
+
- (id) initWithData:(NSData *)theData isXML:(BOOL)isDataXML;
|
42
|
+
- (id) initWithXMLData:(NSData *)theData;
|
43
|
+
- (id) initWithHTMLData:(NSData *)theData;
|
44
|
+
|
45
|
+
+ (TFHpple *) hppleWithData:(NSData *)theData isXML:(BOOL)isDataXML;
|
46
|
+
+ (TFHpple *) hppleWithXMLData:(NSData *)theData;
|
47
|
+
+ (TFHpple *) hppleWithHTMLData:(NSData *)theData;
|
48
|
+
|
49
|
+
- (NSArray *) searchWithXPathQuery:(NSString *)xPathOrCSS;
|
50
|
+
- (TFHppleElement *) peekAtSearchWithXPathQuery:(NSString *)xPathOrCSS;
|
51
|
+
|
52
|
+
@property (nonatomic, strong, readonly) NSData * data;
|
53
|
+
|
54
|
+
@end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
//
|
2
|
+
// TFHpple.m
|
3
|
+
// Hpple
|
4
|
+
//
|
5
|
+
// Created by Geoffrey Grosenbach on 1/31/09.
|
6
|
+
//
|
7
|
+
// Copyright (c) 2009 Topfunky Corporation, http://topfunky.com
|
8
|
+
//
|
9
|
+
// MIT LICENSE
|
10
|
+
//
|
11
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
12
|
+
// a copy of this software and associated documentation files (the
|
13
|
+
// "Software"), to deal in the Software without restriction, including
|
14
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
15
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
16
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
17
|
+
// the following conditions:
|
18
|
+
//
|
19
|
+
// The above copyright notice and this permission notice shall be
|
20
|
+
// included in all copies or substantial portions of the Software.
|
21
|
+
//
|
22
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
23
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
24
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
25
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
26
|
+
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
27
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
28
|
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
29
|
+
|
30
|
+
#import "TFHpple.h"
|
31
|
+
#import "XPathQuery.h"
|
32
|
+
|
33
|
+
@implementation TFHpple
|
34
|
+
|
35
|
+
@synthesize data;
|
36
|
+
|
37
|
+
|
38
|
+
- (id) initWithData:(NSData *)theData isXML:(BOOL)isDataXML
|
39
|
+
{
|
40
|
+
if (!(self = [super init])) {
|
41
|
+
return nil;
|
42
|
+
}
|
43
|
+
|
44
|
+
data = theData;
|
45
|
+
isXML = isDataXML;
|
46
|
+
|
47
|
+
return self;
|
48
|
+
}
|
49
|
+
|
50
|
+
- (id) initWithXMLData:(NSData *)theData
|
51
|
+
{
|
52
|
+
return [self initWithData:theData isXML:YES];
|
53
|
+
}
|
54
|
+
|
55
|
+
- (id) initWithHTMLData:(NSData *)theData
|
56
|
+
{
|
57
|
+
return [self initWithData:theData isXML:NO];
|
58
|
+
}
|
59
|
+
|
60
|
+
+ (TFHpple *) hppleWithData:(NSData *)theData isXML:(BOOL)isDataXML {
|
61
|
+
return [[[self class] alloc] initWithData:theData isXML:isDataXML];
|
62
|
+
}
|
63
|
+
|
64
|
+
+ (TFHpple *) hppleWithHTMLData:(NSData *)theData {
|
65
|
+
return [[self class] hppleWithData:theData isXML:NO];
|
66
|
+
}
|
67
|
+
|
68
|
+
+ (TFHpple *) hppleWithXMLData:(NSData *)theData {
|
69
|
+
return [[self class] hppleWithData:theData isXML:YES];
|
70
|
+
}
|
71
|
+
|
72
|
+
#pragma mark -
|
73
|
+
|
74
|
+
// Returns all elements at xPath.
|
75
|
+
- (NSArray *) searchWithXPathQuery:(NSString *)xPathOrCSS
|
76
|
+
{
|
77
|
+
NSArray * detailNodes = nil;
|
78
|
+
if (isXML) {
|
79
|
+
detailNodes = PerformXMLXPathQuery(data, xPathOrCSS);
|
80
|
+
} else {
|
81
|
+
detailNodes = PerformHTMLXPathQuery(data, xPathOrCSS);
|
82
|
+
}
|
83
|
+
|
84
|
+
NSMutableArray * hppleElements = [NSMutableArray array];
|
85
|
+
for (id node in detailNodes) {
|
86
|
+
[hppleElements addObject:[TFHppleElement hppleElementWithNode:node]];
|
87
|
+
}
|
88
|
+
return hppleElements;
|
89
|
+
}
|
90
|
+
|
91
|
+
// Returns first element at xPath
|
92
|
+
- (TFHppleElement *) peekAtSearchWithXPathQuery:(NSString *)xPathOrCSS
|
93
|
+
{
|
94
|
+
NSArray * elements = [self searchWithXPathQuery:xPathOrCSS];
|
95
|
+
if ([elements count] >= 1) {
|
96
|
+
return [elements objectAtIndex:0];
|
97
|
+
}
|
98
|
+
|
99
|
+
return nil;
|
100
|
+
}
|
101
|
+
|
102
|
+
@end
|
data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHppleElement.h
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
//
|
2
|
+
// TFHppleElement.h
|
3
|
+
// Hpple
|
4
|
+
//
|
5
|
+
// Created by Geoffrey Grosenbach on 1/31/09.
|
6
|
+
//
|
7
|
+
// Copyright (c) 2009 Topfunky Corporation, http://topfunky.com
|
8
|
+
//
|
9
|
+
// MIT LICENSE
|
10
|
+
//
|
11
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
12
|
+
// a copy of this software and associated documentation files (the
|
13
|
+
// "Software"), to deal in the Software without restriction, including
|
14
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
15
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
16
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
17
|
+
// the following conditions:
|
18
|
+
//
|
19
|
+
// The above copyright notice and this permission notice shall be
|
20
|
+
// included in all copies or substantial portions of the Software.
|
21
|
+
//
|
22
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
23
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
24
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
25
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
26
|
+
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
27
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
28
|
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
29
|
+
|
30
|
+
#import <Foundation/Foundation.h>
|
31
|
+
|
32
|
+
|
33
|
+
@interface TFHppleElement : NSObject {
|
34
|
+
@private
|
35
|
+
|
36
|
+
NSDictionary * node;
|
37
|
+
__unsafe_unretained TFHppleElement *parent;
|
38
|
+
}
|
39
|
+
|
40
|
+
- (id) initWithNode:(NSDictionary *) theNode;
|
41
|
+
|
42
|
+
+ (TFHppleElement *) hppleElementWithNode:(NSDictionary *) theNode;
|
43
|
+
|
44
|
+
// Returns this tag's innerHTML content.
|
45
|
+
@property (nonatomic, copy, readonly) NSString *content;
|
46
|
+
|
47
|
+
// Returns the name of the current tag, such as "h3".
|
48
|
+
@property (nonatomic, copy, readonly) NSString *tagName;
|
49
|
+
|
50
|
+
// Returns tag attributes with name as key and content as value.
|
51
|
+
// href = 'http://peepcode.com'
|
52
|
+
// class = 'highlight'
|
53
|
+
@property (nonatomic, strong, readonly) NSDictionary *attributes;
|
54
|
+
|
55
|
+
// Returns the children of a given node
|
56
|
+
@property (nonatomic, strong, readonly) NSArray *children;
|
57
|
+
|
58
|
+
// Returns the first child of a given node
|
59
|
+
@property (nonatomic, strong, readonly) TFHppleElement *firstChild;
|
60
|
+
|
61
|
+
// the parent of a node
|
62
|
+
@property (nonatomic, unsafe_unretained, readonly) TFHppleElement *parent;
|
63
|
+
|
64
|
+
// Returns YES if the node has any child
|
65
|
+
// This is more efficient than using the children property since no NSArray is constructed
|
66
|
+
- (BOOL)hasChildren;
|
67
|
+
|
68
|
+
// Returns YES if this is a text node
|
69
|
+
- (BOOL)isTextNode;
|
70
|
+
|
71
|
+
// Provides easy access to the content of a specific attribute,
|
72
|
+
// such as 'href' or 'class'.
|
73
|
+
- (NSString *) objectForKey:(NSString *) theKey;
|
74
|
+
|
75
|
+
// Returns the children whose tag name equals the given string
|
76
|
+
// (comparison is performed with NSString's isEqualToString)
|
77
|
+
// Returns an empty array if no matching child is found
|
78
|
+
- (NSArray *) childrenWithTagName:(NSString *)tagName;
|
79
|
+
|
80
|
+
// Returns the first child node whose tag name equals the given string
|
81
|
+
// (comparison is performed with NSString's isEqualToString)
|
82
|
+
// Returns nil if no matching child is found
|
83
|
+
- (TFHppleElement *) firstChildWithTagName:(NSString *)tagName;
|
84
|
+
|
85
|
+
// Returns the children whose class equals the given string
|
86
|
+
// (comparison is performed with NSString's isEqualToString)
|
87
|
+
// Returns an empty array if no matching child is found
|
88
|
+
- (NSArray *) childrenWithClassName:(NSString *)className;
|
89
|
+
|
90
|
+
// Returns the first child whose class requals the given string
|
91
|
+
// (comparison is performed with NSString's isEqualToString)
|
92
|
+
// Returns nil if no matching child is found
|
93
|
+
- (TFHppleElement *) firstChildWithClassName:(NSString*)className;
|
94
|
+
|
95
|
+
// Returns the first text node from this element's children
|
96
|
+
// Returns nil if there is no text node among the children
|
97
|
+
- (TFHppleElement *) firstTextChild;
|
98
|
+
|
99
|
+
// Returns the string contained by the first text node from this element's children
|
100
|
+
// Convenience method which can be used instead of firstTextChild.content
|
101
|
+
- (NSString *) text;
|
102
|
+
|
103
|
+
@end
|
data/lib/appjam/generators/templates/blank/EiffelApplication/libs/toolkit/hpple/TFHppleElement.m
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
//
|
2
|
+
// TFHppleElement.m
|
3
|
+
// Hpple
|
4
|
+
//
|
5
|
+
// Created by Geoffrey Grosenbach on 1/31/09.
|
6
|
+
//
|
7
|
+
// Copyright (c) 2009 Topfunky Corporation, http://topfunky.com
|
8
|
+
//
|
9
|
+
// MIT LICENSE
|
10
|
+
//
|
11
|
+
// Permission is hereby granted, free of charge, to any person obtaining
|
12
|
+
// a copy of this software and associated documentation files (the
|
13
|
+
// "Software"), to deal in the Software without restriction, including
|
14
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
15
|
+
// distribute, sublicense, and/or sell copies of the Software, and to
|
16
|
+
// permit persons to whom the Software is furnished to do so, subject to
|
17
|
+
// the following conditions:
|
18
|
+
//
|
19
|
+
// The above copyright notice and this permission notice shall be
|
20
|
+
// included in all copies or substantial portions of the Software.
|
21
|
+
//
|
22
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
23
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
24
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
25
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
26
|
+
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
27
|
+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
28
|
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
29
|
+
|
30
|
+
|
31
|
+
#import "TFHppleElement.h"
|
32
|
+
|
33
|
+
static NSString * const TFHppleNodeContentKey = @"nodeContent";
|
34
|
+
static NSString * const TFHppleNodeNameKey = @"nodeName";
|
35
|
+
static NSString * const TFHppleNodeChildrenKey = @"nodeChildArray";
|
36
|
+
static NSString * const TFHppleNodeAttributeArrayKey = @"nodeAttributeArray";
|
37
|
+
static NSString * const TFHppleNodeAttributeNameKey = @"attributeName";
|
38
|
+
|
39
|
+
static NSString * const TFHppleTextNodeName = @"text";
|
40
|
+
|
41
|
+
@interface TFHppleElement ()
|
42
|
+
@property (nonatomic, unsafe_unretained, readwrite) TFHppleElement *parent;
|
43
|
+
@end
|
44
|
+
|
45
|
+
@implementation TFHppleElement
|
46
|
+
@synthesize parent;
|
47
|
+
|
48
|
+
|
49
|
+
- (id) initWithNode:(NSDictionary *) theNode
|
50
|
+
{
|
51
|
+
if (!(self = [super init]))
|
52
|
+
return nil;
|
53
|
+
|
54
|
+
node = theNode;
|
55
|
+
|
56
|
+
return self;
|
57
|
+
}
|
58
|
+
|
59
|
+
+ (TFHppleElement *) hppleElementWithNode:(NSDictionary *) theNode {
|
60
|
+
return [[[self class] alloc] initWithNode:theNode];
|
61
|
+
}
|
62
|
+
|
63
|
+
#pragma mark -
|
64
|
+
|
65
|
+
- (NSString *) content
|
66
|
+
{
|
67
|
+
return [node objectForKey:TFHppleNodeContentKey];
|
68
|
+
}
|
69
|
+
|
70
|
+
|
71
|
+
- (NSString *) tagName
|
72
|
+
{
|
73
|
+
return [node objectForKey:TFHppleNodeNameKey];
|
74
|
+
}
|
75
|
+
|
76
|
+
- (NSArray *) children
|
77
|
+
{
|
78
|
+
NSMutableArray *children = [NSMutableArray array];
|
79
|
+
for (NSDictionary *child in [node objectForKey:TFHppleNodeChildrenKey]) {
|
80
|
+
TFHppleElement *element = [TFHppleElement hppleElementWithNode:child];
|
81
|
+
element.parent = self;
|
82
|
+
[children addObject:element];
|
83
|
+
}
|
84
|
+
return children;
|
85
|
+
}
|
86
|
+
|
87
|
+
- (TFHppleElement *) firstChild
|
88
|
+
{
|
89
|
+
NSArray * children = self.children;
|
90
|
+
if (children.count)
|
91
|
+
return [children objectAtIndex:0];
|
92
|
+
return nil;
|
93
|
+
}
|
94
|
+
|
95
|
+
|
96
|
+
- (NSDictionary *) attributes
|
97
|
+
{
|
98
|
+
NSMutableDictionary * translatedAttributes = [NSMutableDictionary dictionary];
|
99
|
+
for (NSDictionary * attributeDict in [node objectForKey:TFHppleNodeAttributeArrayKey]) {
|
100
|
+
if ([attributeDict objectForKey:TFHppleNodeContentKey] && [attributeDict objectForKey:TFHppleNodeAttributeNameKey]) {
|
101
|
+
[translatedAttributes setObject:[attributeDict objectForKey:TFHppleNodeContentKey]
|
102
|
+
forKey:[attributeDict objectForKey:TFHppleNodeAttributeNameKey]];
|
103
|
+
}
|
104
|
+
}
|
105
|
+
return translatedAttributes;
|
106
|
+
}
|
107
|
+
|
108
|
+
- (NSString *) objectForKey:(NSString *) theKey
|
109
|
+
{
|
110
|
+
return [[self attributes] objectForKey:theKey];
|
111
|
+
}
|
112
|
+
|
113
|
+
- (id) description
|
114
|
+
{
|
115
|
+
return [node description];
|
116
|
+
}
|
117
|
+
|
118
|
+
- (BOOL)hasChildren
|
119
|
+
{
|
120
|
+
if ([node objectForKey:TFHppleNodeChildrenKey])
|
121
|
+
return YES;
|
122
|
+
else
|
123
|
+
return NO;
|
124
|
+
}
|
125
|
+
|
126
|
+
- (BOOL)isTextNode
|
127
|
+
{
|
128
|
+
// we must distinguish between real text nodes and standard nodes with tha name "text" (<text>)
|
129
|
+
// real text nodes must have content
|
130
|
+
if ([self.tagName isEqualToString:TFHppleTextNodeName] && (self.content))
|
131
|
+
return YES;
|
132
|
+
else
|
133
|
+
return NO;
|
134
|
+
}
|
135
|
+
|
136
|
+
- (NSArray*) childrenWithTagName:(NSString*)tagName
|
137
|
+
{
|
138
|
+
NSMutableArray* matches = [NSMutableArray array];
|
139
|
+
|
140
|
+
for (TFHppleElement* child in self.children)
|
141
|
+
{
|
142
|
+
if ([child.tagName isEqualToString:tagName])
|
143
|
+
[matches addObject:child];
|
144
|
+
}
|
145
|
+
|
146
|
+
return matches;
|
147
|
+
}
|
148
|
+
|
149
|
+
- (TFHppleElement *) firstChildWithTagName:(NSString*)tagName
|
150
|
+
{
|
151
|
+
for (TFHppleElement* child in self.children)
|
152
|
+
{
|
153
|
+
if ([child.tagName isEqualToString:tagName])
|
154
|
+
return child;
|
155
|
+
}
|
156
|
+
|
157
|
+
return nil;
|
158
|
+
}
|
159
|
+
|
160
|
+
- (NSArray*) childrenWithClassName:(NSString*)className
|
161
|
+
{
|
162
|
+
NSMutableArray* matches = [NSMutableArray array];
|
163
|
+
|
164
|
+
for (TFHppleElement* child in self.children)
|
165
|
+
{
|
166
|
+
if ([[child objectForKey:@"class"] isEqualToString:className])
|
167
|
+
[matches addObject:child];
|
168
|
+
}
|
169
|
+
|
170
|
+
return matches;
|
171
|
+
}
|
172
|
+
|
173
|
+
- (TFHppleElement *) firstChildWithClassName:(NSString*)className
|
174
|
+
{
|
175
|
+
for (TFHppleElement* child in self.children)
|
176
|
+
{
|
177
|
+
if ([[child objectForKey:@"class"] isEqualToString:className])
|
178
|
+
return child;
|
179
|
+
}
|
180
|
+
|
181
|
+
return nil;
|
182
|
+
}
|
183
|
+
|
184
|
+
- (TFHppleElement *) firstTextChild;
|
185
|
+
{
|
186
|
+
for (TFHppleElement* child in self.children)
|
187
|
+
{
|
188
|
+
if ([child isTextNode])
|
189
|
+
return child;
|
190
|
+
}
|
191
|
+
|
192
|
+
return [self firstChildWithTagName:TFHppleTextNodeName];
|
193
|
+
}
|
194
|
+
|
195
|
+
- (NSString *) text
|
196
|
+
{
|
197
|
+
return self.firstTextChild.content;
|
198
|
+
}
|
199
|
+
|
200
|
+
@end
|