2012-07-17 22:57:11 +02:00
|
|
|
/**
|
|
|
|
* Copyright Maarten Billemont (http://www.lhunath.com, lhunath@lyndir.com)
|
|
|
|
*
|
|
|
|
* See the enclosed file LICENSE for license information (LGPLv3). If you did
|
|
|
|
* not receive this file, see http://www.gnu.org/licenses/lgpl-3.0.txt
|
|
|
|
*
|
|
|
|
* @author Maarten Billemont <lhunath@lyndir.com>
|
|
|
|
* @license http://www.gnu.org/licenses/lgpl-3.0.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// MPAlgorithm
|
|
|
|
//
|
|
|
|
// Created by Maarten Billemont on 16/07/12.
|
|
|
|
// Copyright 2012 lhunath (Maarten Billemont). All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "MPKey.h"
|
|
|
|
#import "MPElementGeneratedEntity.h"
|
|
|
|
|
|
|
|
#define MPAlgorithmDefaultVersion 1
|
|
|
|
#define MPAlgorithmDefault MPAlgorithmForVersion(MPAlgorithmDefaultVersion)
|
|
|
|
|
|
|
|
@protocol MPAlgorithm<NSObject>
|
|
|
|
|
|
|
|
@required
|
|
|
|
- (NSUInteger)version;
|
2013-04-30 01:49:53 -04:00
|
|
|
- (BOOL)migrateUser:(MPUserEntity *)user inContext:(NSManagedObjectContext *)moc;
|
2012-07-17 22:57:11 +02:00
|
|
|
- (BOOL)migrateElement:(MPElementEntity *)element explicit:(BOOL)explicit;
|
|
|
|
|
|
|
|
- (MPKey *)keyForPassword:(NSString *)password ofUserNamed:(NSString *)userName;
|
|
|
|
- (MPKey *)keyFromKeyData:(NSData *)keyData;
|
|
|
|
- (NSData *)keyIDForKeyData:(NSData *)keyData;
|
|
|
|
|
|
|
|
- (NSString *)nameOfType:(MPElementType)type;
|
|
|
|
- (NSString *)shortNameOfType:(MPElementType)type;
|
|
|
|
- (NSString *)classNameOfType:(MPElementType)type;
|
|
|
|
- (Class)classOfType:(MPElementType)type;
|
|
|
|
|
|
|
|
- (NSString *)generateContentForElement:(MPElementGeneratedEntity *)element usingKey:(MPKey *)key;
|
2013-04-19 00:43:01 -04:00
|
|
|
- (NSString *)generateContentNamed:(NSString *)name ofType:(MPElementType)type withCounter:(NSUInteger)counter usingKey:(MPKey *)key;
|
2012-07-17 22:57:11 +02:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
id<MPAlgorithm> MPAlgorithmForVersion(NSUInteger version);
|
|
|
|
id<MPAlgorithm> MPAlgorithmDefaultForBundleVersion(NSString *bundleVersion);
|