Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 76 lines (61 sloc) 2.782 kB
720b0e7 @uliwitness Added licensing information to the source files.
authored
1 //
2 // UKFileWatcher.h
3 // Filie
4 //
5 // Created by Uli Kusterer on 2005-02-25.
6 // Copyright 2005 Uli Kusterer.
7 //
8 // This software is provided 'as-is', without any express or implied
9 // warranty. In no event will the authors be held liable for any damages
10 // arising from the use of this software.
11 //
12 // Permission is granted to anyone to use this software for any purpose,
13 // including commercial applications, and to alter it and redistribute it
14 // freely, subject to the following restrictions:
15 //
16 // 1. The origin of this software must not be misrepresented; you must not
17 // claim that you wrote the original software. If you use this software
18 // in a product, an acknowledgment in the product documentation would be
19 // appreciated but is not required.
20 //
21 // 2. Altered source versions must be plainly marked as such, and must not be
22 // misrepresented as being the original software.
23 //
24 // 3. This notice may not be removed or altered from any source
25 // distribution.
26 //
dc5be1c Initial check-in.
uli authored
27
28 /*
29 This is a protocol that file change notification classes should adopt.
30 That way, no matter whether you use Carbon's FNNotify/FNSubscribe, BSD's
31 kqueue or whatever, the object being notified can react to change
32 notifications the same way, and you can easily swap one out for the other
33 to cater to different OS versions, target volumes etc.
34 */
35
36 // -----------------------------------------------------------------------------
37 // Protocol:
38 // -----------------------------------------------------------------------------
39
40 @protocol UKFileWatcher
41
42 // +(id) sharedFileWatcher; // Singleton accessor. Not officially part of the protocol, but use this name if you provide a singleton.
43
44 -(void) addPath: (NSString*)path;
45 -(void) removePath: (NSString*)path;
46 -(void) removeAllPaths;
47
48 -(id) delegate;
49 -(void) setDelegate: (id)newDelegate;
50
51 @end
52
53 // -----------------------------------------------------------------------------
54 // Methods delegates need to provide:
55 // -----------------------------------------------------------------------------
56
57 @interface NSObject (UKFileWatcherDelegate)
58
59 -(void) watcher: (id<UKFileWatcher>)kq receivedNotification: (NSString*)nm forPath: (NSString*)fpath;
60
61 @end
62
63
64 // Notifications this sends:
65 /* object = the file watcher object
66 userInfo.path = file path watched
67 These notifications are sent via the NSWorkspace notification center */
68 extern NSString* UKFileWatcherRenameNotification;
69 extern NSString* UKFileWatcherWriteNotification;
70 extern NSString* UKFileWatcherDeleteNotification;
71 extern NSString* UKFileWatcherAttributeChangeNotification;
72 extern NSString* UKFileWatcherSizeIncreaseNotification;
73 extern NSString* UKFileWatcherLinkCountChangeNotification;
74 extern NSString* UKFileWatcherAccessRevocationNotification;
75
Something went wrong with that request. Please try again.