motion-yapper 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.travis.yml +6 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +63 -0
- data/README.md +16 -0
- data/Rakefile +20 -0
- data/app/app_delegate.rb +5 -0
- data/lib/yapper.rb +30 -0
- data/lib/yapper/attachment.rb +48 -0
- data/lib/yapper/bson.rb +20 -0
- data/lib/yapper/config.rb +18 -0
- data/lib/yapper/db.rb +151 -0
- data/lib/yapper/document.rb +54 -0
- data/lib/yapper/document/attachment.rb +26 -0
- data/lib/yapper/document/callbacks.rb +86 -0
- data/lib/yapper/document/persistance.rb +171 -0
- data/lib/yapper/document/relation.rb +84 -0
- data/lib/yapper/document/selection.rb +100 -0
- data/lib/yapper/extensions.rb +80 -0
- data/lib/yapper/log.rb +5 -0
- data/lib/yapper/sync.rb +134 -0
- data/lib/yapper/sync/data.rb +12 -0
- data/lib/yapper/sync/event.rb +194 -0
- data/lib/yapper/sync/queue.rb +164 -0
- data/lib/yapper/timestamps.rb +16 -0
- data/lib/yapper/version.rb +3 -0
- data/lib/yapper/yapper.rb +2 -0
- data/spec/helpers/time_helper.rb +3 -0
- data/spec/integration/all_spec.rb +40 -0
- data/spec/integration/callback_spec.rb +87 -0
- data/spec/integration/db_spec.rb +40 -0
- data/spec/integration/find_spec.rb +51 -0
- data/spec/integration/persistance_spec.rb +118 -0
- data/spec/integration/relation_spec.rb +174 -0
- data/spec/integration/sync_spec.rb +42 -0
- data/spec/integration/timestamps_spec.rb +34 -0
- data/spec/integration/types_spec.rb +23 -0
- data/spec/integration/when_spec.rb +29 -0
- data/spec/integration/where_spec.rb +132 -0
- data/vendor/Podfile.lock +24 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +641 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +1396 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +133 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +327 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +113 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +321 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +71 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +150 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +75 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +157 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +43 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +68 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +143 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +370 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +848 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +89 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +167 -0
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +78 -0
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +191 -0
- data/vendor/Pods/AFNetworking/LICENSE +19 -0
- data/vendor/Pods/AFNetworking/README.md +208 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +641 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +133 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +113 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +71 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +75 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +43 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +68 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +370 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +89 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +78 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/ContextFilterLogFormatter.h +65 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +41 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +102 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +334 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +601 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +167 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DispatchQueueLogFormatter.h +116 -0
- data/vendor/Pods/BuildHeaders/NSData+MD5Digest/NSData+MD5Digest.h +18 -0
- data/vendor/Pods/BuildHeaders/Reachability/Reachability.h +109 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +90 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +20 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +547 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +447 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnectionState.h +29 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +37 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtension.h +15 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionConnection.h +11 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +440 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionTransaction.h +11 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +108 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewConnection.h +12 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +19 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +39 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearch.h +89 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchConnection.h +32 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +69 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +79 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchTransaction.h +68 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseLogging.h +158 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseManager.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +424 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseQuery.h +42 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +100 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexConnection.h +33 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +73 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetup.h +33 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +58 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseStatement.h +13 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseString.h +121 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +541 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +186 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +272 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChangePrivate.h +94 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +115 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +825 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappingsPrivate.h +72 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +56 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPage.h +36 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPageMetadata.h +27 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +153 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptions.h +330 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +447 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapMemoryTable.h +74 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapNull.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapSet.h +41 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapTouch.h +15 -0
- data/vendor/Pods/CocoaLumberjack/LICENSE.txt +18 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +41 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +102 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +727 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +334 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1353 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +601 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +1083 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +167 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +1479 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.h +65 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.m +191 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.h +116 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.m +251 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +7 -0
- data/vendor/Pods/CocoaLumberjack/README.markdown +37 -0
- data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +641 -0
- data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +133 -0
- data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +113 -0
- data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +71 -0
- data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +75 -0
- data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +43 -0
- data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +68 -0
- data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +370 -0
- data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +89 -0
- data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +78 -0
- data/vendor/Pods/Headers/CocoaLumberjack/ContextFilterLogFormatter.h +65 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +41 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +102 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +334 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +601 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +167 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DispatchQueueLogFormatter.h +116 -0
- data/vendor/Pods/Headers/NSData+MD5Digest/NSData+MD5Digest.h +18 -0
- data/vendor/Pods/Headers/Reachability/Reachability.h +109 -0
- data/vendor/Pods/Headers/YapDatabase/YapCache.h +90 -0
- data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +20 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +547 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +447 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnectionState.h +29 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseDefaults.h +37 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtension.h +15 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionConnection.h +11 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionPrivate.h +440 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionTransaction.h +11 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +108 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewConnection.h +12 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewPrivate.h +19 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +39 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearch.h +89 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchConnection.h +32 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchPrivate.h +69 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +79 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchTransaction.h +68 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseLogging.h +158 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseManager.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabasePrivate.h +424 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseQuery.h +42 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +100 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexConnection.h +33 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +73 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexSetup.h +33 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +58 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseStatement.h +13 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseString.h +121 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +541 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +186 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +272 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChangePrivate.h +94 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +115 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +825 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappingsPrivate.h +72 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +56 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPage.h +36 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPageMetadata.h +27 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPrivate.h +153 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptions.h +330 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +447 -0
- data/vendor/Pods/Headers/YapDatabase/YapMemoryTable.h +74 -0
- data/vendor/Pods/Headers/YapDatabase/YapNull.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapSet.h +41 -0
- data/vendor/Pods/Headers/YapDatabase/YapTouch.h +15 -0
- data/vendor/Pods/Headers/____Pods-AFNetworking-prefix.h +17 -0
- data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +5 -0
- data/vendor/Pods/Headers/____Pods-NSData+MD5Digest-prefix.h +5 -0
- data/vendor/Pods/Headers/____Pods-Reachability-prefix.h +5 -0
- data/vendor/Pods/Headers/____Pods-YapDatabase-prefix.h +5 -0
- data/vendor/Pods/Headers/____Pods-environment.h +38 -0
- data/vendor/Pods/Manifest.lock +24 -0
- data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.h +18 -0
- data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.m +39 -0
- data/vendor/Pods/NSData+MD5Digest/README.md +11 -0
- data/vendor/Pods/Pods-AFNetworking-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-AFNetworking-dummy.m +5 -0
- data/vendor/Pods/Pods-AFNetworking-prefix.pch +17 -0
- data/vendor/Pods/Pods-AFNetworking.xcconfig +1 -0
- data/vendor/Pods/Pods-Acknowledgements.markdown +96 -0
- data/vendor/Pods/Pods-Acknowledgements.plist +142 -0
- data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-CocoaLumberjack-dummy.m +5 -0
- data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +5 -0
- data/vendor/Pods/Pods-CocoaLumberjack.xcconfig +0 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-dummy.m +5 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-prefix.pch +5 -0
- data/vendor/Pods/Pods-NSData+MD5Digest.xcconfig +0 -0
- data/vendor/Pods/Pods-Reachability-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-Reachability-dummy.m +5 -0
- data/vendor/Pods/Pods-Reachability-prefix.pch +5 -0
- data/vendor/Pods/Pods-Reachability.xcconfig +1 -0
- data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-YapDatabase-dummy.m +5 -0
- data/vendor/Pods/Pods-YapDatabase-prefix.pch +5 -0
- data/vendor/Pods/Pods-YapDatabase.xcconfig +1 -0
- data/vendor/Pods/Pods-dummy.m +5 -0
- data/vendor/Pods/Pods-environment.h +38 -0
- data/vendor/Pods/Pods-resources.sh +68 -0
- data/vendor/Pods/Pods.bridgesupport +5096 -0
- data/vendor/Pods/Pods.xcconfig +5 -0
- data/vendor/Pods/Pods.xcodeproj/project.pbxproj +5536 -0
- data/vendor/Pods/Reachability/LICENCE.txt +24 -0
- data/vendor/Pods/Reachability/README.md +65 -0
- data/vendor/Pods/Reachability/Reachability.h +109 -0
- data/vendor/Pods/Reachability/Reachability.m +527 -0
- data/vendor/Pods/YapDatabase/LICENSE.txt +18 -0
- data/vendor/Pods/YapDatabase/README.md +30 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +19 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +108 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +175 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.h +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.m +41 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +39 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +966 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +69 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.h +89 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.m +146 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.h +32 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +298 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.h +79 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.m +95 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.h +68 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +1352 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +440 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.h +15 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +58 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.h +11 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +46 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.h +11 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +180 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +73 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +100 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +149 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.h +33 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +330 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.h +33 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +184 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.h +58 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +1166 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewChangePrivate.h +94 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewMappingsPrivate.h +72 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.h +36 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.mm +296 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.h +27 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.m +28 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +153 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewRangeOptionsPrivate.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +272 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +2494 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +825 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +1567 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.h +330 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.m +141 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +186 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +191 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +115 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +897 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +56 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.m +27 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +447 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +4505 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +90 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +453 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.h +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.m +48 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +37 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +83 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.h +158 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.m +73 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.m +56 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +424 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.h +13 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.m +26 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseString.h +121 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.h +74 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.m +603 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +31 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.h +15 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.m +31 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +20 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +194 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.h +42 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.m +96 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.h +41 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.m +82 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +547 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +2022 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +447 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +3874 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +541 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +5282 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +16 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +13 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +20 -0
- data/yapper.gemspec +24 -0
- metadata +458 -0
data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.h
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
|
3
|
+
/**
|
4
|
+
* This class stores the metadata about each "page" in the view.
|
5
|
+
*
|
6
|
+
* That is, a "page" is a subset of the array of rowids in a group.
|
7
|
+
* The metadata does the following:
|
8
|
+
*
|
9
|
+
* - stores the associated group
|
10
|
+
* - keeps the pages ordered (via prevPageKey).
|
11
|
+
* - keeps the count on hand to make it easier to find a particular index
|
12
|
+
*
|
13
|
+
* This class is designed only to store the metadata in RAM.
|
14
|
+
* When the metadata is stored to disk, the individual ivars have an associated column.
|
15
|
+
**/
|
16
|
+
@interface YapDatabaseViewPageMetadata : NSObject <NSCopying> {
|
17
|
+
@public
|
18
|
+
|
19
|
+
NSString * pageKey;
|
20
|
+
NSString * prevPageKey;
|
21
|
+
NSString * group;
|
22
|
+
NSUInteger count;
|
23
|
+
|
24
|
+
BOOL isNew; // Is NOT copied. Relevant only to connection.
|
25
|
+
}
|
26
|
+
|
27
|
+
@end
|
data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.m
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#import "YapDatabaseViewPageMetadata.h"
|
2
|
+
|
3
|
+
|
4
|
+
@implementation YapDatabaseViewPageMetadata
|
5
|
+
|
6
|
+
- (id)copyWithZone:(NSZone *)zone
|
7
|
+
{
|
8
|
+
YapDatabaseViewPageMetadata *copy = [[YapDatabaseViewPageMetadata alloc] init];
|
9
|
+
|
10
|
+
copy->pageKey = pageKey;
|
11
|
+
copy->prevPageKey = prevPageKey;
|
12
|
+
copy->group = group;
|
13
|
+
copy->count = count;
|
14
|
+
|
15
|
+
// Do NOT copy the isNew property.
|
16
|
+
// This value is relavent only to a single connection.
|
17
|
+
|
18
|
+
return copy;
|
19
|
+
}
|
20
|
+
|
21
|
+
- (NSString *)description
|
22
|
+
{
|
23
|
+
return [NSString stringWithFormat:
|
24
|
+
@"<YapDatabaseViewPageMetadata[%p]: group(%@) count(%lu) pageKey(%@) prevPageKey(%@)>",
|
25
|
+
self, group, (unsigned long)count, pageKey, prevPageKey];
|
26
|
+
}
|
27
|
+
|
28
|
+
@end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
|
3
|
+
#import "YapDatabase.h"
|
4
|
+
#import "YapDatabaseConnection.h"
|
5
|
+
#import "YapDatabaseTransaction.h"
|
6
|
+
|
7
|
+
#import "YapDatabaseView.h"
|
8
|
+
#import "YapDatabaseViewOptions.h"
|
9
|
+
#import "YapDatabaseViewConnection.h"
|
10
|
+
#import "YapDatabaseViewTransaction.h"
|
11
|
+
|
12
|
+
#import "YapMemoryTable.h"
|
13
|
+
|
14
|
+
#import "sqlite3.h"
|
15
|
+
|
16
|
+
@class YapCache;
|
17
|
+
@class YapCollectionKey;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* This version number is stored in the yap2 table.
|
21
|
+
* If there is a major re-write to this class, then the version number will be incremented,
|
22
|
+
* and the class can automatically rebuild the tables as needed.
|
23
|
+
**/
|
24
|
+
#define YAP_DATABASE_VIEW_CLASS_VERSION 3
|
25
|
+
|
26
|
+
|
27
|
+
@interface YapDatabaseView () {
|
28
|
+
@public
|
29
|
+
YapDatabaseViewGroupingBlock groupingBlock;
|
30
|
+
YapDatabaseViewSortingBlock sortingBlock;
|
31
|
+
|
32
|
+
YapDatabaseViewBlockType groupingBlockType;
|
33
|
+
YapDatabaseViewBlockType sortingBlockType;
|
34
|
+
|
35
|
+
int version;
|
36
|
+
|
37
|
+
YapDatabaseViewOptions *options;
|
38
|
+
}
|
39
|
+
|
40
|
+
- (NSString *)mapTableName;
|
41
|
+
- (NSString *)pageTableName;
|
42
|
+
- (NSString *)pageMetadataTableName;
|
43
|
+
|
44
|
+
@end
|
45
|
+
|
46
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
47
|
+
#pragma mark -
|
48
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
49
|
+
|
50
|
+
@interface YapDatabaseViewConnection () {
|
51
|
+
@public
|
52
|
+
|
53
|
+
__strong YapDatabaseView *view;
|
54
|
+
__unsafe_unretained YapDatabaseConnection *databaseConnection;
|
55
|
+
|
56
|
+
NSMutableDictionary *group_pagesMetadata_dict; // group -> @[ YapDatabaseViewPageMetadata, ... ]
|
57
|
+
NSMutableDictionary *pageKey_group_dict; // pageKey -> group
|
58
|
+
|
59
|
+
YapCache *mapCache;
|
60
|
+
YapCache *pageCache;
|
61
|
+
|
62
|
+
NSMutableDictionary *dirtyMaps;
|
63
|
+
NSMutableDictionary *dirtyPages;
|
64
|
+
NSMutableDictionary *dirtyLinks;
|
65
|
+
BOOL reset;
|
66
|
+
|
67
|
+
BOOL lastInsertWasAtFirstIndex;
|
68
|
+
BOOL lastInsertWasAtLastIndex;
|
69
|
+
|
70
|
+
NSMutableArray *changes;
|
71
|
+
NSMutableSet *mutatedGroups;
|
72
|
+
}
|
73
|
+
|
74
|
+
- (id)initWithView:(YapDatabaseView *)view databaseConnection:(YapDatabaseConnection *)dbc;
|
75
|
+
|
76
|
+
- (void)prepareForReadWriteTransaction;
|
77
|
+
- (void)postRollbackCleanup;
|
78
|
+
- (void)postCommitCleanup;
|
79
|
+
|
80
|
+
- (sqlite3_stmt *)mapTable_getPageKeyForRowidStatement;
|
81
|
+
- (sqlite3_stmt *)mapTable_setPageKeyForRowidStatement;
|
82
|
+
- (sqlite3_stmt *)mapTable_removeForRowidStatement;
|
83
|
+
- (sqlite3_stmt *)mapTable_removeAllStatement;
|
84
|
+
|
85
|
+
- (sqlite3_stmt *)pageTable_getDataForPageKeyStatement;
|
86
|
+
- (sqlite3_stmt *)pageTable_insertForPageKeyStatement;
|
87
|
+
- (sqlite3_stmt *)pageTable_updateAllForPageKeyStatement;
|
88
|
+
- (sqlite3_stmt *)pageTable_updatePageForPageKeyStatement;
|
89
|
+
- (sqlite3_stmt *)pageTable_updateLinkForPageKeyStatement;
|
90
|
+
- (sqlite3_stmt *)pageTable_removeForPageKeyStatement;
|
91
|
+
- (sqlite3_stmt *)pageTable_removeAllStatement;
|
92
|
+
|
93
|
+
@end
|
94
|
+
|
95
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
96
|
+
#pragma mark -
|
97
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
98
|
+
|
99
|
+
@interface YapDatabaseViewTransaction () {
|
100
|
+
@private
|
101
|
+
|
102
|
+
YapMemoryTableTransaction *mapTableTransaction;
|
103
|
+
YapMemoryTableTransaction *pageTableTransaction;
|
104
|
+
YapMemoryTableTransaction *pageMetadataTableTransaction;
|
105
|
+
|
106
|
+
@protected
|
107
|
+
|
108
|
+
__unsafe_unretained YapDatabaseViewConnection *viewConnection;
|
109
|
+
__unsafe_unretained YapDatabaseReadTransaction *databaseTransaction;
|
110
|
+
|
111
|
+
NSString *lastHandledGroup;
|
112
|
+
}
|
113
|
+
|
114
|
+
- (id)initWithViewConnection:(YapDatabaseViewConnection *)viewConnection
|
115
|
+
databaseTransaction:(YapDatabaseReadTransaction *)databaseTransaction;
|
116
|
+
|
117
|
+
// The following are declared for view subclasses (such as YapDatabaseFilteredView)
|
118
|
+
|
119
|
+
- (BOOL)createTables;
|
120
|
+
|
121
|
+
- (NSString *)registeredName;
|
122
|
+
- (BOOL)isPersistentView;
|
123
|
+
|
124
|
+
- (NSString *)pageKeyForRowid:(int64_t)rowid;
|
125
|
+
- (NSUInteger)indexForRowid:(int64_t)rowid inGroup:(NSString *)group withPageKey:(NSString *)pageKey;
|
126
|
+
- (BOOL)getRowid:(int64_t *)rowidPtr atIndex:(NSUInteger)index inGroup:(NSString *)group;
|
127
|
+
|
128
|
+
- (void)insertRowid:(int64_t)rowid collectionKey:(YapCollectionKey *)collectionKey inNewGroup:(NSString *)group;
|
129
|
+
- (void)insertRowid:(int64_t)rowid collectionKey:(YapCollectionKey *)collectionKey
|
130
|
+
inGroup:(NSString *)group
|
131
|
+
atIndex:(NSUInteger)index
|
132
|
+
withExistingPageKey:(NSString *)existingPageKey;
|
133
|
+
|
134
|
+
- (void)insertRowid:(int64_t)rowid
|
135
|
+
collectionKey:(YapCollectionKey *)collectionKey
|
136
|
+
object:(id)object
|
137
|
+
metadata:(id)metadata
|
138
|
+
inGroup:(NSString *)group
|
139
|
+
withChanges:(int)flags
|
140
|
+
isNew:(BOOL)isGuaranteedNew;
|
141
|
+
|
142
|
+
- (void)removeRowid:(int64_t)rowid
|
143
|
+
collectionKey:(YapCollectionKey *)collectionKey
|
144
|
+
atIndex:(NSUInteger)index
|
145
|
+
inGroup:(NSString *)group;
|
146
|
+
|
147
|
+
- (void)removeRowid:(int64_t)rowid collectionKey:(YapCollectionKey *)collectionKey;
|
148
|
+
- (void)removeAllRowids;
|
149
|
+
|
150
|
+
- (void)enumerateRowidsInGroup:(NSString *)group
|
151
|
+
usingBlock:(void (^)(int64_t rowid, NSUInteger index, BOOL *stop))block;
|
152
|
+
|
153
|
+
@end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#import "YapDatabaseViewRangeOptions.h"
|
2
|
+
|
3
|
+
/**
|
4
|
+
* This header file is PRIVATE, and is only to be used by the YapDatabaseView classes.
|
5
|
+
**/
|
6
|
+
|
7
|
+
@interface YapDatabaseViewRangeOptions ()
|
8
|
+
|
9
|
+
/**
|
10
|
+
* This method returns a copy with the pin value switched.
|
11
|
+
*
|
12
|
+
* That is, if the range was pinned to the beginning, the returned copy will be pinned to the end.
|
13
|
+
* And vice versa.
|
14
|
+
**/
|
15
|
+
- (id)copyAndReverse;
|
16
|
+
|
17
|
+
@end
|
@@ -0,0 +1,272 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
|
3
|
+
typedef enum {
|
4
|
+
YapDatabaseViewChangeInsert = 1,
|
5
|
+
YapDatabaseViewChangeDelete = 2,
|
6
|
+
YapDatabaseViewChangeMove = 3,
|
7
|
+
YapDatabaseViewChangeUpdate = 4,
|
8
|
+
|
9
|
+
} YapDatabaseViewChangeType;
|
10
|
+
|
11
|
+
typedef enum {
|
12
|
+
YapDatabaseViewChangedObject = 1 << 0, // 0001
|
13
|
+
YapDatabaseViewChangedMetadata = 1 << 1, // 0010
|
14
|
+
YapDatabaseViewChangedDependency = 1 << 2, // 0100
|
15
|
+
|
16
|
+
} YapDatabaseViewChangesBitMask;
|
17
|
+
|
18
|
+
|
19
|
+
/**
|
20
|
+
* YapDatabaseViewChange is designed to help facilitate animations to tableViews and collectionsViews.
|
21
|
+
*
|
22
|
+
* In addition to the documentation available in the header files,
|
23
|
+
* you may also wish to read the wiki articles online,
|
24
|
+
* which are designed to give you an overview of the various technologies available.
|
25
|
+
*
|
26
|
+
* General information about setting up and using Views:
|
27
|
+
* https://github.com/yaptv/YapDatabase/wiki/Views
|
28
|
+
*
|
29
|
+
* General information about technologies which integrate with Views:
|
30
|
+
* https://github.com/yaptv/YapDatabase/wiki/LongLivedReadTransactions
|
31
|
+
* https://github.com/yaptv/YapDatabase/wiki/YapDatabaseModifiedNotification
|
32
|
+
**/
|
33
|
+
|
34
|
+
@interface YapDatabaseViewSectionChange : NSObject <NSCopying>
|
35
|
+
|
36
|
+
/**
|
37
|
+
* The type will be either:
|
38
|
+
* - YapDatabaseViewChangeInsert or
|
39
|
+
* - YapDatabaseViewChangeDelete
|
40
|
+
*
|
41
|
+
* @see YapDatabaseViewChangeType
|
42
|
+
**/
|
43
|
+
@property (nonatomic, readonly) YapDatabaseViewChangeType type;
|
44
|
+
|
45
|
+
/**
|
46
|
+
* The section index.
|
47
|
+
*
|
48
|
+
* If the type is YapDatabaseViewChangeDelete, then this represents the originalIndex of the section (pre-animation).
|
49
|
+
* If the type is YapDatabaseViewChangeInsert, then this represents the finalIndex of the section (post-animation).
|
50
|
+
**/
|
51
|
+
@property (nonatomic, readonly) NSUInteger index;
|
52
|
+
|
53
|
+
/**
|
54
|
+
* The corresponding group for the section.
|
55
|
+
**/
|
56
|
+
@property (nonatomic, readonly) NSString *group;
|
57
|
+
|
58
|
+
@end
|
59
|
+
|
60
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
61
|
+
#pragma mark -
|
62
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
63
|
+
|
64
|
+
@interface YapDatabaseViewRowChange : NSObject <NSCopying>
|
65
|
+
|
66
|
+
/**
|
67
|
+
* The type will be one of:
|
68
|
+
* - YapDatabaseViewChangeInsert
|
69
|
+
* - YapDatabaseViewChangeDelete
|
70
|
+
* - YapDatabaseViewChangeMove
|
71
|
+
* - YapDatabaseViewChangeUpdate
|
72
|
+
*
|
73
|
+
* @see YapDatabaseViewChangeType
|
74
|
+
**/
|
75
|
+
@property (nonatomic, readonly) YapDatabaseViewChangeType type;
|
76
|
+
|
77
|
+
/**
|
78
|
+
* The changes property is a bitmask representing what changed for the corresponding row in the database.
|
79
|
+
*
|
80
|
+
* There are 3 types represented in the bit mask:
|
81
|
+
* - YapDatabaseViewChangedObject
|
82
|
+
* - YapDatabaseViewChangedMetadata
|
83
|
+
* - YapDatabaseViewChangedDependency
|
84
|
+
*
|
85
|
+
* YapDatabaseViewChangedObject means the object was changed via setObject:forKey:inCollection:.
|
86
|
+
*
|
87
|
+
* YapDatabaseViewChangedMetadata means the metadata was changed.
|
88
|
+
* This might have happend implicitly if the user invoked setObject:forKey:inCollection: (implicitly setting
|
89
|
+
* the meatadata to nil). Or explicitly if the user invoked setObject:forKey:inCollection:withMetadata: or
|
90
|
+
* setMetadata:forKey:inCollection:.
|
91
|
+
*
|
92
|
+
* YapDatabaseViewChangedDependency means the row was flagged due to a cell drawing dependency configuration.
|
93
|
+
* See YapDatabaseViewMappings: setCellDrawingDependencyForNeighboringCellWithOffset:forGroup:
|
94
|
+
*
|
95
|
+
* Keep in mind that this is a bitmask. So, for example, all bits might be set if
|
96
|
+
* a row was updated, and was also flagged due to an inter-cell drawing dependency.
|
97
|
+
*
|
98
|
+
* This may be useful for various optimizations. For example:
|
99
|
+
* The drawing of your cell depends only on the object.
|
100
|
+
* However, your objects are rather large, and you're using metadata to store small subsets of the object
|
101
|
+
* that often need to be fetched. In addition, you're keeping other information in metadata such as refresh dates
|
102
|
+
* for pulling updates from the server. The grouping and sorting block are optimized and use only the metadata.
|
103
|
+
* However this means that the metadata may change (due to a refresh date update),
|
104
|
+
* when in fact the object itself didn't change.
|
105
|
+
* So you could optimize a bit here by skipping some cell updates.
|
106
|
+
*
|
107
|
+
* if (change.type == YapDatabaseViewChangeUpdate)
|
108
|
+
* {
|
109
|
+
* if (change.modifiedColumns & YapDatabaseViewChangedObject) {
|
110
|
+
* // object changed, update cell
|
111
|
+
* }
|
112
|
+
* else {
|
113
|
+
* // only the metadata changed, so we can skip updating the cell
|
114
|
+
* }
|
115
|
+
* }
|
116
|
+
*
|
117
|
+
*
|
118
|
+
* @see YapDatabaseViewChangesBitMask
|
119
|
+
**/
|
120
|
+
@property (nonatomic, readonly) int changes;
|
121
|
+
|
122
|
+
/**
|
123
|
+
* The indexPath & newIndexPath are available after
|
124
|
+
* you've invoked getSectionChanges:rowChanges:forNotifications:withMappings:.
|
125
|
+
*
|
126
|
+
* @see YapDatabaseConnection getSectionChanges:rowChanges:forNotifications:withMappings:
|
127
|
+
*
|
128
|
+
* These properties are designed to help facilitate animations to tableViews and collectionsViews.
|
129
|
+
*
|
130
|
+
* Recall that a view has no concept of sections.
|
131
|
+
* That is, a view has groups not sections.
|
132
|
+
* A group is a string, and a section is just a number.
|
133
|
+
*
|
134
|
+
* Using groups allows a view to be more dynamic.
|
135
|
+
* Your view may contain dozens of groups,
|
136
|
+
* but a particular tableView within your app may only display a subset of the groups.
|
137
|
+
*
|
138
|
+
* For example, you may have a view for displaying products in a grocery store.
|
139
|
+
* Each product is grouped by department (e.g. produce, deli, bakery), and sorted sorted by name.
|
140
|
+
* Using this view you can easily bring up a table view which displays only
|
141
|
+
* a few departments such as: liquor, wine, beer.
|
142
|
+
*
|
143
|
+
* In this example:
|
144
|
+
* - Section 0 = liquor
|
145
|
+
* - Section 1 = wine
|
146
|
+
* - Section 2 = beer
|
147
|
+
*
|
148
|
+
* NSArray *groups = @{ @"liquor":@(0), @"wine":@(1), @"beer":@(2) };
|
149
|
+
* YapDatabaseMappings *mappings = [YapDatabaseViewMappings mappingsWithGroups:groups view:@"order"];
|
150
|
+
*
|
151
|
+
* The mappings are then used to "map" between the 'groups in the view' and 'items in the table'.
|
152
|
+
*
|
153
|
+
* Mappings can provide a lot of additional functionality as well.
|
154
|
+
* For example, you can configure the mappings to only display a particular range within a group.
|
155
|
+
* This is similar to a LIMIT & OFFSET in SQL.
|
156
|
+
* This is the tip of the iceberg. See YapDatabaseViewMappings.h for more info.
|
157
|
+
*
|
158
|
+
* In order to animate changes to your tableView or collectionView, you eventually do something like this:
|
159
|
+
*
|
160
|
+
* NSArray *sectionChanges = nil;
|
161
|
+
* NSArray *rowChanges = nil;
|
162
|
+
* [databaseConnection getSectionChanges:§ionChanges
|
163
|
+
* rowChanges:&rowChanges
|
164
|
+
* forNotifications:notifications
|
165
|
+
* withMappings:mappings];
|
166
|
+
*
|
167
|
+
* This gives you a list of changes as they affect your tableView / collectionView.
|
168
|
+
*
|
169
|
+
* The indexPath and newIndexPath properties are modeled after:
|
170
|
+
* NSFetchedResultsControllerDelegate controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:
|
171
|
+
*
|
172
|
+
* - indexPath represents the ORIGINAL indexPath for the row.
|
173
|
+
* It is non-nil for the following types : Delete, Move, Update.
|
174
|
+
* (And nil for insert since there was no original indexPath.)
|
175
|
+
*
|
176
|
+
* - newIndexPath represents the FINAL indexPath for the row.
|
177
|
+
* It is non-nil for the following types : Insert, Move.
|
178
|
+
* (And nil for delete since there is no final indexPath.)
|
179
|
+
* (And nil for update since that's how NSFetchedResultsController works,
|
180
|
+
* and thus how existing code might expect it to work.)
|
181
|
+
*
|
182
|
+
* Once you have the sectionChanges & rowChanges, you can animate your tableView very simply like so:
|
183
|
+
*
|
184
|
+
* PS - For a FULL CODE EXAMPLE, see the wiki:
|
185
|
+
* https://github.com/yaptv/YapDatabase/wiki/Views#wiki-animating_updates_in_tableviews_collectionviews
|
186
|
+
*
|
187
|
+
* if ([sectionChanges count] == 0 & [rowChanges count] == 0)
|
188
|
+
* {
|
189
|
+
* // Nothing has changed that affects our tableView
|
190
|
+
* return;
|
191
|
+
* }
|
192
|
+
*
|
193
|
+
* // Familiar with NSFetchedResultsController?
|
194
|
+
* // Then this should look pretty familiar
|
195
|
+
*
|
196
|
+
* [self.tableView beginUpdates];
|
197
|
+
*
|
198
|
+
* for (YapDatabaseViewSectionChange *sectionChange in sectionChanges)
|
199
|
+
* {
|
200
|
+
* switch (sectionChange.type)
|
201
|
+
* {
|
202
|
+
* case YapDatabaseViewChangeDelete :
|
203
|
+
* {
|
204
|
+
* [self.tableView deleteSections:[NSIndexSet indexSetWithIndex:sectionChange.index]
|
205
|
+
* withRowAnimation:UITableViewRowAnimationAutomatic];
|
206
|
+
* break;
|
207
|
+
* }
|
208
|
+
* case YapDatabaseViewChangeInsert :
|
209
|
+
* {
|
210
|
+
* [self.tableView insertSections:[NSIndexSet indexSetWithIndex:sectionChange.index]
|
211
|
+
* withRowAnimation:UITableViewRowAnimationAutomatic];
|
212
|
+
* break;
|
213
|
+
* }
|
214
|
+
* }
|
215
|
+
* }
|
216
|
+
*
|
217
|
+
* for (YapDatabaseViewRowChange *rowChange in rowChanges)
|
218
|
+
* {
|
219
|
+
* switch (rowChange.type)
|
220
|
+
* {
|
221
|
+
* case YapDatabaseViewChangeDelete :
|
222
|
+
* {
|
223
|
+
* [self.tableView deleteRowsAtIndexPaths:@[ rowChange.indexPath ]
|
224
|
+
* withRowAnimation:UITableViewRowAnimationAutomatic];
|
225
|
+
* break;
|
226
|
+
* }
|
227
|
+
* case YapDatabaseViewChangeInsert :
|
228
|
+
* {
|
229
|
+
* [self.tableView insertRowsAtIndexPaths:@[ rowChange.newIndexPath ]
|
230
|
+
* withRowAnimation:UITableViewRowAnimationAutomatic];
|
231
|
+
* break;
|
232
|
+
* }
|
233
|
+
* case YapDatabaseViewChangeMove :
|
234
|
+
* {
|
235
|
+
* [self.tableView deleteRowsAtIndexPaths:@[ rowChange.indexPath ]
|
236
|
+
* withRowAnimation:UITableViewRowAnimationAutomatic];
|
237
|
+
* [self.tableView insertRowsAtIndexPaths:@[ rowChange.newIndexPath ]
|
238
|
+
* withRowAnimation:UITableViewRowAnimationAutomatic];
|
239
|
+
* break;
|
240
|
+
* }
|
241
|
+
* case YapDatabaseViewChangeUpdate :
|
242
|
+
* {
|
243
|
+
* [self.tableView reloadRowsAtIndexPaths:@[ rowChange.indexPath ]
|
244
|
+
* withRowAnimation:UITableViewRowAnimationNone];
|
245
|
+
* break;
|
246
|
+
* }
|
247
|
+
* }
|
248
|
+
* }
|
249
|
+
*
|
250
|
+
* [self.tableView endUpdates];
|
251
|
+
**/
|
252
|
+
@property (nonatomic, readonly) NSIndexPath *indexPath;
|
253
|
+
@property (nonatomic, readonly) NSIndexPath *newIndexPath;
|
254
|
+
|
255
|
+
/**
|
256
|
+
* The "original" values represent the location of the changed item
|
257
|
+
* at the BEGINNING of the read-write transaction(s).
|
258
|
+
*
|
259
|
+
* The "final" values represent the location of the changed item
|
260
|
+
* at the END of the read-write transaction(s).
|
261
|
+
**/
|
262
|
+
|
263
|
+
@property (nonatomic, readonly) NSUInteger originalIndex;
|
264
|
+
@property (nonatomic, readonly) NSUInteger finalIndex;
|
265
|
+
|
266
|
+
@property (nonatomic, readonly) NSUInteger originalSection;
|
267
|
+
@property (nonatomic, readonly) NSUInteger finalSection;
|
268
|
+
|
269
|
+
@property (nonatomic, readonly) NSString *originalGroup;
|
270
|
+
@property (nonatomic, readonly) NSString *finalGroup;
|
271
|
+
|
272
|
+
@end
|