motion-yapper 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 (296) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -2
  3. data/.travis.yml +2 -0
  4. data/Gemfile +1 -0
  5. data/README.md +1 -1
  6. data/Rakefile +1 -1
  7. data/lib/motion-yapper.rb +1 -0
  8. data/lib/yapper.rb +3 -5
  9. data/lib/yapper/config.rb +2 -0
  10. data/lib/yapper/db.rb +105 -40
  11. data/lib/yapper/document.rb +7 -4
  12. data/lib/yapper/document/callbacks.rb +0 -7
  13. data/lib/yapper/document/{persistance.rb → persistence.rb} +27 -21
  14. data/lib/yapper/document/relation.rb +29 -22
  15. data/lib/yapper/document/selection.rb +122 -54
  16. data/lib/yapper/extensions.rb +12 -24
  17. data/lib/yapper/settings.rb +43 -0
  18. data/lib/yapper/timestamps.rb +2 -0
  19. data/lib/yapper/version.rb +1 -1
  20. data/{yapper.gemspec → motion-yapper.gemspec} +0 -0
  21. data/spec/integration/{where_spec.rb → criteria_spec.rb} +78 -10
  22. data/spec/integration/db_spec.rb +70 -0
  23. data/spec/integration/defaults_spec.rb +37 -0
  24. data/spec/integration/extensions_spec.rb +14 -0
  25. data/spec/integration/{persistance_spec.rb → persistence_spec.rb} +0 -0
  26. data/spec/integration/relation_spec.rb +4 -4
  27. data/vendor/Podfile.lock +9 -11
  28. data/vendor/Pods/.build/libPods-CocoaLumberjack.a +0 -0
  29. data/vendor/Pods/.build/libPods-NSData+MD5Digest.a +0 -0
  30. data/vendor/Pods/.build/libPods-YapDatabase.a +0 -0
  31. data/vendor/Pods/.build/libPods.a +0 -0
  32. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +4 -4
  33. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
  34. data/vendor/Pods/{CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.h → BuildHeaders/CocoaLumberjack/DDContextFilterLogFormatter.h} +6 -8
  35. data/vendor/Pods/BuildHeaders/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
  36. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +67 -32
  37. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog+LOGV.h +99 -0
  38. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +98 -65
  39. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDMultiFormatter.h +30 -0
  40. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +39 -25
  41. data/vendor/Pods/BuildHeaders/YapDatabase/NSDictionary+YapDatabase.h +8 -0
  42. data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +1 -0
  43. data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +3 -0
  44. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +4 -4
  45. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +21 -19
  46. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +1 -1
  47. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +35 -31
  48. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +8 -35
  49. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -2
  50. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
  51. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
  52. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +8 -0
  53. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +43 -21
  54. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationship.h +35 -0
  55. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
  56. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
  57. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdgePrivate.h +79 -0
  58. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
  59. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
  60. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipPrivate.h +125 -0
  61. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
  62. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
  63. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +10 -0
  64. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
  65. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +131 -21
  66. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +48 -107
  67. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +2 -2
  68. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +1 -0
  69. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +17 -0
  70. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +10 -3
  71. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +18 -1
  72. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +75 -24
  73. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTypes.h +99 -0
  74. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +4 -4
  75. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +51 -50
  76. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +14 -14
  77. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +546 -546
  78. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +67 -32
  79. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1093 -907
  80. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog+LOGV.h +99 -0
  81. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +98 -65
  82. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +873 -748
  83. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +39 -25
  84. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +1284 -1243
  85. data/vendor/Pods/{BuildHeaders/CocoaLumberjack/ContextFilterLogFormatter.h → CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.h} +6 -8
  86. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{ContextFilterLogFormatter.m → DDContextFilterLogFormatter.m} +70 -70
  87. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
  88. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.m +253 -0
  89. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.h +30 -0
  90. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.m +127 -0
  91. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +1 -1
  92. data/vendor/Pods/CocoaLumberjack/README.markdown +52 -15
  93. data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +4 -4
  94. data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
  95. data/vendor/Pods/Headers/CocoaLumberjack/{ContextFilterLogFormatter.h → DDContextFilterLogFormatter.h} +6 -8
  96. data/vendor/Pods/Headers/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
  97. data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +67 -32
  98. data/vendor/Pods/Headers/CocoaLumberjack/DDLog+LOGV.h +99 -0
  99. data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +98 -65
  100. data/vendor/Pods/Headers/CocoaLumberjack/DDMultiFormatter.h +30 -0
  101. data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +39 -25
  102. data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +3 -0
  103. data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +4 -4
  104. data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +21 -19
  105. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +8 -35
  106. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
  107. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
  108. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationship.h +35 -0
  109. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
  110. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
  111. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
  112. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
  113. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
  114. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
  115. data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +131 -21
  116. data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +48 -107
  117. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +2 -2
  118. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +1 -0
  119. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +17 -0
  120. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +10 -3
  121. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +75 -24
  122. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTypes.h +99 -0
  123. data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +2 -0
  124. data/vendor/Pods/Headers/____Pods-environment.h +15 -15
  125. data/vendor/Pods/Manifest.lock +9 -11
  126. data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +1 -1
  127. data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +2 -0
  128. data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +1 -1
  129. data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +1 -1
  130. data/vendor/Pods/{Pods-Acknowledgements.markdown → Pods-acknowledgements.markdown} +0 -37
  131. data/vendor/Pods/{Pods-Acknowledgements.plist → Pods-acknowledgements.plist} +0 -45
  132. data/vendor/Pods/Pods-environment.h +15 -15
  133. data/vendor/Pods/Pods.xcconfig +3 -3
  134. data/vendor/Pods/Pods.xcodeproj/project.pbxproj +2426 -3155
  135. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-CocoaLumberjack.xcscheme +59 -0
  136. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-NSData+MD5Digest.xcscheme +59 -0
  137. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-YapDatabase.xcscheme +59 -0
  138. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods.xcscheme +59 -0
  139. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/xcschememanagement.plist +31 -0
  140. data/vendor/Pods/YapDatabase/README.md +3 -1
  141. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +0 -2
  142. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +8 -35
  143. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +25 -41
  144. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +17 -17
  145. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +403 -134
  146. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTypes.h +32 -0
  147. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +8 -0
  148. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +8 -8
  149. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +113 -62
  150. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +35 -31
  151. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +25 -0
  152. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +1 -1
  153. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +25 -1
  154. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipEdgePrivate.h +79 -0
  155. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipPrivate.h +125 -0
  156. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.h +35 -0
  157. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.m +129 -0
  158. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.h +29 -0
  159. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.m +802 -0
  160. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.h +163 -0
  161. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.m +408 -0
  162. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipNode.h +99 -0
  163. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.h +59 -0
  164. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.m +29 -0
  165. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.h +384 -0
  166. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.m +5254 -0
  167. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +10 -0
  168. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
  169. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +49 -0
  170. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +12 -0
  171. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +9 -8
  172. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +62 -1
  173. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +148 -45
  174. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +18 -1
  175. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +2 -2
  176. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +15 -9
  177. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +17 -0
  178. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +211 -64
  179. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +48 -107
  180. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +10 -7
  181. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +1 -0
  182. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +13 -22
  183. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +10 -3
  184. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +75 -24
  185. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +725 -244
  186. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTypes.h +99 -0
  187. data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.h +8 -0
  188. data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.m +19 -0
  189. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +1 -0
  190. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +12 -0
  191. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +1 -1
  192. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +3 -3
  193. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +43 -21
  194. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +4 -0
  195. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +3 -0
  196. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +5 -0
  197. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +4 -4
  198. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +84 -93
  199. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +21 -19
  200. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +381 -209
  201. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +131 -21
  202. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +587 -267
  203. data/vendor/Pods/{Pods.bridgesupport → build-iPhoneSimulator/Pods.bridgesupport} +633 -2557
  204. data/vendor/Pods/build-iPhoneSimulator/libPods.a +0 -0
  205. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +2 -1
  206. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +2 -1
  207. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +4 -2
  208. metadata +80 -108
  209. data/Gemfile.lock +0 -63
  210. data/lib/yapper/attachment.rb +0 -48
  211. data/lib/yapper/document/attachment.rb +0 -26
  212. data/lib/yapper/sync.rb +0 -134
  213. data/lib/yapper/sync/data.rb +0 -12
  214. data/lib/yapper/sync/event.rb +0 -194
  215. data/lib/yapper/sync/queue.rb +0 -164
  216. data/spec/integration/all_spec.rb +0 -40
  217. data/spec/integration/sync_spec.rb +0 -42
  218. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +0 -641
  219. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +0 -1396
  220. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +0 -133
  221. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +0 -327
  222. data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +0 -113
  223. data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +0 -321
  224. data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +0 -71
  225. data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +0 -150
  226. data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
  227. data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +0 -157
  228. data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +0 -43
  229. data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +0 -68
  230. data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +0 -143
  231. data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +0 -370
  232. data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +0 -848
  233. data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +0 -89
  234. data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +0 -167
  235. data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +0 -78
  236. data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +0 -191
  237. data/vendor/Pods/AFNetworking/LICENSE +0 -19
  238. data/vendor/Pods/AFNetworking/README.md +0 -208
  239. data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +0 -641
  240. data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +0 -133
  241. data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +0 -113
  242. data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +0 -71
  243. data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
  244. data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +0 -43
  245. data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +0 -68
  246. data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +0 -370
  247. data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +0 -89
  248. data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +0 -78
  249. data/vendor/Pods/BuildHeaders/Reachability/Reachability.h +0 -109
  250. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.m +0 -251
  251. data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +0 -641
  252. data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +0 -133
  253. data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +0 -113
  254. data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +0 -71
  255. data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
  256. data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +0 -43
  257. data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +0 -68
  258. data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +0 -370
  259. data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +0 -89
  260. data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +0 -78
  261. data/vendor/Pods/Headers/Reachability/Reachability.h +0 -109
  262. data/vendor/Pods/Headers/YapDatabase/YapCache.h +0 -90
  263. data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnectionState.h +0 -29
  264. data/vendor/Pods/Headers/YapDatabase/YapDatabaseDefaults.h +0 -37
  265. data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionPrivate.h +0 -440
  266. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -19
  267. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchPrivate.h +0 -69
  268. data/vendor/Pods/Headers/YapDatabase/YapDatabaseLogging.h +0 -158
  269. data/vendor/Pods/Headers/YapDatabase/YapDatabaseManager.h +0 -17
  270. data/vendor/Pods/Headers/YapDatabase/YapDatabasePrivate.h +0 -424
  271. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +0 -73
  272. data/vendor/Pods/Headers/YapDatabase/YapDatabaseStatement.h +0 -13
  273. data/vendor/Pods/Headers/YapDatabase/YapDatabaseString.h +0 -121
  274. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChangePrivate.h +0 -94
  275. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappingsPrivate.h +0 -72
  276. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPage.h +0 -36
  277. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPageMetadata.h +0 -27
  278. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPrivate.h +0 -153
  279. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +0 -17
  280. data/vendor/Pods/Headers/YapDatabase/YapMemoryTable.h +0 -74
  281. data/vendor/Pods/Headers/YapDatabase/YapNull.h +0 -17
  282. data/vendor/Pods/Headers/YapDatabase/YapTouch.h +0 -15
  283. data/vendor/Pods/Headers/____Pods-AFNetworking-prefix.h +0 -17
  284. data/vendor/Pods/Headers/____Pods-Reachability-prefix.h +0 -5
  285. data/vendor/Pods/Pods-AFNetworking-Private.xcconfig +0 -5
  286. data/vendor/Pods/Pods-AFNetworking-dummy.m +0 -5
  287. data/vendor/Pods/Pods-AFNetworking-prefix.pch +0 -17
  288. data/vendor/Pods/Pods-AFNetworking.xcconfig +0 -1
  289. data/vendor/Pods/Pods-Reachability-Private.xcconfig +0 -5
  290. data/vendor/Pods/Pods-Reachability-dummy.m +0 -5
  291. data/vendor/Pods/Pods-Reachability-prefix.pch +0 -5
  292. data/vendor/Pods/Pods-Reachability.xcconfig +0 -1
  293. data/vendor/Pods/Reachability/LICENCE.txt +0 -24
  294. data/vendor/Pods/Reachability/README.md +0 -65
  295. data/vendor/Pods/Reachability/Reachability.h +0 -109
  296. data/vendor/Pods/Reachability/Reachability.m +0 -527
