motion-yapper 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +3 -1
  4. data/lib/yapper.rb +3 -3
  5. data/lib/yapper/db.rb +61 -4
  6. data/lib/yapper/document/persistence.rb +4 -0
  7. data/lib/yapper/document/selection.rb +13 -0
  8. data/lib/yapper/version.rb +1 -1
  9. data/motion-yapper.gemspec +1 -1
  10. data/spec/integration/search_spec.rb +111 -0
  11. data/vendor/Podfile.lock +11 -7
  12. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +16 -2
  13. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +10 -7
  14. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +20 -2
  15. metadata +19 -297
  16. data/vendor/Pods/.build/libPods-CocoaLumberjack.a +0 -0
  17. data/vendor/Pods/.build/libPods-NSData+MD5Digest.a +0 -0
  18. data/vendor/Pods/.build/libPods-YapDatabase.a +0 -0
  19. data/vendor/Pods/.build/libPods.a +0 -0
  20. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +0 -41
  21. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +0 -102
  22. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDContextFilterLogFormatter.h +0 -63
  23. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDDispatchQueueLogFormatter.h +0 -128
  24. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +0 -369
  25. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog+LOGV.h +0 -99
  26. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +0 -634
  27. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDMultiFormatter.h +0 -30
  28. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +0 -181
  29. data/vendor/Pods/BuildHeaders/NSData+MD5Digest/NSData+MD5Digest.h +0 -18
  30. data/vendor/Pods/BuildHeaders/YapDatabase/NSDictionary+YapDatabase.h +0 -8
  31. data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +0 -91
  32. data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +0 -23
  33. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +0 -547
  34. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +0 -449
  35. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnectionState.h +0 -29
  36. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +0 -37
  37. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtension.h +0 -15
  38. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionConnection.h +0 -11
  39. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +0 -444
  40. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionTransaction.h +0 -11
  41. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +0 -81
  42. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewConnection.h +0 -12
  43. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -17
  44. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +0 -39
  45. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTypes.h +0 -32
  46. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearch.h +0 -89
  47. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchConnection.h +0 -32
  48. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +0 -77
  49. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +0 -79
  50. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchTransaction.h +0 -68
  51. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseLogging.h +0 -158
  52. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseManager.h +0 -17
  53. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +0 -446
  54. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseQuery.h +0 -42
  55. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationship.h +0 -35
  56. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipConnection.h +0 -29
  57. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdge.h +0 -163
  58. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdgePrivate.h +0 -79
  59. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipNode.h +0 -99
  60. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipOptions.h +0 -59
  61. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipPrivate.h +0 -125
  62. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipTransaction.h +0 -384
  63. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +0 -149
  64. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexConnection.h +0 -33
  65. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +0 -83
  66. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetup.h +0 -33
  67. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetupPrivate.h +0 -18
  68. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +0 -58
  69. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseStatement.h +0 -13
  70. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseString.h +0 -121
  71. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +0 -651
  72. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +0 -127
  73. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +0 -272
  74. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChangePrivate.h +0 -94
  75. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +0 -116
  76. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +0 -842
  77. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappingsPrivate.h +0 -72
  78. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +0 -63
  79. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPage.h +0 -36
  80. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPageMetadata.h +0 -27
  81. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +0 -170
  82. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptions.h +0 -330
  83. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +0 -17
  84. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +0 -498
  85. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTypes.h +0 -99
  86. data/vendor/Pods/BuildHeaders/YapDatabase/YapMemoryTable.h +0 -74
  87. data/vendor/Pods/BuildHeaders/YapDatabase/YapNull.h +0 -17
  88. data/vendor/Pods/BuildHeaders/YapDatabase/YapSet.h +0 -41
  89. data/vendor/Pods/BuildHeaders/YapDatabase/YapTouch.h +0 -15
  90. data/vendor/Pods/CocoaLumberjack/LICENSE.txt +0 -18
  91. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +0 -41
  92. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +0 -100
  93. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +0 -102
  94. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +0 -727
  95. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +0 -369
  96. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +0 -1539
  97. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog+LOGV.h +0 -99
  98. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +0 -634
  99. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +0 -1208
  100. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +0 -181
  101. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +0 -1520
  102. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.h +0 -63
  103. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.m +0 -191
  104. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.h +0 -128
  105. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.m +0 -253
  106. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.h +0 -30
  107. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.m +0 -127
  108. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +0 -7
  109. data/vendor/Pods/CocoaLumberjack/README.markdown +0 -74
  110. data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +0 -41
  111. data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +0 -102
  112. data/vendor/Pods/Headers/CocoaLumberjack/DDContextFilterLogFormatter.h +0 -63
  113. data/vendor/Pods/Headers/CocoaLumberjack/DDDispatchQueueLogFormatter.h +0 -128
  114. data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +0 -369
  115. data/vendor/Pods/Headers/CocoaLumberjack/DDLog+LOGV.h +0 -99
  116. data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +0 -634
  117. data/vendor/Pods/Headers/CocoaLumberjack/DDMultiFormatter.h +0 -30
  118. data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +0 -181
  119. data/vendor/Pods/Headers/NSData+MD5Digest/NSData+MD5Digest.h +0 -18
  120. data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +0 -23
  121. data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +0 -547
  122. data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +0 -449
  123. data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtension.h +0 -15
  124. data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionConnection.h +0 -11
  125. data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionTransaction.h +0 -11
  126. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +0 -81
  127. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewConnection.h +0 -12
  128. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +0 -39
  129. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTypes.h +0 -32
  130. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearch.h +0 -89
  131. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchConnection.h +0 -32
  132. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +0 -79
  133. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchTransaction.h +0 -68
  134. data/vendor/Pods/Headers/YapDatabase/YapDatabaseQuery.h +0 -42
  135. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationship.h +0 -35
  136. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipConnection.h +0 -29
  137. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipEdge.h +0 -163
  138. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipNode.h +0 -99
  139. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipOptions.h +0 -59
  140. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipTransaction.h +0 -384
  141. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +0 -149
  142. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexConnection.h +0 -33
  143. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexSetup.h +0 -33
  144. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +0 -58
  145. data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +0 -651
  146. data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +0 -127
  147. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +0 -272
  148. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +0 -116
  149. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +0 -842
  150. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +0 -63
  151. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptions.h +0 -330
  152. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +0 -498
  153. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTypes.h +0 -99
  154. data/vendor/Pods/Headers/YapDatabase/YapSet.h +0 -41
  155. data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +0 -7
  156. data/vendor/Pods/Headers/____Pods-NSData+MD5Digest-prefix.h +0 -5
  157. data/vendor/Pods/Headers/____Pods-YapDatabase-prefix.h +0 -5
  158. data/vendor/Pods/Headers/____Pods-environment.h +0 -38
  159. data/vendor/Pods/Manifest.lock +0 -22
  160. data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.h +0 -18
  161. data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.m +0 -39
  162. data/vendor/Pods/NSData+MD5Digest/README.md +0 -11
  163. data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +0 -5
  164. data/vendor/Pods/Pods-CocoaLumberjack-dummy.m +0 -5
  165. data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +0 -7
  166. data/vendor/Pods/Pods-CocoaLumberjack.xcconfig +0 -0
  167. data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +0 -5
  168. data/vendor/Pods/Pods-NSData+MD5Digest-dummy.m +0 -5
  169. data/vendor/Pods/Pods-NSData+MD5Digest-prefix.pch +0 -5
  170. data/vendor/Pods/Pods-NSData+MD5Digest.xcconfig +0 -0
  171. data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +0 -5
  172. data/vendor/Pods/Pods-YapDatabase-dummy.m +0 -5
  173. data/vendor/Pods/Pods-YapDatabase-prefix.pch +0 -5
  174. data/vendor/Pods/Pods-YapDatabase.xcconfig +0 -1
  175. data/vendor/Pods/Pods-acknowledgements.markdown +0 -59
  176. data/vendor/Pods/Pods-acknowledgements.plist +0 -97
  177. data/vendor/Pods/Pods-dummy.m +0 -5
  178. data/vendor/Pods/Pods-environment.h +0 -38
  179. data/vendor/Pods/Pods-resources.sh +0 -68
  180. data/vendor/Pods/Pods.xcconfig +0 -5
  181. data/vendor/Pods/Pods.xcodeproj/project.pbxproj +0 -4807
  182. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-CocoaLumberjack.xcscheme +0 -59
  183. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-NSData+MD5Digest.xcscheme +0 -59
  184. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-YapDatabase.xcscheme +0 -59
  185. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods.xcscheme +0 -59
  186. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/xcschememanagement.plist +0 -31
  187. data/vendor/Pods/YapDatabase/LICENSE.txt +0 -18
  188. data/vendor/Pods/YapDatabase/README.md +0 -32
  189. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +0 -17
  190. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +0 -81
  191. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +0 -159
  192. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.h +0 -12
  193. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.m +0 -41
  194. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +0 -39
  195. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +0 -1235
  196. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTypes.h +0 -32
  197. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +0 -77
  198. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.h +0 -89
  199. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.m +0 -146
  200. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.h +0 -32
  201. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +0 -298
  202. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.h +0 -79
  203. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.m +0 -95
  204. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.h +0 -68
  205. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +0 -1403
  206. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +0 -444
  207. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.h +0 -15
  208. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +0 -83
  209. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.h +0 -11
  210. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +0 -46
  211. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.h +0 -11
  212. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +0 -204
  213. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipEdgePrivate.h +0 -79
  214. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipPrivate.h +0 -125
  215. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.h +0 -35
  216. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.m +0 -129
  217. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.h +0 -29
  218. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.m +0 -802
  219. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.h +0 -163
  220. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.m +0 -408
  221. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipNode.h +0 -99
  222. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.h +0 -59
  223. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.m +0 -29
  224. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.h +0 -384
  225. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.m +0 -5254
  226. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +0 -83
  227. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexSetupPrivate.h +0 -18
  228. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +0 -149
  229. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +0 -161
  230. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.h +0 -33
  231. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +0 -331
  232. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.h +0 -33
  233. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +0 -245
  234. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.h +0 -58
  235. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +0 -1269
  236. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewChangePrivate.h +0 -94
  237. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewMappingsPrivate.h +0 -72
  238. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.h +0 -36
  239. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.mm +0 -296
  240. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.h +0 -27
  241. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.m +0 -28
  242. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +0 -170
  243. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewRangeOptionsPrivate.h +0 -17
  244. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +0 -272
  245. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +0 -2500
  246. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +0 -842
  247. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +0 -1714
  248. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.h +0 -330
  249. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.m +0 -141
  250. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +0 -127
  251. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +0 -194
  252. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +0 -116
  253. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +0 -888
  254. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +0 -63
  255. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.m +0 -27
  256. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +0 -498
  257. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +0 -4986
  258. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTypes.h +0 -99
  259. data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.h +0 -8
  260. data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.m +0 -19
  261. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +0 -91
  262. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +0 -465
  263. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.h +0 -29
  264. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.m +0 -48
  265. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +0 -37
  266. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +0 -83
  267. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.h +0 -158
  268. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.m +0 -73
  269. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.h +0 -17
  270. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.m +0 -56
  271. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +0 -446
  272. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.h +0 -13
  273. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.m +0 -26
  274. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseString.h +0 -121
  275. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.h +0 -74
  276. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.m +0 -603
  277. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.h +0 -17
  278. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +0 -35
  279. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.h +0 -15
  280. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.m +0 -31
  281. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +0 -23
  282. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +0 -199
  283. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.h +0 -42
  284. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.m +0 -96
  285. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.h +0 -41
  286. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.m +0 -82
  287. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +0 -547
  288. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +0 -2013
  289. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +0 -449
  290. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +0 -4046
  291. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +0 -651
  292. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +0 -5602
  293. data/vendor/Pods/build-iPhoneSimulator/Pods.bridgesupport +0 -3172
  294. data/vendor/Pods/build-iPhoneSimulator/libPods.a +0 -0
