TemplateInfo 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. data/.DS_Store +0 -0
  2. data/.gitignore +2 -0
  3. data/TemplateInfo.gemspec +1 -1
  4. data/bin/tif_create.rb +157 -0
  5. data/lib/TemplateInfo/version.rb +1 -1
  6. data/test.xctemplate/.DS_Store +0 -0
  7. data/test.xctemplate/TemplateInfo.plist +2830 -0
  8. data/test.xctemplate/TemplateInfo.xml +2842 -0
  9. data/test.xctemplate/libs/BeeFramework/Bee.h +35 -0
  10. data/test.xctemplate/libs/BeeFramework/Bee_Precompile.h +143 -0
  11. data/test.xctemplate/libs/BeeFramework/Core/Bee_Core.h +36 -0
  12. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Foundation.h +54 -0
  13. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Foundation.mm +33 -0
  14. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Log.h +64 -0
  15. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Log.mm +164 -0
  16. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Performance.h +111 -0
  17. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Performance.mm +122 -0
  18. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Runtime.h +98 -0
  19. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Runtime.mm +437 -0
  20. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Sandbox.h +45 -0
  21. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Sandbox.mm +81 -0
  22. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Singleton.h +47 -0
  23. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Singleton.mm +34 -0
  24. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_SystemInfo.h +62 -0
  25. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_SystemInfo.m +147 -0
  26. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Thread.h +64 -0
  27. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Bee_Thread.mm +91 -0
  28. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSArray+BeeExtension.h +76 -0
  29. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSArray+BeeExtension.m +300 -0
  30. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSData+BeeExtension.h +44 -0
  31. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSData+BeeExtension.m +92 -0
  32. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDate+BeeExtension.h +44 -0
  33. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDate+BeeExtension.m +85 -0
  34. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDictionary+BeeExtension.h +90 -0
  35. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSDictionary+BeeExtension.m +509 -0
  36. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSNumber+BeeExtension.h +50 -0
  37. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSNumber+BeeExtension.m +64 -0
  38. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeJSON.h +43 -0
  39. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeJSON.m +116 -0
  40. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeNotification.h +66 -0
  41. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeNotification.m +150 -0
  42. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeProperty.h +210 -0
  43. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeProperty.m +34 -0
  44. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTicker.h +41 -0
  45. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTicker.m +156 -0
  46. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTypeConversion.h +49 -0
  47. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSObject+BeeTypeConversion.m +109 -0
  48. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSString+BeeExtension.h +86 -0
  49. data/test.xctemplate/libs/BeeFramework/Core/Foundation/Extension/NSString+BeeExtension.m +464 -0
  50. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Network.h +36 -0
  51. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Network.m +33 -0
  52. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Request.h +144 -0
  53. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_Request.m +560 -0
  54. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_RequestQueue.h +99 -0
  55. data/test.xctemplate/libs/BeeFramework/Core/Network/Bee_RequestQueue.m +742 -0
  56. data/test.xctemplate/libs/BeeFramework/Core/Network/Extension/NSObject+BeeRequest.h +62 -0
  57. data/test.xctemplate/libs/BeeFramework/Core/Network/Extension/NSObject+BeeRequest.m +175 -0
  58. data/test.xctemplate/libs/BeeFramework/Core/Storage/0.2.4.zip +0 -0
  59. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveBase.h +133 -0
  60. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveBase.m +641 -0
  61. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveRecord.h +106 -0
  62. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_ActiveRecord.m +1956 -0
  63. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Cache.h +91 -0
  64. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Cache.m +318 -0
  65. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Database.h +223 -0
  66. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Database.m +3007 -0
  67. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Keychain.h +55 -0
  68. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Keychain.m +173 -0
  69. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Storage.h +39 -0
  70. data/test.xctemplate/libs/BeeFramework/Core/Storage/Bee_Storage.m +33 -0
  71. data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeDatabase.h +47 -0
  72. data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeDatabase.m +81 -0
  73. data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeKeychain.h +44 -0
  74. data/test.xctemplate/libs/BeeFramework/Core/Storage/Extension/NSObject+BeeKeychain.m +57 -0
  75. data/test.xctemplate/libs/BeeFramework/MVC/Bee_MVC.h +49 -0
  76. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Controller.h +66 -0
  77. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Controller.mm +228 -0
  78. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Message.h +209 -0
  79. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_Message.mm +873 -0
  80. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_MessageQueue.h +75 -0
  81. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Bee_MessageQueue.mm +389 -0
  82. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+ActiveRecord.h +52 -0
  83. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+ActiveRecord.m +150 -0
  84. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+HTTP.h +49 -0
  85. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+HTTP.mm +201 -0
  86. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+JSON.h +52 -0
  87. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+JSON.mm +118 -0
  88. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+XML.h +49 -0
  89. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/BeeMessage+XML.mm +78 -0
  90. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/NSObject+BeeMessage.h +57 -0
  91. data/test.xctemplate/libs/BeeFramework/MVC/Controller/Extension/NSObject+BeeMessage.mm +138 -0
  92. data/test.xctemplate/libs/BeeFramework/MVC/Model/Bee_Model.h +64 -0
  93. data/test.xctemplate/libs/BeeFramework/MVC/Model/Bee_Model.m +190 -0
  94. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActionSheet.h +71 -0
  95. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActionSheet.m +307 -0
  96. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActivityIndicatorView.h +52 -0
  97. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIActivityIndicatorView.m +152 -0
  98. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIAlertView.h +73 -0
  99. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIAlertView.m +234 -0
  100. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIButton.h +97 -0
  101. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIButton.m +424 -0
  102. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIDatePicker.h +78 -0
  103. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIDatePicker.m +362 -0
  104. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIGridCell.h +82 -0
  105. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIGridCell.m +298 -0
  106. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIImageView.h +110 -0
  107. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIImageView.m +541 -0
  108. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIKeyboard.h +74 -0
  109. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIKeyboard.m +243 -0
  110. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UILabel.h +46 -0
  111. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UILabel.m +99 -0
  112. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIMatrixView.h +124 -0
  113. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIMatrixView.m +821 -0
  114. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UINavigationBar.h +57 -0
  115. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UINavigationBar.m +161 -0
  116. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIOrientation.h +60 -0
  117. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIOrientation.m +146 -0
  118. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPageControl.h +61 -0
  119. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPageControl.m +190 -0
  120. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIProgressView.h +47 -0
  121. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIProgressView.m +113 -0
  122. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPullLoader.h +71 -0
  123. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIPullLoader.m +236 -0
  124. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIScrollView.h +146 -0
  125. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIScrollView.m +1487 -0
  126. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISegmentedControl.h +60 -0
  127. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISegmentedControl.m +192 -0
  128. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISignal.h +126 -0
  129. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UISignal.m +453 -0
  130. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITabBar.h +70 -0
  131. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITabBar.m +249 -0
  132. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextField.h +67 -0
  133. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextField.m +242 -0
  134. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextView.h +75 -0
  135. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITextView.m +311 -0
  136. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITipsView.h +184 -0
  137. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UITipsView.m +911 -0
  138. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIWebView.h +65 -0
  139. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIWebView.m +242 -0
  140. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIZoomView.h +91 -0
  141. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_UIZoomView.m +444 -0
  142. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_View.h +72 -0
  143. data/test.xctemplate/libs/BeeFramework/MVC/View/Bee_View.m +38 -0
  144. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/CGRect+BeeExtension.h +79 -0
  145. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/CGRect+BeeExtension.m +288 -0
  146. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIColor+BeeExtension.h +65 -0
  147. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIColor+BeeExtension.m +161 -0
  148. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIFont+BeeExtension.h +45 -0
  149. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIFont+BeeExtension.m +137 -0
  150. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIImage+BeeExtension.h +56 -0
  151. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIImage+BeeExtension.m +218 -0
  152. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeExtension.h +105 -0
  153. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeExtension.m +556 -0
  154. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeUISignal.h +53 -0
  155. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+BeeUISignal.m +104 -0
  156. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+HoldGesture.h +52 -0
  157. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+HoldGesture.m +170 -0
  158. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+PanGesture.h +54 -0
  159. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+PanGesture.m +166 -0
  160. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+SwipeGesture.h +54 -0
  161. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+SwipeGesture.m +184 -0
  162. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+TapGesture.h +57 -0
  163. data/test.xctemplate/libs/BeeFramework/MVC/View/Extension/UIView+TapGesture.m +275 -0
  164. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIBoard.h +212 -0
  165. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIBoard.m +1219 -0
  166. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStack.h +111 -0
  167. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStack.m +694 -0
  168. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStackGroup.h +71 -0
  169. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_UIStackGroup.m +258 -0
  170. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_ViewController.h +45 -0
  171. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Bee_ViewController.m +36 -0
  172. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeExtension.h +57 -0
  173. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeExtension.m +151 -0
  174. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeUISignal.h +53 -0
  175. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+BeeUISignal.m +92 -0
  176. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.h +72 -0
  177. data/test.xctemplate/libs/BeeFramework/MVC/ViewController/Extension/UIViewController+UINavigationBar.m +175 -0
  178. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UICollection.h +59 -0
  179. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UICollection.m +249 -0
  180. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UILayout.h +199 -0
  181. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UILayout.m +1170 -0
  182. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIQuery.h +113 -0
  183. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIQuery.m +710 -0
  184. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIStyle.h +66 -0
  185. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UIStyle.m +189 -0
  186. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplate.h +69 -0
  187. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplate.m +210 -0
  188. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateAndroid.h +45 -0
  189. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateAndroid.m +59 -0
  190. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateHTML.h +45 -0
  191. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateHTML.m +55 -0
  192. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateJSON.h +45 -0
  193. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateJSON.m +54 -0
  194. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateOmniGraffle.h +45 -0
  195. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateOmniGraffle.m +54 -0
  196. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateXML.h +45 -0
  197. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_UITemplateXML.m +438 -0
  198. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_ViewLayout.h +60 -0
  199. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Bee_ViewLayout.m +37 -0
  200. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIQuery+BeeUIStyle.h +45 -0
  201. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIQuery+BeeUIStyle.m +55 -0
  202. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIStyle+BeeUIQuery.h +45 -0
  203. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/BeeUIStyle+BeeUIQuery.m +55 -0
  204. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIButton+BeeUIStyle.h +41 -0
  205. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIButton+BeeUIStyle.m +100 -0
  206. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIImageView+BeeUIStyle.h +41 -0
  207. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIImageView+BeeUIStyle.m +101 -0
  208. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UILabel+BeeUIStyle.h +41 -0
  209. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UILabel+BeeUIStyle.m +48 -0
  210. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextField+BeeUIStyle.h +41 -0
  211. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextField+BeeUIStyle.m +77 -0
  212. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextView+BeeUIStyle.h +41 -0
  213. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UITextView+BeeUIStyle.m +47 -0
  214. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUILayout.h +52 -0
  215. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUILayout.m +177 -0
  216. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIQuery.h +44 -0
  217. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIQuery.m +57 -0
  218. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIStyle.h +50 -0
  219. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIView+BeeUIStyle.m +283 -0
  220. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUILayout.h +52 -0
  221. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUILayout.m +178 -0
  222. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIQuery.h +44 -0
  223. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIQuery.m +58 -0
  224. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIStyle.h +44 -0
  225. data/test.xctemplate/libs/BeeFramework/MVC/ViewLayout/Extension/UIViewController+BeeUIStyle.m +57 -0
  226. metadata +226 -3
