MYDirectoryWatcher.h
author snej@snej-mbp.mtv.corp.google.com
Tue Apr 07 11:13:25 2009 -0700 (2009-04-07)
changeset 23 a910102a1c9d
child 31 2068331949ee
permissions -rw-r--r--
* Added MYReturnError.
* Better iPhone support in ExceptionUtils.
* Make sure "All Tests Passed/Failed" message is always logged.
jens@20
     1
//
jens@20
     2
//  MYDirectoryWatcher.h
jens@20
     3
//  Murky
jens@20
     4
//
jens@20
     5
//  Copyright 2008 Jens Alfke. All rights reserved.
jens@20
     6
//
jens@20
     7
jens@20
     8
#import <Cocoa/Cocoa.h>
jens@20
     9
jens@20
    10
jens@20
    11
/* A wrapper for FSEvents, which notifies its delegate when filesystem changes occur. */
jens@20
    12
@interface MYDirectoryWatcher : NSObject 
jens@20
    13
{
jens@20
    14
    NSString *_path;
jens@20
    15
    id _target;
jens@20
    16
    SEL _action;
jens@20
    17
    UInt64 _lastEventID;
jens@20
    18
    BOOL _historyDone;
jens@20
    19
    CFTimeInterval _latency;
jens@20
    20
    FSEventStreamRef _stream;
jens@20
    21
}
jens@20
    22
jens@20
    23
- (id) initWithDirectory: (NSString*)path target: (id)target action: (SEL)action;
jens@20
    24
jens@20
    25
@property (readonly,nonatomic) NSString* path;
jens@20
    26
jens@20
    27
@property UInt64 lastEventID;
jens@20
    28
@property CFTimeInterval latency;
jens@20
    29
jens@20
    30
- (BOOL) start;
jens@20
    31
- (void) pause;
jens@20
    32
- (void) stop;
jens@20
    33
- (void) stopTemporarily;               // stop, but re-start on next runloop cycle
jens@20
    34
jens@20
    35
@end
jens@20
    36
jens@20
    37
jens@20
    38
jens@20
    39
@interface MYDirectoryEvent : NSObject
jens@20
    40
{
jens@20
    41
    MYDirectoryWatcher *watcher;
jens@20
    42
    NSString *path;
jens@20
    43
    UInt64 eventID;
jens@20
    44
    UInt32 flags;
jens@20
    45
}
jens@20
    46
jens@20
    47
@property (readonly, nonatomic) MYDirectoryWatcher *watcher;
jens@20
    48
@property (readonly, nonatomic) NSString *path, *relativePath;
jens@20
    49
@property (readonly, nonatomic) UInt64 eventID;
jens@20
    50
@property (readonly, nonatomic) UInt32 flags;
jens@20
    51
jens@20
    52
@property (readonly, nonatomic) BOOL mustScanSubdirectories;
jens@20
    53
@property (readonly, nonatomic) BOOL eventsWereDropped;
jens@20
    54
@property (readonly, nonatomic) BOOL isHistorical;   
jens@20
    55
@property (readonly, nonatomic) BOOL rootChanged;
jens@20
    56
jens@20
    57
@end