@@ -1,9 +1,13 @@
1
1
  #import <Foundation/Foundation.h>
2
2
 
3
3
  #import "YapDatabaseExtension.h"
4
+ #import "YapDatabaseViewTypes.h"
4
5
  #import "YapDatabaseViewOptions.h"
5
6
  #import "YapDatabaseViewConnection.h"
6
7
  #import "YapDatabaseViewTransaction.h"
8
+ #import "YapDatabaseViewMappings.h"
9
+ #import "YapDatabaseViewChange.h"
10
+ #import "YapDatabaseViewRangeOptions.h"
7
11
 
8
12
  /**
9
13
  * Welcome to YapDatabase!
@@ -22,122 +26,46 @@
22
26
  * Just in case you don't have Internet access,
23
27
  * see the quick overview in YapDatabaseView.h.
24
28
  **/
29
+ @interface YapDatabaseView : YapDatabaseExtension
25
30
 
26
- /**
27
- * The grouping block handles both filtering and grouping.
28
- *
29
- * When you add or update rows in the databse the grouping block is invoked.
30
- * Your grouping block can inspect the row and determine if it should be a part of the view.
31
- * If not, your grouping block simply returns 'nil' and the object is excluded from the view (removing it if needed).
32
- * Otherwise your grouping block returns a group, which can be any string you want.
33
- * Once the view knows what group the row belongs to,
34
- * it will then determine the position of the row within the group (using the sorting block).
35
- *
36
- * You should choose a block type that takes the minimum number of required parameters.
37
- * The view can make various optimizations based on required parameters of the block.
38
- **/
39
- typedef id YapDatabaseViewGroupingBlock; // One of the YapDatabaseViewGroupingX types below.
31
+ /* Inherited from YapDatabaseExtension
32
+
33
+ @property (nonatomic, strong, readonly) NSString *registeredName;
40
34
 
41
- typedef NSString* (^YapDatabaseViewGroupingWithKeyBlock)(NSString *collection, NSString *key);
42
- typedef NSString* (^YapDatabaseViewGroupingWithObjectBlock)(NSString *collection, NSString *key, id object);
43
- typedef NSString* (^YapDatabaseViewGroupingWithMetadataBlock)(NSString *collection, NSString *key, id metadata);
44
- typedef NSString* (^YapDatabaseViewGroupingWithRowBlock)(NSString *collection, NSString *key, id object, id metadata);
35
+ */
45
36
 