@@ -0,0 +1,873 @@
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_Message.h
31
+ //
32
+
33
+ #import "Bee_Precompile.h"
34
+ #import "Bee_Core.h"
35
+ #import "Bee_Message.h"
36
+ #import "Bee_MessageQueue.h"
37
+ #import "Bee_Controller.h"
38
+
39
+ #import <objc/runtime.h>
40
+
41
+ #pragma mark -
42
+
43
+ #undef DEFAULT_TIMEOUT_SECONDS
44
+ #define DEFAULT_TIMEOUT_SECONDS (10.0f)
45
+
46
+ #pragma mark -
47
+
48
+ @interface BeeMessage(Private)
49
+ - (void)didMessageTimeout;
50
+ - (void)callResponder;
51
+ @end
52
+
53
+ #pragma mark -
54
+
55
+ @implementation BeeMessage
56
+
57
+ DEF_STRING( ERROR_DOMAIN_UNKNOWN, @"domain.unknown" )
58
+ DEF_STRING( ERROR_DOMAIN_SERVER, @"domain.server" )
59
+ DEF_STRING( ERROR_DOMAIN_CLIENT, @"domain.client" )
60
+ DEF_STRING( ERROR_DOMAIN_NETWORK, @"domain.network" )
61
+
62
+ DEF_INT( ERROR_CODE_OK, 0 )
63
+ DEF_INT( ERROR_CODE_UNKNOWN, -1 )
64
+ DEF_INT( ERROR_CODE_TIMEOUT, -2 )
65
+ DEF_INT( ERROR_CODE_PARAMS, -3 )
66
+ DEF_INT( ERROR_CODE_ROUTES, -4 )
67
+
68
+ DEF_INT( STATE_CREATED, 0 )
69
+ DEF_INT( STATE_SENDING, 1 )
70
+ DEF_INT( STATE_SUCCEED, 2 )
71
+ DEF_INT( STATE_FAILED, 3 )
72
+ DEF_INT( STATE_CANCELLED, 4 )
73
+ DEF_INT( STATE_WAITING, 5 )
74
+
75
+ @dynamic INPUT;
76
+ @dynamic OUTPUT;
77
+ @dynamic GET_INPUT;
78
+ @dynamic GET_OUTPUT;
79
+ @dynamic TIMEOUT;
80
+
81
+ @synthesize unique = _unique;
82
+ @synthesize disabled = _disabled;
83
+ @synthesize async = _async;
84
+ @synthesize timeout = _timeout;
85
+ @synthesize cached = _cached;
86
+ @synthesize emitted = _emitted;
87
+ @synthesize oneDirection = _oneDirection;
88
+ @synthesize seconds = _seconds;
89
+ @synthesize useCache = _useCache;
90
+
91
+ @synthesize toldProgress = _toldProgress;
92
+ @synthesize progressed = _progressed;
93
+
94
+ @synthesize responder = _responder;
95
+ @synthesize nextState = _nextState;
96
+ @synthesize state = _state;
97
+ @synthesize message = _message;
98
+ @synthesize input = _input;
99
+ @synthesize output = _output;
100
+ @synthesize executer = _executer;
101
+
102
+ @synthesize errorDomain = _errorDomain;
103
+ @synthesize errorCode = _errorCode;
104
+ @synthesize errorDesc = _errorDesc;
105
+
106
+ @synthesize initTimeStamp = _initTimeStamp;
107
+ @synthesize sendTimeStamp = _sendTimeStamp;
108
+ @synthesize recvTimeStamp = _recvTimeStamp;
109
+
110
+ @synthesize whenUpdate = _whenUpdate;
111
+
112
+ #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
113
+ @synthesize callstack = _callstack;
114
+ #endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
115
+
116
+ @synthesize created;
117
+ @synthesize arrived = _arrived;
118
+ @synthesize sending;
119
+ @synthesize waiting;
120
+ @synthesize succeed;
121
+ @synthesize failed;
122
+ @synthesize cancelled;
123
+
124
+ @synthesize timeElapsed;
125
+ @synthesize timeCostPending;
126
+ @synthesize timeCostOverAir;
127
+
128
+ - (id)init
129
+ {
130
+ self = [super init];
131
+ if ( self )
132
+ {
133
+ _unique = NO;
134
+ _async = YES;
135
+ _cached = NO;
136
+ _timeout = NO;
137
+ _seconds = DEFAULT_TIMEOUT_SECONDS;
138
+ _timer = nil;
139
+ _useCache = NO;
140
+
141
+ _nextState = BeeMessage.STATE_CREATED;
142
+ _state = BeeMessage.STATE_CREATED;
143
+ _message = [@"nil.nil" retain];
144
+ _input = [[NSMutableDictionary alloc] init];
145
+ _output = [[NSMutableDictionary alloc] init];
146
+ _responder = nil;
147
+ _executer = nil;
148
+
149
+ _errorCode = BeeMessage.ERROR_CODE_OK;
150
+ _errorDomain = nil;
151
+
152
+ _initTimeStamp = [NSDate timeIntervalSinceReferenceDate];
153
+ _sendTimeStamp = _initTimeStamp;
154
+ _recvTimeStamp = _initTimeStamp;
155
+
156
+ _arrived = NO;
157
+
158
+ self.whenUpdate = nil;
159
+
160
+ if ( [BeeMessageQueue sharedInstance].whenCreate )
161
+ {
162
+ [BeeMessageQueue sharedInstance].whenCreate( self );
163
+ }
164
+
165
+ #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
166
+ _callstack = [[NSMutableArray alloc] init];
167
+ #endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
168
+ }
169
+
170
+ return self;
171
+ }
172
+
173
+ - (NSString *)description
174
+ {
175
+ return [NSString stringWithFormat:@"msg '%@', state %d", self.message, self.state];
176
+ }
177
+
178
+ - (void)dealloc
179
+ {
180
+ [self cancelRequests];
181
+
182
+ [_timer invalidate];
183
+ [_message release];
184
+ [_input release];
185
+ [_output release];
186
+
187
+ [_errorDomain release];
188
+ [_errorDesc release];
189
+
190
+ #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
191
+ [_callstack removeAllObjects];
192
+ [_callstack release];
193
+ #endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
194
+
195
+ self.whenUpdate = nil;
196
+
197
+ [super dealloc];
198
+ }
199
+
200
+ + (BeeMessage *)message
201
+ {
202
+ return [[[BeeMessage alloc] init] autorelease];
203
+ }
204
+
205
+ + (BeeMessage *)message:(NSString *)msg
206
+ {
207
+ BeeMessage * bmsg = [[BeeMessage alloc] init];
208
+ bmsg.message = msg;
209
+ return [bmsg autorelease];
210
+ }
211
+
212
+ + (BeeMessage *)message:(NSString *)msg timeoutSeconds:(NSUInteger)seconds
213
+ {
214
+ BeeMessage * bmsg = [[BeeMessage alloc] init];
215
+ bmsg.message = msg;
216
+ bmsg.seconds = seconds ? seconds : DEFAULT_TIMEOUT_SECONDS;
217
+ return [bmsg autorelease];
218
+ }
219
+
220
+ + (BeeMessage *)message:(NSString *)msg responder:(id)responder
221
+ {
222
+ BeeMessage * bmsg = [[BeeMessage alloc] init];
223
+ bmsg.message = msg;
224
+ bmsg.responder = responder;
225
+ return [bmsg autorelease];
226
+ }
227
+
228
+ + (BeeMessage *)message:(NSString *)msg responder:(id)responder timeoutSeconds:(NSUInteger)seconds
229
+ {
230
+ BeeMessage * bmsg = [[BeeMessage alloc] init];
231
+ bmsg.message = msg;
232
+ bmsg.responder = responder;
233
+ bmsg.seconds = seconds ? seconds : DEFAULT_TIMEOUT_SECONDS;
234
+ return [bmsg autorelease];
235
+ }
236
+
237
+ - (void)didMessageTimeout
238
+ {
239
+ _timer = nil;
240
+ _timeout = YES;
241
+ _emitted = NO;
242
+
243
+ [self changeState:BeeMessage.STATE_CANCELLED];
244
+ }
245
+
246
+ - (void)internalStartTimer
247
+ {
248
+ if ( YES == _emitted || nil == _executer )
249
+ return;
250
+
251
+ [_timer invalidate];
252
+ _timer = nil;
253
+
254
+ if ( _seconds > 0.0f )
255
+ {
256
+ _timer = [NSTimer scheduledTimerWithTimeInterval:_seconds
257
+ target:self
258
+ selector:@selector(didMessageTimeout)
259
+ userInfo:nil
260
+ repeats:NO];
261
+ }
262
+
263
+ _emitted = YES;
264
+ }
265
+
266
+ - (void)internalStopTimer
267
+ {
268
+ if ( NO == _emitted || nil == _executer )
269
+ return;
270
+
271
+ [_timer invalidate];
272
+ _timer = nil;
273
+
274
+ _emitted = NO;
275
+ }
276
+
277
+ - (void)internalNotifySending
278
+ {
279
+ _sendTimeStamp = [NSDate timeIntervalSinceReferenceDate];
280
+ _recvTimeStamp = _sendTimeStamp;
281
+
282
+ if ( NO == self.disabled )
283
+ {
284
+ if ( self.whenUpdate )
285
+ {
286
+ self.whenUpdate( self );
287
+ }
288
+
289
+ [self callResponder];
290
+ }
291
+ }
292
+
293
+ - (void)internalNotifySucceed
294
+ {
295
+ _recvTimeStamp = [NSDate timeIntervalSinceReferenceDate];
296
+
297
+ if ( NO == self.disabled )
298
+ {
299
+ if ( self.whenUpdate )
300
+ {
301
+ self.whenUpdate( self );
302
+ }
303
+
304
+ [self callResponder];
305
+ }
306
+ }
307
+
308
+ - (void)internalNotifyFailed
309
+ {
310
+ _recvTimeStamp = [NSDate timeIntervalSinceReferenceDate];
311
+
312
+ if ( NO == self.disabled )
313
+ {
314
+ if ( self.whenUpdate )
315
+ {
316
+ self.whenUpdate( self );
317
+ }
318
+
319
+ [self callResponder];
320
+ }
321
+ }
322
+
323
+ - (void)internalNotifyCancelled
324
+ {
325
+ _recvTimeStamp = [NSDate timeIntervalSinceReferenceDate];
326
+
327
+ if ( NO == self.disabled )
328
+ {
329
+ if ( self.whenUpdate )
330
+ {
331
+ self.whenUpdate( self );
332
+ }
333
+
334
+ [self callResponder];
335
+ }
336
+ }
337
+
338
+ - (void)internalNotifyProgressUpdated
339
+ {
340
+ if ( NO == _toldProgress )
341
+ return;
342
+
343
+ _state = BeeMessage.STATE_WAITING;
344
+ _progressed = YES;
345
+
346
+ if ( NO == self.disabled )
347
+ {
348
+ if ( self.whenUpdate )
349
+ {
350
+ self.whenUpdate( self );
351
+ }
352
+
353
+ [self callResponder];
354
+ }
355
+
356
+ _progressed = NO;
357
+ }
358
+
359
+ - (void)callResponder
360
+ {
361
+ [self forwardResponder:self.responder];
362
+ }
363
+
364
+ - (void)forwardResponder:(NSObject *)obj
365
+ {
366
+ if ( nil == obj )
367
+ return;
368
+
369
+ NSArray * array = [_message componentsSeparatedByString:@"."];
370
+ if ( array && array.count > 1 )
371
+ {
372
+ // NSString * prefix = (NSString *)[array objectAtIndex:0];
373
+ NSString * clazz = (NSString *)[array objectAtIndex:1];
374
+ NSString * name = (NSString *)[array objectAtIndex:2];
375
+
376
+ #if defined(__BEE_SELECTOR_STYLE2__) && __BEE_SELECTOR_STYLE2__
377
+ {
378
+ NSString * selectorName;
379
+ SEL selector;
380
+
381
+ selectorName = [NSString stringWithFormat:@"handleMessage_%@_%@:", clazz, name];
382
+ selector = NSSelectorFromString(selectorName);
383
+
384
+ if ( [obj respondsToSelector:selector] )
385
+ {
386
+ [obj performSelector:selector withObject:self];
387
+ return;
388
+ }
389
+
390
+ selectorName = [NSString stringWithFormat:@"handleMessage_%@:", clazz];
391
+ selector = NSSelectorFromString(selectorName);
392
+
393
+ if ( [obj respondsToSelector:selector] )
394
+ {
395
+ [obj performSelector:selector withObject:self];
396
+ return;
397
+ }
398
+ }
399
+ #endif // #if defined(__BEE_SELECTOR_STYLE2__) && __BEE_SELECTOR_STYLE2__
400
+
401
+ #if defined(__BEE_SELECTOR_STYLE1__) && __BEE_SELECTOR_STYLE1__
402
+ {
403
+ NSString * selectorName;
404
+ SEL selector;
405
+
406
+ selectorName = [NSString stringWithFormat:@"handle%@:", clazz];
407
+ selector = NSSelectorFromString( selectorName );
408
+
409
+ if ( [obj respondsToSelector:selector] )
410
+ {
411
+ [obj performSelector:selector withObject:self];
412
+ return;
413
+ }
414
+ }
415
+ #endif // #if defined(__BEE_SELECTOR_STYLE1__) && __BEE_SELECTOR_STYLE1__
416
+ }
417
+
418
+ if ( obj && [obj respondsToSelector:@selector(handleMessage:)] )
419
+ {
420
+ [obj performSelector:@selector(handleMessage) withObject:self];
421
+ }
422
+ }
423
+
424
+ - (BeeMessage *)send
425
+ {
426
+ if ( YES == _emitted )
427
+ return self;
428
+
429
+ #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
430
+ [_callstack addObjectsFromArray:[BeeRuntime callstack:16]];
431
+ #endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
432
+
433
+ [[BeeMessageQueue sharedInstance] sendMessage:self];
434
+ return self;
435
+ }
436
+
437
+ - (BeeMessage *)input:(id)first, ...
438
+ {
439
+ va_list args;
440
+ va_start( args, first );
441
+
442
+ for ( ;; )
443
+ {
444
+ NSObject<NSCopying> * key = [self.input count] ? va_arg( args, NSObject * ) : first;
445
+ if ( nil == key )
446
+ break;
447
+
448
+ NSObject * value = va_arg( args, NSObject * );
449
+ if ( nil == value )
450
+ break;
451
+
452
+ // CC( @"input, %@ = %@", [key description], [value description] );
453
+
454
+ [self.input setObject:value forKey:key];
455
+ }
456
+
457
+ va_end( args );
458
+ return self;
459
+ }
460
+
461
+ - (BeeMessage *)output:(id)first, ...
462
+ {
463
+ va_list args;
464
+ va_start( args, first );
465
+
466
+ for ( ;; )
467
+ {
468
+ NSObject<NSCopying> * key = [self.output count] ? va_arg( args, NSObject * ) : first;
469
+ if ( nil == key )
470
+ break;
471
+
472
+ NSObject * value = va_arg( args, NSObject * );
473
+ if ( nil == value )
474
+ break;
475
+
476
+ CC( @"output, %@ = %@", [key description], [value description] );
477
+
478
+ [self.output setObject:value forKey:key];
479
+ }
480
+
481
+ va_end( args );
482
+ return self;
483
+ }
484
+
485
+ - (BeeMessage *)cancel
486
+ {
487
+ if ( NO == _emitted || nil == _executer )
488
+ return self;
489
+
490
+ [self changeState:BeeMessage.STATE_CANCELLED];
491
+ return self;
492
+ }
493
+
494
+ - (BeeMessage *)reset
495
+ {
496
+ [self cancelRequests];
497
+ [self internalStopTimer];
498
+
499
+ self.responder = nil;
500
+ self.whenUpdate = nil;
501
+
502
+ _initTimeStamp = [NSDate timeIntervalSinceReferenceDate];
503
+ _sendTimeStamp = _initTimeStamp;
504
+ _recvTimeStamp = _sendTimeStamp;
505
+
506
+ return self;
507
+ }
508
+
509
+ - (NSTimeInterval)timeElapsed
510
+ {
511
+ return _recvTimeStamp - _initTimeStamp;
512
+ }
513
+
514
+ - (NSTimeInterval)timeCostPending
515
+ {
516
+ return _sendTimeStamp - _initTimeStamp;
517
+ }
518
+
519
+ - (NSTimeInterval)timeCostOverAir
520
+ {
521
+ return _recvTimeStamp - _sendTimeStamp;
522
+ }
523
+
524
+ - (BOOL)is:(NSString *)name
525
+ {
526
+ return [_message isEqualToString:name];
527
+ }
528
+
529
+ - (BOOL)isKindOf:(NSString *)prefix
530
+ {
531
+ return [_message hasPrefix:prefix];
532
+ }
533
+
534
+ - (BOOL)isTwinWith:(BeeMessage *)msg
535
+ {
536
+ if ( self == msg )
537
+ {
538
+ return YES;
539
+ }
540
+
541
+ if ( [_message isEqualToString:msg.message] && _responder == msg.responder )
542
+ {
543
+ return YES;
544
+ }
545
+ else
546
+ {
547
+ return NO;
548
+ }
549
+ }
550
+
551
+ - (void)setLastError
552
+ {
553
+ self.errorCode = BeeMessage.ERROR_CODE_UNKNOWN;
554
+ self.errorDomain = BeeMessage.ERROR_DOMAIN_UNKNOWN;
555
+ self.errorDesc = @"unknown";
556
+ }
557
+
558
+ - (void)setLastError:(NSInteger)code
559
+ {
560
+ self.errorCode = code;
561
+ self.errorDomain = BeeMessage.ERROR_DOMAIN_UNKNOWN;
562
+ self.errorDesc = @"unknown";
563
+ }
564
+
565
+ - (void)setLastError:(NSInteger)code domain:(NSString *)domain
566
+ {
567
+ self.errorCode = code;
568
+ self.errorDomain = domain;
569
+ self.errorDesc = @"";
570
+ }
571
+
572
+ - (void)setLastError:(NSInteger)code domain:(NSString *)domain desc:(NSString *)desc
573
+ {
574
+ self.errorCode = code;
575
+ self.errorDomain = domain;
576
+ self.errorDesc = desc ? desc : @"";
577
+ }
578
+
579
+ - (BOOL)created
580
+ {
581
+ return BeeMessage.STATE_CREATED == _state ? YES : NO;
582
+ }
583
+
584
+ - (void)setCreated:(BOOL)flag
585
+ {
586
+ if ( flag )
587
+ {
588
+ _nextState = BeeMessage.STATE_CREATED;
589
+ }
590
+ }
591
+
592
+ - (BOOL)sending
593
+ {
594
+ return BeeMessage.STATE_SENDING == _state ? YES : NO;
595
+ }
596
+
597
+ - (void)setSending:(BOOL)flag
598
+ {
599
+ if ( flag )
600
+ {
601
+ _nextState = BeeMessage.STATE_SENDING;
602
+ }
603
+ }
604
+
605
+ - (BOOL)waiting
606
+ {
607
+ return BeeMessage.STATE_WAITING == _state ? YES : NO;
608
+ }
609
+
610
+ - (void)setWaiting:(BOOL)flag
611
+ {
612
+ if ( flag )
613
+ {
614
+ _nextState = BeeMessage.STATE_WAITING;
615
+ }
616
+ }
617
+
618
+ - (BOOL)succeed
619
+ {
620
+ return BeeMessage.STATE_SUCCEED == _state ? YES : NO;
621
+ }
622
+
623
+ - (void)setSucceed:(BOOL)flag
624
+ {
625
+ if ( flag )
626
+ {
627
+ _nextState = BeeMessage.STATE_SUCCEED;
628
+ }
629
+ else
630
+ {
631
+ _nextState = BeeMessage.STATE_FAILED;
632
+ }
633
+ }
634
+
635
+ - (BOOL)failed
636
+ {
637
+ return BeeMessage.STATE_FAILED == _state ? YES : NO;
638
+ }
639
+
640
+ - (void)setFailed:(BOOL)flag
641
+ {
642
+ if ( flag )
643
+ {
644
+ _nextState = BeeMessage.STATE_FAILED;
645
+ }
646
+ }
647
+
648
+ - (BOOL)cancelled
649
+ {
650
+ return BeeMessage.STATE_CANCELLED == _state ? YES : NO;
651
+ }
652
+
653
+ - (void)setCancelled:(BOOL)flag
654
+ {
655
+ if ( flag )
656
+ {
657
+ _nextState = BeeMessage.STATE_CANCELLED;
658
+ }
659
+ }
660
+
661
+ - (void)runloop
662
+ {
663
+ if ( _nextState != _state )
664
+ {
665
+ [self changeState:_nextState];
666
+ }
667
+ }
668
+
669
+ - (void)changeState:(NSInteger)newState
670
+ {
671
+ BOOL shouldRemove = NO;
672
+
673
+ if ( _state == newState )
674
+ return;
675
+
676
+ CC( @"msg '%@', state %d => %d", _message, _state, newState );
677
+
678
+ _state = newState;
679
+ _nextState = newState;
680
+
681
+ if ( BeeMessage.STATE_CREATED != _state )
682
+ {
683
+ if ( NO == _arrived )
684
+ {
685
+ // TODO:
686
+ _arrived = YES;
687
+ }
688
+ }
689
+
690
+ // Find an executer
691
+ if ( nil == _executer )
692
+ {
693
+ self.executer = [BeeController routes:_message];
694
+ if ( nil == self.executer )
695
+ return;
696
+ }
697
+
698
+ if ( [_executer respondsToSelector:@selector(route:)] )
699
+ {
700
+ [_executer route:self];
701
+ }
702
+ else
703
+ {
704
+ [_executer index:self];
705
+ }
706
+
707
+ if ( BeeMessage.ERROR_CODE_OK != _errorCode )
708
+ {
709
+ _state = BeeMessage.STATE_FAILED;
710
+ }
711
+
712
+ if ( BeeMessage.STATE_CREATED == _state )
713
+ {
714
+ // TODO: nothing to do
715
+ }
716
+ else if ( BeeMessage.STATE_SENDING == _state )
717
+ {
718
+ #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
719
+ CC( @"[REQUEST]\n'%@'.parameters = %@", _message, [_input description] );
720
+ #endif //#if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
721
+
722
+ if ( self.oneDirection )
723
+ {
724
+ [self internalStopTimer];
725
+ [self internalNotifySucceed];
726
+
727
+ shouldRemove = YES;
728
+ }
729
+ else
730
+ {
731
+ [self internalStartTimer];
732
+ [self internalNotifySending];
733
+ }
734
+ }
735
+ else if ( BeeMessage.STATE_WAITING == _state )
736
+ {
737
+ // TODO: nothing to do
738
+ }
739
+ else if ( BeeMessage.STATE_SUCCEED == _state )
740
+ {
741
+ if ( _nextState == _state )
742
+ {
743
+ #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
744
+ CC( @"[SUCCEED]\n'%@'.input = \n%@\n'%@'.output = \n%@\n",
745
+ _message, [_input description],
746
+ _message, [_output description]
747
+ );
748
+ #endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
749
+
750
+ [self internalStopTimer];
751
+ [self internalNotifySucceed];
752
+
753
+ shouldRemove = YES;
754
+ }
755
+ }
756
+ else if ( BeeMessage.STATE_FAILED == _state )
757
+ {
758
+ if ( _nextState == _state )
759
+ {
760
+ #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
761
+ CC( @"[FAILED]\n'%@'.input = \n%@\n", _message, [_input description] );
762
+ #endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
763
+
764
+ [self internalStopTimer];
765
+ [self internalNotifyFailed];
766
+
767
+ shouldRemove = YES;
768
+ }
769
+ }
770
+ else if ( BeeMessage.STATE_CANCELLED == _state )
771
+ {
772
+ if ( _nextState == _state )
773
+ {
774
+ #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
775
+ CC( @"[CANCELLED]\n'%@'.input = %@", _message, [_input description] );
776
+ #endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
777
+
778
+ [self cancelRequests];
779
+
780
+ [self internalStopTimer];
781
+ [self internalNotifyCancelled];
782
+
783
+ shouldRemove = YES;
784
+ }
785
+ }
786
+
787
+ if ( [BeeMessageQueue sharedInstance].whenUpdate )
788
+ {
789
+ [BeeMessageQueue sharedInstance].whenUpdate( self );
790
+ }
791
+
792
+ if ( shouldRemove )
793
+ {
794
+ [[BeeMessageQueue sharedInstance] removeMessage:self];
795
+ }
796
+ }
797
+
798
+ - (BeeMessageObjectBlockN)GET_INPUT
799
+ {
800
+ BeeMessageObjectBlockN block = ^ id ( id first, ... )
801
+ {
802
+ return [self.input objectAtPath:(NSString *)first];
803
+ };
804
+
805
+ return [[block copy] autorelease];
806
+ }
807
+
808
+ - (BeeMessageObjectBlockN)GET_OUTPUT
809
+ {
810
+ BeeMessageObjectBlockN block = ^ id ( id first, ... )
811
+ {
812
+ return [self.output objectAtPath:(NSString *)first];
813
+ };
814
+
815
+ return [[block copy] autorelease];
816
+ }
817
+
818
+ - (BeeMessageBlockN)INPUT
819
+ {
820
+ BeeMessageBlockN block = ^ BeeMessage * ( id first, ... )
821
+ {
822
+ va_list args;
823
+ va_start( args, first );
824
+
825
+ NSString * key = (NSString *)first;
826
+ NSObject * value = va_arg( args, NSObject * );
827
+
828
+ if ( key && value )
829
+ {
830
+ [self.input setObject:value atPath:key];
831
+ }
832
+
833
+ va_end( args );
834
+ return self;
835
+ };
836
+
837
+ return [[block copy] autorelease];
838
+ }
839
+
840
+ - (BeeMessageBlockN)OUTPUT
841
+ {
842
+ BeeMessageBlockN block = ^ BeeMessage * ( id first, ... )
843
+ {
844
+ va_list args;
845
+ va_start( args, first );
846
+
847
+ NSString * key = (NSString *)first;
848
+ NSObject * value = va_arg( args, NSObject * );
849
+
850
+ if ( key && value )
851
+ {
852
+ [self.output setObject:value atPath:key];
853
+ }
854
+
855
+ va_end( args );
856
+ return self;
857
+ };
858
+
859
+ return [[block copy] autorelease];
860
+ }
861
+
862
+ - (BeeMessageBlockT)TIMEOUT
863
+ {
864
+ BeeMessageBlockT block = ^ BeeMessage * ( NSTimeInterval time )
865
+ {
866
+ self.seconds = time;
867
+ return self;
868
+ };
869
+
870
+ return [[block copy] autorelease];
871
+ }
872
+
873
+ @end