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,99 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
-
4
- /**
5
- * The grouping block handles both filtering and grouping.
6
- *
7
- * When you add or update rows in the databse the grouping block is invoked.
8
- * Your grouping block can inspect the row and determine if it should be a part of the view.
9
- * If not, your grouping block simply returns 'nil' and the object is excluded from the view (removing it if needed).
10
- * Otherwise your grouping block returns a group, which can be any string you want.
11
- * Once the view knows what group the row belongs to,
12
- * it will then determine the position of the row within the group (using the sorting block).
13
- *
14
- * You should choose a block type that takes the minimum number of required parameters.
15
- * The view can make various optimizations based on required parameters of the block.
16
- **/
17
- typedef id YapDatabaseViewGroupingBlock; // One of the YapDatabaseViewGroupingX types below.
18
-
19
- typedef NSString* (^YapDatabaseViewGroupingWithKeyBlock)(NSString *collection, NSString *key);
20
- typedef NSString* (^YapDatabaseViewGroupingWithObjectBlock)(NSString *collection, NSString *key, id object);
21
- typedef NSString* (^YapDatabaseViewGroupingWithMetadataBlock)(NSString *collection, NSString *key, id metadata);
22
- typedef NSString* (^YapDatabaseViewGroupingWithRowBlock)(NSString *collection, NSString *key, id object, id metadata);
23
-
24
-
25
- /**
26
- * The sorting block handles sorting of objects within their group.
27
- *
28
- * After the view invokes the grouping block to determine what group a database row belongs to (if any),
29
- * the view then needs to determine what index within that group the row should be.
30
- * In order to do this, it needs to compare the new/updated row with existing rows in the same view group.
31
- * This is what the sorting block is used for.
32
- * So the sorting block will be invoked automatically during this process until the view has come to a conclusion.
33
- *
34
- * You should choose a block type that takes the minimum number of required parameters.
35
- * The view can make various optimizations based on required parameters of the block.
36
- *
37
- * For example, if sorting is based on the object, and the metadata of a row is updated,
38
- * then the view can deduce that the index hasn't changed (if the group hans't), and can skip this step.
39
- *
40
- * Performance Note:
41
- *
42
- * The view uses various optimizations (based on common patterns)
43
- * to reduce the number of times it needs to invoke the sorting block.
44
- *
45
- * - Pattern : row is updated, but its index in the view doesn't change.
46
- * Optimization : if an updated row doesn't change groups, the view will first compare it with
47
- * objects to the left and right.
48
- *
49
- * - Pattern : rows are added to the beginning or end or a view
50
- * Optimization : if the last change put an object at the beginning of the view, then it will test this quickly.
51
- * if the last change put an object at the end of the view, then it will test this quickly.
52
- *
53
- * These optimizations offer huge performance benefits to many common cases.
54
- * For example, adding objects to a view that are sorted by timestamp of when they arrived.
55
- *
56
- * The optimizations are not always performed.
57
- * That is, if the row is added to a group it didn't previously belong,
58
- * or if the last change didn't place an item at the beginning or end of the view.
59
- *
60
- * If optimizations fail, or are skipped, then the view uses a binary search algorithm.
61
- *
62
- * Although this may be considered "internal information",
63
- * I feel it is important to explain for the following reason:
64
- *
65
- * Another common pattern is to fetch a number of objects in a batch, and then insert them into the database.
66
- * Now imagine a situation in which the view is sorting posts based on timestamp,
67
- * and you just fetched the most recent 10 posts. You can enumerate these 10 posts in forwards or backwards
68
- * while adding them to the database. One direction will hit the optimization every time. The other will cause
69
- * the view to perform a binary search every time. These little one-liner optimzations are easy.
70
- **/
71
- typedef id YapDatabaseViewSortingBlock; // One of the YapDatabaseViewSortingX types below.
72
-
73
- typedef NSComparisonResult (^YapDatabaseViewSortingWithKeyBlock) \
74
- (NSString *group, NSString *collection1, NSString *key1, \
75
- NSString *collection2, NSString *key2);
76
- typedef NSComparisonResult (^YapDatabaseViewSortingWithObjectBlock) \
77
- (NSString *group, NSString *collection1, NSString *key1, id object1, \
78
- NSString *collection2, NSString *key2, id object2);
79
- typedef NSComparisonResult (^YapDatabaseViewSortingWithMetadataBlock) \
80
- (NSString *group, NSString *collection1, NSString *key1, id metadata, \
81
- NSString *collection2, NSString *key2, id metadata2);
82
- typedef NSComparisonResult (^YapDatabaseViewSortingWithRowBlock) \
83
- (NSString *group, NSString *collection1, NSString *key1, id object1, id metadata1, \
84
- NSString *collection2, NSString *key2, id object2, id metadata2);
85
-
86
-
87
- /**
88
- * I wish there was a way to inspect a given block and see what kind of parameters it takes.
89
- * Sadly this does not appear to be possible (at least not in any kind of standard legal way).
90
- *
91
- * Thus you will have to specify what kind of block you're passing.
92
- **/
93
- typedef enum {
94
- YapDatabaseViewBlockTypeWithKey = 1,
95
- YapDatabaseViewBlockTypeWithObject = 2,
96
- YapDatabaseViewBlockTypeWithMetadata = 3,
97
- YapDatabaseViewBlockTypeWithRow = 4
98
- } YapDatabaseViewBlockType;
99
-
@@ -1,8 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
-
4
- @interface NSDictionary (YapDatabase)
5
-
6
- - (BOOL)ydb_containsKey:(id)key;
7
-
8
- @end
@@ -1,19 +0,0 @@
1
- #import "NSDictionary+YapDatabase.h"
2
-
3
-
4
- @implementation NSDictionary (YapDatabase)
5
-
6
- /**
7
- * Originally I named this method simply 'containsKey:'.
8
- * But then immediately got a stack overflow when using the category.
9
- *
10
- * Apparently Apple's code actually registers the 'containsKey:' method in the objective-c space.
11
- * And invoking CFDictionaryContainsKey results in a method call back to our 'containsKey:' method,
12
- * and thus we get an infinite loop.
13
- **/
14
- - (BOOL)ydb_containsKey:(id)key
15
- {
16
- return CFDictionaryContainsKey((CFDictionaryRef)self, (const void *)key);
17
- }
18
-
19
- @end
@@ -1,91 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- #define YAP_CACHE_STATISTICS 0
4
-
5
- /**
6
- * YapCache implements a simple strict cache.
7
- *
8
- * It is very similar to NSCache and shares a similar API.
9
- * However, YapCache implements a strict countLimit and monitors usage so eviction is properly ordered.
10
- *
11
- * For example:
12
- * If you set a countLimit of 4, then when you add the 5th item to the cache, another item is automatically evicted.
13
- * It doesn't happen at a later time as with NSCache. It happens atomically during the addition of the 5th item.
14
-
15
- * Which item gets evicted? That depends entirely on usage.
16
- * YapCache maintains a doubly linked-list of keys ordered by access.
17
- * The most recently accessed key is at the front of the linked-list,
18
- * and the least recently accessed key is at the back.
19
- * So it's very quick and efficient to evict items based on recent usage.
20
- *
21
- * YapCache is NOT thread-safe.
22
- * It is designed to be used by the various YapDatabase classes, which inherently serialize access to the cache.
23
- **/
24
-
25
- @interface YapCache : NSObject
26
-
27
- /**
28
- * Initializes a cache.
29
- *
30
- * Since the countLimit is a common configuration, it may optionally be passed during initialization.
31
- * This is also used as a hint internally when initializing components (i.e. [NSMutableDictionary initWithCapacity:]).
32
- **/
33
- - (id)initWithKeyClass:(Class)keyClass;
34
- - (id)initWithKeyClass:(Class)keyClass countLimit:(NSUInteger)countLimit;
35
-
36
- /**
37
- * The countLimit specifies the maximum number of items to keep in the cache.
38
- * This limit is strictly enforced.
39
- *
40
- * The default countLimit is 40.
41
- *
42
- * You may optionally disable the countLimit by setting it to zero.
43
- *
44
- * You may change the countLimit at any time.
45
- * Changes to the countLimit take immediate effect on the cache (before the set method returns).
46
- * Thus, if needed, you can temporarily increase the cache size for certain operations.
47
- **/
48
- @property (nonatomic, assign, readwrite) NSUInteger countLimit;
49
-
50
- //
51
- // The normal cache stuff...
52
- //
53
-
54
- - (void)setObject:(id)object forKey:(id)key;
55
-
56
- - (id)objectForKey:(id)key;
57
- - (BOOL)containsKey:(id)key;
58
-
59
- - (NSUInteger)count;
60
-
61
- - (void)removeAllObjects;
62
- - (void)removeObjectForKey:(id)key;
63
- - (void)removeObjectsForKeys:(NSArray *)keys;
64
-
65
- - (void)enumerateKeysWithBlock:(void (^)(id key, BOOL *stop))block;
66
- - (void)enumerateKeysAndObjectsWithBlock:(void (^)(id key, id obj, BOOL *stop))block;
67
-
68
- //
69
- // Some debugging stuff that gets compiled out
70
- //
71
-
72
- #if YAP_CACHE_STATISTICS
73
-
74
- /**
75
- * When querying the cache for an object via objectForKey,
76
- * the hitCount is incremented if the object is in the cache,
77
- * and the missCount is incremented if the object is not in the cache.
78
- **/
79
- @property (nonatomic, readonly) NSUInteger hitCount;
80
- @property (nonatomic, readonly) NSUInteger missCount;
81
-
82
- /**
83
- * When adding objects to the cache via setObject:forKey:,
84
- * the evictionCount is incremented if the cache is full,
85
- * and the added object causes another object (the least recently used object) to be evicted.
86
- **/
87
- @property (nonatomic, readonly) NSUInteger evictionCount;
88
-
89
- #endif
90
-
91
- @end
@@ -1,465 +0,0 @@
1
- #import "YapCache.h"
2
- #import "YapDatabaseLogging.h"
3
-
4
-
5
- /**
6
- * Define log level for this file: OFF, ERROR, WARN, INFO, VERBOSE
7
- * See YapDatabaseLogging.h for more information.
8
- **/
9
- #if DEBUG
10
- static const int ydbLogLevel = YDB_LOG_LEVEL_OFF;
11
- #else
12
- static const int ydbLogLevel = YDB_LOG_LEVEL_OFF;
13
- #endif
14
-
15
- /**
16
- * Default countLimit, as specified in header file.
17
- **/
18
- #define YAP_CACHE_DEFAULT_COUNT_LIMIT 40
19
-
20
-
21
- @interface YapCacheItem : NSObject {
22
- @public
23
- __unsafe_unretained YapCacheItem *prev; // retained by cfdict
24
- __unsafe_unretained YapCacheItem *next; // retained by cfdict
25
-
26
- __unsafe_unretained id key; // retained by cfdict as key
27
- __strong id value; // retained only by us
28
- }
29
-
30
- - (id)initWithKey:(id)key value:(id)value;
31
-
32
- @end
33
-
34
- @implementation YapCacheItem
35
-
36
- - (id)initWithKey:(id <NSCopying>)aKey value:(id)aValue
37
- {
38
- if ((self = [super init]))
39
- {
40
- key = aKey;
41
- value = aValue;
42
- }
43
- return self;
44
- }
45
-
46
- - (NSString *)description
47
- {
48
- return [NSString stringWithFormat:@"<YapCacheItem[%p] key(%@)>", self, key];
49
- }
50
-
51
- @end
52
-
53
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
54
- #pragma mark -
55
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
56
-
57
- @implementation YapCache
58
- {
59
- Class keyClass;
60
- CFMutableDictionaryRef cfdict;
61
-
62
- NSUInteger countLimit;
63
-
64
- __unsafe_unretained YapCacheItem *mostRecentCacheItem;
65
- __unsafe_unretained YapCacheItem *leastRecentCacheItem;
66
-
67
- __strong YapCacheItem *evictedCacheItem;
68
-
69
- #if YAP_CACHE_STATISTICS
70
- NSUInteger hitCount;
71
- NSUInteger missCount;
72
- NSUInteger evictionCount;
73
- #endif
74
- }
75
-
76
- #if YAP_CACHE_STATISTICS
77
- @synthesize hitCount = hitCount;
78
- @synthesize missCount = missCount;
79
- @synthesize evictionCount = evictionCount;
80
- #endif
81
-
82
- - (id)init
83
- {
84
- return [self initWithKeyClass:NULL countLimit:0];
85
- }
86
-
87
- - (id)initWithKeyClass:(Class)inKeyClass
88
- {
89
- return [self initWithKeyClass:inKeyClass countLimit:0];
90
- }
91
-
92
- - (id)initWithKeyClass:(Class)inKeyClass countLimit:(NSUInteger)inCountLimit
93
- {
94
- if ((self = [super init]))
95
- {
96
- if (inKeyClass == NULL)
97
- keyClass = [NSString class];
98
- else
99
- keyClass = inKeyClass;
100
-
101
- if (inCountLimit == 0)
102
- countLimit = YAP_CACHE_DEFAULT_COUNT_LIMIT;
103
- else
104
- countLimit = inCountLimit;
105
-
106
- // We actually use countLimit plus one.
107
- // This is because we evict items after the count surpasses the countLimit.
108
- // In other words, we evict items when the count reaches countLimit plus one.
109
-
110
- cfdict = CFDictionaryCreateMutable(kCFAllocatorDefault,
111
- 0,
112
- &kCFTypeDictionaryKeyCallBacks,
113
- &kCFTypeDictionaryValueCallBacks);
114
- }
115
- return self;
116
- }
117
-
118
- - (void)dealloc
119
- {
120
- if (cfdict) CFRelease(cfdict);
121
- }
122
-
123
- - (NSUInteger)countLimit
124
- {
125
- return countLimit;
126
- }
127
-
128
- - (void)setCountLimit:(NSUInteger)newCountLimit
129
- {
130
- if (countLimit != newCountLimit)
131
- {
132
- countLimit = newCountLimit;
133
-
134
- if (countLimit != 0) {
135
- while (CFDictionaryGetCount(cfdict) > countLimit)
136
- {
137
- leastRecentCacheItem->prev->next = nil;
138
-
139
- evictedCacheItem = leastRecentCacheItem;
140
- leastRecentCacheItem = leastRecentCacheItem->prev;
141
-
142
- CFDictionaryRemoveValue(cfdict, (const void *)(evictedCacheItem->key));
143
-
144
- evictedCacheItem->prev = nil;
145
- evictedCacheItem->next = nil;
146
- evictedCacheItem->key = nil;
147
- evictedCacheItem->value = nil;
148
-
149
- #if YAP_CACHE_STATISTICS
150
- evictionCount++;
151
- #endif
152
- }
153
- }
154
- }
155
- }
156
-
157
- - (id)objectForKey:(id)key
158
- {
159
- NSAssert([key isKindOfClass:keyClass], @"Unexpected key class. Expected %@, passed %@", keyClass, [key class]);
160
-
161
- YapCacheItem *item = CFDictionaryGetValue(cfdict, (const void *)key);
162
- if (item)
163
- {
164
- if (item != mostRecentCacheItem)
165
- {
166
- // Remove item from current position in linked-list.
167
- //
168
- // Notes:
169
- // We fetched the item from the list,
170
- // so we know there's a valid mostRecentCacheItem & leastRecentCacheItem.
171
- // Furthermore, we know the item isn't the mostRecentCacheItem.
172
-
173
- item->prev->next = item->next;
174
-
175
- if (item == leastRecentCacheItem)
176
- leastRecentCacheItem = item->prev;
177
- else
178
- item->next->prev = item->prev;
179
-
180
- // Move item to beginning of linked-list
181
-
182
- item->prev = nil;
183
- item->next = mostRecentCacheItem;
184
-
185
- mostRecentCacheItem->prev = item;
186
- mostRecentCacheItem = item;
187
- }
188
-
189
- #if YAP_CACHE_STATISTICS
190
- hitCount++;
191
- #endif
192
- return item->value;
193
- }
194
- else
195
- {
196
- #if YAP_CACHE_STATISTICS
197
- missCount++;
198
- #endif
199
- return nil;
200
- }
201
- }
202
-
203
- - (BOOL)containsKey:(id)key
204
- {
205
- NSAssert([key isKindOfClass:keyClass], @"Unexpected key class. Expected %@, passed %@", keyClass, [key class]);
206
-
207
- return CFDictionaryContainsKey(cfdict, (const void *)key);
208
- }
209
-
210
- - (void)setObject:(id)object forKey:(id)key
211
- {
212
- NSAssert([key isKindOfClass:keyClass], @"Unexpected key class. Expected %@, passed %@", keyClass, [key class]);
213
-
214
- YapCacheItem *item = CFDictionaryGetValue(cfdict, (const void *)key);
215
- if (item)
216
- {
217
- // Update item value
218
- item->value = object;
219
-
220
- if (item != mostRecentCacheItem)
221
- {
222
- // Remove item from current position in linked-list
223
- //
224
- // Notes:
225
- // We fetched the item from the list,
226
- // so we know there's a valid mostRecentCacheItem & leastRecentCacheItem.
227
- // Furthermore, we know the item isn't the mostRecentCacheItem.
228
-
229
- item->prev->next = item->next;
230
-
231
- if (item == leastRecentCacheItem)
232
- leastRecentCacheItem = item->prev;
233
- else
234
- item->next->prev = item->prev;
235
-
236
- // Move item to beginning of linked-list
237
-
238
- item->prev = nil;
239
- item->next = mostRecentCacheItem;
240
-
241
- mostRecentCacheItem->prev = item;
242
- mostRecentCacheItem = item;
243
-
244
- YDBLogVerbose(@"key(%@) <- existing, new mostRecent", key);
245
- }
246
- else
247
- {
248
- YDBLogVerbose(@"key(%@) <- existing, already mostRecent", key);
249
- }
250
- }
251
- else
252
- {
253
- // Create new item (or recycle old evicted item)
254
-
255
- if (evictedCacheItem)
256
- {
257
- item = evictedCacheItem;
258
- item->key = key;
259
- item->value = object;
260
-
261
- evictedCacheItem = nil;
262
- }
263
- else
264
- {
265
- item = [[YapCacheItem alloc] initWithKey:key value:object];
266
- }
267
-
268
- // Add item to set
269
- CFDictionarySetValue(cfdict, (const void *)key, (const void *)item);
270
-
271
- // Add item to beginning of linked-list
272
-
273
- item->next = mostRecentCacheItem;
274
-
275
- if (mostRecentCacheItem)
276
- mostRecentCacheItem->prev = item;
277
-
278
- mostRecentCacheItem = item;
279
-
280
- // Evict leastRecentCacheItem if needed
281
-
282
- if ((countLimit != 0) && (CFDictionaryGetCount(cfdict) > countLimit))
283
- {
284
- YDBLogVerbose(@"key(%@), out(%@)", key, leastRecentCacheItem->key);
285
-
286
- leastRecentCacheItem->prev->next = nil;
287
-
288
- evictedCacheItem = leastRecentCacheItem;
289
- leastRecentCacheItem = leastRecentCacheItem->prev;
290
-
291
- CFDictionaryRemoveValue(cfdict, (const void *)(evictedCacheItem->key));
292
-
293
- evictedCacheItem->prev = nil;
294
- evictedCacheItem->next = nil;
295
- evictedCacheItem->key = nil;
296
- evictedCacheItem->value = nil;
297
-
298
- #if YAP_CACHE_STATISTICS
299
- evictionCount++;
300
- #endif
301
- }
302
- else
303
- {
304
- if (leastRecentCacheItem == nil)
305
- leastRecentCacheItem = item;
306
-
307
- YDBLogVerbose(@"key(%@) <- new, new mostRecent [%ld of %lu]",
308
- key, CFDictionaryGetCount(cfdict), (unsigned long)countLimit);
309
- }
310
- }
311
-
312
- if (ydbLogLevel & YDB_LOG_FLAG_VERBOSE)
313
- {
314
- YDBLogVerbose(@"cfdict: %@", cfdict);
315
-
316
- YapCacheItem *loopItem = mostRecentCacheItem;
317
- NSUInteger i = 0;
318
-
319
- while (loopItem != nil)
320
- {
321
- YDBLogVerbose(@"%lu: %@", (unsigned long)i, loopItem);
322
-
323
- loopItem = loopItem->next;
324
- i++;
325
- }
326
- }
327
- }
328
-
329
- - (NSUInteger)count
330
- {
331
- return CFDictionaryGetCount(cfdict);
332
- }
333
-
334
- - (void)removeAllObjects
335
- {
336
- mostRecentCacheItem = nil;
337
- leastRecentCacheItem = nil;
338
- evictedCacheItem = nil;
339
-
340
- CFDictionaryRemoveAllValues(cfdict);
341
- }
342
-
343
- - (void)removeObjectForKey:(id)key
344
- {
345
- NSAssert([key isKindOfClass:keyClass], @"Unexpected key class. Expected %@, passed %@", keyClass, [key class]);
346
-
347
- YapCacheItem *item = CFDictionaryGetValue(cfdict, (const void *)key);
348
- if (item)
349
- {
350
- if (item->prev)
351
- item->prev->next = item->next;
352
-
353
- if (item->next)
354
- item->next->prev = item->prev;
355
-
356
- if (mostRecentCacheItem == item)
357
- mostRecentCacheItem = item->next;
358
-
359
- if (leastRecentCacheItem == item)
360
- leastRecentCacheItem = item->prev;
361
-
362
- CFDictionaryRemoveValue(cfdict, (const void *)key);
363
- }
364
- }
365
-
366
- - (void)removeObjectsForKeys:(NSArray *)keys
367
- {
368
- for (id key in keys)
369
- {
370
- NSAssert([key isKindOfClass:keyClass], @"Unexpected key class. Expected %@, passed %@", keyClass, [key class]);
371
-
372
- YapCacheItem *item = CFDictionaryGetValue(cfdict, (const void *)key);
373
- if (item)
374
- {
375
- if (item->prev)
376
- item->prev->next = item->next;
377
-
378
- if (item->next)
379
- item->next->prev = item->prev;
380
-
381
- if (mostRecentCacheItem == item)
382
- mostRecentCacheItem = item->next;
383
-
384
- if (leastRecentCacheItem == item)
385
- leastRecentCacheItem = item->prev;
386
-
387
- CFDictionaryRemoveValue(cfdict, (const void *)key);
388
- }
389
- }
390
- }
391
-
392
- - (void)enumerateKeysWithBlock:(void (^)(id key, BOOL *stop))block
393
- {
394
- NSDictionary *nsdict = (__bridge NSDictionary *)cfdict;
395
- BOOL stop = NO;
396
-
397
- for (id key in [nsdict keyEnumerator])
398
- {
399
- block(key, &stop);
400
-
401
- if (stop) break;
402
- }
403
- }
404
-
405
- - (void)enumerateKeysAndObjectsWithBlock:(void (^)(id key, id obj, BOOL *stop))block
406
- {
407
- NSDictionary *nsdict = (__bridge NSDictionary *)cfdict;
408
-
409
- [nsdict enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
410
-
411
- __unsafe_unretained YapCacheItem *cacheItem = (YapCacheItem *)obj;
412
-
413
- block(key, cacheItem->value, stop);
414
- }];
415
- }
416
-
417
- - (NSString *)description
418
- {
419
- NSMutableString *description = [NSMutableString string];
420
- [description appendFormat:@"%@, count=%ld, keys=\n", NSStringFromClass([self class]), CFDictionaryGetCount(cfdict)];
421
-
422
- YapCacheItem *item = mostRecentCacheItem;
423
- NSUInteger itemIndex = 0;
424
-
425
- while (item != nil)
426
- {
427
- [description appendFormat:@" %lu: %@\n", (unsigned long)itemIndex, item->key];
428
-
429
- item = item->next;
430
- itemIndex++;
431
- }
432
-
433
- return description;
434
- }
435
-
436
- /*
437
- - (void)debug
438
- {
439
- CFIndex count = CFDictionaryGetCount(cfdict);
440
- NSAssert(count <= countLimit, @"Invalid count");
441
-
442
- NSMutableArray *forwardsKeys = [NSMutableArray arrayWithCapacity:count];
443
- NSMutableArray *backwardsKeys = [NSMutableArray arrayWithCapacity:count];
444
-
445
- __unsafe_unretained YapCacheItem *loopItem;
446
-
447
- loopItem = mostRecentCacheItem;
448
- while (loopItem != nil)
449
- {
450
- [forwardsKeys addObject:loopItem->key];
451
- loopItem = loopItem->next;
452
- }
453
-
454
- loopItem = leastRecentCacheItem;
455
- while (loopItem != nil)
456
- {
457
- [backwardsKeys insertObject:loopItem->key atIndex:0];
458
- loopItem = loopItem->prev;
459
- }
460
-
461
- NSAssert([forwardsKeys isEqual:backwardsKeys], @"Invalid order");
462
- }
463
- */
464
-
465
- @end