46
37
  /**
47
- * The sorting block handles sorting of objects within their group.
38
+ * See the wiki for an example of how to initialize a view:
39
+ * https://github.com/yaptv/YapDatabase/wiki/Views#wiki-initializing_a_view
48
40
  *
49
- * After the view invokes the grouping block to determine what group a database row belongs to (if any),
50
- * the view then needs to determine what index within that group the row should be.
51
- * In order to do this, it needs to compare the new/updated row with existing rows in the same view group.
52
- * This is what the sorting block is used for.
53
- * So the sorting block will be invoked automatically during this process until the view has come to a conclusion.
41
+ * @param groupingBlock
54
42
  *
55
- * You should choose a block type that takes the minimum number of required parameters.
56
- * The view can make various optimizations based on required parameters of the block.
43
+ * The grouping block handles both filtering and grouping.
44
+ *
45
+ * @see YapDatabaseViewTypes.h for block type definition(s).
57
46
  *
58
- * For example, if sorting is based on the object, and the metadata of a row is updated,
59
- * then the view can deduce that the index hasn't changed (if the group hans't), and can skip this step.
47
+ * @param groupingBlockType
60
48
  *
61
- * Performance Note:
49
+ * Specify the type of groupingBlock that is being passed.
50
+ *
51
+ * @see YapDatabaseViewTypes.h for block type definition(s).
62
52
  *
63
- * The view uses various optimizations (based on common patterns)
64
- * to reduce the number of times it needs to invoke the sorting block.
65
- *
66
- * - Pattern : row is updated, but its index in the view doesn't change.
67
- * Optimization : if an updated row doesn't change groups, the view will first compare it with
68
- * objects to the left and right.
69
- *
70
- * - Pattern : rows are added to the beginning or end or a view
71
- * Optimization : if the last change put an object at the beginning of the view, then it will test this quickly.
72
- * if the last change put an object at the end of the view, then it will test this quickly.
53
+ * @param sortingBlock
73
54
  *
74
- * These optimizations offer huge performance benefits to many common cases.
75
- * For example, adding objects to a view that are sorted by timestamp of when they arrived.
76
- *
77
- * The optimizations are not always performed.
78
- * That is, if the row is added to a group it didn't previously belong,
79
- * or if the last change didn't place an item at the beginning or end of the view.
80
- *
81
- * If optimizations fail, or are skipped, then the view uses a binary search algorithm.
55
+ * The sorting block handles sorting of objects within their group.
56
+ *
57
+ * @see YapDatabaseViewTypes.h for block type definition(s).
82
58
  *
83
- * Although this may be considered "internal information",
84
- * I feel it is important to explain for the following reason:
59
+ * @param sortingBlockType
85
60
  *
86
- * Another common pattern is to fetch a number of objects in a batch, and then insert them into the database.
87
- * Now imagine a situation in which the view is sorting posts based on timestamp,
88
- * and you just fetched the most recent 10 posts. You can enumerate these 10 posts in forwards or backwards
89
- * while adding them to the database. One direction will hit the optimization every time. The other will cause
90
- * the view to perform a binary search every time. These little one-liner optimzations are easy.
91
- **/
92
- typedef id YapDatabaseViewSortingBlock; // One of the YapDatabaseViewSortingX types below.
93
-
94
- typedef NSComparisonResult (^YapDatabaseViewSortingWithKeyBlock) \
95
- (NSString *group, NSString *collection1, NSString *key1, \
96
- NSString *collection2, NSString *key2);
97
- typedef NSComparisonResult (^YapDatabaseViewSortingWithObjectBlock) \
98
- (NSString *group, NSString *collection1, NSString *key1, id object1, \
99
- NSString *collection2, NSString *key2, id object2);
100
- typedef NSComparisonResult (^YapDatabaseViewSortingWithMetadataBlock) \
101
- (NSString *group, NSString *collection1, NSString *key1, id metadata, \
102
- NSString *collection2, NSString *key2, id metadata2);
103
- typedef NSComparisonResult (^YapDatabaseViewSortingWithRowBlock) \
104
- (NSString *group, NSString *collection1, NSString *key1, id object1, id metadata1, \
105
- NSString *collection2, NSString *key2, id object2, id metadata2);
106
-
107
- #ifndef YapDatabaseViewBlockTypeDefined
108
- #define YapDatabaseViewBlockTypeDefined 1
109
-
110
- /**
111
- * I wish there was a way to inspect a given block and see what kind of parameters it takes.
112
- * Sadly this does not appear to be possible (at least not in any kind of standard legal way).
113
- *
114
- * Thus, unfortunately (for now), you will have to specify what kind of block you're passing.
115
- **/
116
- typedef enum {
117
- YapDatabaseViewBlockTypeWithKey = 1,
118
- YapDatabaseViewBlockTypeWithObject = 2,
119
- YapDatabaseViewBlockTypeWithMetadata = 3,
120
- YapDatabaseViewBlockTypeWithRow = 4
121
- } YapDatabaseViewBlockType;
122
-
123
- #endif
124
-
125
- @interface YapDatabaseView : YapDatabaseExtension
126
-
127
- /* Inherited from YapDatabaseExtension
128
-
129
- @property (nonatomic, strong, readonly) NSString *registeredName;
130
-
131
- */
132
-
133
- /**
134
- * See the wiki for an example of how to initialize a view:
135
- * https://github.com/yaptv/YapDatabase/wiki/Views#wiki-initializing_a_view
61
+ * Specify the type of sortingBlock that is being passed.
62
+ *
63
+ * @see YapDatabaseViewTypes.h for block type definition(s).
136
64
  *
137
- * @param version
65
+ * @param versionTag
138
66
  *
139
67
  * If, after creating a view, you need to change either the groupingBlock or sortingBlock,
140
- * then simply use the version parameter. If you pass a version that is different from the last
68
+ * then simply use the versionTag parameter. If you pass a versionTag that is different from the last
141
69
  * initialization of the view, then the view will automatically flush its tables, and re-populate itself.
142
70
  *
143
71
  * @param options
@@ -154,13 +82,13 @@ typedef enum {
154
82
  groupingBlockType:(YapDatabaseViewBlockType)groupingBlockType
155
83
  sortingBlock:(YapDatabaseViewSortingBlock)sortingBlock
156
84
  sortingBlockType:(YapDatabaseViewBlockType)sortingBlockType
157
- version:(int)version;
85
+ versionTag:(NSString *)versionTag;
158
86
 
159
87
  - (id)initWithGroupingBlock:(YapDatabaseViewGroupingBlock)groupingBlock
160
88
  groupingBlockType:(YapDatabaseViewBlockType)groupingBlockType
161
89
  sortingBlock:(YapDatabaseViewSortingBlock)sortingBlock
162
90
  sortingBlockType:(YapDatabaseViewBlockType)sortingBlockType
163
- version:(int)version
91
+ versionTag:(NSString *)versionTag
164
92
  options:(YapDatabaseViewOptions *)options;
165
93
 
166
94
  @property (nonatomic, strong, readonly) YapDatabaseViewGroupingBlock groupingBlock;
@@ -170,13 +98,26 @@ typedef enum {
170
98
  @property (nonatomic, assign, readonly) YapDatabaseViewBlockType sortingBlockType;
171
99
 
172
100
  /**
173
- * The version assists you in updating your blocks.
101
+ * The versionTag assists you in updating your blocks.
174
102
  *
175
103
  * If you need to change the groupingBlock or sortingBlock,
176
- * then simply pass an incremented version during the init method,
177
- * and the view will automatically update itself.
104
+ * then simply pass a different versionTag during the init method, and the view will automatically update itself.
105
+ *
106
+ * If you want to keep things simple, you can use something like @"1",
107
+ * representing version 1 of my groupingBlock & sortingBlock.
108
+ *
109
+ * For more advanced applications, you may also include within the versionTag string:
110
+ * - localization information (if you're using localized sorting routines)
111
+ * - configuration information (if your sorting routine is based on some in-app configuration)
112
+ *
113
+ * For example, if you're sorting strings using a localized string compare method, then embedding the localization
114
+ * information into your versionTag means the view will automatically re-populate itself (re-sort)
115
+ * if the user launches the app in a different language than last time.
116
+ *
117
+ * NSString *localeIdentifier = [[NSLocale currentLocale] localeIdentifier];
118
+ * NSString *versionTag = [NSString stringWithFormat:@"1-%@", localeIdentifier];
178
119
  **/
