OSDN Git Service

Add move file
[tombo/Tombo.git] / iOS / Tombo / Tombo / Storage.h
1 /*
2  Data Storage
3  Abstraction of file and directory.
4  */
5 #import <Foundation/Foundation.h>
6 #import "FileItem.h"
7
8 @interface Storage : NSObject
9
10 @property NSString *documentRoot;
11 @property NSString *currentDirectory;
12 @property NSFileManager *fileManager;
13
14 + (id)init;
15
16 /*
17  * Enumerate current directory and return array of FileItem.
18  */
19 -(NSArray*)listItems;
20
21 /*
22  * Change directory.
23  */
24 -(void)chdir:(NSString *)subdir;
25
26 -(void)updir;
27
28 /*
29  * Is current directory Top?
30  */
31 -(BOOL)isTopDir;
32
33 /*
34  * Enumerate top directory recursively and return array of NSString.
35  */
36 - (NSArray *)listFolders;
37
38
39 -(FileItem*)newItem;
40
41 /*
42  * Save note to file.
43  * 
44  * Returns new FileItem. This may be path/name is changed if note's title is changed.
45  * If path is not changed, returns item itself.
46  */
47 -(FileItem *)savePlain:(NSString *)note item:(FileItem *)item;
48 -(FileItem *)saveCrypt:(NSString *)note item:(FileItem *)item password:(NSString *)password;
49
50 - (void)deleteItem:(FileItem*)item;
51
52 - (FileItem *)newFolder:(NSString *)folder;
53
54 /*
55  * Load note.
56  */
57 + (NSString *)load:(NSString *)path;
58 + (NSString *)loadCryptFile:(NSString *)path password:(NSString *)password;
59
60 - (FileItem *)encrypt:(NSString *)key item:(FileItem*)item;
61 - (FileItem *)decrypt:(NSString *)key item:(FileItem*)item;
62
63 - (void)moveFrom:(FileItem *)from to:(FileItem *)to;
64 - (NSString *)moveFrom:(FileItem *)from toPath:(NSString *)to;
65
66 @end