@@ -1,12 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import "YapDatabaseViewConnection.h"
3
-
4
- @class YapDatabaseFilteredView;
5
-
6
-
7
- @interface YapDatabaseFilteredViewConnection : YapDatabaseViewConnection
8
-
9
- // Returns properly typed parent view instance
10
- @property (nonatomic, strong, readonly) YapDatabaseFilteredView *filteredView;
11
-
12
- @end
@@ -1,41 +0,0 @@
1
- #import "YapDatabaseFilteredViewConnection.h"
2
- #import "YapDatabaseFilteredViewPrivate.h"
3
-
4
-
5
- @implementation YapDatabaseFilteredViewConnection
6
-
7
- - (YapDatabaseFilteredView *)filteredView
8
- {
9
- return (YapDatabaseFilteredView *)view;
10
- }
11
-
12
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
13
- #pragma mark Transactions
14
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
15
-
16
- /**
17
- * Required override method from YapDatabaseExtensionConnection.
18
- **/
19
- - (id)newReadTransaction:(YapDatabaseReadTransaction *)databaseTransaction
20
- {
21
- YapDatabaseFilteredViewTransaction *filteredViewTransaction =
22
- [[YapDatabaseFilteredViewTransaction alloc] initWithViewConnection:self
23
- databaseTransaction:databaseTransaction];
24
-
25
- return filteredViewTransaction;
26
- }
27
-
28
- /**
29
- * Required override method from YapDatabaseExtensionConnection.
30
- **/
31
- - (id)newReadWriteTransaction:(YapDatabaseReadWriteTransaction *)databaseTransaction
32
- {
33
- YapDatabaseFilteredViewTransaction *filteredViewTransaction =
34
- [[YapDatabaseFilteredViewTransaction alloc] initWithViewConnection:self
35
- databaseTransaction:databaseTransaction];
36
-
37
- [self prepareForReadWriteTransaction];
38
- return filteredViewTransaction;
39
- }
40
-
41
- @end
@@ -1,39 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- #import "YapDatabaseViewTransaction.h"
4
- #import "YapDatabaseFilteredViewTypes.h"
5
- #import "YapDatabaseFilteredView.h"
6
-
7
-
8
- @interface YapDatabaseFilteredViewTransaction : YapDatabaseViewTransaction
9
-
10
- // This class extends YapDatabaseViewTransaction.
11
- //
12
- // Please see YapDatabaseViewTransaction.h
13
-
14
- @end
15
-
16
- #pragma mark -
17
-
18
- @interface YapDatabaseFilteredViewTransaction (ReadWrite)
19
-
20
- /**
21
- * This method allows you to change the filterBlock on-the-fly.
22
- *
23
- * When you do so, the extension will emit the smallest change-set possible.
24
- * That is, it does NOT clear the view and start from scratch.
25
- * Rather it performs a quick in-place update.
26
- * The end result is a minimal change-set that looks nice for tableView / collectionView animations.
27
- *
28
- * For example, in Apple's phone app, in the Recents tab, one can switch between "all" and "missed" calls.
29
- * Tapping the "missed" button smoothly animates away all non-red rows. It looks great.
30
- * You can get the same effect by using a YapDatabaseFilteredView,
31
- * and swapping in/out a filterBlock to allow/disallow non-missed calls.
32
- *
33
- * Note: You must pass a different versionTag, or this method does nothing.
34
- **/
35
- - (void)setFilteringBlock:(YapDatabaseViewFilteringBlock)filteringBlock
36
- filteringBlockType:(YapDatabaseViewBlockType)filteringBlockType
37
- versionTag:(NSString *)tag;
38
-
39
- @end
@@ -1,1235 +0,0 @@
1
- #import "YapDatabaseFilteredViewTransaction.h"
2
- #import "YapDatabaseFilteredViewPrivate.h"
3
- #import "YapDatabasePrivate.h"
4
- #import "YapDatabaseViewChangePrivate.h"
5
- #import "YapDatabaseExtensionPrivate.h"
6
- #import "YapCollectionKey.h"
7
- #import "YapDatabaseLogging.h"
8
-
9
- #if ! __has_feature(objc_arc)
10
- #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
11
- #endif
12
-
13
- /**
14
- * Define log level for this file: OFF, ERROR, WARN, INFO, VERBOSE
15
- * See YapDatabaseLogging.h for more information.
16
- **/
17
- #if DEBUG
18
- static const int ydbLogLevel = YDB_LOG_LEVEL_WARN;
19
- #else
20
- static const int ydbLogLevel = YDB_LOG_LEVEL_WARN;
21
- #endif
22
-
23
- #define ExtKey_classVersion @"classVersion"
24
- #define ExtKey_persistent @"persistent"
25
- #define ExtKey_parentViewName @"parentViewName"
26
- #define ExtKey_tag_deprecated @"tag"
27
- #define ExtKey_versionTag @"versionTag"
28
-
29
- @implementation YapDatabaseFilteredViewTransaction
30
-
31
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
32
- #pragma mark Extension Lifecycle
33
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
34
-
35
- /**
36
- * Required override method from YapDatabaseExtensionTransaction.
37
- *
38
- * This method is called to create any necessary tables (if needed),
39
- * as well as populate the view (if needed) by enumerating over the existing rows in the database.
40
- **/
41
- - (BOOL)createIfNeeded
42
- {
43
- YDBLogAutoTrace();
44
-
45
- __unsafe_unretained YapDatabaseFilteredView *filteredView = (YapDatabaseFilteredView *)(viewConnection->view);
46
-
47
- int classVersion = YAP_DATABASE_VIEW_CLASS_VERSION;
48
- BOOL isPersistent = [self isPersistentView];
49
-
50
- NSString *parentViewName = filteredView->parentViewName;
51
- NSString *versionTag = filteredView->versionTag;
52
-
53
- // Figure out what steps we need to take in order to register the view
54
-
55
- BOOL needsCreateTables = NO;
56
-
57
- BOOL oldIsPersistent = NO;
58
- BOOL hasOldIsPersistent = NO;
59
-
60
- NSString *oldParentViewName = nil;
61
- NSString *oldVersionTag = nil;
62
-
63
- // Check classVersion (the internal version number of view implementation)
64
-
65
- int oldClassVersion = 0;
66
- BOOL hasOldClassVersion = [self getIntValue:&oldClassVersion forExtensionKey:ExtKey_classVersion];
67
-
68
- if (!hasOldClassVersion)
69
- {
70
- needsCreateTables = YES;
71
- }
72
- else if (oldClassVersion != classVersion)
73
- {
74
- [self dropTablesForOldClassVersion:oldClassVersion];
75
- needsCreateTables = YES;
76
- }
77
-
78
- // Check persistence.
79
- // Need to properly transition from persistent to non-persistent, and vice-versa.
80
-
81
- if (!needsCreateTables || hasOldClassVersion)
82
- {
83
- hasOldIsPersistent = [self getBoolValue:&oldIsPersistent forExtensionKey:ExtKey_persistent];
84
-
85
- if (hasOldIsPersistent && oldIsPersistent && !isPersistent)
86
- {
87
- [[viewConnection->view class]
88
- dropTablesForRegisteredName:[self registeredName]
89
- withTransaction:(YapDatabaseReadWriteTransaction *)databaseTransaction];
90
- }
91
-
92
- if (!hasOldIsPersistent || (oldIsPersistent != isPersistent))
93
- {
94
- needsCreateTables = YES;
95
- }
96
- else if (!isPersistent)
97
- {
98
- // We always have to create & populate the tables for non-persistent views.
99
- // Even when re-registering from previous app launch.
100
- needsCreateTables = YES;
101
-
102
- oldParentViewName = [self stringValueForExtensionKey:ExtKey_parentViewName];
103
- oldVersionTag = [self stringValueForExtensionKey:ExtKey_versionTag];
104
- }
105
- }
106
-
107
- // Create or re-populate if needed
108
-
109
- if (needsCreateTables)
110
- {
111
- // First time registration
112
-
113
- if (![self createTables]) return NO;
114
- if (![self populateView]) return NO;
115
-
116
- if (!hasOldClassVersion || (oldClassVersion != classVersion)) {
117
- [self setIntValue:classVersion forExtensionKey:ExtKey_classVersion];
118
- }
119
-
120
- if (!hasOldIsPersistent || (oldIsPersistent != isPersistent)) {
121
- [self setBoolValue:isPersistent forExtensionKey:ExtKey_persistent];
122
- }
123
-
124
- if (![oldParentViewName isEqualToString:parentViewName]) {
125
- [self setStringValue:parentViewName forExtensionKey:ExtKey_parentViewName];
126
- }
127
-
128
- if (![oldVersionTag isEqualToString:versionTag]) {
129
- [self setStringValue:versionTag forExtensionKey:ExtKey_versionTag];
130
- }
131
- }
132
- else
133
- {
134
- BOOL needsRepopulateView = NO;
135
-
136
- // Check parentViewName.
137
- // Need to re-populate if the parent changed.
138
-
139
- oldParentViewName = [self stringValueForExtensionKey:ExtKey_parentViewName];
140
-
141
- if (![oldParentViewName isEqualToString:parentViewName])
142
- {
143
- needsRepopulateView = YES;
144
- }
145
-
146
- // Check user-supplied tag.
147
- // We may need to re-populate the database if the groupingBlock or sortingBlock changed.
148
-
149
- oldVersionTag = [self stringValueForExtensionKey:ExtKey_versionTag];
150
-
151
- NSString *oldTag_deprecated = nil;
152
- if (oldVersionTag == nil)
153
- {
154
- oldTag_deprecated = [self stringValueForExtensionKey:ExtKey_tag_deprecated];
155
- if (oldTag_deprecated)
156
- {
157
- oldVersionTag = oldTag_deprecated;
158
- }
159
- }
160
-
161
- if (![oldVersionTag isEqualToString:versionTag])
162
- {
163
- needsRepopulateView = YES;
164
- }
165
-
166
- if (needsRepopulateView)
167
- {
168
- if (![self populateView]) return NO;
169
-
170
- if (![oldParentViewName isEqualToString:parentViewName]) {
171
- [self setStringValue:parentViewName forExtensionKey:ExtKey_parentViewName];
172
- }
173
-
174
- if (![oldVersionTag isEqualToString:versionTag]) {
175
- [self setStringValue:versionTag forExtensionKey:ExtKey_versionTag];
176
- }
177
-
178
- if (oldTag_deprecated)
179
- [self removeValueForExtensionKey:ExtKey_tag_deprecated];
180
- }
181
- else if (oldTag_deprecated)
182
- {
183
- [self removeValueForExtensionKey:ExtKey_tag_deprecated];
184
- [self setStringValue:versionTag forExtensionKey:ExtKey_versionTag];
185
- }
186
- }
187
-
188
- return YES;
189
- }
190
-
191
- /**
192
- * Internal method.
193
- * This method overrides the version in YapDatabaseViewTransaction.
194
- *
195
- * This method is called, if needed, to populate the view.
196
- * It does so by enumerating the rows in the database, and invoking the usual blocks and insertion methods.
197
- **/
198
- - (BOOL)populateView
199
- {
200
- YDBLogAutoTrace();
201
-
202
- __unsafe_unretained YapDatabaseFilteredView *filteredView =
203
- (YapDatabaseFilteredView *)viewConnection->view;
204
-
205
- YapDatabaseViewTransaction *parentViewTransaction =
206
- [databaseTransaction ext:filteredView->parentViewName];
207
-
208
- // Remove everything from the database
209
-
210
- [self removeAllRowids];
211
-
212
- // Initialize ivars
213
-
214
- viewConnection->group_pagesMetadata_dict = [[NSMutableDictionary alloc] init];
215
- viewConnection->pageKey_group_dict = [[NSMutableDictionary alloc] init];
216
-
217
- // Enumerate the existing rows in the database and populate the view
218
-
219
- if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithKey)
220
- {
221
- YapDatabaseViewFilteringWithKeyBlock filterBlock =
222
- (YapDatabaseViewFilteringWithKeyBlock)filteredView->filteringBlock;
223
-
224
- for (NSString *group in [parentViewTransaction allGroups])
225
- {
226
- __block NSUInteger filteredIndex = 0;
227
-
228
- [parentViewTransaction enumerateRowidsInGroup:group
229
- usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
230
- {
231
- YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
232
-
233
- if (filterBlock(group, ck.collection, ck.key))
234
- {
235
- if (filteredIndex == 0)
236
- [self insertRowid:rowid collectionKey:ck inNewGroup:group];
237
- else
238
- [self insertRowid:rowid collectionKey:ck inGroup:group atIndex:filteredIndex
239
- withExistingPageKey:nil];
240
- filteredIndex++;
241
- }
242
- }];
243
- }
244
- }
245
- else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithObject)
246
- {
247
- YapDatabaseViewFilteringWithObjectBlock filterBlock =
248
- (YapDatabaseViewFilteringWithObjectBlock)filteredView->filteringBlock;
249
-
250
- for (NSString *group in [parentViewTransaction allGroups])
251
- {
252
- __block NSUInteger filteredIndex = 0;
253
-
254
- [parentViewTransaction enumerateRowidsInGroup:group
255
- usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
256
- {
257
- YapCollectionKey *ck = nil;
258
- id object = nil;
259
- [databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
260
-
261
- if (filterBlock(group, ck.collection, ck.key, object))
262
- {
263
- if (filteredIndex == 0)
264
- [self insertRowid:rowid collectionKey:ck inNewGroup:group];
265
- else
266
- [self insertRowid:rowid collectionKey:ck inGroup:group atIndex:filteredIndex
267
- withExistingPageKey:nil];
268
- filteredIndex++;
269
- }
270
- }];
271
- }
272
- }
273
- else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithMetadata)
274
- {
275
- YapDatabaseViewFilteringWithMetadataBlock filterBlock =
276
- (YapDatabaseViewFilteringWithMetadataBlock)filteredView->filteringBlock;
277
-
278
- for (NSString *group in [parentViewTransaction allGroups])
279
- {
280
- __block NSUInteger filteredIndex = 0;
281
-
282
- [parentViewTransaction enumerateRowidsInGroup:group
283
- usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
284
- {
285
- YapCollectionKey *ck = nil;
286
- id metadata = nil;
287
- [databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
288
-
289
- if (filterBlock(group, ck.collection, ck.key, metadata))
290
- {
291
- if (filteredIndex == 0)
292
- [self insertRowid:rowid collectionKey:ck inNewGroup:group];
293
- else
294
- [self insertRowid:rowid collectionKey:ck inGroup:group atIndex:filteredIndex
295
- withExistingPageKey:nil];
296
- filteredIndex++;
297
- }
298
- }];
299
- }
300
- }
301
- else // if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithRow)
302
- {
303
- YapDatabaseViewFilteringWithRowBlock filterBlock =
304
- (YapDatabaseViewFilteringWithRowBlock)filteredView->filteringBlock;
305
-
306
- for (NSString *group in [parentViewTransaction allGroups])
307
- {
308
- __block NSUInteger filteredIndex = 0;
309
-
310
- [parentViewTransaction enumerateRowidsInGroup:group
311
- usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
312
- {
313
- YapCollectionKey *ck = nil;
314
- id object = nil;
315
- id metadata = nil;
316
-
317
- [databaseTransaction getCollectionKey:&ck
318
- object:&object
319
- metadata:&metadata
320
- forRowid:rowid];
321
-
322
- if (filterBlock(group, ck.collection, ck.key, object, metadata))
323
- {
324
- if (filteredIndex == 0)
325
- [self insertRowid:rowid collectionKey:ck inNewGroup:group];
326
- else
327
- [self insertRowid:rowid collectionKey:ck inGroup:group atIndex:filteredIndex
328
- withExistingPageKey:nil];
329
- filteredIndex++;
330
- }
331
- }];
332
- }
333
- }
334
-
335
- return YES;
336
- }
337
-
338
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
339
- #pragma mark Logic
340
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
341
-
342
- - (void)repopulateView
343
- {
344
- YDBLogAutoTrace();
345
-
346
- __unsafe_unretained YapDatabaseFilteredView *filteredView =
347
- (YapDatabaseFilteredView *)viewConnection->view;
348
-
349
- YapDatabaseViewTransaction *parentViewTransaction =
350
- [databaseTransaction ext:filteredView->parentViewName];
351
-
352
- // Code overview:
353
- //
354
- // The objective is to enumerate the parentView, and invoke the new filter on each row.
355
- // However, we want our changeset to properly match what actually changes.
356
- // That is, we don't want to simply reset our view, and then repopulate from scratch.
357
- // We want our changeset to specify the exact diff,
358
- // highlighting just those items that were ultimately added or removed.
359
- // This will allow for smooth animations when changing the filter.
360
- //
361
- // For example, in Apple's phone app, in the Recents tab, one can switch between "all" and "missed" calls.
362
- // Tapping the "missed" button smoothly animates away all non-red rows. It looks great.
363
- // This is what we're going for.
364
-
365
- if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithKey)
366
- {
367
- YapDatabaseViewFilteringWithKeyBlock filterBlock =
368
- (YapDatabaseViewFilteringWithKeyBlock)filteredView->filteringBlock;
369
-
370
- for (NSString *group in [parentViewTransaction allGroups])
371
- {
372
- __block BOOL existing = NO;
373
- __block int64_t existingRowid = 0;
374
-
375
- existing = [self getRowid:&existingRowid atIndex:0 inGroup:group];
376
-
377
- __block NSUInteger index = 0;
378
-
379
- [parentViewTransaction enumerateRowidsInGroup:group
380
- usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
381
- {
382
- YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
383
-
384
- if (filterBlock(group, ck.collection, ck.key))
385
- {
386
- if (existing && (existingRowid == rowid))
387
- {
388
- // The row was previously in the view (allowed by previous filter),
389
- // and is still in the view (allowed by new filter).
390
-
391
- index++;
392
- existing = [self getRowid:&existingRowid atIndex:index inGroup:group];
393
- }
394
- else
395
- {
396
- // The row was not previously in the view (disallowed by previous filter),
397
- // but is now in the view (allowed by new filter).
398
-
399
- if (index == 0 && ([viewConnection->group_pagesMetadata_dict objectForKey:group] == nil))
400
- [self insertRowid:rowid collectionKey:ck inNewGroup:group];
401
- else
402
- [self insertRowid:rowid collectionKey:ck inGroup:group
403
- atIndex:index withExistingPageKey:nil];
404
- index++;
405
- }
406
- }
407
- else
408
- {
409
- if (existing && (existingRowid == rowid))
410
- {
411
- // The row was previously in the view (allowed by previous filter),
412
- // but is no longer in the view (disallowed by new filter).
413
-
414
- [self removeRowid:rowid collectionKey:ck atIndex:index inGroup:group];
415
- existing = [self getRowid:&existingRowid atIndex:index inGroup:group];
416
- }
417
- else
418
- {
419
- // The row was not previously in the view (disallowed by previous filter),
420
- // and is still not in the view (disallowed by new filter).
421
- }
422
- }
423
- }];
424
- }
425
- }
426
- else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithObject)
427
- {
428
- YapDatabaseViewFilteringWithObjectBlock filterBlock =
429
- (YapDatabaseViewFilteringWithObjectBlock)filteredView->filteringBlock;
430
-
431
- for (NSString *group in [parentViewTransaction allGroups])
432
- {
433
- __block BOOL existing = NO;
434
- __block int64_t existingRowid = 0;
435
-
436
- existing = [self getRowid:&existingRowid atIndex:0 inGroup:group];
437
-
438
- __block NSUInteger index = 0;
439
-
440
- [parentViewTransaction enumerateRowidsInGroup:group
441
- usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
442
- {
443
- YapCollectionKey *ck = nil;
444
- id object = nil;
445
- [databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
446
-
447
- if (filterBlock(group, ck.collection, ck.key, object))
448
- {
449
- if (existing && (existingRowid == rowid))
450
- {
451
- // The row was previously in the view (allowed by previous filter),
452
- // and is still in the view (allowed by new filter).
453
-
454
- index++;
455
- existing = [self getRowid:&existingRowid atIndex:index inGroup:group];
456
- }
457
- else
458
- {
459
- // The row was not previously in the view (disallowed by previous filter),
460
- // but is now in the view (allowed by new filter).
461
-
462
- if (index == 0 && ([viewConnection->group_pagesMetadata_dict objectForKey:group] == nil))
463
- [self insertRowid:rowid collectionKey:ck inNewGroup:group];
464
- else
465
- [self insertRowid:rowid collectionKey:ck inGroup:group
466
- atIndex:index withExistingPageKey:nil];
467
- index++;
468
- }
469
- }
470
- else
471
- {
472
- if (existing && (existingRowid == rowid))
473
- {
474
- // The row was previously in the view (allowed by previous filter),
475
- // but is no longer in the view (disallowed by new filter).
476
-
477
- [self removeRowid:rowid collectionKey:ck atIndex:index inGroup:group];
478
- existing = [self getRowid:&existingRowid atIndex:index inGroup:group];
479
- }
480
- else
481
- {
482
- // The row was not previously in the view (disallowed by previous filter),
483
- // and is still not in the view (disallowed by new filter).
484
- }
485
- }
486
- }];
487
- }
488
- }
489
- else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithMetadata)
490
- {
491
- YapDatabaseViewFilteringWithMetadataBlock filterBlock =
492
- (YapDatabaseViewFilteringWithMetadataBlock)filteredView->filteringBlock;
493
-
494
- for (NSString *group in [parentViewTransaction allGroups])
495
- {
496
- __block BOOL existing = NO;
497
- __block int64_t existingRowid = 0;
498
-
499
- existing = [self getRowid:&existingRowid atIndex:0 inGroup:group];
500
-
501
- __block NSUInteger index = 0;
502
-
503
- [parentViewTransaction enumerateRowidsInGroup:group
504
- usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
505
- {
506
- YapCollectionKey *ck = nil;
507
- id metadata = nil;
508
- [databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
509
-
510
- if (filterBlock(group, ck.collection, ck.key, metadata))
511
- {
512
- if (existing && (existingRowid == rowid))
513
- {
514
- // The row was previously in the view (allowed by previous filter),
515
- // and is still in the view (allowed by new filter).
516
-
517
- index++;
518
- existing = [self getRowid:&existingRowid atIndex:index inGroup:group];
519
- }
520
- else
521
- {
522
- // The row was not previously in the view (disallowed by previous filter),
523
- // but is now in the view (allowed by new filter).
524
-
525
- if (index == 0 && ([viewConnection->group_pagesMetadata_dict objectForKey:group] == nil))
526
- [self insertRowid:rowid collectionKey:ck inNewGroup:group];
527
- else
528
- [self insertRowid:rowid collectionKey:ck inGroup:group
529
- atIndex:index withExistingPageKey:nil];
530
- index++;
531
- }
532
- }
533
- else
534
- {
535
- if (existing && (existingRowid == rowid))
536
- {
537
- // The row was previously in the view (allowed by previous filter),
538
- // but is no longer in the view (disallowed by new filter).
539
-
540
- [self removeRowid:rowid collectionKey:ck atIndex:index inGroup:group];
541
- existing = [self getRowid:&existingRowid atIndex:index inGroup:group];
542
- }
543
- else
544
- {
545
- // The row was not previously in the view (disallowed by previous filter),
546
- // and is still not in the view (disallowed by new filter).
547
- }
548
- }
549
- }];
550
- }
551
- }
552
- else // if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithRow)
553
- {
554
- YapDatabaseViewFilteringWithRowBlock filterBlock =
555
- (YapDatabaseViewFilteringWithRowBlock)filteredView->filteringBlock;
556
-
557
- for (NSString *group in [parentViewTransaction allGroups])
558
- {
559
- __block BOOL existing = NO;
560
- __block int64_t existingRowid = 0;
561
-
562
- existing = [self getRowid:&existingRowid atIndex:0 inGroup:group];
563
-
564
- __block NSUInteger index = 0;
565
-
566
- [parentViewTransaction enumerateRowidsInGroup:group
567
- usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
568
- {
569
- YapCollectionKey *ck = nil;
570
- id object = nil;
571
- id metadata = nil;
572
-
573
- [databaseTransaction getCollectionKey:&ck
574
- object:&object
575
- metadata:&metadata
576
- forRowid:rowid];
577
-
578
- if (filterBlock(group, ck.collection, ck.key, object, metadata))
579
- {
580
- if (existing && (existingRowid == rowid))
581
- {
582
- // The row was previously in the view (allowed by previous filter),
583
- // and is still in the view (allowed by new filter).
584
-
585
- index++;
586
- existing = [self getRowid:&existingRowid atIndex:index inGroup:group];
587
- }
588
- else
589
- {
590
- // The row was not previously in the view (disallowed by previous filter),
591
- // but is now in the view (allowed by new filter).
592
-
593
- if (index == 0 && ([viewConnection->group_pagesMetadata_dict objectForKey:group] == nil))
594
- [self insertRowid:rowid collectionKey:ck inNewGroup:group];
595
- else
596
- [self insertRowid:rowid collectionKey:ck inGroup:group
597
- atIndex:index withExistingPageKey:nil];
598
- index++;
599
- }
600
- }
601
- else
602
- {
603
- if (existing && (existingRowid == rowid))
604
- {
605
- // The row was previously in the view (allowed by previous filter),
606
- // but is no longer in the view (disallowed by new filter).
607
-
608
- [self removeRowid:rowid collectionKey:ck atIndex:index inGroup:group];
609
- existing = [self getRowid:&existingRowid atIndex:index inGroup:group];
610
- }
611
- else
612
- {
613
- // The row was not previously in the view (disallowed by previous filter),
614
- // and is still not in the view (disallowed by new filter).
615
- }
616
- }
617
- }];
618
- }
619
- }
620
- }
621
-
622
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
623
- #pragma mark YapDatabaseExtensionTransaction_Hooks
624
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
625
-
626
- /**
627
- * YapDatabase extension hook.
628
- * This method is invoked by a YapDatabaseReadWriteTransaction as a post-operation-hook.
629
- * This method overrides the version in YapDatabaseViewTransaction.
630
- **/
631
- - (void)handleInsertObject:(id)object
632
- forCollectionKey:(YapCollectionKey *)collectionKey
633
- withMetadata:(id)metadata
634
- rowid:(int64_t)rowid
635
- {
636
- YDBLogAutoTrace();
637
-
638
- __unsafe_unretained YapDatabaseFilteredView *filteredView =
639
- (YapDatabaseFilteredView *)viewConnection->view;
640
-
641
- __unsafe_unretained NSString *collection = collectionKey.collection;
642
- __unsafe_unretained NSString *key = collectionKey.key;
643
-
644
- // Instead of going to the groupingBlock,
645
- // just ask the parentViewTransaction what the last group was.
646
-
647
- YapDatabaseViewTransaction *parentViewTransaction =
648
- [databaseTransaction ext:filteredView->parentViewName];
649
-
650
- NSString *group = parentViewTransaction->lastHandledGroup;
651
-
652
- if (group == nil)
653
- {
654
- // Not included in parentView.
655
- // This was an insert operation, so we know the key wasn't already in the view.
656
-
657
- lastHandledGroup = nil;
658
- return;
659
- }
660
-
661
- // Ask filter block if we should add key to view.
662
-
663
- BOOL passesFilter;
664
-
665
- if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithKey)
666
- {
667
- YapDatabaseViewFilteringWithKeyBlock filterBlock =
668
- (YapDatabaseViewFilteringWithKeyBlock)filteredView->filteringBlock;
669
-
670
- passesFilter = filterBlock(group, collection, key);
671
- }
672
- else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithObject)
673
- {
674
- YapDatabaseViewFilteringWithObjectBlock filterBlock =
675
- (YapDatabaseViewFilteringWithObjectBlock)filteredView->filteringBlock;
676
-
677
- passesFilter = filterBlock(group, collection, key, object);
678
- }
679
- else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithMetadata)
680
- {
681
- YapDatabaseViewFilteringWithMetadataBlock filterBlock =
682
- (YapDatabaseViewFilteringWithMetadataBlock)filteredView->filteringBlock;
683
-
684
- passesFilter = filterBlock(group, collection, key, metadata);
685
- }
686
- else // if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithRow)
687
- {
688
- YapDatabaseViewFilteringWithRowBlock filterBlock =
689
- (YapDatabaseViewFilteringWithRowBlock)filteredView->filteringBlock;
690
-
691
- passesFilter = filterBlock(group, collection, key, object, metadata);
692
- }
693
-
694
- if (passesFilter)
695
- {
696
- // This was an insert operation, so we know the key wasn't already in the view.
697
-
698
- int flags = (YapDatabaseViewChangedObject | YapDatabaseViewChangedMetadata);
699
-
700
- [self insertRowid:rowid
701
- collectionKey:collectionKey
702
- object:object
703
- metadata:metadata
704
- inGroup:group
705
- withChanges:flags
706
- isNew:YES];
707
-
708
- lastHandledGroup = group;
709
- }
710
- else
711
- {
712
- // Filtered from this view.
713
- // This was an insert operation, so we know the key wasn't already in the view.
714
-
715
- lastHandledGroup = nil;
716
- }
717
- }
718
-
719
- /**
720
- * YapDatabase extension hook.
721
- * This method is invoked by a YapDatabaseReadWriteTransaction as a post-operation-hook.
722
- * This method overrides the version in YapDatabaseViewTransaction.
723
- **/
724
- - (void)handleUpdateObject:(id)object
725
- forCollectionKey:(YapCollectionKey *)collectionKey
726
- withMetadata:(id)metadata
727
- rowid:(int64_t)rowid
728
- {
729
- YDBLogAutoTrace();
730
-
731
- __unsafe_unretained YapDatabaseFilteredView *filteredView =
732
- (YapDatabaseFilteredView *)viewConnection->view;
733
-
734
- __unsafe_unretained NSString *collection = collectionKey.collection;
735
- __unsafe_unretained NSString *key = collectionKey.key;
736
-
737
- // Instead of going to the groupingBlock,
738
- // just ask the parentViewTransaction what the last group was.
739
-
740
- YapDatabaseViewTransaction *parentViewTransaction =
741
- [databaseTransaction ext:filteredView->parentViewName];
742
-
743
- NSString *group = parentViewTransaction->lastHandledGroup;
744
-
745
- if (group == nil)
746
- {
747
- // Not included in parentView.
748
- // Remove key from view (if needed).
749
- // This was an update operation, so the key may have previously been in the view.
750
-
751
- [self removeRowid:rowid collectionKey:collectionKey];
752
-
753
- lastHandledGroup = nil;
754
- return;
755
- }
756
-
757
- // Ask filter block if we should add key to view.
758
-
759
- BOOL passesFilter;
760
-
761
- if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithKey)
762
- {
763
- YapDatabaseViewFilteringWithKeyBlock filterBlock =
764
- (YapDatabaseViewFilteringWithKeyBlock)filteredView->filteringBlock;
765
-
766
- passesFilter = filterBlock(group, collection, key);
767
- }
768
- else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithObject)
769
- {
770
- YapDatabaseViewFilteringWithObjectBlock filterBlock =
771
- (YapDatabaseViewFilteringWithObjectBlock)filteredView->filteringBlock;
772
-
773
- passesFilter = filterBlock(group, collection, key, object);
774
- }
775
- else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithMetadata)
776
- {
777
- YapDatabaseViewFilteringWithMetadataBlock filterBlock =
778
- (YapDatabaseViewFilteringWithMetadataBlock)filteredView->filteringBlock;
779
-
780
- passesFilter = filterBlock(group, collection, key, metadata);
781
- }
782
- else // if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithRow)
783
- {
784
- YapDatabaseViewFilteringWithRowBlock filterBlock =
785
- (YapDatabaseViewFilteringWithRowBlock)filteredView->filteringBlock;
786
-
787
- passesFilter = filterBlock(group, collection, key, object, metadata);
788
- }
789
-
790
- if (passesFilter)
791
- {
792
- // Add key to view (or update position).
793
- // This was an update operation, so the key may have previously been in the view.
794
-
795
- int flags = (YapDatabaseViewChangedObject | YapDatabaseViewChangedMetadata);
796
-
797
- [self insertRowid:rowid
798
- collectionKey:collectionKey
799
- object:object
800
- metadata:metadata
801
- inGroup:group
802
- withChanges:flags
803
- isNew:NO];
804
-
805
- lastHandledGroup = group;
806
- }
807
- else
808
- {
809
- // Filtered from this view.
810
- // Remove key from view (if needed).
811
- // This was an update operation, so the key may have previously been in the view.
812
-
813
- [self removeRowid:rowid collectionKey:collectionKey];
814
- lastHandledGroup = nil;
815
- }
816
- }
817
-
818
- /**
819
- * YapDatabase extension hook.
820
- * This method is invoked by a YapDatabaseReadWriteTransaction as a post-operation-hook.
821
- * This method overrides the version in YapDatabaseViewTransaction.
822
- **/
823
- - (void)handleReplaceObject:(id)object forCollectionKey:(YapCollectionKey *)collectionKey withRowid:(int64_t)rowid
824
- {
825
- YDBLogAutoTrace();
826
-
827
- __unsafe_unretained YapDatabaseFilteredView *filteredView =
828
- (YapDatabaseFilteredView *)viewConnection->view;
829
-
830
- __unsafe_unretained NSString *collection = collectionKey.collection;
831
- __unsafe_unretained NSString *key = collectionKey.key;
832
-
833
- BOOL groupMayHaveChanged = filteredView->groupingBlockType == YapDatabaseViewBlockTypeWithRow ||
834
- filteredView->groupingBlockType == YapDatabaseViewBlockTypeWithObject;
835
-
836
- BOOL sortMayHaveChanged = filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithRow ||
837
- filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithObject;
838
-
839
- // Instead of going to the groupingBlock,
840
- // just ask the parentViewTransaction what the last group was.
841
-
842
- YapDatabaseViewTransaction *parentViewTransaction =
843
- [databaseTransaction ext:filteredView->parentViewName];
844
-
845
- NSString *group = parentViewTransaction->lastHandledGroup;
846
-
847
- if (group == nil)
848
- {
849
- // Not included in parentView.
850
-
851
- if (groupMayHaveChanged)
852
- {
853
- // Remove key from view (if needed).
854
- // This was an update operation, so the key may have previously been in the view.
855
-
856
- [self removeRowid:rowid collectionKey:collectionKey];
857
- }
858
- else
859
- {
860
- // The group hasn't changed.
861
- // Thus it wasn't previously in view, and still isn't in the view.
862
- }
863
-
864
- lastHandledGroup = nil;
865
- return;
866
- }
867
-
868
- BOOL filterMayHaveChanged = filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithRow ||
869
- filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithObject;
870
-
871
- if (!groupMayHaveChanged && !sortMayHaveChanged && !filterMayHaveChanged)
872
- {
873
- // Nothing has changed that could possibly affect the view.
874
- // Just note the touch.
875
-
876
- int flags = YapDatabaseViewChangedObject;
877
-
878
- NSString *pageKey = [self pageKeyForRowid:rowid];
879
- NSUInteger existingIndex = [self indexForRowid:rowid inGroup:group withPageKey:pageKey];
880
-
881
- [viewConnection->changes addObject:
882
- [YapDatabaseViewRowChange updateKey:collectionKey changes:flags inGroup:group atIndex:existingIndex]];
883
-
884
- lastHandledGroup = group;
885
- return;
886
- }
887
-
888
- // Ask filter block if we should add key to view.
889
-
890
- BOOL passesFilter;
891
- id metadata = nil;
892
-
893
- if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithKey)
894
- {
895
- YapDatabaseViewFilteringWithKeyBlock filterBlock =
896
- (YapDatabaseViewFilteringWithKeyBlock)filteredView->filteringBlock;
897
-
898
- passesFilter = filterBlock(group, collection, key);
899
- }
900
- else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithObject)
901
- {
902
- YapDatabaseViewFilteringWithObjectBlock filterBlock =
903
- (YapDatabaseViewFilteringWithObjectBlock)filteredView->filteringBlock;
904
-
905
- passesFilter = filterBlock(group, collection, key, object);
906
- }
907
- else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithMetadata)
908
- {
909
- YapDatabaseViewFilteringWithMetadataBlock filterBlock =
910
- (YapDatabaseViewFilteringWithMetadataBlock)filteredView->filteringBlock;
911
-
912
- metadata = [databaseTransaction metadataForCollectionKey:collectionKey withRowid:rowid];
913
- passesFilter = filterBlock(group, collection, key, metadata);
914
- }
915
- else // if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithRow)
916
- {
917
- YapDatabaseViewFilteringWithRowBlock filterBlock =
918
- (YapDatabaseViewFilteringWithRowBlock)filteredView->filteringBlock;
919
-
920
- metadata = [databaseTransaction metadataForCollectionKey:collectionKey withRowid:rowid];
921
- passesFilter = filterBlock(group, collection, key, object, metadata);
922
- }
923
-
924
- if (passesFilter)
925
- {
926
- // Add key to view (or update position).
927
- // This was an update operation, so the key may have previously been in the view.
928
-
929
- int flags = (YapDatabaseViewChangedObject | YapDatabaseViewChangedMetadata);
930
-
931
- BOOL sortingBlockNeedsMetadata = filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithRow ||
932
- filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithMetadata;
933
- if (sortingBlockNeedsMetadata && metadata == nil)
934
- {
935
- metadata = [databaseTransaction metadataForCollectionKey:collectionKey withRowid:rowid];
936
- }
937
-
938
- [self insertRowid:rowid
939
- collectionKey:collectionKey
940
- object:object
941
- metadata:metadata
942
- inGroup:group
943
- withChanges:flags
944
- isNew:NO];
945
-
946
- lastHandledGroup = group;
947
- }
948
- else
949
- {
950
- // Filtered from this view.
951
- // Remove key from view (if needed).
952
- // This was an update operation, so the key may have previously been in the view.
953
-
954
- [self removeRowid:rowid collectionKey:collectionKey];
955
- lastHandledGroup = nil;
956
- }
957
- }
958
-
959
- /**
960
- * YapDatabase extension hook.
961
- * This method is invoked by a YapDatabaseReadWriteTransaction as a post-operation-hook.
962
- * This method overrides the version in YapDatabaseViewTransaction.
963
- **/
964
- - (void)handleReplaceMetadata:(id)metadata forCollectionKey:(YapCollectionKey *)collectionKey withRowid:(int64_t)rowid
965
- {
966
- YDBLogAutoTrace();
967
-
968
- __unsafe_unretained YapDatabaseFilteredView *filteredView =
969
- (YapDatabaseFilteredView *)viewConnection->view;
970
-
971
- __unsafe_unretained NSString *collection = collectionKey.collection;
972
- __unsafe_unretained NSString *key = collectionKey.key;
973
-
974
- BOOL groupMayHaveChanged = filteredView->groupingBlockType == YapDatabaseViewBlockTypeWithRow ||
975
- filteredView->groupingBlockType == YapDatabaseViewBlockTypeWithMetadata;
976
-
977
- BOOL sortMayHaveChanged = filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithRow ||
978
- filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithMetadata;
979
-
980
- // Instead of going to the groupingBlock,
981
- // just ask the parentViewTransaction what the last group was.
982
-
983
- YapDatabaseViewTransaction *parentViewTransaction =
984
- [databaseTransaction ext:filteredView->parentViewName];
985
-
986
- NSString *group = parentViewTransaction->lastHandledGroup;
987
-
988
- if (group == nil)
989
- {
990
- // Not included in parentView.
991
-
992
- if (groupMayHaveChanged)
993
- {
994
- // Remove key from view (if needed).
995
- // This was an update operation, so the key may have previously been in the view.
996
-
997
- [self removeRowid:rowid collectionKey:collectionKey];
998
- }
999
- else
1000
- {
1001
- // The group hasn't changed.
1002
- // Thus it wasn't previously in view, and still isn't in the view.
1003
- }
1004
-
1005
- lastHandledGroup = nil;
1006
- return;
1007
- }
1008
-
1009
- BOOL filterMayHaveChanged = filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithRow ||
1010
- filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithMetadata;
1011
-
1012
- if (!groupMayHaveChanged && !sortMayHaveChanged && !filterMayHaveChanged)
1013
- {
1014
- // Nothing has changed that could possibly affect the view.
1015
- // Just note the touch.
1016
-
1017
- int flags = YapDatabaseViewChangedMetadata;
1018
-
1019
- NSString *pageKey = [self pageKeyForRowid:rowid];
1020
- NSUInteger existingIndex = [self indexForRowid:rowid inGroup:group withPageKey:pageKey];
1021
-
1022
- [viewConnection->changes addObject:
1023
- [YapDatabaseViewRowChange updateKey:collectionKey changes:flags inGroup:group atIndex:existingIndex]];
1024
-
1025
- lastHandledGroup = group;
1026
- return;
1027
- }
1028
-
1029
- // Ask filter block if we should add key to view.
1030
-
1031
- BOOL passesFilter;
1032
- id object = nil;
1033
-
1034
- if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithKey)
1035
- {
1036
- YapDatabaseViewFilteringWithKeyBlock filterBlock =
1037
- (YapDatabaseViewFilteringWithKeyBlock)filteredView->filteringBlock;
1038
-
1039
- passesFilter = filterBlock(group, collection, key);
1040
- }
1041
- else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithObject)
1042
- {
1043
- YapDatabaseViewFilteringWithObjectBlock filterBlock =
1044
- (YapDatabaseViewFilteringWithObjectBlock)filteredView->filteringBlock;
1045
-
1046
- object = [databaseTransaction objectForCollectionKey:collectionKey withRowid:rowid];
1047
- passesFilter = filterBlock(group, collection, key, object);
1048
- }
1049
- else if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithMetadata)
1050
- {
1051
- YapDatabaseViewFilteringWithMetadataBlock filterBlock =
1052
- (YapDatabaseViewFilteringWithMetadataBlock)filteredView->filteringBlock;
1053
-
1054
- passesFilter = filterBlock(group, collection, key, metadata);
1055
- }
1056
- else // if (filteredView->filteringBlockType == YapDatabaseViewBlockTypeWithRow)
1057
- {
1058
- YapDatabaseViewFilteringWithRowBlock filterBlock =
1059
- (YapDatabaseViewFilteringWithRowBlock)filteredView->filteringBlock;
1060
-
1061
- object = [databaseTransaction objectForCollectionKey:collectionKey withRowid:rowid];
1062
- passesFilter = filterBlock(group, collection, key, object, metadata);
1063
- }
1064
-
1065
- if (passesFilter)
1066
- {
1067
- // Add key to view (or update position).
1068
- // This was an update operation, so the key may have previously been in the view.
1069
-
1070
- int flags = (YapDatabaseViewChangedObject | YapDatabaseViewChangedMetadata);
1071
-
1072
- BOOL sortingBlockNeedsObject = filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithRow ||
1073
- filteredView->sortingBlockType == YapDatabaseViewBlockTypeWithObject;
1074
- if (sortingBlockNeedsObject && object == nil)
1075
- {
1076
- object = [databaseTransaction objectForCollectionKey:collectionKey withRowid:rowid];
1077
- }
1078
-
1079
- [self insertRowid:rowid
1080
- collectionKey:collectionKey
1081
- object:object
1082
- metadata:metadata
1083
- inGroup:group
1084
- withChanges:flags
1085
- isNew:NO];
1086
-
1087
- lastHandledGroup = group;
1088
- }
1089
- else
1090
- {
1091
- // Filtered from this view.
1092
- // Remove key from view (if needed).
1093
- // This was an update operation, so the key may have previously been in the view.
1094
-
1095
- [self removeRowid:rowid collectionKey:collectionKey];
1096
- lastHandledGroup = nil;
1097
- }
1098
- }
1099
-
1100
- ///
1101
- /// All other hook methods are handled by superclass (YapDatabaseViewTransaction).
1102
- ///
1103
-
1104
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1105
- #pragma mark YapDatabaseViewDependency Protocol
1106
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1107
-
1108
- /**
1109
- * This method is invoked if our parentView repopulates.
1110
- * For example:
1111
- *
1112
- * - The parentView is a YapDatabaseView, and the groupingBlock and/or sortingBlock was changed.
1113
- * - The parentView is a YapDatabaseFilteredView, and the filterBlock was changed.
1114
- * - The parentView of the parentView was changed...
1115
- *
1116
- * When this happens, there has likely been a significant change in the content of the parentView,
1117
- * and a full repopulate is required on our part.
1118
- **/
1119
- - (void)viewDidRepopulate:(NSString *)parentViewName
1120
- {
1121
- YDBLogAutoTrace();
1122
-
1123
- if (!databaseTransaction->isReadWriteTransaction)
1124
- {
1125
- YDBLogWarn(@"%@ - Method only allowed in readWrite transaction", THIS_METHOD);
1126
- return;
1127
- }
1128
-
1129
- __unsafe_unretained YapDatabaseFilteredView *filteredView =
1130
- (YapDatabaseFilteredView *)viewConnection->view;
1131
-
1132
- if (![parentViewName isEqualToString:filteredView->parentViewName])
1133
- {
1134
- YDBLogWarn(@"%@ - Method inappropriately invoked. Doesn't match parentViewName.", THIS_METHOD);
1135
- return;
1136
- }
1137
-
1138
- // The parentView has significantly changed.
1139
- // We need to repopulate.
1140
-
1141
- [self repopulateView];
1142
-
1143
- // Propogate the notification onward to any extensions dependent upon this one.
1144
-
1145
- __unsafe_unretained NSString *registeredName = [self registeredName];
1146
- __unsafe_unretained NSDictionary *extensionDependencies = databaseTransaction->connection->extensionDependencies;
1147
-
1148
- [extensionDependencies enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop){
1149
-
1150
- __unsafe_unretained NSString *extName = (NSString *)key;
1151
- __unsafe_unretained NSSet *extDependencies = (NSSet *)obj;
1152
-
1153
- if ([extDependencies containsObject:registeredName])
1154
- {
1155
- YapDatabaseExtensionTransaction *extTransaction = [databaseTransaction ext:extName];
1156
-
1157
- if ([extTransaction respondsToSelector:@selector(viewDidRepopulate:)])
1158
- {
1159
- [(id <YapDatabaseViewDependency>)extTransaction viewDidRepopulate:registeredName];
1160
- }
1161
- }
1162
- }];
1163
- }
1164
-
1165
- @end
1166
-
1167
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1168
- #pragma mark -
1169
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
1170
-
1171
- @implementation YapDatabaseFilteredViewTransaction (ReadWrite)
1172
-
1173
- - (void)setFilteringBlock:(YapDatabaseViewFilteringBlock)inFilteringBlock
1174
- filteringBlockType:(YapDatabaseViewBlockType)inFilteringBlockType
1175
- versionTag:(NSString *)inVersionTag
1176
-
1177
- {
1178
- YDBLogAutoTrace();
1179
-
1180
- NSAssert(inFilteringBlock != NULL, @"Invalid filteringBlock");
1181
-
1182
- NSAssert(inFilteringBlockType == YapDatabaseViewBlockTypeWithKey ||
1183
- inFilteringBlockType == YapDatabaseViewBlockTypeWithObject ||
1184
- inFilteringBlockType == YapDatabaseViewBlockTypeWithMetadata ||
1185
- inFilteringBlockType == YapDatabaseViewBlockTypeWithRow,
1186
- @"Invalid filteringBlockType");
1187
-
1188
- if (!databaseTransaction->isReadWriteTransaction)
1189
- {
1190
- YDBLogWarn(@"%@ - Method only allowed in readWrite transaction", THIS_METHOD);
1191
- return;
1192
- }
1193
-
1194
- __unsafe_unretained YapDatabaseFilteredView *filteredView =
1195
- (YapDatabaseFilteredView *)viewConnection->view;
1196
-
1197
- NSString *newVersionTag = inVersionTag ? [inVersionTag copy] : @"";
1198
-
1199
- if ([filteredView->versionTag isEqualToString:newVersionTag])
1200
- {
1201
- YDBLogWarn(@"%@ - versionTag didn't change, so not updating view", THIS_METHOD);
1202
- return;
1203
- }
1204
-
1205
- filteredView->filteringBlock = inFilteringBlock;
1206
- filteredView->filteringBlockType = inFilteringBlockType;
1207
-
1208
- filteredView->versionTag = newVersionTag;
1209
-
1210
- [self repopulateView];
1211
- [self setStringValue:newVersionTag forExtensionKey:ExtKey_versionTag];
1212
-
1213
- // Notify any extensions dependent upon this one that we repopulated.
1214
-
1215
- NSString *registeredName = [self registeredName];
1216
- NSDictionary *extensionDependencies = databaseTransaction->connection->extensionDependencies;
1217
-
1218
- [extensionDependencies enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop){
1219
-
1220
- __unsafe_unretained NSString *extName = (NSString *)key;
1221
- __unsafe_unretained NSSet *extDependencies = (NSSet *)obj;
1222
-
1223
- if ([extDependencies containsObject:registeredName])
1224
- {
1225
- YapDatabaseExtensionTransaction *extTransaction = [databaseTransaction ext:extName];
1226
-
1227
- if ([extTransaction respondsToSelector:@selector(viewDidRepopulate:)])
1228
- {
1229
- [(id <YapDatabaseViewDependency>)extTransaction viewDidRepopulate:registeredName];
1230
- }
1231
- }
1232
- }];
1233
- }
1234
-
1235
- @end