RSSKit: RSSFeed Class Reference

Main Page | Class List | File List | Class Members | Related Pages

# RSSFeed Class Reference

`#import <RSSFeed.h>`

List of all members.

## Public Member Functions
(id) | - initWithURL:
(NSString *) | - description
(enum RSSFeedStatus) | - status
(RSSArticle *) | - articleAtIndex:
(unsigned int) | - count
(NSEnumerator *) | - articleEnumerator
(void) | - removeArticle:
(NSString *) | - feedName
(NSURL *) | - feedURL
(void) | - setAutoClear:
(BOOL) | - autoClear
(void) | - clearArticles
(void) | - setArticleClass:
(Class) | - articleClass
(NSDate *) | - lastRetrieval

## 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:
  `enum RSSFeedError err = [feed fetch];`
- Optionally tell the RSSFeed to keep old articles.
  `[feed setAutoClear: NO];`
- Iterate over the articles contained in the feed. This is analogous to the iteration over a NSArray.

            int i;
            for (i=0; i<[feed count]; i++)
              {
                RSSArticle* myArticle = [feed articleAtIndex: i];
                // [...] more code here
              }

See also:
  - initWithURL: (RSSFeed)

  - fetch (RSSFeed(Fetching))

  - setAutoClear: (RSSFeed)

  RSSArticle

  NSURL

## Member Function Documentation

- (RSSArticle*) articleAtIndex: |  | (int) | index |  |

  | Lets you access the individual articles in the feed. Often used in conjunction with the count method. Also take a look at the example in the description of this class. (RSSFeed) Parameters:
  | index | of the article to get
Returns: Article number index See also: RSSArticle - count RSSFeed

- (Class) articleClass |  |  |  |

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

- (NSEnumerator*) articleEnumerator |  |  |  |

| Returns: an enumerator for the articles in this feed

- (BOOL) autoClear |  |  |  |

| Returns: YES, if the automatic clearing of the article list is enabled for this feed. NO otherwise.

- (void) clearArticles |  |  |  |

| Clears the list of articles.

- (unsigned int) count |  |  |  |

| Returns: the number of articles in this feed.

- (NSString*) description |  |  |  |

| Returns: Description of the Feed (the feed name)

- (NSString*) feedName |  |  |  |

| Returns: The name of the feed

- (NSURL*) feedURL |  |  |  |

| Returns: the URL where the feed can be downloaded from (as NSURL object) See also: NSURL

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

  | Designated initializer. Parameters:
  | aURL | The URL where the feed can be downloaded from.

- (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.

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

  | Deletes an article from the feed. Parameters:
  | article | The index of the article to delete.

- (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.

- (void) setAutoClear: |  | (BOOL) | autoClear |  |

  | Lets you decide if the feed should be cleared before new articles are downloaded. Parameters:
  | autoClear | YES, if the feed should clear its article list before fetching new articles. NO otherwise

- (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... Returns: either RSSFeedIsFetching or RSSFeedIsIdle

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

- RSSFeed.h