motion-yapper 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -2
  3. data/.travis.yml +2 -0
  4. data/Gemfile +1 -0
  5. data/README.md +1 -1
  6. data/Rakefile +1 -1
  7. data/lib/motion-yapper.rb +1 -0
  8. data/lib/yapper.rb +3 -5
  9. data/lib/yapper/config.rb +2 -0
  10. data/lib/yapper/db.rb +105 -40
  11. data/lib/yapper/document.rb +7 -4
  12. data/lib/yapper/document/callbacks.rb +0 -7
  13. data/lib/yapper/document/{persistance.rb → persistence.rb} +27 -21
  14. data/lib/yapper/document/relation.rb +29 -22
  15. data/lib/yapper/document/selection.rb +122 -54
  16. data/lib/yapper/extensions.rb +12 -24
  17. data/lib/yapper/settings.rb +43 -0
  18. data/lib/yapper/timestamps.rb +2 -0
  19. data/lib/yapper/version.rb +1 -1
  20. data/{yapper.gemspec → motion-yapper.gemspec} +0 -0
  21. data/spec/integration/{where_spec.rb → criteria_spec.rb} +78 -10
  22. data/spec/integration/db_spec.rb +70 -0
  23. data/spec/integration/defaults_spec.rb +37 -0
  24. data/spec/integration/extensions_spec.rb +14 -0
  25. data/spec/integration/{persistance_spec.rb → persistence_spec.rb} +0 -0
  26. data/spec/integration/relation_spec.rb +4 -4
  27. data/vendor/Podfile.lock +9 -11
  28. data/vendor/Pods/.build/libPods-CocoaLumberjack.a +0 -0
  29. data/vendor/Pods/.build/libPods-NSData+MD5Digest.a +0 -0
  30. data/vendor/Pods/.build/libPods-YapDatabase.a +0 -0
  31. data/vendor/Pods/.build/libPods.a +0 -0
  32. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +4 -4
  33. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
  34. data/vendor/Pods/{CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.h → BuildHeaders/CocoaLumberjack/DDContextFilterLogFormatter.h} +6 -8
  35. data/vendor/Pods/BuildHeaders/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
  36. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +67 -32
  37. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog+LOGV.h +99 -0
  38. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +98 -65
  39. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDMultiFormatter.h +30 -0
  40. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +39 -25
  41. data/vendor/Pods/BuildHeaders/YapDatabase/NSDictionary+YapDatabase.h +8 -0
  42. data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +1 -0
  43. data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +3 -0
  44. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +4 -4
  45. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +21 -19
  46. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +1 -1
  47. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +35 -31
  48. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +8 -35
  49. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -2
  50. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
  51. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
  52. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +8 -0
  53. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +43 -21
  54. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationship.h +35 -0
  55. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
  56. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
  57. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdgePrivate.h +79 -0
  58. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
  59. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
  60. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipPrivate.h +125 -0
  61. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
  62. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
  63. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +10 -0
  64. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
  65. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +131 -21
  66. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +48 -107
  67. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +2 -2
  68. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +1 -0
  69. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +17 -0
  70. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +10 -3
  71. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +18 -1
  72. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +75 -24
  73. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTypes.h +99 -0
  74. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +4 -4
  75. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +51 -50
  76. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +14 -14
  77. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +546 -546
  78. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +67 -32
  79. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1093 -907
  80. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog+LOGV.h +99 -0
  81. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +98 -65
  82. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +873 -748
  83. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +39 -25
  84. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +1284 -1243
  85. data/vendor/Pods/{BuildHeaders/CocoaLumberjack/ContextFilterLogFormatter.h → CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.h} +6 -8
  86. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{ContextFilterLogFormatter.m → DDContextFilterLogFormatter.m} +70 -70
  87. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
  88. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.m +253 -0
  89. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.h +30 -0
  90. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.m +127 -0
  91. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +1 -1
  92. data/vendor/Pods/CocoaLumberjack/README.markdown +52 -15
  93. data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +4 -4
  94. data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +14 -14
  95. data/vendor/Pods/Headers/CocoaLumberjack/{ContextFilterLogFormatter.h → DDContextFilterLogFormatter.h} +6 -8
  96. data/vendor/Pods/Headers/CocoaLumberjack/{DispatchQueueLogFormatter.h → DDDispatchQueueLogFormatter.h} +18 -6
  97. data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +67 -32
  98. data/vendor/Pods/Headers/CocoaLumberjack/DDLog+LOGV.h +99 -0
  99. data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +98 -65
  100. data/vendor/Pods/Headers/CocoaLumberjack/DDMultiFormatter.h +30 -0
  101. data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +39 -25
  102. data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +3 -0
  103. data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +4 -4
  104. data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +21 -19
  105. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +8 -35
  106. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +17 -17
  107. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTypes.h +32 -0
  108. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationship.h +35 -0
  109. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipConnection.h +29 -0
  110. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipEdge.h +163 -0
  111. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipNode.h +99 -0
  112. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipOptions.h +59 -0
  113. data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipTransaction.h +384 -0
  114. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +49 -0
  115. data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +131 -21
  116. data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +48 -107
  117. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +2 -2
  118. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +1 -0
  119. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +17 -0
  120. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +10 -3
  121. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +75 -24
  122. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTypes.h +99 -0
  123. data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +2 -0
  124. data/vendor/Pods/Headers/____Pods-environment.h +15 -15
  125. data/vendor/Pods/Manifest.lock +9 -11
  126. data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +1 -1
  127. data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +2 -0
  128. data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +1 -1
  129. data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +1 -1
  130. data/vendor/Pods/{Pods-Acknowledgements.markdown → Pods-acknowledgements.markdown} +0 -37
  131. data/vendor/Pods/{Pods-Acknowledgements.plist → Pods-acknowledgements.plist} +0 -45
  132. data/vendor/Pods/Pods-environment.h +15 -15
  133. data/vendor/Pods/Pods.xcconfig +3 -3
  134. data/vendor/Pods/Pods.xcodeproj/project.pbxproj +2426 -3155
  135. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-CocoaLumberjack.xcscheme +59 -0
  136. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-NSData+MD5Digest.xcscheme +59 -0
  137. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-YapDatabase.xcscheme +59 -0
  138. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods.xcscheme +59 -0
  139. data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/xcschememanagement.plist +31 -0
  140. data/vendor/Pods/YapDatabase/README.md +3 -1
  141. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +0 -2
  142. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +8 -35
  143. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +25 -41
  144. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +17 -17
  145. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +403 -134
  146. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTypes.h +32 -0
  147. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +8 -0
  148. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +8 -8
  149. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +113 -62
  150. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +35 -31
  151. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +25 -0
  152. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +1 -1
  153. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +25 -1
  154. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipEdgePrivate.h +79 -0
  155. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipPrivate.h +125 -0
  156. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.h +35 -0
  157. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.m +129 -0
  158. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.h +29 -0
  159. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.m +802 -0
  160. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.h +163 -0
  161. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.m +408 -0
  162. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipNode.h +99 -0
  163. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.h +59 -0
  164. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.m +29 -0
  165. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.h +384 -0
  166. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.m +5254 -0
  167. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +10 -0
  168. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexSetupPrivate.h +18 -0
  169. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +49 -0
  170. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +12 -0
  171. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +9 -8
  172. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +62 -1
  173. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +148 -45
  174. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +18 -1
  175. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +2 -2
  176. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +15 -9
  177. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +17 -0
  178. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +211 -64
  179. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +48 -107
  180. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +10 -7
  181. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +1 -0
  182. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +13 -22
  183. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +10 -3
  184. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +75 -24
  185. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +725 -244
  186. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTypes.h +99 -0
  187. data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.h +8 -0
  188. data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.m +19 -0
  189. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +1 -0
  190. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +12 -0
  191. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +1 -1
  192. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +3 -3
  193. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +43 -21
  194. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +4 -0
  195. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +3 -0
  196. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +5 -0
  197. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +4 -4
  198. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +84 -93
  199. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +21 -19
  200. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +381 -209
  201. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +131 -21
  202. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +587 -267
  203. data/vendor/Pods/{Pods.bridgesupport → build-iPhoneSimulator/Pods.bridgesupport} +633 -2557
  204. data/vendor/Pods/build-iPhoneSimulator/libPods.a +0 -0
  205. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +2 -1
  206. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +2 -1
  207. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +4 -2
  208. metadata +80 -108
  209. data/Gemfile.lock +0 -63
  210. data/lib/yapper/attachment.rb +0 -48
  211. data/lib/yapper/document/attachment.rb +0 -26
  212. data/lib/yapper/sync.rb +0 -134
  213. data/lib/yapper/sync/data.rb +0 -12
  214. data/lib/yapper/sync/event.rb +0 -194
  215. data/lib/yapper/sync/queue.rb +0 -164
  216. data/spec/integration/all_spec.rb +0 -40
  217. data/spec/integration/sync_spec.rb +0 -42
  218. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +0 -641
  219. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +0 -1396
  220. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +0 -133
  221. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +0 -327
  222. data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +0 -113
  223. data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +0 -321
  224. data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +0 -71
  225. data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +0 -150
  226. data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
  227. data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +0 -157
  228. data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +0 -43
  229. data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +0 -68
  230. data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +0 -143
  231. data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +0 -370
  232. data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +0 -848
  233. data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +0 -89
  234. data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +0 -167
  235. data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +0 -78
  236. data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +0 -191
  237. data/vendor/Pods/AFNetworking/LICENSE +0 -19
  238. data/vendor/Pods/AFNetworking/README.md +0 -208
  239. data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +0 -641
  240. data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +0 -133
  241. data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +0 -113
  242. data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +0 -71
  243. data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
  244. data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +0 -43
  245. data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +0 -68
  246. data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +0 -370
  247. data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +0 -89
  248. data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +0 -78
  249. data/vendor/Pods/BuildHeaders/Reachability/Reachability.h +0 -109
  250. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.m +0 -251
  251. data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +0 -641
  252. data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +0 -133
  253. data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +0 -113
  254. data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +0 -71
  255. data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +0 -75
  256. data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +0 -43
  257. data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +0 -68
  258. data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +0 -370
  259. data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +0 -89
  260. data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +0 -78
  261. data/vendor/Pods/Headers/Reachability/Reachability.h +0 -109
  262. data/vendor/Pods/Headers/YapDatabase/YapCache.h +0 -90
  263. data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnectionState.h +0 -29
  264. data/vendor/Pods/Headers/YapDatabase/YapDatabaseDefaults.h +0 -37
  265. data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionPrivate.h +0 -440
  266. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -19
  267. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchPrivate.h +0 -69
  268. data/vendor/Pods/Headers/YapDatabase/YapDatabaseLogging.h +0 -158
  269. data/vendor/Pods/Headers/YapDatabase/YapDatabaseManager.h +0 -17
  270. data/vendor/Pods/Headers/YapDatabase/YapDatabasePrivate.h +0 -424
  271. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +0 -73
  272. data/vendor/Pods/Headers/YapDatabase/YapDatabaseStatement.h +0 -13
  273. data/vendor/Pods/Headers/YapDatabase/YapDatabaseString.h +0 -121
  274. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChangePrivate.h +0 -94
  275. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappingsPrivate.h +0 -72
  276. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPage.h +0 -36
  277. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPageMetadata.h +0 -27
  278. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPrivate.h +0 -153
  279. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +0 -17
  280. data/vendor/Pods/Headers/YapDatabase/YapMemoryTable.h +0 -74
  281. data/vendor/Pods/Headers/YapDatabase/YapNull.h +0 -17
  282. data/vendor/Pods/Headers/YapDatabase/YapTouch.h +0 -15
  283. data/vendor/Pods/Headers/____Pods-AFNetworking-prefix.h +0 -17
  284. data/vendor/Pods/Headers/____Pods-Reachability-prefix.h +0 -5
  285. data/vendor/Pods/Pods-AFNetworking-Private.xcconfig +0 -5
  286. data/vendor/Pods/Pods-AFNetworking-dummy.m +0 -5
  287. data/vendor/Pods/Pods-AFNetworking-prefix.pch +0 -17
  288. data/vendor/Pods/Pods-AFNetworking.xcconfig +0 -1
  289. data/vendor/Pods/Pods-Reachability-Private.xcconfig +0 -5
  290. data/vendor/Pods/Pods-Reachability-dummy.m +0 -5
  291. data/vendor/Pods/Pods-Reachability-prefix.pch +0 -5
  292. data/vendor/Pods/Pods-Reachability.xcconfig +0 -1
  293. data/vendor/Pods/Reachability/LICENCE.txt +0 -24
  294. data/vendor/Pods/Reachability/README.md +0 -65
  295. data/vendor/Pods/Reachability/Reachability.h +0 -109
  296. data/vendor/Pods/Reachability/Reachability.m +0 -527
