• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

An Objective-C wrapper for Mac OS X’s FSEvents C API.


コミットメタ情報

リビジョン44ade61ed2aede69aefea7a4206543c732ebc00f (tree)
日時2011-10-25 06:05:56
作者Aron Cedercrantz <aron@cede...>
コミッターAron Cedercrantz

ログメッセージ

Update the read me to reflect the new changes.

変更サマリ

差分

--- a/README.mdown
+++ b/README.mdown
@@ -1,55 +1,86 @@
11 # CDEvents ![Project status](http://stillmaintained.com/rastersize/CDEvents.png) #
2-***Note:*** Experimental ARC branch
2+***Note:*** The `develop` branch **requires Mac OS X 10.6 or newer** as the framework relies on [ARC](http://clang.llvm.org/docs/AutomaticReferenceCounting.html "Automatic Reference Counting Technical Specification") and [blocks](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Blocks/Articles/00_Introduction.html "Blocks Programming Topics").
3+
34
45 ## What is this? ##
5-It's an Objective-C wrapper for Mac OS X's [FSEvents C API](http://developer.apple.com/mac/library/documentation/Darwin/Reference/FSEvents_Ref/FSEvents_h/index.html). Inspired and based upon the ([MIT-licensed](http://www.opensource.org/licenses/mit-license.php)) open source project [SCEvents](http://stuconnolly.com/projects/code/) created by [Stuart Connolly](http://stuconnolly.com/).
6+It's an Objective-C wrapper for Mac OS X's [FSEvents C API](http://developer.apple.com/mac/library/documentation/Darwin/Reference/FSEvents_Ref/FSEvents_h/index.html) with support for blocks. Furthermore, all the classes are immutable and it should be thread-safe.
7+
68
79 ## Requirements ##
8-Requires Mac OS X 10.6 (Snow Leopard) and an Intel 64-bit CPU. The requirements stems from that automatic reference counting (ARC) is supported from 10.6 and up as long as the modern (i.e. 64-bit) Objective-C runtime is used. (ARC requires the non-fragile ABI.) Although the built product should work on 10.6 and up it must be built on a machine running 10.7 (Lion) using Xcode 4.2 and the 10.7 SDK as the 10.6 SDK does not include ARC. Supports both manual memory management and automatic reference counting.
10+Requires Mac OS X 10.6 (Snow Leopard) and an Intel 64-bit CPU. The requirements stems from that automatic reference counting (ARC) is supported from 10.6 and up as long as the modern (i.e. 64-bit) Objective-C runtime is used since ARC requires the non-fragile ABI. Although the built product works on 10.6 and up it must be built on a machine running 10.7 (Lion) using Xcode 4.2 and the 10.7 SDK as the 10.6 SDK does not include ARC. The built product support both manual memory management and automatic reference counting.
11+
12+If you need to support older versions of OS X or garbage collection please see the branch `support/1.1`. All _1.1.x_ version will support garbage collection and OS X 10.5.
913
10-If you need to support older versions of OS X please see the non-ARC branch, currently `develop` and `master`. Though which branch is the non-ARC will probably change in the future.
1114
1215 ## Usage ##
16+You can use either the block based version (recommended) or the delegate based. Using both systems at the same time is not supported.
17+
18+### Block based (recommended) ###
19+1. Add CDEvents to your project,
20+ * either by compiling the project and dragging the `CDEvents.framework` into your project or
21+ * by dragging the entire CDEvents project into your project as a sub-project.
22+2. Import the `CDEvents.h` header where you need it.
23+3. Set up your `CDEvents` instance and give it a block to execute when a event occurs.
24+
25+Easy example code:
26+
27+ self.events = [[CDEvents alloc]] initWithURLs:<NSArray of URLs to watch>
28+ block:^(CDEvents *watcher, CDEvent *event) {
29+ <Your code here>
30+ }];
31+
32+Or use all the glory-all-options initiator:
33+
34+ self.events = [[CDEvents alloc] initWithURLs:<NSArray of URLs to watch>
35+ block:^(CDEvents *watcher, CDEvent *event) {
36+ <Your code here>
37+ }
38+ onRunLoop:[NSRunLoop currentRunLoop]
39+ sinceEventIdentifier:kCDEventsSinceEventNow
40+ notificationLantency:CD_EVENTS_DEFAULT_NOTIFICATION_LATENCY
41+ ignoreEventsFromSubDirs:CD_EVENTS_DEFAULT_IGNORE_EVENT_FROM_SUB_DIRS
42+ excludeURLs:<NSArray of URLs to exlude>
43+ streamCreationFlags:kCDEventsDefaultEventStreamFlags];
44+
45+See the test app (`TestApp`) for an example on how to use the framework.
46+
47+### Delegate based ###
48+***This is the same behavior as pre ARC and blocks.***
1349
1450 1. Add CDEvents to your project,
1551 * either by compiling the project and dragging the `CDEvents.framework` into your project or
1652 * by dragging the entire CDEvents project into your project as a sub-project.
1753 2. Import the `CDEvents.h` header where you need it.
1854 3. Import the `CDEventsDelegate.h` header where you need it (i.e. in the file which declares your delegate).
19-4. See the test app (`TestApp`) for details on how to use the framework. Essentially it boils down to,
20- 1. Implement the delegate method `-URLWatcher:eventOccurred:`.
21- 2. Set up your `CDEvents` instance.
55+4. Implement the delegate (`-URLWatcher:eventOccurred:`) and create your `CDEvents` instance.
56+5. Zero out the delegate when you no longer need it.
2257
23-` `
58+Example code:
2459
2560 self.events = [[CDEvents alloc] initWithURLs:<NSArray of URLs to watch>
26- delegate:<Your delegate>
27- onRunLoop:[NSRunLoop currentRunLoop]
28- sinceEventIdentifier:kCDEventsSinceEventNow
29- notificationLantency:CD_EVENTS_DEFAULT_NOTIFICATION_LATENCY
30- ignoreEventsFromSubDirs:CD_EVENTS_DEFAULT_IGNORE_EVENT_FROM_SUB_DIRS
31- excludeURLs:<NSArray of URLs to exlude>
32- streamCreationFlags:kCDEventsDefaultEventStreamFlags];
33-
34-**Important:** Since we have 10.6 set as the deployment target automatic zeroing of weak references is not available and as such you must set the `delegate` of `CDEvents` to `nil` when you no longer want to receive events. That is, at least in your `-dealloc` method. This is also required when using 10.7 and up!
61+ delegate:<Your delegate>
62+ onRunLoop:[NSRunLoop currentRunLoop]
63+ sinceEventIdentifier:kCDEventsSinceEventNow
64+ notificationLantency:CD_EVENTS_DEFAULT_NOTIFICATION_LATENCY
65+ ignoreEventsFromSubDirs:CD_EVENTS_DEFAULT_IGNORE_EVENT_FROM_SUB_DIRS
66+ excludeURLs:<NSArray of URLs to exlude>
67+ streamCreationFlags:kCDEventsDefaultEventStreamFlags];
3568
36-For more details please refer to the documentation in the header files and the section "API documentation" below.
69+See the test app (`TestApp`) for an example on how to use the framework.
3770
38-## What differentiates CDEvents from SCEvents then? ##
39-Not all that much but a few things differentiate the two. The (event data wrapper) class `CDEvent` is immutable in contrast to `SCEvent` which is mutable. The next difference, which were the initial reason why I decided to rewrite `SCEvents` is that the class `SCEvents`' is a singleton class, where's `CDEvents` is a "normal" class. I couldn't find a good reason as to why `SCEvents` had been designed that way and for my project a "normal" non-singleton class would be and is better.
71+**Important:** Since Mac OS X 10.6 is set as the deployment target automatic zeroing of weak references is not available. Thus you must set the `delegate` of `CDEvents` to `nil` when you no longer want to receive events. That is, at least in your `-dealloc` method. This is also required when using 10.7 and up! (`delegate` is an `unsafe_unretained` property.)
4072
41-Another difference between `CDEvents` and `SCEvents` is that `CDEvents` is available for both manual memory management and environments using garbage collection.
73+For more details please refer to the documentation in the header files and the section "API documentation" below.
4274
43-So I've written some of the code from scratch and "borrowed" some from `SCEvents`.
4475
4576 ## API documentation ##
4677 You can generate API documentation with the help of [Doxygen](http://www.stack.nl/~dimitri/doxygen/). In Doxygen open the file `api.doxygen`, click the `Run` tab and then the `Run doxygen` button. When it's done you should have a directory (ignored by git) in the root of the project named `api` with a sub-directory `html` in which you will find `index.html` double-click and enjoy.
4778
48-## Authors ##
79+## Author ##
4980
50-* Aron Cedercrantz
81+* [Aron Cedercrantz](http://github.com/rastersize)
5182
5283 ## License ##
5384 The code is released under the [MIT-license](http://www.opensource.org/licenses/mit-license.php).
5485
55-If you want, even though you really don't have to, I would love hearing what you use CDEvents for! Send me an email (first name @ last name dot se) or a [message via GitHub](http://github.com/inbox/new/rastersize).
86+If you want, even though you really don't have to, I would love to hear what you use CDEvents for! Send me an email (first name (i.e. aron) @ last name (i.e. cedercrantz) dot se) or a [message via GitHub](http://github.com/inbox/new/rastersize).