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
@@ -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,447 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import "YapDatabaseExtensionTransaction.h"
|
3
|
+
#import "YapDatabaseViewMappings.h"
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Welcome to YapDatabase!
|
7
|
+
*
|
8
|
+
* The project page has a wealth of documentation if you have any questions.
|
9
|
+
* https://github.com/yaptv/YapDatabase
|
10
|
+
*
|
11
|
+
* If you're new to the project you may want to check out the wiki
|
12
|
+
* https://github.com/yaptv/YapDatabase/wiki
|
13
|
+
*
|
14
|
+
* YapDatabaseView is an extension designed to work with YapDatabase.
|
15
|
+
* It gives you a persistent sorted "view" of a configurable subset of your data.
|
16
|
+
*
|
17
|
+
* For more information, please see the wiki article about Views:
|
18
|
+
* https://github.com/yaptv/YapDatabase/wiki/Views
|
19
|
+
*
|
20
|
+
* You may also wish to consult the documentation in YapDatabaseView.h for information on setting up a view.
|
21
|
+
*
|
22
|
+
* You access this class within a regular transaction.
|
23
|
+
* For example:
|
24
|
+
*
|
25
|
+
* [databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction){
|
26
|
+
*
|
27
|
+
* topUsaSale = [[transaction ext:@"myView"] objectAtIndex:0 inGroup:@"usa"]
|
28
|
+
* }];
|
29
|
+
*
|
30
|
+
* Keep in mind that the YapDatabaseViewTransaction object is linked to the YapDatabaseReadTransaction object.
|
31
|
+
* So don't try to use it outside the transaction block (cause it won't work).
|
32
|
+
**/
|
33
|
+
@interface YapDatabaseViewTransaction : YapDatabaseExtensionTransaction
|
34
|
+
|
35
|
+
#pragma mark Groups
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Returns the number of groups the view manages.
|
39
|
+
* Each group has one or more keys in it.
|
40
|
+
**/
|
41
|
+
- (NSUInteger)numberOfGroups;
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Returns the names of all groups in an unsorted array.
|
45
|
+
* Each group has one or more keys in it.
|
46
|
+
*
|
47
|
+
* @see YapDatabaseView - groupingBlock
|
48
|
+
**/
|
49
|
+
- (NSArray *)allGroups;
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Returns YES if there are any keys in the given group.
|
53
|
+
* This is equivalent to ([viewTransaction numberOfKeysInGroup:group] > 0)
|
54
|
+
**/
|
55
|
+
- (BOOL)hasGroup:(NSString *)group;
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Returns the total number of keys in the given group.
|
59
|
+
* If the group doesn't exist, returns zero.
|
60
|
+
**/
|
61
|
+
- (NSUInteger)numberOfKeysInGroup:(NSString *)group;
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Returns the total number of keys in every single group.
|
65
|
+
**/
|
66
|
+
- (NSUInteger)numberOfKeysInAllGroups;
|
67
|
+
|
68
|
+
#pragma mark Fetching
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Returns the key & collection at the given index within the given group.
|
72
|
+
* Returns nil if the group doesn't exist, or if the index is out of bounds.
|
73
|
+
**/
|
74
|
+
- (BOOL)getKey:(NSString **)keyPtr
|
75
|
+
collection:(NSString **)collectionPtr
|
76
|
+
atIndex:(NSUInteger)index
|
77
|
+
inGroup:(NSString *)group;
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Shortcut for: [view getKey:&key collection:&collection atIndex:0 inGroup:group]
|
81
|
+
**/
|
82
|
+
- (BOOL)getFirstKey:(NSString **)keyPtr collection:(NSString **)collectionPtr inGroup:(NSString *)group;
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Shortcut for: [view getKey:&key collection:&collection atIndex:(numberOfKeysInGroup-1) inGroup:group]
|
86
|
+
**/
|
87
|
+
- (BOOL)getLastKey:(NSString **)keyPtr collection:(NSString **)collectionPtr inGroup:(NSString *)group;
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Shortcut for fetching just the collection at the given index.
|
91
|
+
**/
|
92
|
+
- (NSString *)collectionAtIndex:(NSUInteger)index inGroup:(NSString *)group;
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Shortcut for fetching just the key at the given index.
|
96
|
+
* Convenient if you already know what collection the key is in.
|
97
|
+
**/
|
98
|
+
- (NSString *)keyAtIndex:(NSUInteger)index inGroup:(NSString *)group;
|
99
|
+
|
100
|
+
/**
|
101
|
+
* If the given {collection, key} are included in the view, then returns the associated group.
|
102
|
+
* If the {collection, key} isn't in the view, then returns nil.
|
103
|
+
**/
|
104
|
+
- (NSString *)groupForKey:(NSString *)key inCollection:(NSString *)collection;
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Fetches both the group and the index within the group for the given {collection, key}.
|
108
|
+
*
|
109
|
+
* Returns YES if the {collection, key} is included in the view.
|
110
|
+
* Otherwise returns NO, and sets the parameters to nil & zero.
|
111
|
+
**/
|
112
|
+
- (BOOL)getGroup:(NSString **)groupPtr
|
113
|
+
index:(NSUInteger *)indexPtr
|
114
|
+
forKey:(NSString *)key
|
115
|
+
inCollection:(NSString *)collection;
|
116
|
+
|
117
|
+
#pragma mark Finding
|
118
|
+
|
119
|
+
typedef id YapDatabaseViewFindBlock; // One of the YapDatabaseViewFindX types below.
|
120
|
+
|
121
|
+
typedef NSComparisonResult (^YapDatabaseViewFindWithKeyBlock) \
|
122
|
+
(NSString *collection, NSString *key);
|
123
|
+
typedef NSComparisonResult (^YapDatabaseViewFindWithObjectBlock) \
|
124
|
+
(NSString *collection, NSString *key, id object);
|
125
|
+
typedef NSComparisonResult (^YapDatabaseViewFindWithMetadataBlock) \
|
126
|
+
(NSString *collection, NSString *key, id metadata);
|
127
|
+
typedef NSComparisonResult (^YapDatabaseViewFindWithRowBlock) \
|
128
|
+
(NSString *collection, NSString *key, id object, id metadata);
|
129
|
+
|
130
|
+
#ifndef YapDatabaseViewBlockTypeDefined
|
131
|
+
#define YapDatabaseViewBlockTypeDefined 1
|
132
|
+
|
133
|
+
typedef enum {
|
134
|
+
YapDatabaseViewBlockTypeWithKey = 201,
|
135
|
+
YapDatabaseViewBlockTypeWithObject = 202,
|
136
|
+
YapDatabaseViewBlockTypeWithMetadata = 203,
|
137
|
+
YapDatabaseViewBlockTypeWithRow = 204
|
138
|
+
} YapDatabaseViewBlockType;
|
139
|
+
|
140
|
+
#endif
|
141
|
+
|
142
|
+
/**
|
143
|
+
* This method uses a binary search algorithm to find a range of items within the view that match the given criteria.
|
144
|
+
* For example:
|
145
|
+
*
|
146
|
+
* You have a view which sorts items by timestamp (oldest to newest)
|
147
|
+
* You could then use this method to quickly find all items whose timestamp falls on a certain day.
|
148
|
+
* Or, more generally, within a certain timespan.
|
149
|
+
*
|
150
|
+
* NSDate *beginningOfMonday = ... // Monday at 12:00 AM
|
151
|
+
* NSDate *beginningOfTuesday = ... // Tuesday at 12:00 AM
|
152
|
+
*
|
153
|
+
* YapDatabaseViewBlockType blockType = YapDatabaseViewBlockTypeWithObject;
|
154
|
+
* YapDatabaseViewFindWithObjectBlock block = ^(NSString *key, id object){
|
155
|
+
*
|
156
|
+
* Purchase *purchase = (Purchase *)object;
|
157
|
+
*
|
158
|
+
* if ([purchase.timestamp compare:beginningOfMonday] == NSOrderedAscending) // earlier than start range
|
159
|
+
* return NSOrderedAscending;
|
160
|
+
*
|
161
|
+
* if ([purchase.timestamp compare:beginningOfTuesday] == NSOrderedAscending) // earlier than end range
|
162
|
+
* return NSOrderedSame;
|
163
|
+
*
|
164
|
+
* return NSOrderedDescending; // greater than end range (or exactly midnight on tuesday)
|
165
|
+
* };
|
166
|
+
*
|
167
|
+
* The return values from the YapDatabaseViewFindBlock have the following meaning:
|
168
|
+
*
|
169
|
+
* - NSOrderedAscending : The given row (block parameters) is less than the range I'm looking for.
|
170
|
+
* That is, the row would have a smaller index within the view than would the range I seek.
|
171
|
+
*
|
172
|
+
* - NSOrderedDecending : The given row (block parameters) is greater than the range I'm looking for.
|
173
|
+
* That is, the row would have a greater index within the view than would the range I seek.
|
174
|
+
*
|
175
|
+
* - NSOrderedSame : The given row (block parameters) is within the range I'm looking for.
|
176
|
+
*
|
177
|
+
* Keep in mind 2 things:
|
178
|
+
*
|
179
|
+
* #1 : This method can only be used if you need to find items according to their sort order.
|
180
|
+
* That is, according to how the items are sorted via the view's sortingBlock.
|
181
|
+
* Attempting to use this method in any other manner makes no sense.
|
182
|
+
*
|
183
|
+
* #2 : The findBlock that you pass needs to be setup in the same manner as the view's sortingBlock.
|
184
|
+
* That is, the following rules must be followed, or the results will be incorrect:
|
185
|
+
*
|
186
|
+
* For example, say you have a view like this, looking for the following range of 3 items:
|
187
|
+
* myView = @[ A, B, C, D, E, F, G ]
|
188
|
+
* ^^^^^^^
|
189
|
+
* sortingBlock(A, B) => NSOrderedAscending
|
190
|
+
* findBlock(A) => NSOrderedAscending
|
191
|
+
*
|
192
|
+
* sortingBlock(E, D) => NSOrderedDescending
|
193
|
+
* findBlock(E) => NSOrderedDescending
|
194
|
+
*
|
195
|
+
* findBlock(B) => NSOrderedSame
|
196
|
+
* findBlock(C) => NSOrderedSame
|
197
|
+
* findBlock(D) => NSOrderedSame
|
198
|
+
*
|
199
|
+
* In other words, you can't sort one way in the sortingBlock, and "sort" another way in the findBlock.
|
200
|
+
* Another way to think about it is in terms of how the Apple docs define the NSOrdered enums:
|
201
|
+
*
|
202
|
+
* NSOrderedAscending : The left operand is smaller than the right operand.
|
203
|
+
* NSOrderedDescending : The left operand is greater than the right operand.
|
204
|
+
*
|
205
|
+
* For the findBlock, the "left operand" is the row that is passed,
|
206
|
+
* and the "right operand" is the desired range.
|
207
|
+
*
|
208
|
+
* And NSOrderedSame means: "the passed row is within the range I'm looking for".
|
209
|
+
*
|
210
|
+
* Implementation Note:
|
211
|
+
* This method uses a binary search to find an item for which the block returns NSOrderedSame.
|
212
|
+
* It then uses information from the first binary search (known min/max) to perform two subsequent binary searches.
|
213
|
+
* One to find the start of the range, and another to find the end of the range.
|
214
|
+
* Thus:
|
215
|
+
* - the implementation is efficient
|
216
|
+
* - the block won't be invoked for every item within the range
|
217
|
+
*
|
218
|
+
* @param group
|
219
|
+
* The group within the view to search.
|
220
|
+
*
|
221
|
+
* @param block
|
222
|
+
* One of the YapDatabaseViewFindWithXBlock types.
|
223
|
+
*
|
224
|
+
* @param blockType
|
225
|
+
* The proper YapDatabaseViewBlockTypeWithX type that matches the given block.
|
226
|
+
*
|
227
|
+
* @return
|
228
|
+
* If found, the range that matches the items within the desired range.
|
229
|
+
* That is, is these items were passed to the given block, the block would return NSOrderedSame.
|
230
|
+
* If not found, returns NSMakeRange(NSNotFound, 0).
|
231
|
+
**/
|
232
|
+
- (NSRange)findRangeInGroup:(NSString *)group
|
233
|
+
usingBlock:(YapDatabaseViewFindBlock)block
|
234
|
+
blockType:(YapDatabaseViewBlockType)blockType;
|
235
|
+
|
236
|
+
#pragma mark Enumerating
|
237
|
+
|
238
|
+
/**
|
239
|
+
* Enumerates the keys in the given group.
|
240
|
+
**/
|
241
|
+
- (void)enumerateKeysInGroup:(NSString *)group
|
242
|
+
usingBlock:(void (^)(NSString *collection, NSString *key, NSUInteger index, BOOL *stop))block;
|
243
|
+
|
244
|
+
/**
|
245
|
+
* Enumerates the keys in the given group.
|
246
|
+
* Reverse enumeration is supported by passing NSEnumerationReverse. (No other enumeration options are supported.)
|
247
|
+
**/
|
248
|
+
- (void)enumerateKeysInGroup:(NSString *)group
|
249
|
+
withOptions:(NSEnumerationOptions)options
|
250
|
+
usingBlock:(void (^)(NSString *collection, NSString *key, NSUInteger index, BOOL *stop))block;
|
251
|
+
|
252
|
+
/**
|
253
|
+
* Enumerates the keys in the range of the given group.
|
254
|
+
* Reverse enumeration is supported by passing NSEnumerationReverse. (No other enumeration options are supported.)
|
255
|
+
**/
|
256
|
+
- (void)enumerateKeysInGroup:(NSString *)group
|
257
|
+
withOptions:(NSEnumerationOptions)options
|
258
|
+
range:(NSRange)range
|
259
|
+
usingBlock:(void (^)(NSString *collection, NSString *key, NSUInteger index, BOOL *stop))block;
|
260
|
+
|
261
|
+
@end
|
262
|
+
|
263
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
264
|
+
#pragma mark -
|
265
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
266
|
+
|
267
|
+
@interface YapDatabaseViewTransaction (ReadWrite)
|
268
|
+
|
269
|
+
/**
|
270
|
+
* "Touching" a object allows you to mark an item in the view as "updated",
|
271
|
+
* even if the object itself wasn't directly updated.
|
272
|
+
*
|
273
|
+
* This is most often useful when a view is being used by a tableView,
|
274
|
+
* but the tableView cells are also dependent upon another object in the database.
|
275
|
+
*
|
276
|
+
* For example:
|
277
|
+
*
|
278
|
+
* You have a view which includes the departments in the company, sorted by name.
|
279
|
+
* But as part of the cell that's displayed for the department,
|
280
|
+
* you also display the number of employees in the department.
|
281
|
+
* The employee count comes from elsewhere.
|
282
|
+
* That is, the employee count isn't a property of the department object itself.
|
283
|
+
* Perhaps you get the count from another view,
|
284
|
+
* or perhaps the count is simply the number of keys in a particular collection.
|
285
|
+
* Either way, when you add or remove an employee, you want to ensure that the view marks the
|
286
|
+
* affected department as updated so that the corresponding cell will properly redraw itself.
|
287
|
+
*
|
288
|
+
* So the idea is to mark certain items as "updated" (in terms of this view) so that
|
289
|
+
* the changeset for the view will properly reflect a change to the corresponding index.
|
290
|
+
* But you don't actually need to update the item on disk.
|
291
|
+
* This is exactly what "touch" does.
|
292
|
+
*
|
293
|
+
* Touching an item has very minimal overhead.
|
294
|
+
* It doesn't cause the groupingBlock or sortingBlock to be invoked,
|
295
|
+
* and it doesn't cause any writes to the database.
|
296
|
+
*
|
297
|
+
* You can touch
|
298
|
+
* - just the object
|
299
|
+
* - just the metadata
|
300
|
+
* - or both object and metadata (the row)
|
301
|
+
*
|
302
|
+
* If you mark just the object as changed,
|
303
|
+
* and neither the groupingBlock nor sortingBlock depend upon the object,
|
304
|
+
* then the view doesn't reflect any change.
|
305
|
+
*
|
306
|
+
* If you mark just the metadata as changed,
|
307
|
+
* and neither the groupingBlock nor sortingBlock depend upon the metadata,
|
308
|
+
* then the view doesn't relect any change.
|
309
|
+
*
|
310
|
+
* In all other cases, the view will properly reflect a corresponding change in the notification that's posted.
|
311
|
+
**/
|
312
|
+
|
313
|
+
- (void)touchRowForKey:(NSString *)key inCollection:(NSString *)collection;
|
314
|
+
- (void)touchObjectForKey:(NSString *)key inCollection:(NSString *)collection;
|
315
|
+
- (void)touchMetadataForKey:(NSString *)key inCollection:(NSString *)collection;
|
316
|
+
|
317
|
+
@end
|
318
|
+
|
319
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
320
|
+
#pragma mark -
|
321
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
322
|
+
|
323
|
+
/**
|
324
|
+
* YapDatabaseView deals with ordered arrays of collection/key tuples.
|
325
|
+
* So, strictly speaking, it only knows about collection/key tuples, groups, and indexes.
|
326
|
+
*
|
327
|
+
* But it's really convenient to have methods that put it all together to fetch an object in a single method.
|
328
|
+
**/
|
329
|
+
@interface YapDatabaseViewTransaction (Convenience)
|
330
|
+
|
331
|
+
/**
|
332
|
+
* Equivalent to invoking:
|
333
|
+
*
|
334
|
+
* NSString *collection = nil;
|
335
|
+
* NSString *key = nil;
|
336
|
+
* [[transaction ext:@"myView"] getKey:&key collection:&collection atIndex:index inGroup:group];
|
337
|
+
* [transaction objectForKey:key inCollection:collection];
|
338
|
+
**/
|
339
|
+
- (id)objectAtIndex:(NSUInteger)keyIndex inGroup:(NSString *)group;
|
340
|
+
|
341
|
+
/**
|
342
|
+
* Equivalent to invoking:
|
343
|
+
*
|
344
|
+
* NSString *collection = nil;
|
345
|
+
* NSString *key = nil;
|
346
|
+
* [[transaction ext:@"myView"] getFirstKey:&key collection:&collection inGroup:group];
|
347
|
+
* [transaction objectForKey:key inCollection:collection];
|
348
|
+
**/
|
349
|
+
- (id)firstObjectInGroup:(NSString *)group;
|
350
|
+
|
351
|
+
/**
|
352
|
+
* Equivalent to invoking:
|
353
|
+
*
|
354
|
+
* NSString *collection = nil;
|
355
|
+
* NSString *key = nil;
|
356
|
+
* [[transaction ext:@"myView"] getLastKey:&key collection:&collection inGroup:group];
|
357
|
+
* [transaction objectForKey:key inCollection:collection];
|
358
|
+
**/
|
359
|
+
- (id)lastObjectInGroup:(NSString *)group;
|
360
|
+
|
361
|
+
/**
|
362
|
+
* The following methods are equivalent to invoking the enumerateKeysInGroup:... methods,
|
363
|
+
* and then fetching the metadata within your own block.
|
364
|
+
**/
|
365
|
+
|
366
|
+
- (void)enumerateKeysAndMetadataInGroup:(NSString *)group
|
367
|
+
usingBlock:
|
368
|
+
(void (^)(NSString *collection, NSString *key, id metadata, NSUInteger index, BOOL *stop))block;
|
369
|
+
|
370
|
+
- (void)enumerateKeysAndMetadataInGroup:(NSString *)group
|
371
|
+
withOptions:(NSEnumerationOptions)options
|
372
|
+
usingBlock:
|
373
|
+
(void (^)(NSString *collection, NSString *key, id metadata, NSUInteger index, BOOL *stop))block;
|
374
|
+
|
375
|
+
- (void)enumerateKeysAndMetadataInGroup:(NSString *)group
|
376
|
+
withOptions:(NSEnumerationOptions)options
|
377
|
+
range:(NSRange)range
|
378
|
+
usingBlock:
|
379
|
+
(void (^)(NSString *collection, NSString *key, id metadata, NSUInteger index, BOOL *stop))block;
|
380
|
+
|
381
|
+
/**
|
382
|
+
* The following methods are equivalent to invoking the enumerateKeysInGroup:... methods,
|
383
|
+
* and then fetching the object within your own block.
|
384
|
+
**/
|
385
|
+
|
386
|
+
- (void)enumerateKeysAndObjectsInGroup:(NSString *)group
|
387
|
+
usingBlock:
|
388
|
+
(void (^)(NSString *collection, NSString *key, id object, NSUInteger index, BOOL *stop))block;
|
389
|
+
|
390
|
+
- (void)enumerateKeysAndObjectsInGroup:(NSString *)group
|
391
|
+
withOptions:(NSEnumerationOptions)options
|
392
|
+
usingBlock:
|
393
|
+
(void (^)(NSString *collection, NSString *key, id object, NSUInteger index, BOOL *stop))block;
|
394
|
+
|
395
|
+
- (void)enumerateKeysAndObjectsInGroup:(NSString *)group
|
396
|
+
withOptions:(NSEnumerationOptions)options
|
397
|
+
range:(NSRange)range
|
398
|
+
usingBlock:
|
399
|
+
(void (^)(NSString *collection, NSString *key, id object, NSUInteger index, BOOL *stop))block;
|
400
|
+
|
401
|
+
/**
|
402
|
+
* The following methods are equivalent to invoking the enumerateKeysInGroup:... methods,
|
403
|
+
* and then fetching the object and metadata within your own block.
|
404
|
+
**/
|
405
|
+
|
406
|
+
- (void)enumerateRowsInGroup:(NSString *)group
|
407
|
+
usingBlock:
|
408
|
+
(void (^)(NSString *collection, NSString *key, id object, id metadata, NSUInteger index, BOOL *stop))block;
|
409
|
+
|
410
|
+
- (void)enumerateRowsInGroup:(NSString *)group
|
411
|
+
withOptions:(NSEnumerationOptions)options
|
412
|
+
usingBlock:
|
413
|
+
(void (^)(NSString *collection, NSString *key, id object, id metadata, NSUInteger index, BOOL *stop))block;
|
414
|
+
|
415
|
+
- (void)enumerateRowsInGroup:(NSString *)group
|
416
|
+
withOptions:(NSEnumerationOptions)options
|
417
|
+
range:(NSRange)range
|
418
|
+
usingBlock:
|
419
|
+
(void (^)(NSString *collection, NSString *key, id object, id metadata, NSUInteger index, BOOL *stop))block;
|
420
|
+
|
421
|
+
@end
|
422
|
+
|
423
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
424
|
+
#pragma mark -
|
425
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
426
|
+
|
427
|
+
@interface YapDatabaseViewTransaction (Mappings)
|
428
|
+
|
429
|
+
/**
|
430
|
+
* Gets the key & collection at the given indexPath, assuming the given mappings are being used.
|
431
|
+
* Returns NO if the indexPath is invalid, or the mappings aren't initialized.
|
432
|
+
* Otherwise returns YES, and sets the key & collection ptr (both optional).
|
433
|
+
**/
|
434
|
+
- (BOOL)getKey:(NSString **)keyPtr
|
435
|
+
collection:(NSString **)collectionPtr
|
436
|
+
atIndexPath:(NSIndexPath *)indexPath
|
437
|
+
withMappings:(YapDatabaseViewMappings *)mappings;
|
438
|
+
|
439
|
+
/**
|
440
|
+
* Fetches the indexPath for the given {collection, key} tuple, assuming the given mappings are being used.
|
441
|
+
* Returns nil if the {collection, key} tuple isn't included in the view + mappings.
|
442
|
+
**/
|
443
|
+
- (NSIndexPath *)indexPathForKey:(NSString *)key
|
444
|
+
inCollection:(NSString *)collection
|
445
|
+
withMappings:(YapDatabaseViewMappings *)mappings;
|
446
|
+
|
447
|
+
@end
|