143 lines
5.3 KiB
Objective-C
143 lines
5.3 KiB
Objective-C
#import <Foundation/Foundation.h>
|
|
|
|
#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 <NSCoding, YapDatabaseRelationshipNode>
|
|
|
|
@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 <NSCoding, YapDatabaseRelationshipNode>
|
|
|
|
@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 <NSCoding, YapDatabaseRelationshipNode>
|
|
|
|
@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 <NSCoding, YapDatabaseRelationshipNode>
|
|
|
|
@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 <NSCoding, YapDatabaseRelationshipNode>
|
|
|
|
@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 <NSCoding, YapDatabaseRelationshipNode>
|
|
|
|
@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 <NSCoding, YapDatabaseRelationshipNode>
|
|
|
|
@property (nonatomic, strong, readonly) NSString *key;
|
|
@property (nonatomic, strong, readwrite) NSString *child;
|
|
|
|
@end
|
|
|
|
@interface Node_NotifyCount : NSObject <NSCoding, YapDatabaseRelationshipNode>
|
|
|
|
@property (nonatomic, strong, readonly) NSString *key;
|
|
|
|
+ (NSUInteger)notifyCount;
|
|
|
|
@end
|