summaryrefslogtreecommitdiffstats
path: root/Frameworks/LiBackend/LiFileHandle.h
blob: 5e5dcb335134836797888dfaf8c15f8b6f466411 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//
//  LiFileHandle.h
//  Liaison
//
//  Created by Brian Cully on Sat May 24 2003.
//  Copyright (c) 2003 Brian Cully. All rights reserved.
//

@interface LiFileHandle : NSObject <NSCoding>
{
    id theStoreID;
    id theFileID;
}
+ (LiFileHandle *)fileHandleWithID: (id)aFileID
                           storeID: (id)aStoreID;

// For the file validator methods.
- (BOOL)shouldUpdate;

- (id)valueForAttribute: (NSString *)anAttribute;
- (void)setValue: (id)aValue forAttribute: (NSString *)anAttribute;
- (NSArray *)valuesForAttributes: (NSArray *)someAttributes;
- (void)setValues: (NSArray *)someValues forAttributes: (NSArray *)someAttributes;
@property (retain,getter=fileID) id theFileID;
@property (retain,getter=storeID) id theStoreID;
@end

@interface LiFileHandle (Accessors)
- (id)storeID;
- (void)setStoreID: (id)aStoreID;
- (id)fileID;
- (void)setFileID: (id)aFileID;
@end

// These are common access methods - actually nothing more than convenience
// methods that are nothing more than wrappers to valueForAttribute: and
// setValue:forAttribute:
// It is recommended that plugins use the same method for attribute access.
@interface LiFileHandle (CommonAccessors)
- (LiFileStore *)fileStore;
- (void)setFileStore: (LiFileStore *)aFileStore;
- (BOOL)isEditable;
- (void)setIsEditable: (BOOL)editable;
- (NSString *)filename;
- (void)setFilename: (NSString *)aFilename;
- (NSString *)type;
- (void)setType: (NSString *)aType;
- (NSNumber *)hfsCreator;
- (void)setHFSCreator: (NSNumber *)aTypeCode;
- (NSNumber *)hfsType;
- (void)setHFSType: (NSNumber *)aTypeCode;
- (NSString *)application;
- (void)setApplication: (NSString *)pathToApp;
- (NSDate *)lastModifiedTime;
- (void)setLastModifiedTime: (NSDate *)aTime;
- (NSDate *)creationTime;
- (void)setCreationTime: (NSDate *)aTime;
- (NSNumber *)fileSize;

- (NSMutableArray *)groups;
- (void)addToGroup: (NSString *)aGroup;
- (BOOL)isMemberOfGroup: (NSString *)aGroup;
- (void)removeFromGroup: (NSString *)aGroup;
- (void)renameGroup: (NSString *)oldName toGroup: (NSString *)newName;
- (BOOL)matchesFilter: (LiFilter *)aFilter;
@end

@interface LiFileHandle (CommonUtilities)
- (NSString *)description;
- (NSDictionary *)dictionary;
- (void)update;
- (void)open;
- (NSURL *)url;
@end

@interface LiFileHandle (Scripting)
- (NSScriptObjectSpecifier *)objectSpecifier;

- (NSString *)urlString;
@end

@interface LiFileStore (LiFileHandleMethods)
// Add a file to the library with the results of
// [LiFileStore fileSystemAttributesForPath:].
- (LiFileHandle *)addFileWithAttributes: (NSDictionary *)someAttributes;

// To get a file's attributes.
- (NSDictionary *)attributesForFileHandle: (LiFileHandle *)aFileHandle;

// Set the attributes to be updated in the dictionary.
- (void)updateFileHandle: (LiFileHandle *)aFileHandle
          withAttributes: (NSDictionary *)someAttributes;

// Remove file from the library.
- (void)removeFileHandle: (LiFileHandle *)aFileHandle;

// Returns all the LiFileHandles in the store.
- (NSArray *)allFileHandles;

// Returns a list of LiFileHandle objects for attributes
// that match the dictionary.
- (NSArray *)filesMatchingFilter: (LiFilter *)aFilter;
@end