179
- @property (nonatomic, assign, readonly) int version;
120
+ @property (nonatomic, copy, readonly) NSString *versionTag;
180
121
 
181
122
  /**
182
123
  * The options allow you to specify things like creating an in-memory-only view (non persistent).
@@ -89,7 +89,7 @@
89
89
  @synthesize groupingBlockType = groupingBlockType;
90
90
  @synthesize sortingBlockType = sortingBlockType;
91
91
 
92
- @synthesize version = version;
92
+ @synthesize versionTag = versionTag;
93
93
  @dynamic options;
94
94
 
95
95
  - (id)initWithGroupingBlock:(YapDatabaseViewGroupingBlock)inGroupingBlock
@@ -101,7 +101,7 @@
101
101
  groupingBlockType:inGroupingBlockType
102
102
  sortingBlock:inSortingBlock
103
103
  sortingBlockType:inSortingBlockType
104
- version:0
104
+ versionTag:@""
105
105
  options:nil];
106
106
  }
107
107
 
@@ -109,13 +109,13 @@
109
109
  groupingBlockType:(YapDatabaseViewBlockType)inGroupingBlockType
110
110
  sortingBlock:(YapDatabaseViewSortingBlock)inSortingBlock
111
111
  sortingBlockType:(YapDatabaseViewBlockType)inSortingBlockType
112
- version:(int)inVersion
112
+ versionTag:(NSString *)inVersionTag
113
113
  {
114
114
  return [self initWithGroupingBlock:inGroupingBlock
115
115
  groupingBlockType:inGroupingBlockType
116
116
  sortingBlock:inSortingBlock
117
117
  sortingBlockType:inSortingBlockType
118
- version:inVersion
118
+ versionTag:inVersionTag
119
119
  options:nil];
120
120
  }
121
121
 
@@ -123,11 +123,14 @@
123
123
  groupingBlockType:(YapDatabaseViewBlockType)inGroupingBlockType
124
124
  sortingBlock:(YapDatabaseViewSortingBlock)inSortingBlock
125
125
  sortingBlockType:(YapDatabaseViewBlockType)inSortingBlockType
126
- version:(int)inVersion
127
- options:(YapDatabaseViewOptions *)inOptions;
126
+ versionTag:(NSString *)inVersionTag
127
+ options:(YapDatabaseViewOptions *)inOptions
128
128
  {
129
129
  if ((self = [super init]))
130
130
  {
131
+ NSAssert(inGroupingBlock != NULL, @"Invalid grouping block");
132
+ NSAssert(inSortingBlock != NULL, @"Invalid sorting block");
133
+
131
134
  NSAssert(inGroupingBlockType == YapDatabaseViewBlockTypeWithKey ||
132
135
  inGroupingBlockType == YapDatabaseViewBlockTypeWithObject ||
133
136
  inGroupingBlockType == YapDatabaseViewBlockTypeWithMetadata ||
@@ -146,7 +149,7 @@
146
149
  sortingBlock = inSortingBlock;
147
150
  sortingBlockType = inSortingBlockType;
148
151
 
149
- version = inVersion;
152
+ versionTag = inVersionTag ? [inVersionTag copy] : @"";
150
153
 
151
154
  options = inOptions ? [inOptions copy] : [[YapDatabaseViewOptions alloc] init];
152
155
  }
@@ -1,4 +1,5 @@
1
1
  #import <Foundation/Foundation.h>
2
+
2
3
  #import "YapDatabaseExtensionConnection.h"
3
4
  #import "YapDatabaseViewChange.h"
4
5
  #import "YapDatabaseViewMappings.h"
@@ -69,6 +69,11 @@ static NSString *const key_changes = @"changes";
69
69
  }
70
70
 
71
71
  - (void)dealloc
72
+ {
73
+ [self _flushStatements];
74
+ }
75
+
76
+ - (void)_flushStatements
72
77
  {
73
78
  sqlite_finalize_null(&mapTable_getPageKeyForRowidStatement);
74
79
  sqlite_finalize_null(&mapTable_setPageKeyForRowidStatement);
@@ -87,33 +92,17 @@ static NSString *const key_changes = @"changes";
87
92
  /**
88
93
  * Required override method from YapDatabaseExtensionConnection
89
94
  **/
