#import #import "YapDatabaseRelationshipNode.h" #import "YapDatabaseRelationshipEdge.h" /** * The following test classes are for use by TestYapDatabaseRelationship. **/ /** * Standard relationship: (parent)->(child) * nodeDeleteRule = YDB_DeleteDestinationIfSourceDeleted * * So the parent node creates the edge which points to the child node. * And the child should get deleted if the parent is deleted. **/ @interface Node_Standard : NSObject @property (nonatomic, strong, readonly) NSString *key; @property (nonatomic, copy, readwrite) NSArray *childKeys; @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Standard inverse relationship: (child)->(parent) * nodeDeleteRule = YDB_DeleteSourceIfDestinationDeleted * * So the child node creates the edge which points to the parent node. * And the child should get deleted if the parent is deleted. **/ @interface Node_Inverse : NSObject @property (nonatomic, strong, readonly) NSString *key; @property (nonatomic, copy, readwrite) NSString *parentKey; @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Retain count relationship: (retainer)->(retained) * nodeDeleteRule = YDB_DeleteDestinationIfAllSourcesDeleted * * So the retainer node creates the edge which points the the retained node. * And there may be multiple retainers pointing to the same retained node. * And the retained node doesn't get deleted unless all the retainers are deleted. **/ @interface Node_RetainCount : NSObject @property (nonatomic, strong, readonly) NSString *key; @property (nonatomic, copy, readwrite) NSString *retainedKey; @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Inverse retain count relationship: (retained)->(retainer) * nodeDeleteRule = YDB_DeleteSourceIfAllDestinationsDeleted * * So the retained node creates the edge which points to the retainer node(s). * And there may be multiple retainers. * And the retained node should get deleted if all the retainers are deleted. **/ @interface Node_InverseRetainCount : NSObject @property (nonatomic, strong, readonly) NSString *key; @property (nonatomic, copy, readwrite) NSArray *retainerKeys; @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Standard file relationship: (parent)->(file) * nodeDeleteRule = YDB_DeleteDestinationIfSourceDeleted * * So the parent node creates the edge which points to the "child" filePath. * And the file should get deleted if the parent is deleted. **/ @interface Node_Standard_FileURL : NSObject @property (nonatomic, strong, readonly) NSString *key; @property (nonatomic, copy, readwrite) NSURL *fileURL; @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Retain count file relationship: (parent)->(file) * nodeDeleteRule = YDB_DeleteDestinationIfAllSourcesDeleted * * So the retainer node creates the edge which points the the retained file. * And there may be multiple retainers pointing to the same retained file. * And the file doesn't get deleted unless all the retainers are deleted. **/ @interface Node_RetainCount_FileURL : NSObject @property (nonatomic, strong, readonly) NSString *key; @property (nonatomic, copy, readwrite) NSURL *fileURL; @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Notify & Delete relationship: (parent)->(child) * nodeDeleteRule = YDB_DeleteDestinationIfSourceDeleted | YDB_NotifyIfSourceDeleted * * So the parent node creates the edge which points to the child node. * And the child should get deleted if the parent is deleted. * But the child node also needs to get notified first. **/ @interface Node_Notify : NSObject @property (nonatomic, strong, readonly) NSString *key; @property (nonatomic, strong, readwrite) NSString *child; @end @interface Node_NotifyCount : NSObject @property (nonatomic, strong, readonly) NSString *key; + (NSUInteger)notifyCount; @end