@@ -97,4 +97,53 @@ typedef enum {
97
97
  block:(YapDatabaseSecondaryIndexBlock)block
98
98
  blockType:(YapDatabaseSecondaryIndexBlockType)blockType;
99
99
 
100
+ /**
101
+ * Creates a new secondary index extension.
102
+ * After creation, you'll need to register the extension with the database system.
103
+ *
104
+ * @param setup
105
+ *
106
+ * A YapDatabaseSecondaryIndexSetup instance allows you to specify the column names and type.
107
+ * The column names can be whatever you want, with a few exceptions for reserved names such as "rowid".
108
+ * The types can reflect numbers or text.
109
+ *
110
+ * @param block
111
+ *
112
+ * Pass a block that is one of the following types:
113
+ * - YapDatabaseSecondaryIndexWithKeyBlock
114
+ * - YapDatabaseSecondaryIndexWithObjectBlock
115
+ * - YapDatabaseSecondaryIndexWithMetadataBlock
116
+ * - YapDatabaseSecondaryIndexWithRowBlock
117
+ *
118
+ * @param blockType
119
+ *
120
+ * Pass the blockType enum that matches the passed block:
121
+ * - YapDatabaseSecondaryIndexBlockTypeWithKey
122
+ * - YapDatabaseSecondaryIndexBlockTypeWithObject
123
+ * - YapDatabaseSecondaryIndexBlockTypeWithMetadata
124
+ * - YapDatabaseSecondaryIndexBlockTypeWithRow
125
+ *
126
+ * @param version
127
+ *
128
+ * If, after creating the secondary index(es), you need to change the setup or block,
129
+ * then simply increment the version parameter. If you pass a version that is different from the last
130
+ * initialization of the extension, then it will automatically re-create itself.
131
+ *
132
+ * @see YapDatabaseSecondaryIndexSetup
133
+ * @see YapDatabase registerExtension:withName:
134
+ **/
135
+ - (id)initWithSetup:(YapDatabaseSecondaryIndexSetup *)setup
136
+ block:(YapDatabaseSecondaryIndexBlock)block
137
+ blockType:(YapDatabaseSecondaryIndexBlockType)blockType
138
+ version:(int)version;
139
+
140
+ /**
141
+ * The version assists in making changes to the extension.
142
+ *
143
+ * If you need to change the columnNames and/or block,
144
+ * then simply pass an incremented version during the init method,
145
+ * and the FTS extension will automatically update itself.
146
+ **/
147
+ @property (nonatomic, assign, readonly) int version;
148
+
100
149
  @end
@@ -7,10 +7,20 @@
7
7
  #import "YapDatabaseSecondaryIndexTransaction.h"
8
8
 
9
9
  #import "YapDatabaseSecondaryIndexSetup.h"
10
+ #import "YapDatabaseSecondaryIndexSetupPrivate.h"
11
+
10
12
  #import "YapCache.h"
11
13
 
12
14
  #import "sqlite3.h"
13
15
 
16
+ /**
17
+ * This version number is stored in the yap2 table.
18
+ * If there is a major re-write to this class, then the version number will be incremented,
19
+ * and the class can automatically rebuild the table as needed.
20
+ **/
21
+ #define YAP_DATABASE_SECONDARY_INDEX_CLASS_VERSION 1
22
+
23
+
14
24
  @interface YapDatabaseSecondaryIndex () {
15
25
  @public
16
26
 
@@ -0,0 +1,18 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import "YapDatabaseSecondaryIndexSetup.h"
3
+
4
+
5
+ @interface YapDatabaseSecondaryIndexSetup ()
6
+
7
+ /**
8
+ * This method compares its setup to a current table structure.
9
+ *
10
+ * @param columns
11
+ *
12
+ * Dictionary of column names and affinity.
13
+ *
14
+ * @see YapDatabase columnNamesAndAffinityForTable:using:
15
+ **/
16
+ - (BOOL)matchesExistingColumnNamesAndAffinity:(NSDictionary *)columns;
17
+
18
+ @end
@@ -443,40 +443,148 @@
443
443
 
444
444
  /**
445
445
  * Primitive access.
446
+ * This method is available in case you need to store irregular data that
447
+ * shouldn't go through the configured serializer/deserializer.
446
448
  *
447
- * These are available in-case you store irregular data
448
- * that shouldn't go through configured serializer/deserializer.
449
+ * Primitive data is stored into the database, but doesn't get routed through any of the extensions.
450
+ *
451
+ * Remember that if you place primitive data into the database via this method,
452
+ * you are responsible for accessing it via the appropriate primitive accessor (such as
453
+ * primitiveDataForKey:inCollection:). If you attempt to access it via the object accessor
454
+ * (objectForKey:inCollection), then the system will attempt to deserialize the primitive data via the
455
+ * configured deserializer, which may or may not work depending on the primitive data you're storing.
456
+ *
457
+ * This method is the primitive version of setObject:forKey:inCollection:.
458
+ * For more information see the documentation for setObject:forKey:inCollection:.
459
+ *
460
+ * @see setObject:forKey:inCollection:
461
+ * @see primitiveDataForKey:inCollection:
462
+ **/
463
+ - (void)setPrimitiveData:(NSData *)primitiveData forKey:(NSString *)key inCollection:(NSString *)collection;
464
+
465
+ /**
466
+ * Primitive access.
467
+ * This method is available in case you need to store irregular data that
468
+ * shouldn't go through the configured serializer/deserializer.
469
+ *
470
+ * Primitive data is stored into the database, but doesn't get routed through any of the extensions.
449
471
  *
450
- * @see objectForKey:collection:
472
+ * Remember that if you place primitive data into the database via this method,
473
+ * you are responsible for accessing it via the appropriate primitive accessor (such as
474
+ * primitiveDataForKey:inCollection:). If you attempt to access it via the object accessor
475
+ * (objectForKey:inCollection), then the system will attempt to deserialize the primitive data via the
476
+ * configured deserializer, which may or may not work depending on the primitive data you're storing.
477
+ *
478
+ * This method is the primitive version of setObject:forKey:inCollection:withMetadata:.
479
+ * For more information see the documentation for setObject:forKey:inCollection:withMetadata:.
480
+ *
481
+ * @see setObject:forKey:inCollection:withMetadata:
482
+ * @see primitiveDataForKey:inCollection:
483
+ * @see primitiveMetadataForKey:inCollection:
451
484
  **/
452
- - (void)setPrimitiveData:(NSData *)data forKey:(NSString *)key inCollection:(NSString *)collection;
453
- - (void)setPrimitiveData:(NSData *)data
485
+ - (void)setPrimitiveData:(NSData *)primitiveData
454
486
  forKey:(NSString *)key
455
487
  inCollection:(NSString *)collection
456
488
  withPrimitiveMetadata:(NSData *)primitiveMetadata;
457
- - (void)setPrimitiveMetadata:(NSData *)primitiveMetadata forKey:(NSString *)key inCollection:(NSString *)collection;
489
+
490
+ /**
491
+ * Primitive access.
492
+ * This method is available in case you need to store irregular data that
493
+ * shouldn't go through the configured serializer/deserializer.
494
+ *
495
+ * Primitive data is stored into the database, but doesn't get routed through any of the extensions.
496
+ *
497
+ * Remember that if you place primitive data into the database via this method,
498
+ * you are responsible for accessing it via the appropriate primitive accessor (such as
499
+ * primitiveDataForKey:inCollection:). If you attempt to access it via the object accessor
500
+ * (objectForKey:inCollection), then the system will attempt to deserialize the primitive data via the
501
+ * configured deserializer, which may or may not work depending on the primitive data you're storing.
502
+ *
503
+ * This method is the primitive version of replaceObject:forKey:inCollection:.
504
+ * For more information see the documentation for replaceObject:forKey:inCollection:.
505
+ *
506
+ * @see replaceObject:forKey:inCollection:
507
+ * @see primitiveDataForKey:inCollection:
508
+ **/
509
+ - (void)replacePrimitiveData:(NSData *)primitiveData forKey:(NSString *)key inCollection:(NSString *)collection;
510
+
511
+ /**
512
+ * Primitive access.
513
+ * This method is available in case you need to store irregular data that
514
+ * shouldn't go through the configured serializer/deserializer.
515
+ *
516
+ * Primitive data is stored into the database, but doesn't get routed through any of the extensions.
517
+ *
518
+ * Remember that if you place primitive data into the database via this method,
519
+ * you are responsible for accessing it via the appropriate primitive accessor (such as
520
+ * primitiveMetadataForKey:inCollection:). If you attempt to access it via the object accessor
521
+ * (metadataForKey:inCollection), then the system will attempt to deserialize the primitive data via the
522
+ * configured deserializer, which may or may not work depending on the primitive data you're storing.
523
+ *
524
+ * This method is the primitive version of replaceMetadata:forKey:inCollection:.
525
+ * For more information see the documentation for replaceMetadata:forKey:inCollection:.
526
+ *
527
+ * @see replaceMetadata:forKey:inCollection:
528
+ * @see primitiveMetadataForKey:inCollection:
529
+ **/
530
+ - (void)replacePrimitiveMetadata:(NSData *)primitiveMetadata forKey:(NSString *)key inCollection:(NSString *)collection;
531
+
532
+ /**
533
+ * DEPRECATED: Use replacePrimitiveMetadata:forKey:inCollection: instead.
534
+ **/
535
+ - (void)setPrimitiveMetadata:(NSData *)primitiveMetadata forKey:(NSString *)key inCollection:(NSString *)collection
536
+ __attribute((deprecated("Use method replacePrimitiveMetadata:forKey:inCollection: instead")));
458
537
 
459
538
  #pragma mark Object & Metadata
460
539
 
461
540
  /**
462
541
  * Sets the object for the given key/collection.
463
- * Objects are automatically serialized using the database's configured serializer.
542
+ * The object is automatically serialized using the database's configured objectSerializer.
464
543
  *
465
- * You may optionally pass metadata about the object.
466
- * The metadata is also written to the database for persistent storage, and thus persists between sessions.
467
- * Metadata is serialized/deserialized to/from disk just like the object.
544
+ * If you pass nil for the object, then this method will remove the row from the database (if it exists).
545
+ *
546
+ * This method implicitly sets the associated metadata to nil.
468
547
  **/
469
548
  - (void)setObject:(id)object forKey:(NSString *)key inCollection:(NSString *)collection;
549
+
550
+ /**
551
+ * Sets the object & metadata for the given key/collection.
552
+ *
553
+ * The object is automatically serialized using the database's configured objectSerializer.
554
+ * The metadata is automatically serialized using the database's configured metadataSerializer.
555
+ *
556
+ * The metadata is optional. You can pass nil for the metadata is unneeded.
557
+ * If non-nil then the metadata is also written to the database (metadata is also persistent).
558
+ *
559
+ * If you pass nil for the object, then this method will remove the row from the database (if it exists).
560
+ **/
470
561
  - (void)setObject:(id)object forKey:(NSString *)key inCollection:(NSString *)collection withMetadata:(id)metadata;
471
562
 
472
563
  /**
473
- * Updates the metadata, and only the metadata, for the given key/collection.
474
- * The object for the key doesn't change.
564
+ * If a row with the given key/collection exists, then replaces the object for that row with the new value.
565
+ * It only replaces the object. The metadata for the row doesn't change.
566
+ *
567
+ * If there is no row in the database for the given key/collection then this method does nothing.
568
+ *
569
+ * If you pass nil for the object, then this method will remove
570
+ **/
571
+ - (void)replaceObject:(id)object forKey:(NSString *)key inCollection:(NSString *)collection;
572
+
573
+ /**
574
+ * If a row with the given key/collection exists, then replaces the metadata for that row with the new value.
575
+ * It only replaces the metadata. The object for the row doesn't change.
475
576
  *
476
- * Note: If there is no stored object for the given key/collection, this method does nothing.
477
- * If you pass nil for the metadata, any given metadata associated with the key/colleciton is removed.
577
+ * If there is no row in the database for the given key/collection then this method does nothing.
578
+ *
579
+ * If you pass nil for the metadata, any metadata previously associated with the key/collection is removed.
580
+ **/
581
+ - (void)replaceMetadata:(id)metadata forKey:(NSString *)key inCollection:(NSString *)collection;
582
+
583
+ /**
584
+ * DEPRECATED: Use replaceMetadata:forKey:inCollection: instead.
478
585
  **/
479
- - (void)setMetadata:(id)metadata forKey:(NSString *)key inCollection:(NSString *)collection;
586
+ - (void)setMetadata:(id)metadata forKey:(NSString *)key inCollection:(NSString *)collection
587
+ __attribute((deprecated("Use method replaceMetadata:forKey:inCollection: instead")));
480
588
 
481
589
  #pragma mark Touch
482
590
 
@@ -487,11 +595,13 @@
487
595
  *
488
596
  * You have a BNBook object in your database.
489
597
  * One of the properties of the book object is a URL pointing to an image for the front cover of the book.
490
- * This image gets changed. Thus the UI representation of the book needs to be updated to reflect the updated image.
491
- * You realize that all your views are already listening for YapDatabaseModified notifications,
492
- * so if you update the object in the database, all your views are already wired to update the UI appropriately.
493
- * However, the actual object itself didn't change. So while there technically isn't any reason to
494
- * update the object on disk, doing so would be the most efficient way to keep the UI up-to-date.
598
+ * This image gets changed on the server. Thus the UI representation of the book needs to be updated
599
+ * to reflect the updated image on the server. You realize that all your views are already listening for
600
+ * YapDatabaseModified notifications, so if you update the object in the database then all your views are
601
+ * already wired to update the UI appropriately. However, the actual object itself didn't change. So while
602
+ * there technically isn't any reason to update the object on disk, doing so would be the easiest way to
603
+ * keep the UI up-to-date. So what you really want is a way to "mark" the object as updated, without actually
604
+ * incurring the overhead of rewriting it to disk.
495
605
  *
496
606
  * And this is exactly what the touch methods were designed for.
497
607
  * It won't actually cause the object to get rewritten to disk.
@@ -502,7 +612,7 @@
502
612
  * and passing the object & metadata that already exists for the key. But without the overhead of fetching the items,
503
613
  * or re-writing the items to disk.
504
614
  *
505
- * The touchMetadataForKey: method is similar to calling setMetadata:forKey:,
615
+ * The touchMetadataForKey: method is similar to calling replaceMetadata:forKey:,
506
616
  * and passing the metadata that already exists for the key. But without the overhead of fetching the metadata,
507
617
  * or re-writing the metadata to disk.
508
618
  *
@@ -1,9 +1,13 @@
1
1
  #import <Foundation/Foundation.h>
2
2
 
3
3
  #import "YapDatabaseExtension.h"
4
+ #import "YapDatabaseViewTypes.h"
4
5
  #import "YapDatabaseViewOptions.h"
5
6
  #import "YapDatabaseViewConnection.h"
6
7
  #import "YapDatabaseViewTransaction.h"
8
+ #import "YapDatabaseViewMappings.h"
9
+ #import "YapDatabaseViewChange.h"
10
+ #import "YapDatabaseViewRangeOptions.h"
7
11
 
8
12
  /**
9
13
  * Welcome to YapDatabase!
@@ -22,122 +26,46 @@
22
26
  * Just in case you don't have Internet access,
23
27
  * see the quick overview in YapDatabaseView.h.
24
28
  **/
29
+ @interface YapDatabaseView : YapDatabaseExtension
25
30
 
26
- /**
27
- * The grouping block handles both filtering and grouping.
28
- *
29
- * When you add or update rows in the databse the grouping block is invoked.
30
- * Your grouping block can inspect the row and determine if it should be a part of the view.
31
- * If not, your grouping block simply returns 'nil' and the object is excluded from the view (removing it if needed).
32
- * Otherwise your grouping block returns a group, which can be any string you want.
33
- * Once the view knows what group the row belongs to,
34
- * it will then determine the position of the row within the group (using the sorting block).
35
- *
36
- * You should choose a block type that takes the minimum number of required parameters.
37
- * The view can make various optimizations based on required parameters of the block.
38
- **/
39
- typedef id YapDatabaseViewGroupingBlock; // One of the YapDatabaseViewGroupingX types below.
31
+ /* Inherited from YapDatabaseExtension
32
+
33
+ @property (nonatomic, strong, readonly) NSString *registeredName;
40
34
 
41
- typedef NSString* (^YapDatabaseViewGroupingWithKeyBlock)(NSString *collection, NSString *key);
42
- typedef NSString* (^YapDatabaseViewGroupingWithObjectBlock)(NSString *collection, NSString *key, id object);
43
- typedef NSString* (^YapDatabaseViewGroupingWithMetadataBlock)(NSString *collection, NSString *key, id metadata);
44
- typedef NSString* (^YapDatabaseViewGroupingWithRowBlock)(NSString *collection, NSString *key, id object, id metadata);
35
+ */
45
36
 
46
37
  /**
47
- * The sorting block handles sorting of objects within their group.
38
+ * See the wiki for an example of how to initialize a view:
39
+ * https://github.com/yaptv/YapDatabase/wiki/Views#wiki-initializing_a_view
48
40
  *
49
- * After the view invokes the grouping block to determine what group a database row belongs to (if any),
50
- * the view then needs to determine what index within that group the row should be.
51
- * In order to do this, it needs to compare the new/updated row with existing rows in the same view group.
52
- * This is what the sorting block is used for.
53
- * So the sorting block will be invoked automatically during this process until the view has come to a conclusion.
41
+ * @param groupingBlock
54
42
  *
55
- * You should choose a block type that takes the minimum number of required parameters.
56
- * The view can make various optimizations based on required parameters of the block.
43
+ * The grouping block handles both filtering and grouping.
44
+ *
45
+ * @see YapDatabaseViewTypes.h for block type definition(s).
57
46
  *
58
- * For example, if sorting is based on the object, and the metadata of a row is updated,
59
- * then the view can deduce that the index hasn't changed (if the group hans't), and can skip this step.
47
+ * @param groupingBlockType
60
48
  *
61
- * Performance Note:
49
+ * Specify the type of groupingBlock that is being passed.
50
+ *
51
+ * @see YapDatabaseViewTypes.h for block type definition(s).
62
52
  *
63
- * The view uses various optimizations (based on common patterns)
64
- * to reduce the number of times it needs to invoke the sorting block.
65
- *
66
- * - Pattern : row is updated, but its index in the view doesn't change.
67
- * Optimization : if an updated row doesn't change groups, the view will first compare it with
68
- * objects to the left and right.
69
- *
70
- * - Pattern : rows are added to the beginning or end or a view
71
- * Optimization : if the last change put an object at the beginning of the view, then it will test this quickly.
72
- * if the last change put an object at the end of the view, then it will test this quickly.
53
+ * @param sortingBlock
73
54
  *
74
- * These optimizations offer huge performance benefits to many common cases.
75
- * For example, adding objects to a view that are sorted by timestamp of when they arrived.
76
- *
77
- * The optimizations are not always performed.
78
- * That is, if the row is added to a group it didn't previously belong,
79
- * or if the last change didn't place an item at the beginning or end of the view.
80
- *
81
- * If optimizations fail, or are skipped, then the view uses a binary search algorithm.
55
+ * The sorting block handles sorting of objects within their group.
56
+ *
57
+ * @see YapDatabaseViewTypes.h for block type definition(s).
82
58
  *
83
- * Although this may be considered "internal information",
84
- * I feel it is important to explain for the following reason:
59
+ * @param sortingBlockType
85
60
  *
86
- * Another common pattern is to fetch a number of objects in a batch, and then insert them into the database.
87
- * Now imagine a situation in which the view is sorting posts based on timestamp,
88
- * and you just fetched the most recent 10 posts. You can enumerate these 10 posts in forwards or backwards
89
- * while adding them to the database. One direction will hit the optimization every time. The other will cause
90
- * the view to perform a binary search every time. These little one-liner optimzations are easy.
91
- **/
92
- typedef id YapDatabaseViewSortingBlock; // One of the YapDatabaseViewSortingX types below.
93
-
94
- typedef NSComparisonResult (^YapDatabaseViewSortingWithKeyBlock) \
95
- (NSString *group, NSString *collection1, NSString *key1, \
96
- NSString *collection2, NSString *key2);
97
- typedef NSComparisonResult (^YapDatabaseViewSortingWithObjectBlock) \
98
- (NSString *group, NSString *collection1, NSString *key1, id object1, \
99
- NSString *collection2, NSString *key2, id object2);
100
- typedef NSComparisonResult (^YapDatabaseViewSortingWithMetadataBlock) \
101
- (NSString *group, NSString *collection1, NSString *key1, id metadata, \
102
- NSString *collection2, NSString *key2, id metadata2);
103
- typedef NSComparisonResult (^YapDatabaseViewSortingWithRowBlock) \
104
- (NSString *group, NSString *collection1, NSString *key1, id object1, id metadata1, \
105
- NSString *collection2, NSString *key2, id object2, id metadata2);
106
-
107
- #ifndef YapDatabaseViewBlockTypeDefined
108
- #define YapDatabaseViewBlockTypeDefined 1
109
-
110
- /**
111
- * I wish there was a way to inspect a given block and see what kind of parameters it takes.
112
- * Sadly this does not appear to be possible (at least not in any kind of standard legal way).
113
- *
114
- * Thus, unfortunately (for now), you will have to specify what kind of block you're passing.
115
- **/
116
- typedef enum {
117
- YapDatabaseViewBlockTypeWithKey = 1,
118
- YapDatabaseViewBlockTypeWithObject = 2,
119
- YapDatabaseViewBlockTypeWithMetadata = 3,
120
- YapDatabaseViewBlockTypeWithRow = 4
121
- } YapDatabaseViewBlockType;
122
-
123
- #endif
124
-
125
- @interface YapDatabaseView : YapDatabaseExtension
126
-
127
- /* Inherited from YapDatabaseExtension
128
-
129
- @property (nonatomic, strong, readonly) NSString *registeredName;
130
-
131
- */
132
-
133
- /**
134
- * See the wiki for an example of how to initialize a view:
135
- * https://github.com/yaptv/YapDatabase/wiki/Views#wiki-initializing_a_view
61
+ * Specify the type of sortingBlock that is being passed.
62
+ *
63
+ * @see YapDatabaseViewTypes.h for block type definition(s).
136
64
  *
137
- * @param version
65
+ * @param versionTag
138
66
  *
139
67
  * If, after creating a view, you need to change either the groupingBlock or sortingBlock,
140
- * then simply use the version parameter. If you pass a version that is different from the last
68
+ * then simply use the versionTag parameter. If you pass a versionTag that is different from the last
141
69
  * initialization of the view, then the view will automatically flush its tables, and re-populate itself.
142
70
  *
143
71
  * @param options
@@ -154,13 +82,13 @@ typedef enum {
154
82
  groupingBlockType:(YapDatabaseViewBlockType)groupingBlockType
155
83
  sortingBlock:(YapDatabaseViewSortingBlock)sortingBlock
156
84
  sortingBlockType:(YapDatabaseViewBlockType)sortingBlockType
157
- version:(int)version;
85
+ versionTag:(NSString *)versionTag;
158
86
 
159
87
  - (id)initWithGroupingBlock:(YapDatabaseViewGroupingBlock)groupingBlock
160
88
  groupingBlockType:(YapDatabaseViewBlockType)groupingBlockType
161
89
  sortingBlock:(YapDatabaseViewSortingBlock)sortingBlock
162
90
  sortingBlockType:(YapDatabaseViewBlockType)sortingBlockType
163
- version:(int)version
91
+ versionTag:(NSString *)versionTag
164
92
  options:(YapDatabaseViewOptions *)options;
165
93
 
166
94
  @property (nonatomic, strong, readonly) YapDatabaseViewGroupingBlock groupingBlock;
@@ -170,13 +98,26 @@ typedef enum {
170
98
  @property (nonatomic, assign, readonly) YapDatabaseViewBlockType sortingBlockType;
171
99
 
172
100
  /**
173
- * The version assists you in updating your blocks.
101
+ * The versionTag assists you in updating your blocks.
174
102
  *
175
103
  * If you need to change the groupingBlock or sortingBlock,
176
- * then simply pass an incremented version during the init method,
177
- * and the view will automatically update itself.
104
+ * then simply pass a different versionTag during the init method, and the view will automatically update itself.
105
+ *
106
+ * If you want to keep things simple, you can use something like @"1",
107
+ * representing version 1 of my groupingBlock & sortingBlock.
108
+ *
109
+ * For more advanced applications, you may also include within the versionTag string:
110
+ * - localization information (if you're using localized sorting routines)
111
+ * - configuration information (if your sorting routine is based on some in-app configuration)
112
+ *
113
+ * For example, if you're sorting strings using a localized string compare method, then embedding the localization
114
+ * information into your versionTag means the view will automatically re-populate itself (re-sort)
115
+ * if the user launches the app in a different language than last time.
116
+ *
117
+ * NSString *localeIdentifier = [[NSLocale currentLocale] localeIdentifier];
118
+ * NSString *versionTag = [NSString stringWithFormat:@"1-%@", localeIdentifier];
178
119
  **/
179
- @property (nonatomic, assign, readonly) int version;
120
+ @property (nonatomic, copy, readonly) NSString *versionTag;
180
121
 
181
122
  /**
182
123
  * The options allow you to specify things like creating an in-memory-only view (non persistent).