CatNiP -test sprint-4-interim
catnip
|
#import <MediaWikiDownload.h>
Public Member Functions | |
(id) | - initWithDelegate: |
(id) | - initWithDelegate:mediaWikiURL: |
(BOOL) | - startQuery |
(NSString *) | - buildQueryURL |
(void) | - connection:didReceiveResponse: |
(void) | - connection:didReceiveData: |
(void) | - connection:didFailWithError: |
(void) | - connectionDidFinishLoading: |
Protected Attributes | |
id< MediaWikiDownloadDelegate > | queryDelegate |
NSMutableURLRequest * | mediaWikiRequest |
NSURLConnection * | mediaWikiConnection |
NSMutableData * | receivedData |
NSFileHandle * | outHandle |
NSString * | outputPath |
BOOL | working |
Properties | |
NSString * | mediaWikiURLString |
NSString * | mediaWikiFilename |
- (NSString *) buildQueryURL |
Builds the query URL, intended to be easily re-implemented in sublcasses
Builds the query URL
The URL is based on the mediaWikiURLString property. The filename property is appended to the base URL to receive the final, complete URL to download.
- (void) connection: | (NSURLConnection *) | connection | |
didFailWithError: | (NSError *) | error | |
NSURLConnection delegate method
NSURLConnectionDelegate implementation, reports the error with NSLog
- (void) connection: | (NSURLConnection *) | connection | |
didReceiveData: | (NSData *) | data | |
NSURLConnection delegate method
NSURLConnectionDelegate implementation, passes the data to a filehandle
- (void) connection: | (NSURLConnection *) | connection | |
didReceiveResponse: | (NSURLResponse *) | response | |
NSURLConnection delegate method
NSURLConnectionDelegate implementation, resets the output file handle (only the data from the last response is stuff we're interested in).
- (void) connectionDidFinishLoading: | (NSURLConnection *) | connection |
NSURLConnection delegate method
NSURLConnectionDelegate implementation, passes the received data to the delegate.
- (id) initWithDelegate: | (id <MediaWikiDownloadDelegate>) | mediaWikiDownloadDelegate |
Initialize a new MediaWikiDownload object with the specified delegate
Initializes the object with the specified delegate
MediaWikiDownloadDelegate | The delegate object that will receive the data read from the URL |
- (id) initWithDelegate: | (id <MediaWikiDownloadDelegate>) | mediaWikiDownloadDelegate | |
mediaWikiURL: | (NSString*) | mwURLString | |
Initialize a new MediaWikiDownload object with the specified delegate and MediaWiki URL (as a string)
Initializes the object with the specified delegate and MediaWiki URL
MediaWikiDownloadDelegate | The delegate object that will receive the data read from the URL |
mwURLString | The URL to read from. |
- (BOOL) startQuery |
Launches the query process
Starts the MediaWiki query
Starts the HTTP query represented by the URL received using [self buildQueryURL] using an internal NSURLConnection object. This object functions as the delegate for the NSURLConnection, and passes the read data to it's delegate once the connection finishes loading.
- (NSURLConnection*) mediaWikiConnection [protected] |
- (NSMutableURLRequest*) mediaWikiRequest [protected] |
- (NSFileHandle*) outHandle [protected] |
- (NSString*) outputPath [protected] |
- (id<MediaWikiDownloadDelegate>) queryDelegate [protected] |
- (NSMutableData*) receivedData [protected] |
- (BOOL) working [protected] |
- (NSString *) mediaWikiFilename [read, write, copy] |
The filename of the file to download.
- (NSString *) mediaWikiURLString [read, write, copy] |
The base URL for this MediaWiki query