CatNiP -test sprint-4-interim
catnip
MediaWikiQuery Class Reference

#import <MediaWikiQuery.h>

Inheritance diagram for MediaWikiQuery:
MediaWikiCategoryQuery MediaWikiPageQuery

List of all members.

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< MediaWikiQueryDelegatequeryDelegate
NSURLRequest * mediaWikiRequest
NSURLConnection * mediaWikiConnection
NSMutableData * receivedData
BOOL working

Properties

NSString * mediaWikiURLString

Detailed Description

MediaWikiQuery.m A basic URL fetch class that reads the given URL into an NSData object and passes it on to it's delegate once the process has finished.

Created by Antti V J Niemela, tkol on 5/24/11. Copyright 2011 University of Helsinki. All rights reserved.


Member Function Documentation

- (NSString *) buildQueryURL

Builds the query URL, intended to be easily re-implemented in sublcasses

Builds the query URL

The URL is based on the mediaWikiURString property. Subclasses of MediaWikiQuery will likely want to override this method.

Returns:
The URL to be used when attempting the connection
- (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, reads the data into an internal variable

- (void) connection: (NSURLConnection *)  connection
didReceiveResponse: (NSURLResponse *)  response 

NSURLConnection delegate method

NSURLConnectionDelegate implementation, resets the internal data buffer (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 <MediaWikiQueryDelegate>)  mediaWikiQueryDelegate

Initialize a new MediaWikiQuery object with the specified delegate

Initializes the object with the specified delegate

Parameters:
mediaWikiQueryDelegateThe delegate object that will receive the data read from the URL
Returns:
id pointer to the initialized object.
- (id) initWithDelegate: (id <MediaWikiQueryDelegate>)  mediaWikiQueryDelegate
mediaWikiURL: (NSString*)  mwURLString 

Initialize a new MediaWikiQuery object with the specified delegate and MediaWiki URL (as a string)

Initializes the object with the specified delegate and MediaWiki URL

Parameters:
mediaWikiQueryDelegateThe delegate object that will receive the data read from the URL
mwURLStringThe URL to read from.
Returns:
id pointer to the initialized object.
- (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.

Returns:
YES if the connection started succesfully, NO if the URL was malformed or this object was already in the middle of reading data

Member Data Documentation

- (NSURLConnection*) mediaWikiConnection [protected]
- (NSURLRequest*) mediaWikiRequest [protected]
- (NSMutableData*) receivedData [protected]
- (BOOL) working [protected]

Property Documentation

- (NSString *) mediaWikiURLString [read, write, copy]

The base URL for this MediaWiki query


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Properties Defines