source: trunk/macosx/UKKQueue/UKFileWatcher.h @ 847

Last change on this file since 847 was 847, checked in by livings124, 15 years ago

Use UKKQueue for auto import which gets rid of polling and makes the process instantaneous.

File size: 2.1 KB
Line 
1/* =============================================================================
2        FILE:           UKFileWatcher.h
3        PROJECT:        Filie
4   
5    COPYRIGHT:  (c) 2005 M. Uli Kusterer, all rights reserved.
6   
7        AUTHORS:        M. Uli Kusterer - UK
8   
9    LICENSES:   MIT License
10
11        REVISIONS:
12                2006-03-13      UK      Moved notification constants to .m file.
13                2005-02-25      UK      Created.
14   ========================================================================== */
15
16/*
17    This is a protocol that file change notification classes should adopt.
18    That way, no matter whether you use Carbon's FNNotify/FNSubscribe, BSD's
19    kqueue or whatever, the object being notified can react to change
20    notifications the same way, and you can easily swap one out for the other
21    to cater to different OS versions, target volumes etc.
22*/
23
24// -----------------------------------------------------------------------------
25//  Protocol:
26// -----------------------------------------------------------------------------
27
28@protocol UKFileWatcher
29
30// +(id) sharedFileWatcher;                     // Singleton accessor. Not officially part of the protocol, but use this name if you provide a singleton.
31
32-(void) addPath: (NSString*)path;
33-(void) removePath: (NSString*)path;
34
35-(id)   delegate;
36-(void) setDelegate: (id)newDelegate;
37
38@end
39
40// -----------------------------------------------------------------------------
41//  Methods delegates need to provide:
42// -----------------------------------------------------------------------------
43
44@interface NSObject (UKFileWatcherDelegate)
45
46-(void) watcher: (id<UKFileWatcher>)kq receivedNotification: (NSString*)nm forPath: (NSString*)fpath;
47
48@end
49
50
51// Notifications this sends:
52/*  object                      = the file watcher object
53        userInfo.path   = file path watched
54        These notifications are sent via the NSWorkspace notification center */
55extern NSString* UKFileWatcherRenameNotification;
56extern NSString* UKFileWatcherWriteNotification;
57extern NSString* UKFileWatcherDeleteNotification;
58extern NSString* UKFileWatcherAttributeChangeNotification;
59extern NSString* UKFileWatcherSizeIncreaseNotification;
60extern NSString* UKFileWatcherLinkCountChangeNotification;
61extern NSString* UKFileWatcherAccessRevocationNotification;
62
Note: See TracBrowser for help on using the repository browser.