90
- - (void)_flushMemoryWithLevel:(int)level
95
+ - (void)_flushMemoryWithFlags:(YapDatabaseConnectionFlushMemoryFlags)flags
91
96
  {
92
- if (level >= YapDatabaseConnectionFlushMemoryLevelMild)
97
+ if (flags & YapDatabaseConnectionFlushMemoryFlags_Caches)
93
98
  {
94
99
  [mapCache removeAllObjects];
95
100
  [pageCache removeAllObjects];
96
101
  }
97
102
 
98
- if (level >= YapDatabaseConnectionFlushMemoryLevelModerate)
103
+ if (flags & YapDatabaseConnectionFlushMemoryFlags_Statements)
99
104
  {
100
- sqlite_finalize_null(&mapTable_setPageKeyForRowidStatement);
101
- sqlite_finalize_null(&mapTable_removeForRowidStatement);
102
- sqlite_finalize_null(&mapTable_removeAllStatement);
103
-
104
- sqlite_finalize_null(&pageTable_insertForPageKeyStatement);
105
- sqlite_finalize_null(&pageTable_updateAllForPageKeyStatement);
106
- sqlite_finalize_null(&pageTable_updatePageForPageKeyStatement);
107
- sqlite_finalize_null(&pageTable_updateLinkForPageKeyStatement);
108
- sqlite_finalize_null(&pageTable_removeForPageKeyStatement);
109
- sqlite_finalize_null(&pageTable_removeAllStatement);
110
- }
111
-
112
- if (level >= YapDatabaseConnectionFlushMemoryLevelFull)
113
- {
114
- sqlite_finalize_null(&mapTable_getPageKeyForRowidStatement);
115
-
116
- sqlite_finalize_null(&pageTable_getDataForPageKeyStatement);
105
+ [self _flushStatements];
117
106
  }
118
107
  }
