Subclassing/wrapping NSTask?
Subclassing/wrapping NSTask?
- Subject: Subclassing/wrapping NSTask?
- From: "l.m.orchard" <email@hidden>
- Date: Mon, 6 Aug 2001 19:51:41 -0400
Hallo again.
I'm making a small wrapper around NSTask which uses threads to implement
asynchronous processing of the task's output. It spawns a thread in which
a loop runs that reads in all the data from the NSTask's StandardOutput.
The reader loop extracts complete lines from the output and sends them in
messages to an object back in the main thread.
The only problem I'm having is that I started out trying to make a
subclass (is-a) instead of a wrapper (has-a). When I tried making a
subclass, I ran into all sorts of errors like "setLaunchPath not defined
in abstract class". Does this mean that NSTask is actually abstract and
that another class in the cluster is really instantiated? (I just heard
about clusters of classes, and I think I understand them)
The other thing I though of was, maybe, making a category in which
launchThreaded: is added to NSTask. Or, since what I have now works,
maybe I should just go with it.
Mostly just wondering what's the Right Thing to Do.
--
Leslie Michael Orchard <email@hidden>
ICQ: 492905 (home) 11082089 (work)
"...see you space cowboy..."