vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h in motion-yapper-0.0.1 vs vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h in motion-yapper-0.0.2

- old
+ new

@@ -1,7 +1,9 @@ #import <Foundation/Foundation.h> + #import "YapDatabaseExtensionTransaction.h" +#import "YapDatabaseViewTypes.h" #import "YapDatabaseViewMappings.h" /** * Welcome to YapDatabase! * @@ -125,22 +127,10 @@ typedef NSComparisonResult (^YapDatabaseViewFindWithMetadataBlock) \ (NSString *collection, NSString *key, id metadata); typedef NSComparisonResult (^YapDatabaseViewFindWithRowBlock) \ (NSString *collection, NSString *key, id object, id metadata); -#ifndef YapDatabaseViewBlockTypeDefined -#define YapDatabaseViewBlockTypeDefined 1 - -typedef enum { - YapDatabaseViewBlockTypeWithKey = 201, - YapDatabaseViewBlockTypeWithObject = 202, - YapDatabaseViewBlockTypeWithMetadata = 203, - YapDatabaseViewBlockTypeWithRow = 204 -} YapDatabaseViewBlockType; - -#endif - /** * This method uses a binary search algorithm to find a range of items within the view that match the given criteria. * For example: * * You have a view which sorts items by timestamp (oldest to newest) @@ -312,10 +302,21 @@ - (void)touchRowForKey:(NSString *)key inCollection:(NSString *)collection; - (void)touchObjectForKey:(NSString *)key inCollection:(NSString *)collection; - (void)touchMetadataForKey:(NSString *)key inCollection:(NSString *)collection; +/** + * This method allows you to change the groupingBlock and/or sortingBlock on-the-fly. + * + * Note: You must pass a different versionTag, or this method does nothing. +**/ +- (void)setGroupingBlock:(YapDatabaseViewGroupingBlock)groupingBlock + groupingBlockType:(YapDatabaseViewBlockType)groupingBlockType + sortingBlock:(YapDatabaseViewSortingBlock)sortingBlock + sortingBlockType:(YapDatabaseViewBlockType)sortingBlockType + versionTag:(NSString *)versionTag; + @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -329,34 +330,34 @@ @interface YapDatabaseViewTransaction (Convenience) /** * Equivalent to invoking: * - * NSString *collection = nil; - * NSString *key = nil; - * [[transaction ext:@"myView"] getKey:&key collection:&collection atIndex:index inGroup:group]; - * [transaction objectForKey:key inCollection:collection]; + * NSString *collection, *key; + * if ([[transaction ext:@"myView"] getKey:&key collection:&collection atIndex:index inGroup:group]) { + * object = [transaction objectForKey:key inCollection:collection]; + * } **/ - (id)objectAtIndex:(NSUInteger)keyIndex inGroup:(NSString *)group; /** * Equivalent to invoking: * - * NSString *collection = nil; - * NSString *key = nil; - * [[transaction ext:@"myView"] getFirstKey:&key collection:&collection inGroup:group]; - * [transaction objectForKey:key inCollection:collection]; + * NSString *collection, *key; + * if ([[transaction ext:@"myView"] getFirstKey:&key collection:&collection inGroup:group]) { + * object = [transaction objectForKey:key inCollection:collection]; + * } **/ - (id)firstObjectInGroup:(NSString *)group; /** * Equivalent to invoking: * - * NSString *collection = nil; - * NSString *key = nil; - * [[transaction ext:@"myView"] getLastKey:&key collection:&collection inGroup:group]; - * [transaction objectForKey:key inCollection:collection]; + * NSString *collection, *key; + * if ([[transaction ext:@"myView"] getLastKey:&key collection:&collection inGroup:group]) { + * object = [transaction objectForKey:key inCollection:collection]; + * } **/ - (id)lastObjectInGroup:(NSString *)group; /** * The following methods are equivalent to invoking the enumerateKeysInGroup:... methods, @@ -435,13 +436,63 @@ collection:(NSString **)collectionPtr atIndexPath:(NSIndexPath *)indexPath withMappings:(YapDatabaseViewMappings *)mappings; /** + * Gets the key & collection at the given row & section, assuming the given mappings are being used. + * Returns NO if the row or section is invalid, or the mappings aren't initialized. + * Otherwise returns YES, and sets the key & collection ptr (both optional). +**/ +- (BOOL)getKey:(NSString **)keyPtr + collection:(NSString **)collectionPtr + forRow:(NSUInteger)row + inSection:(NSUInteger)section + withMappings:(YapDatabaseViewMappings *)mappings; + +/** + * Gets the object at the given indexPath, assuming the given mappings are being used. + * + * Equivalent to invoking: + * + * NSString *collection, *key; + * if ([[transaction ext:@"myView"] getKey:&key collection:&collection atIndexPath:indexPath withMappings:mappings]) { + * object = [transaction objectForKey:key inCollection:collection]; + * } +**/ +- (id)objectAtIndexPath:(NSIndexPath *)indexPath withMappings:(YapDatabaseViewMappings *)mappings; + +/** + * Gets the object at the given indexPath, assuming the given mappings are being used. + * + * Equivalent to invoking: + * + * NSString *collection, *key; + * if ([[transaction ext:@"view"] getKey:&key + * collection:&collection + * forRow:row + * inSection:section + * withMappings:mappings]) { + * object = [transaction objectForKey:key inCollection:collection]; + * } +**/ +- (id)objectAtRow:(NSUInteger)row inSection:(NSUInteger)section withMappings:(YapDatabaseViewMappings *)mappings; + +/** * Fetches the indexPath for the given {collection, key} tuple, assuming the given mappings are being used. * Returns nil if the {collection, key} tuple isn't included in the view + mappings. **/ - (NSIndexPath *)indexPathForKey:(NSString *)key inCollection:(NSString *)collection withMappings:(YapDatabaseViewMappings *)mappings; + +/** + * Fetches the row & section for the given {collection, key} tuple, assuming the given mappings are being used. + * Returns NO if the {collection, key} tuple isn't included in the view + mappings. + * Otherwise returns YES, and sets the row & section (both optional). +**/ +- (BOOL)getRow:(NSUInteger *)rowPtr + section:(NSUInteger *)sectionPtr + forKey:(NSString *)key + inCollection:(NSString *)collection + withMappings:(YapDatabaseViewMappings *)mappings; @end