119
108
 
@@ -293,7 +282,9 @@ static NSString *const key_changes = @"changes";
293
282
  NSMutableDictionary *externalChangeset = nil;
294
283
  BOOL hasDiskChanges = NO;
295
284
 
296
- if ([dirtyMaps count] || [dirtyPages count] || [dirtyLinks count] || reset)
285
+ if ([dirtyMaps count] > 0 ||
286
+ [dirtyPages count] > 0 ||
287
+ [dirtyLinks count] > 0 || reset)
297
288
  {
298
289
  hasDiskChanges = view->options.isPersistent;
299
290
  internalChangeset = [NSMutableDictionary dictionaryWithSharedKeySet:sharedKeySetForInternalChangeset];
@@ -323,7 +314,7 @@ static NSString *const key_changes = @"changes";
323
314
  [internalChangeset setObject:pageKey_group_dict_copy forKey:key_pageKey_group_dict];
324
315
  }
325
316
 
326
- if ([changes count])
317
+ if ([changes count] > 0)
327
318
  {
328
319
  externalChangeset = [NSMutableDictionary dictionaryWithSharedKeySet:sharedKeySetForExternalChangeset];
329
320
 
@@ -43,11 +43,18 @@
43
43
  *
44
44
  * The primary motivation for this is to reduce the overhead when first populating the view.
45
45
  * For example, if you're creating a view which only includes objects from a single collection,
46
- * then you could specify that collection here. And when the view first populates itself,
46
+ * then you could specify that collection here. So when the view first populates itself,
47
47
  * it will enumerate over just the allowedCollections, as opposed to enumerating over all collections.
48
+ * And enumerating a small subset of the entire database during view population can improve speed,
49
+ * especially with larger databases.
48
50
  *
49
- * The groupingBlock will still be invoked, but only if the collection is contained in allowedCollections.
50
- * If not, the view will not invoke the groupingBlock, and act as if the groupingBlock had returned nil.
51
+ * In addition to reducing the overhead when first populating the view,
52
+ * the allowedCollections will pre-filter while you're making changes to the database.
53
+ * So if you add a new object to the database, and the associated collection isn't in allowedCollections,
54
+ * then the groupingBlock will never be invoked, and the view will act as if the groupingBlock returned nil.
55
+ *
56
+ * For all rows whose collection is in the allowedCollections, the view acts normally.
57
+ * So the groupingBlock would still be invoked as normal.
51
58
  *
52
59
  * The default value is nil.
53
60
  **/
@@ -1,5 +1,7 @@
1
1
  #import <Foundation/Foundation.h>
2
+
2
3
  #import "YapDatabaseExtensionTransaction.h"
4
+ #import "YapDatabaseViewTypes.h"
3
5
  #import "YapDatabaseViewMappings.h"
4
6
 
5
7
  /**
@@ -127,18 +129,6 @@ typedef NSComparisonResult (^YapDatabaseViewFindWithMetadataBlock) \
127
129
  typedef NSComparisonResult (^YapDatabaseViewFindWithRowBlock) \
128
130
  (NSString *collection, NSString *key, id object, id metadata);
129
131
 
130
- #ifndef YapDatabaseViewBlockTypeDefined
131
- #define YapDatabaseViewBlockTypeDefined 1
132
-
133
- typedef enum {
134
- YapDatabaseViewBlockTypeWithKey = 201,
135
- YapDatabaseViewBlockTypeWithObject = 202,
136
- YapDatabaseViewBlockTypeWithMetadata = 203,
137
- YapDatabaseViewBlockTypeWithRow = 204
138
- } YapDatabaseViewBlockType;
139
-
140
- #endif
141
-
142
132
  /**
143
133
  * This method uses a binary search algorithm to find a range of items within the view that match the given criteria.
144
134
  * For example:
@@ -314,6 +304,17 @@ typedef enum {
314
304
  - (void)touchObjectForKey:(NSString *)key inCollection:(NSString *)collection;
315
305
  - (void)touchMetadataForKey:(NSString *)key inCollection:(NSString *)collection;
316
306
 
307
+ /**
308
+ * This method allows you to change the groupingBlock and/or sortingBlock on-the-fly.
309
+ *
310
+ * Note: You must pass a different versionTag, or this method does nothing.
311
+ **/
312
+ - (void)setGroupingBlock:(YapDatabaseViewGroupingBlock)groupingBlock
313
+ groupingBlockType:(YapDatabaseViewBlockType)groupingBlockType
314
+ sortingBlock:(YapDatabaseViewSortingBlock)sortingBlock
315
+ sortingBlockType:(YapDatabaseViewBlockType)sortingBlockType
316
+ versionTag:(NSString *)versionTag;
317
+
317
318
  @end
318
319
 
319
320
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -331,30 +332,30 @@ typedef enum {
331
332
  /**
332
333
  * Equivalent to invoking:
333
334
  *
334
- * NSString *collection = nil;
335
- * NSString *key = nil;
336
- * [[transaction ext:@"myView"] getKey:&key collection:&collection atIndex:index inGroup:group];
337
- * [transaction objectForKey:key inCollection:collection];
335
+ * NSString *collection, *key;
336
+ * if ([[transaction ext:@"myView"] getKey:&key collection:&collection atIndex:index inGroup:group]) {
337
+ * object = [transaction objectForKey:key inCollection:collection];
338
+ * }
338
339
  **/
339
340
  - (id)objectAtIndex:(NSUInteger)keyIndex inGroup:(NSString *)group;
340
341
 
341
342
  /**
342
343
  * Equivalent to invoking:
343
344
  *
344
- * NSString *collection = nil;
345
- * NSString *key = nil;
346
- * [[transaction ext:@"myView"] getFirstKey:&key collection:&collection inGroup:group];
347
- * [transaction objectForKey:key inCollection:collection];
345
+ * NSString *collection, *key;
346
+ * if ([[transaction ext:@"myView"] getFirstKey:&key collection:&collection inGroup:group]) {
347
+ * object = [transaction objectForKey:key inCollection:collection];
348
+ * }
348
349
  **/
349
350
  - (id)firstObjectInGroup:(NSString *)group;
350
351
 
351
352
  /**
352
353
  * Equivalent to invoking:
353
354
  *
354
- * NSString *collection = nil;
355
- * NSString *key = nil;
356
- * [[transaction ext:@"myView"] getLastKey:&key collection:&collection inGroup:group];
357
- * [transaction objectForKey:key inCollection:collection];
355
+ * NSString *collection, *key;
356
+ * if ([[transaction ext:@"myView"] getLastKey:&key collection:&collection inGroup:group]) {
357
+ * object = [transaction objectForKey:key inCollection:collection];
358
+ * }
358
359
  **/
359
360
  - (id)lastObjectInGroup:(NSString *)group;
360
361
 
@@ -436,6 +437,45 @@ typedef enum {
436
437
  atIndexPath:(NSIndexPath *)indexPath
437
438
  withMappings:(YapDatabaseViewMappings *)mappings;
438
439
 
440
+ /**
441
+ * Gets the key & collection at the given row & section, assuming the given mappings are being used.
442
+ * Returns NO if the row or section is invalid, or the mappings aren't initialized.
443
+ * Otherwise returns YES, and sets the key & collection ptr (both optional).
444
+ **/
445
+ - (BOOL)getKey:(NSString **)keyPtr
446
+ collection:(NSString **)collectionPtr
447
+ forRow:(NSUInteger)row
448
+ inSection:(NSUInteger)section
449
+ withMappings:(YapDatabaseViewMappings *)mappings;
450
+
451
+ /**
452
+ * Gets the object at the given indexPath, assuming the given mappings are being used.
453
+ *
454
+ * Equivalent to invoking:
455
+ *
456
+ * NSString *collection, *key;
457
+ * if ([[transaction ext:@"myView"] getKey:&key collection:&collection atIndexPath:indexPath withMappings:mappings]) {
458
+ * object = [transaction objectForKey:key inCollection:collection];
459
+ * }
460
+ **/
461
+ - (id)objectAtIndexPath:(NSIndexPath *)indexPath withMappings:(YapDatabaseViewMappings *)mappings;
462
+
463
+ /**
464
+ * Gets the object at the given indexPath, assuming the given mappings are being used.
465
+ *
466
+ * Equivalent to invoking:
467
+ *
468
+ * NSString *collection, *key;
469
+ * if ([[transaction ext:@"view"] getKey:&key
470
+ * collection:&collection
471
+ * forRow:row
472
+ * inSection:section
473
+ * withMappings:mappings]) {
474
+ * object = [transaction objectForKey:key inCollection:collection];
475
+ * }
476
+ **/
477
+ - (id)objectAtRow:(NSUInteger)row inSection:(NSUInteger)section withMappings:(YapDatabaseViewMappings *)mappings;
478
+
439
479
  /**
440
480
  * Fetches the indexPath for the given {collection, key} tuple, assuming the given mappings are being used.
441
481
  * Returns nil if the {collection, key} tuple isn't included in the view + mappings.
@@ -444,4 +484,15 @@ typedef enum {
444
484
  inCollection:(NSString *)collection
445
485
  withMappings:(YapDatabaseViewMappings *)mappings;
446
486
 
487
+ /**
488
+ * Fetches the row & section for the given {collection, key} tuple, assuming the given mappings are being used.
489
+ * Returns NO if the {collection, key} tuple isn't included in the view + mappings.
490
+ * Otherwise returns YES, and sets the row & section (both optional).
491
+ **/
492
+ - (BOOL)getRow:(NSUInteger *)rowPtr
493
+ section:(NSUInteger *)sectionPtr
494
+ forKey:(NSString *)key
495
+ inCollection:(NSString *)collection
496
+ withMappings:(YapDatabaseViewMappings *)mappings;
497
+
447
498
  @end