TemplateInfo 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/.gitignore +2 -0
- data/TemplateInfo.gemspec +1 -1
- data/bin/tif_create.rb +157 -0
- data/lib/TemplateInfo/version.rb +1 -1
- data/test.xctemplate/.DS_Store +0 -0
- data/test.xctemplate/TemplateInfo.plist +2830 -0
- data/test.xctemplate/TemplateInfo.xml +2842 -0
- data/test.xctemplate/libs/BeeFramework/Bee.h +35 -0
- data/test.xctemplate/libs/BeeFramework/Bee_Precompile.h +143 -0
- data/test.xctemplate/libs/BeeFramework/Core/Bee_Core.h +36 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Foundation.h +54 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Foundation.mm +33 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Log.h +64 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Log.mm +164 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Performance.h +111 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Performance.mm +122 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Runtime.h +98 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Runtime.mm +437 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Sandbox.h +45 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Sandbox.mm +81 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Singleton.h +47 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Singleton.mm +34 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_SystemInfo.h +62 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_SystemInfo.m +147 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Thread.h +64 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Thread.mm +91 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSArray+BeeExtension.h +76 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSArray+BeeExtension.m +300 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSData+BeeExtension.h +44 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSData+BeeExtension.m +92 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDate+BeeExtension.h +44 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDate+BeeExtension.m +85 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDictionary+BeeExtension.h +90 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDictionary+BeeExtension.m +509 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSNumber+BeeExtension.h +50 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSNumber+BeeExtension.m +64 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeJSON.h +43 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeJSON.m +116 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeNotification.h +66 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeNotification.m +150 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeProperty.h +210 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeProperty.m +34 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTicker.h +41 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTicker.m +156 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTypeConversion.h +49 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTypeConversion.m +109 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSString+BeeExtension.h +86 -0
- data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSString+BeeExtension.m +464 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Network.h +36 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Network.m +33 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Request.h +144 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Request.m +560 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_RequestQueue.h +99 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_RequestQueue.m +742 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Extension/NSObject+BeeRequest.h +62 -0
- data/test.xctemplate/libs/BeeFramework/Core/Network/Extension/NSObject+BeeRequest.m +175 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/0.2.4.zip +0 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveBase.h +133 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveBase.m +641 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveRecord.h +106 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveRecord.m +1956 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Cache.h +91 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Cache.m +318 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Database.h +223 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Database.m +3007 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Keychain.h +55 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Keychain.m +173 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Storage.h +39 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Storage.m +33 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeDatabase.h +47 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeDatabase.m +81 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeKeychain.h +44 -0
- data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeKeychain.m +57 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Bee_MVC.h +49 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Controller.h +66 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Controller.mm +228 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Message.h +209 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Message.mm +873 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_MessageQueue.h +75 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_MessageQueue.mm +389 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+ActiveRecord.h +52 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+ActiveRecord.m +150 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+HTTP.h +49 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+HTTP.mm +201 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+JSON.h +52 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+JSON.mm +118 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+XML.h +49 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+XML.mm +78 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/NSObject+BeeMessage.h +57 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/NSObject+BeeMessage.mm +138 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Model/Bee_Model.h +64 -0
- data/test.xctemplate/libs/BeeFramework/MVC/Model/Bee_Model.m +190 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActionSheet.h +71 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActionSheet.m +307 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActivityIndicatorView.h +52 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActivityIndicatorView.m +152 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIAlertView.h +73 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIAlertView.m +234 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIButton.h +97 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIButton.m +424 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIDatePicker.h +78 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIDatePicker.m +362 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIGridCell.h +82 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIGridCell.m +298 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIImageView.h +110 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIImageView.m +541 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIKeyboard.h +74 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIKeyboard.m +243 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UILabel.h +46 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UILabel.m +99 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIMatrixView.h +124 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIMatrixView.m +821 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UINavigationBar.h +57 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UINavigationBar.m +161 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIOrientation.h +60 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIOrientation.m +146 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPageControl.h +61 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPageControl.m +190 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIProgressView.h +47 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIProgressView.m +113 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPullLoader.h +71 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPullLoader.m +236 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIScrollView.h +146 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIScrollView.m +1487 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISegmentedControl.h +60 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISegmentedControl.m +192 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISignal.h +126 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISignal.m +453 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITabBar.h +70 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITabBar.m +249 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextField.h +67 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextField.m +242 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextView.h +75 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextView.m +311 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITipsView.h +184 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITipsView.m +911 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIWebView.h +65 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIWebView.m +242 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIZoomView.h +91 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIZoomView.m +444 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_View.h +72 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_View.m +38 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/CGRect+BeeExtension.h +79 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/CGRect+BeeExtension.m +288 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIColor+BeeExtension.h +65 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIColor+BeeExtension.m +161 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIFont+BeeExtension.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIFont+BeeExtension.m +137 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIImage+BeeExtension.h +56 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIImage+BeeExtension.m +218 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeExtension.h +105 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeExtension.m +556 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeUISignal.h +53 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeUISignal.m +104 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+HoldGesture.h +52 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+HoldGesture.m +170 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+PanGesture.h +54 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+PanGesture.m +166 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+SwipeGesture.h +54 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+SwipeGesture.m +184 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+TapGesture.h +57 -0
- data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+TapGesture.m +275 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIBoard.h +212 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIBoard.m +1219 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStack.h +111 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStack.m +694 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStackGroup.h +71 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStackGroup.m +258 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_ViewController.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_ViewController.m +36 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeExtension.h +57 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeExtension.m +151 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeUISignal.h +53 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeUISignal.m +92 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.h +72 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.m +175 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UICollection.h +59 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UICollection.m +249 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UILayout.h +199 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UILayout.m +1170 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIQuery.h +113 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIQuery.m +710 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIStyle.h +66 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIStyle.m +189 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplate.h +69 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplate.m +210 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateAndroid.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateAndroid.m +59 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateHTML.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateHTML.m +55 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateJSON.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateJSON.m +54 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateOmniGraffle.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateOmniGraffle.m +54 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateXML.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateXML.m +438 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_ViewLayout.h +60 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_ViewLayout.m +37 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIQuery+BeeUIStyle.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIQuery+BeeUIStyle.m +55 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIStyle+BeeUIQuery.h +45 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIStyle+BeeUIQuery.m +55 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIButton+BeeUIStyle.h +41 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIButton+BeeUIStyle.m +100 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIImageView+BeeUIStyle.h +41 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIImageView+BeeUIStyle.m +101 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UILabel+BeeUIStyle.h +41 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UILabel+BeeUIStyle.m +48 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextField+BeeUIStyle.h +41 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextField+BeeUIStyle.m +77 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextView+BeeUIStyle.h +41 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextView+BeeUIStyle.m +47 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUILayout.h +52 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUILayout.m +177 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIQuery.h +44 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIQuery.m +57 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIStyle.h +50 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIStyle.m +283 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUILayout.h +52 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUILayout.m +178 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIQuery.h +44 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIQuery.m +58 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIStyle.h +44 -0
- data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIStyle.m +57 -0
- metadata +226 -3
@@ -0,0 +1,560 @@
|
|
1
|
+
//
|
2
|
+
// ______ ______ ______
|
3
|
+
// /\ __ \ /\ ___\ /\ ___\
|
4
|
+
// \ \ __< \ \ __\_ \ \ __\_
|
5
|
+
// \ \_____\ \ \_____\ \ \_____\
|
6
|
+
// \/_____/ \/_____/ \/_____/
|
7
|
+
//
|
8
|
+
// Copyright (c) 2012 BEE creators
|
9
|
+
// http://www.whatsbug.com
|
10
|
+
//
|
11
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
12
|
+
// copy of this software and associated documentation files (the "Software"),
|
13
|
+
// to deal in the Software without restriction, including without limitation
|
14
|
+
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
15
|
+
// and/or sell copies of the Software, and to permit persons to whom the
|
16
|
+
// Software is furnished to do so, subject to the following conditions:
|
17
|
+
//
|
18
|
+
// The above copyright notice and this permission notice shall be included in
|
19
|
+
// all copies or substantial portions of the Software.
|
20
|
+
//
|
21
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
22
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
23
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
24
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
25
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
27
|
+
// IN THE SOFTWARE.
|
28
|
+
//
|
29
|
+
//
|
30
|
+
// Bee_Request.m
|
31
|
+
//
|
32
|
+
|
33
|
+
#include <execinfo.h>
|
34
|
+
|
35
|
+
#import "Bee_Precompile.h"
|
36
|
+
#import "Bee_Network.h"
|
37
|
+
#import "Bee_Runtime.h"
|
38
|
+
#import "Bee_Log.h"
|
39
|
+
|
40
|
+
#import "NSArray+BeeExtension.h"
|
41
|
+
#import "NSString+BeeExtension.h"
|
42
|
+
#import "NSDictionary+BeeExtension.h"
|
43
|
+
#import "NSObject+BeeTypeConversion.h"
|
44
|
+
|
45
|
+
#import "ASIHTTPRequest.h"
|
46
|
+
#import "ASIDataDecompressor.h"
|
47
|
+
#import "ASIFormDataRequest.h"
|
48
|
+
|
49
|
+
#pragma mark -
|
50
|
+
|
51
|
+
@interface BeeRequest(Private)
|
52
|
+
- (void)updateSendProgress;
|
53
|
+
- (void)updateRecvProgress;
|
54
|
+
@end
|
55
|
+
|
56
|
+
#pragma mark -
|
57
|
+
|
58
|
+
@implementation BeeRequest
|
59
|
+
|
60
|
+
DEF_INT( STATE_CREATED, 0 );
|
61
|
+
DEF_INT( STATE_SENDING, 1 );
|
62
|
+
DEF_INT( STATE_RECVING, 2 );
|
63
|
+
DEF_INT( STATE_FAILED, 3 );
|
64
|
+
DEF_INT( STATE_SUCCEED, 4 );
|
65
|
+
DEF_INT( STATE_CANCELLED, 5 );
|
66
|
+
|
67
|
+
@dynamic HEADER;
|
68
|
+
@dynamic BODY;
|
69
|
+
@dynamic PARAM;
|
70
|
+
@dynamic FILE;
|
71
|
+
|
72
|
+
@synthesize state = _state;
|
73
|
+
@synthesize errorCode = _errorCode;
|
74
|
+
//@synthesize responder = _responder;
|
75
|
+
@synthesize responders = _responders;
|
76
|
+
@synthesize userInfo = _userInfo;
|
77
|
+
|
78
|
+
@synthesize whenUpdate = _whenUpdate;
|
79
|
+
|
80
|
+
@synthesize initTimeStamp = _initTimeStamp;
|
81
|
+
@synthesize sendTimeStamp = _sendTimeStamp;
|
82
|
+
@synthesize recvTimeStamp = _recvTimeStamp;
|
83
|
+
@synthesize doneTimeStamp = _doneTimeStamp;
|
84
|
+
|
85
|
+
@synthesize timeCostPending; // 排队等待耗时
|
86
|
+
@synthesize timeCostOverDNS; // 网络连接耗时(DNS)
|
87
|
+
@synthesize timeCostRecving; // 网络收包耗时
|
88
|
+
@synthesize timeCostOverAir; // 网络整体耗时
|
89
|
+
|
90
|
+
#if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
91
|
+
@synthesize callstack = _callstack;
|
92
|
+
#endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
93
|
+
|
94
|
+
@synthesize created;
|
95
|
+
@synthesize sending;
|
96
|
+
@synthesize recving;
|
97
|
+
@synthesize failed;
|
98
|
+
@synthesize succeed;
|
99
|
+
//@synthesize cancelled;
|
100
|
+
@synthesize sendProgressed = _sendProgressed;
|
101
|
+
@synthesize recvProgressed = _recvProgressed;
|
102
|
+
|
103
|
+
@synthesize uploadPercent;
|
104
|
+
@synthesize uploadBytes;
|
105
|
+
@synthesize uploadTotalBytes;
|
106
|
+
@synthesize downloadPercent;
|
107
|
+
@synthesize downloadBytes;
|
108
|
+
@synthesize downloadTotalBytes;
|
109
|
+
|
110
|
+
- (id)initWithURL:(NSURL *)newURL
|
111
|
+
{
|
112
|
+
self = [super initWithURL:newURL];
|
113
|
+
if ( self )
|
114
|
+
{
|
115
|
+
_state = BeeRequest.STATE_CREATED;
|
116
|
+
_errorCode = 0;
|
117
|
+
|
118
|
+
_responders = [[NSMutableArray nonRetainingArray] retain];
|
119
|
+
_userInfo = [[NSMutableDictionary alloc] init];
|
120
|
+
|
121
|
+
_whenUpdate = nil;
|
122
|
+
|
123
|
+
_sendProgressed = NO;
|
124
|
+
_recvProgressed = NO;
|
125
|
+
|
126
|
+
_initTimeStamp = [NSDate timeIntervalSinceReferenceDate];
|
127
|
+
_sendTimeStamp = _initTimeStamp;
|
128
|
+
_recvTimeStamp = _initTimeStamp;
|
129
|
+
_doneTimeStamp = _initTimeStamp;
|
130
|
+
|
131
|
+
#if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
132
|
+
_callstack = [[NSMutableArray alloc] init];
|
133
|
+
[_callstack addObjectsFromArray:[BeeRuntime callstack:16]];
|
134
|
+
#endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
135
|
+
}
|
136
|
+
|
137
|
+
return self;
|
138
|
+
}
|
139
|
+
|
140
|
+
- (NSString *)description
|
141
|
+
{
|
142
|
+
return [NSString stringWithFormat:@"%@ %@, state ==> %d, %d/%d",
|
143
|
+
self.requestMethod, [self.url absoluteString],
|
144
|
+
self.state,
|
145
|
+
[self uploadBytes], [self downloadBytes]];
|
146
|
+
}
|
147
|
+
|
148
|
+
- (void)dealloc
|
149
|
+
{
|
150
|
+
self.whenUpdate = nil;
|
151
|
+
|
152
|
+
[_responders removeAllObjects];
|
153
|
+
[_responders release];
|
154
|
+
_responders = nil;
|
155
|
+
|
156
|
+
[_userInfo removeAllObjects];
|
157
|
+
[_userInfo release];
|
158
|
+
_userInfo = nil;
|
159
|
+
|
160
|
+
#if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
161
|
+
[_callstack removeAllObjects];
|
162
|
+
[_callstack release];
|
163
|
+
_callstack = nil;
|
164
|
+
#endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
|
165
|
+
|
166
|
+
[super dealloc];
|
167
|
+
}
|
168
|
+
|
169
|
+
- (CGFloat)uploadPercent
|
170
|
+
{
|
171
|
+
NSUInteger bytes1 = self.uploadBytes;
|
172
|
+
NSUInteger bytes2 = self.uploadTotalBytes;
|
173
|
+
|
174
|
+
return bytes2 ? ((CGFloat)bytes1 / (CGFloat)bytes2) : 0.0f;
|
175
|
+
}
|
176
|
+
|
177
|
+
- (NSUInteger)uploadBytes
|
178
|
+
{
|
179
|
+
if ( [self.requestMethod isEqualToString:@"GET"] )
|
180
|
+
{
|
181
|
+
return 0;
|
182
|
+
}
|
183
|
+
else if ( [self.requestMethod isEqualToString:@"POST"] )
|
184
|
+
{
|
185
|
+
return self.postLength;
|
186
|
+
}
|
187
|
+
|
188
|
+
return 0;
|
189
|
+
}
|
190
|
+
|
191
|
+
- (NSUInteger)uploadTotalBytes
|
192
|
+
{
|
193
|
+
if ( [self.requestMethod isEqualToString:@"GET"] )
|
194
|
+
{
|
195
|
+
return 0;
|
196
|
+
}
|
197
|
+
else if ( [self.requestMethod isEqualToString:@"POST"] )
|
198
|
+
{
|
199
|
+
return self.postLength;
|
200
|
+
}
|
201
|
+
|
202
|
+
return 0;
|
203
|
+
}
|
204
|
+
|
205
|
+
- (CGFloat)downloadPercent
|
206
|
+
{
|
207
|
+
NSUInteger bytes1 = self.downloadBytes;
|
208
|
+
NSUInteger bytes2 = self.downloadTotalBytes;
|
209
|
+
|
210
|
+
return bytes2 ? ((CGFloat)bytes1 / (CGFloat)bytes2) : 0.0f;
|
211
|
+
}
|
212
|
+
|
213
|
+
- (NSUInteger)downloadBytes
|
214
|
+
{
|
215
|
+
return [[self rawResponseData] length];
|
216
|
+
}
|
217
|
+
|
218
|
+
- (NSUInteger)downloadTotalBytes
|
219
|
+
{
|
220
|
+
return self.contentLength;
|
221
|
+
}
|
222
|
+
|
223
|
+
- (BOOL)is:(NSString *)text
|
224
|
+
{
|
225
|
+
return [[self.url absoluteString] isEqualToString:text];
|
226
|
+
}
|
227
|
+
|
228
|
+
- (void)callResponders
|
229
|
+
{
|
230
|
+
NSArray * responds = [self.responders copy];
|
231
|
+
|
232
|
+
for ( NSObject * responder in responds)
|
233
|
+
{
|
234
|
+
if ( [responder isRequestResponder] )
|
235
|
+
{
|
236
|
+
[responder handleRequest:self];
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
240
|
+
[responds release];
|
241
|
+
}
|
242
|
+
|
243
|
+
- (void)forwardResponder:(NSObject *)obj
|
244
|
+
{
|
245
|
+
if ( [obj isRequestResponder] )
|
246
|
+
{
|
247
|
+
[obj handleRequest:self];
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
- (void)changeState:(NSUInteger)state
|
252
|
+
{
|
253
|
+
if ( state != _state )
|
254
|
+
{
|
255
|
+
_state = state;
|
256
|
+
|
257
|
+
if ( BeeRequest.STATE_SENDING == _state )
|
258
|
+
{
|
259
|
+
_sendTimeStamp = [NSDate timeIntervalSinceReferenceDate];
|
260
|
+
}
|
261
|
+
else if ( BeeRequest.STATE_RECVING == _state )
|
262
|
+
{
|
263
|
+
_recvTimeStamp = [NSDate timeIntervalSinceReferenceDate];
|
264
|
+
}
|
265
|
+
else if ( BeeRequest.STATE_FAILED == _state || BeeRequest.STATE_SUCCEED == _state || BeeRequest.STATE_CANCELLED == _state )
|
266
|
+
{
|
267
|
+
_doneTimeStamp = [NSDate timeIntervalSinceReferenceDate];
|
268
|
+
}
|
269
|
+
|
270
|
+
[self callResponders];
|
271
|
+
|
272
|
+
// if ( [_responder isRequestResponder] )
|
273
|
+
// {
|
274
|
+
// [_responder handleRequest:self];
|
275
|
+
// }
|
276
|
+
|
277
|
+
if ( self.whenUpdate )
|
278
|
+
{
|
279
|
+
self.whenUpdate( self );
|
280
|
+
}
|
281
|
+
}
|
282
|
+
}
|
283
|
+
|
284
|
+
- (void)updateSendProgress
|
285
|
+
{
|
286
|
+
_sendProgressed = YES;
|
287
|
+
|
288
|
+
[self callResponders];
|
289
|
+
|
290
|
+
// if ( [_responder isRequestResponder] )
|
291
|
+
// {
|
292
|
+
// [_responder handleRequest:self];
|
293
|
+
// }
|
294
|
+
|
295
|
+
if ( self.whenUpdate )
|
296
|
+
{
|
297
|
+
self.whenUpdate( self );
|
298
|
+
}
|
299
|
+
|
300
|
+
_sendProgressed = NO;
|
301
|
+
}
|
302
|
+
|
303
|
+
- (void)updateRecvProgress
|
304
|
+
{
|
305
|
+
if ( _state == BeeRequest.STATE_SUCCEED || _state == BeeRequest.STATE_FAILED || _state == BeeRequest.STATE_CANCELLED )
|
306
|
+
return;
|
307
|
+
|
308
|
+
if ( self.didUseCachedResponse )
|
309
|
+
return;
|
310
|
+
|
311
|
+
_recvProgressed = YES;
|
312
|
+
|
313
|
+
[self callResponders];
|
314
|
+
|
315
|
+
// if ( [_responder isRequestResponder] )
|
316
|
+
// {
|
317
|
+
// [_responder handleRequest:self];
|
318
|
+
// }
|
319
|
+
|
320
|
+
if ( self.whenUpdate )
|
321
|
+
{
|
322
|
+
self.whenUpdate( self );
|
323
|
+
}
|
324
|
+
|
325
|
+
_recvProgressed = NO;
|
326
|
+
}
|
327
|
+
|
328
|
+
- (NSTimeInterval)timeCostPending
|
329
|
+
{
|
330
|
+
return _sendTimeStamp - _initTimeStamp;
|
331
|
+
}
|
332
|
+
|
333
|
+
- (NSTimeInterval)timeCostOverDNS
|
334
|
+
{
|
335
|
+
return _recvTimeStamp - _sendTimeStamp;
|
336
|
+
}
|
337
|
+
|
338
|
+
- (NSTimeInterval)timeCostRecving
|
339
|
+
{
|
340
|
+
return _doneTimeStamp - _recvTimeStamp;
|
341
|
+
}
|
342
|
+
|
343
|
+
- (NSTimeInterval)timeCostOverAir
|
344
|
+
{
|
345
|
+
return _doneTimeStamp - _sendTimeStamp;
|
346
|
+
}
|
347
|
+
|
348
|
+
- (BOOL)created
|
349
|
+
{
|
350
|
+
return BeeRequest.STATE_CREATED == _state ? YES : NO;
|
351
|
+
}
|
352
|
+
|
353
|
+
- (BOOL)sending
|
354
|
+
{
|
355
|
+
return BeeRequest.STATE_SENDING == _state ? YES : NO;
|
356
|
+
}
|
357
|
+
|
358
|
+
- (BOOL)recving
|
359
|
+
{
|
360
|
+
return BeeRequest.STATE_RECVING == _state ? YES : NO;
|
361
|
+
}
|
362
|
+
|
363
|
+
- (BOOL)succeed
|
364
|
+
{
|
365
|
+
return BeeRequest.STATE_SUCCEED == _state ? YES : NO;
|
366
|
+
}
|
367
|
+
|
368
|
+
- (BOOL)failed
|
369
|
+
{
|
370
|
+
return BeeRequest.STATE_FAILED == _state ? YES : NO;
|
371
|
+
}
|
372
|
+
|
373
|
+
- (BOOL)cancelled
|
374
|
+
{
|
375
|
+
return BeeRequest.STATE_CANCELLED == _state ? YES : NO;
|
376
|
+
}
|
377
|
+
|
378
|
+
- (BOOL)hasResponder:(id)responder
|
379
|
+
{
|
380
|
+
return [_responders containsObject:responder];
|
381
|
+
}
|
382
|
+
|
383
|
+
- (void)addResponder:(id)responder
|
384
|
+
{
|
385
|
+
[_responders addObject:responder];
|
386
|
+
}
|
387
|
+
|
388
|
+
- (void)removeResponder:(id)responder
|
389
|
+
{
|
390
|
+
[_responders removeObject:responder];
|
391
|
+
}
|
392
|
+
|
393
|
+
- (void)removeAllResponders
|
394
|
+
{
|
395
|
+
[_responders removeAllObjects];
|
396
|
+
}
|
397
|
+
|
398
|
+
- (BeeRequestBlockN)HEADER
|
399
|
+
{
|
400
|
+
BeeRequestBlockN block = ^ BeeRequest * ( id first, ... )
|
401
|
+
{
|
402
|
+
va_list args;
|
403
|
+
va_start( args, first );
|
404
|
+
|
405
|
+
NSString * key = [(NSObject *)first asNSString];
|
406
|
+
NSString * value = [va_arg( args, NSObject * ) asNSString];
|
407
|
+
|
408
|
+
[self addRequestHeader:key value:(NSString *)value];
|
409
|
+
|
410
|
+
va_end( args );
|
411
|
+
|
412
|
+
return self;
|
413
|
+
};
|
414
|
+
|
415
|
+
return [[block copy] autorelease];
|
416
|
+
}
|
417
|
+
|
418
|
+
- (BeeRequestBlockN)BODY
|
419
|
+
{
|
420
|
+
BeeRequestBlockN block = ^ BeeRequest * ( id first, ... )
|
421
|
+
{
|
422
|
+
NSData * data = nil;
|
423
|
+
|
424
|
+
if ( [first isKindOfClass:[NSData class]] )
|
425
|
+
{
|
426
|
+
data = (NSData *)first;
|
427
|
+
}
|
428
|
+
else if ( [first isKindOfClass:[NSString class]] )
|
429
|
+
{
|
430
|
+
data = [(NSString *)first dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
|
431
|
+
}
|
432
|
+
else if ( [first isKindOfClass:[NSArray class]] )
|
433
|
+
{
|
434
|
+
NSString * text = [NSString queryStringFromArray:(NSArray *)first];
|
435
|
+
if ( text )
|
436
|
+
{
|
437
|
+
data = [text dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
|
438
|
+
}
|
439
|
+
}
|
440
|
+
else if ( [first isKindOfClass:[NSDictionary class]] )
|
441
|
+
{
|
442
|
+
NSString * text = [NSString queryStringFromDictionary:(NSDictionary *)first];
|
443
|
+
if ( text )
|
444
|
+
{
|
445
|
+
data = [text dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
|
446
|
+
}
|
447
|
+
}
|
448
|
+
else
|
449
|
+
{
|
450
|
+
data = [[first description] dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
|
451
|
+
}
|
452
|
+
|
453
|
+
if ( data )
|
454
|
+
{
|
455
|
+
self.postBody = [NSMutableData dataWithData:data];
|
456
|
+
}
|
457
|
+
|
458
|
+
return self;
|
459
|
+
};
|
460
|
+
|
461
|
+
return [[block copy] autorelease];
|
462
|
+
}
|
463
|
+
|
464
|
+
- (BeeRequestBlockN)PARAM
|
465
|
+
{
|
466
|
+
BeeRequestBlockN block = ^ BeeRequest * ( id first, ... )
|
467
|
+
{
|
468
|
+
va_list args;
|
469
|
+
va_start( args, first );
|
470
|
+
|
471
|
+
NSString * key = [(NSString *)first asNSString];
|
472
|
+
NSString * value = [va_arg( args, NSObject * ) asNSString];
|
473
|
+
|
474
|
+
if ( [self.requestMethod is:@"GET"] )
|
475
|
+
{
|
476
|
+
NSString * base = [self.url absoluteString];
|
477
|
+
NSString * params = [NSString queryStringFromKeyValues:key, value, nil];
|
478
|
+
NSString * query = self.url.query;
|
479
|
+
|
480
|
+
NSURL * newURL = nil;
|
481
|
+
|
482
|
+
if ( query.length )
|
483
|
+
{
|
484
|
+
newURL = [NSURL URLWithString:[base stringByAppendingFormat:@"&%@", params]];
|
485
|
+
}
|
486
|
+
else
|
487
|
+
{
|
488
|
+
newURL = [NSURL URLWithString:[base stringByAppendingFormat:@"?%@", params]];
|
489
|
+
}
|
490
|
+
|
491
|
+
if ( newURL )
|
492
|
+
{
|
493
|
+
[self setURL:newURL];
|
494
|
+
}
|
495
|
+
}
|
496
|
+
else
|
497
|
+
{
|
498
|
+
[self setPostValue:value forKey:key];
|
499
|
+
}
|
500
|
+
|
501
|
+
va_end( args );
|
502
|
+
|
503
|
+
return self;
|
504
|
+
};
|
505
|
+
|
506
|
+
return [[block copy] autorelease];
|
507
|
+
}
|
508
|
+
|
509
|
+
- (BeeRequestBlockN)FILE
|
510
|
+
{
|
511
|
+
BeeRequestBlockN block = ^ BeeRequest * ( id first, ... )
|
512
|
+
{
|
513
|
+
va_list args;
|
514
|
+
va_start( args, first );
|
515
|
+
|
516
|
+
NSString * name = [(NSString *)first asNSString];
|
517
|
+
id data = va_arg( args, NSObject * );
|
518
|
+
|
519
|
+
if ( data )
|
520
|
+
{
|
521
|
+
NSString * path;
|
522
|
+
|
523
|
+
path = NSHomeDirectory();
|
524
|
+
path = [path stringByAppendingPathComponent:@"Documents"];
|
525
|
+
path = [path stringByAppendingPathComponent:name];
|
526
|
+
|
527
|
+
if ( [data isKindOfClass:[NSString class]] )
|
528
|
+
{
|
529
|
+
NSString * string = (NSString *)data;
|
530
|
+
[string writeToFile:path
|
531
|
+
atomically:YES
|
532
|
+
encoding:NSUTF8StringEncoding
|
533
|
+
error:NULL];
|
534
|
+
}
|
535
|
+
else if ( [data isKindOfClass:[NSData class]] )
|
536
|
+
{
|
537
|
+
[data writeToFile:path
|
538
|
+
options:NSDataWritingAtomic
|
539
|
+
error:NULL];
|
540
|
+
}
|
541
|
+
else
|
542
|
+
{
|
543
|
+
NSData * data = [[first description] dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
|
544
|
+
[data writeToFile:path
|
545
|
+
options:NSDataWritingAtomic
|
546
|
+
error:NULL];
|
547
|
+
}
|
548
|
+
|
549
|
+
[self setFile:path forKey:name];
|
550
|
+
}
|
551
|
+
|
552
|
+
va_end( args );
|
553
|
+
|
554
|
+
return self;
|
555
|
+
};
|
556
|
+
|
557
|
+
return [[block copy] autorelease];
|
558
|
+
}
|
559
|
+
|
560
|
+
@end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
//
|
2
|
+
// ______ ______ ______
|
3
|
+
// /\ __ \ /\ ___\ /\ ___\
|
4
|
+
// \ \ __< \ \ __\_ \ \ __\_
|
5
|
+
// \ \_____\ \ \_____\ \ \_____\
|
6
|
+
// \/_____/ \/_____/ \/_____/
|
7
|
+
//
|
8
|
+
// Copyright (c) 2012 BEE creators
|
9
|
+
// http://www.whatsbug.com
|
10
|
+
//
|
11
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
12
|
+
// copy of this software and associated documentation files (the "Software"),
|
13
|
+
// to deal in the Software without restriction, including without limitation
|
14
|
+
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
15
|
+
// and/or sell copies of the Software, and to permit persons to whom the
|
16
|
+
// Software is furnished to do so, subject to the following conditions:
|
17
|
+
//
|
18
|
+
// The above copyright notice and this permission notice shall be included in
|
19
|
+
// all copies or substantial portions of the Software.
|
20
|
+
//
|
21
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
22
|
+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
23
|
+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
24
|
+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
25
|
+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
27
|
+
// IN THE SOFTWARE.
|
28
|
+
//
|
29
|
+
//
|
30
|
+
// Bee_Network.h
|
31
|
+
//
|
32
|
+
|
33
|
+
#import "Bee_Precompile.h"
|
34
|
+
#import "Bee_Singleton.h"
|
35
|
+
#import "Bee_Request.h"
|
36
|
+
|
37
|
+
#pragma mark -
|
38
|
+
|
39
|
+
@interface BeeRequestQueue : NSObject<ASIHTTPRequestDelegate>
|
40
|
+
{
|
41
|
+
BOOL _merge;
|
42
|
+
BOOL _online;
|
43
|
+
|
44
|
+
BOOL _blackListEnable;
|
45
|
+
NSTimeInterval _blackListTimeout;
|
46
|
+
NSMutableDictionary * _blackList;
|
47
|
+
|
48
|
+
NSUInteger _bytesUpload;
|
49
|
+
NSUInteger _bytesDownload;
|
50
|
+
|
51
|
+
NSTimeInterval _delay;
|
52
|
+
NSMutableArray * _requests;
|
53
|
+
|
54
|
+
BeeRequestBlock _whenCreate;
|
55
|
+
BeeRequestBlock _whenUpdate;
|
56
|
+
}
|
57
|
+
|
58
|
+
@property (nonatomic, assign) BOOL merge;
|
59
|
+
@property (nonatomic, assign) BOOL online; // 开网/断网
|
60
|
+
|
61
|
+
@property (nonatomic, assign) BOOL blackListEnable; // 是否使用黑名单
|
62
|
+
@property (nonatomic, assign) NSTimeInterval blackListTimeout; // 黑名单超时
|
63
|
+
@property (nonatomic, retain) NSMutableDictionary * blackList;
|
64
|
+
|
65
|
+
@property (nonatomic, assign) NSUInteger bytesUpload;
|
66
|
+
@property (nonatomic, assign) NSUInteger bytesDownload;
|
67
|
+
|
68
|
+
@property (nonatomic, assign) NSTimeInterval delay;
|
69
|
+
@property (nonatomic, retain) NSMutableArray * requests;
|
70
|
+
|
71
|
+
@property (nonatomic, copy) BeeRequestBlock whenCreate;
|
72
|
+
@property (nonatomic, copy) BeeRequestBlock whenUpdate;
|
73
|
+
|
74
|
+
+ (BeeRequestQueue *)sharedInstance;
|
75
|
+
|
76
|
+
+ (BOOL)isReachableViaWIFI;
|
77
|
+
+ (BOOL)isReachableViaWLAN;
|
78
|
+
+ (BOOL)isNetworkInUse;
|
79
|
+
+ (NSUInteger)bandwidthUsedPerSecond;
|
80
|
+
|
81
|
+
+ (BeeRequest *)GET:(NSString *)url;
|
82
|
+
+ (BeeRequest *)POST:(NSString *)url;
|
83
|
+
+ (BeeRequest *)PUT:(NSString *)url;
|
84
|
+
|
85
|
+
+ (BOOL)requesting:(NSString *)url;
|
86
|
+
+ (BOOL)requesting:(NSString *)url byResponder:(id)responder;
|
87
|
+
|
88
|
+
+ (NSArray *)requests:(NSString *)url;
|
89
|
+
+ (NSArray *)requests:(NSString *)url byResponder:(id)responder;
|
90
|
+
|
91
|
+
+ (void)cancelRequest:(BeeRequest *)request;
|
92
|
+
+ (void)cancelRequestByResponder:(id)responder;
|
93
|
+
+ (void)cancelAllRequests;
|
94
|
+
|
95
|
+
+ (void)blockURL:(NSString *)url;
|
96
|
+
+ (void)unblockURL:(NSString *)url;
|
97
|
+
|
98
|
+
@end
|
99
|
+
|