File: module.pmod

package info (click to toggle)
pike8.0 8.0.1956-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 60,580 kB
  • sloc: ansic: 259,734; xml: 36,320; makefile: 3,748; sh: 1,713; cpp: 1,349; awk: 1,036; lisp: 655; javascript: 468; asm: 242; objc: 240; pascal: 157; sed: 34
file content (38 lines) | stat: -rw-r--r-- 1,371 bytes parent folder | download | duplicates (6)
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
#pike __REAL_VERSION__
#require constant(System._FSEvents)

//! The @[System.FSEvents] module provides an interface to FSEvents.
//! FSEvents is an API in Mac OS X which allows an application to register 
//! for notifications of changes to a given directory tree without forcing 
//! the application to continously poll the directory tree.
//! 
//! This module is designed for use in asynchronous, or backend mode. That 
//! is, rather than polling for changes, a function you specify will be 
//! called when events of interest occur. 
//!
//! @note
//! This module requires the presence and use of a CFRunLoop based Backend 
//! object, otherwise this module will not receive events from the OS. 
//! CFRunLoop based backends are avilable on Mac OS X 10.5 and higher.
//!
//! @seealso
//!  @[Pike.PollDeviceBackend.enable_core_foundation]
inherit System._FSEvents;

//!  describe the event flags associated with an event.
//!
//! @returns
//!   a string describing the flags set.
string describe_event_flag(int mask) {
        array(string) list = ({});
        
        foreach (indices(this_program);; string name) {
                if (has_prefix(name, "kFSEventStreamEventFlag")) {
                        int value = `[](this_program, name);

                        if (value & mask) list += ({ name });
                }
        }

        return list * "|";
}