RSSFeed Class Reference

`#include <RSSFeed.h>`

## Instance Methods

(id) | - initWithURL:
(NSString *) | - description
(enum RSSFeedStatus) | - status
(BOOL) | - isFetching
(NSEnumerator *) | - articleEnumerator
(void) | - removeArticle:
(void) | - setFeedName:
(NSString *) | - feedName
(NSURL *) | - feedURL
(void) | - clearArticles
(void) | - setArticleClass:
(Class) | - articleClass
(NSDate *) | - lastRetrieval
(void) | - newArticleFound:
(enum RSSFeedError) | - fetch
(void) | - fetchInBackground
(NSMutableDictionary *) | - plistDictionary

## Class Methods

(id) | + feedFromPlistDictionary:

## Protected Attributes

enum RSSFeedError | lastError
Class | articleClass

## Detailed Description

Objects of this class represent a RSS/ATOM feed, which is basically just a source for new articles. When creating a RSSFeed object, you'll just have to provide it with the URL, where the feed can be downloaded from.

This is the generic way to read feeds:

- Create a URL object with the location of the feed.
  `NSURL* url = [NSURL URLWithString:"http://www.example.com/feed.xml"];`
- Create a RSSFeed object with the URL:
  `RSSFeed* feed = [RSSFeed initWithURL: url];`
- Fetch the contents of the feed:
  `[feed fetch]; // alternatively [feed fetchInBackground];`
- Optionally tell the RSSFeed to keep old articles.
  `[feed setAutoClear: NO];`
- Retrieve the set of articles. `NSSet* articles = [feed articleSet];`

See also
  - initWithURL: (RSSFeed)
  - fetch (RSSFeed)
  setAutoClear:
  RSSArticle
  NSURL

## Method Documentation

## articleClass

- (Class) articleClass |  |  |

Returns the class of the article objects. This will be a subtype of RSSArticle.

Returns
  the article class

## articleEnumerator

- (NSEnumerator *) articleEnumerator |  |  |

Returns
  an enumerator for the articles in this feed

Reimplemented from <RSSFeed>.

References articleEnumerator.

Referenced by articleEnumerator, and status.

## clearArticles

- (void) clearArticles |  |  |

Clears the list of articles.

Clears the article list. NOT SYNCHRONIZED!

References clearArticles.

Referenced by clearArticles, and feedURL.

## description

- (NSString *) description |  |  |

Returns
  Description of the Feed (the feed name)

References description.

Referenced by description.

## feedFromPlistDictionary:

+ (id) feedFromPlistDictionary: |  | (NSDictionary*) | plistDictionary |

Creates a feed from a suitable Plist-able dictionary representation.

Provided by category RSSFeed(Storage).

## feedName

- (NSString *) feedName |  |  |

Returns
  The name of the feed

Reimplemented from <RSSFeed>.

## feedURL

- (NSURL *) feedURL |  |  |

Returns
  the URL where the feed can be downloaded from (as NSURL object)

See also
  NSURL

Reimplemented from <RSSFeed>.

References articleClass, and clearArticles.

## fetch

- (enum RSSFeedError) fetch |  |  |

Fetches the feed from the web.

Returns
  An error number (of type enum RSSFeedError)

See also
  NSURL
  RSSFeedError

Fetches the feed from its feed URL, parses it and adds the found articles to the list of articles contained in this feed (if they are new).

Reimplemented from <RSSFeed>.

Provided by category RSSFeed(Fetching).

## fetchInBackground

- (void) fetchInBackground |  |  |

Fetches the feed from the web. Feed fetching is done in the background. When the feed is fetched, the feed will post a RSSFeedFetchedNotification.

See also
  RSSFeedFetchedNotification

Reimplemented from <RSSFeed>.

Provided by category RSSFeed(Fetching).

## initWithURL:

- (id) initWithURL: |  | (NSURL*) | aURL |

Designated initializer.

Parameters

  aURL | The URL where the feed can be downloaded from.

Designated initializer

References articleClass, and lastError.

## isFetching

- (BOOL) isFetching |  |  |

Returns YES if and only if this feed is currently being fetched.

Reimplemented from <RSSFeed>.

References isFetching.

Referenced by isFetching, and status.

## lastRetrieval

- (NSDate *) lastRetrieval |  |  |

Returns the date of last retrieval of this feed. If the feed hasn't been retrieved yet, this method returns nil.

Returns
  The date of last retrieval as a NSDate pointer.

## newArticleFound:

- (void) newArticleFound: |  | (id) | anArticle |

RSSFeed also implements the NewRSSArticleListener informal protocol.

Implementation of the NewRSSArticleListener protocol.

## plistDictionary

- (NSMutableDictionary *) plistDictionary |  |  |

Returns a Plist-able dictionary representation of this feed.

Provided by category RSSFeed(Storage).

## removeArticle:

- (void) removeArticle: |  | (RSSArticle*) | article |

Deletes an article from the feed.

Parameters

  article | The index of the article to delete.

## setArticleClass:

- (void) setArticleClass: |  | (Class) | aClass |

Sets the class of the article objects. This needs to be a subtype of RSSArticle.

Parameters

  aClass | The class newly created article objects should have.

References articleClass.

## setFeedName:

- (void) setFeedName: |  | (NSString*) | aFeedName |

Sets the feed name

## status

- (enum RSSFeedStatus) status |  |  |

Accessor for the status of the feed. This can be used by a multithreaded GUI to indicate if a feed is currently fetching...

Deprecated
  in favor of -isFetching

See also
  - isFetching

Returns
  either RSSFeedIsFetching or RSSFeedIsIdle

References articleEnumerator, and isFetching.

## Member Data Documentation

## articleClass

- (Class) articleClass

protected

Returns the class of the article objects. This needs to be a subclass of RSSArticle. (Also needed to implement the NewRSSArticleListener class)

Returns
  the article class

Referenced by feedURL, initWithURL:, and setArticleClass:.

## lastError

- (enum RSSFeedError) lastError

protected

Returns the last fetching error.

Returns the last error. Guaranteed to return the last fetching result.

Provided by category RSSFeed(Fetching).

References RSSFeed(Fetching)::lastError.

Referenced by initWithURL:, and RSSFeed(Fetching)::lastError.

The documentation for this class was generated from the following files:

- RSSFeed.h
- RSSFeed.m