-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mobile User
committed
Nov 3, 2011
0 parents
commit b174680
Showing
14 changed files
with
474 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<plist> | ||
<dict> | ||
<key>CFBundleIdentifier</key> | ||
<string>org.h2co3.rsskit</string> | ||
<key>CFBundleExecutable</key> | ||
<string>RSSKit</string> | ||
<key>CFBundlePackageType</key> | ||
<string>FMWK</string> | ||
<key>CFBundleVersion</key> | ||
<string>0.1</string> | ||
</dict> | ||
</plist> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
TARGET = RSSKit | ||
|
||
SYSROOT = /User/sysroot | ||
CC = gcc | ||
LD = $(CC) | ||
CFLAGS = -isysroot $(SYSROOT) \ | ||
-Wall \ | ||
-std=gnu99 \ | ||
-I. \ | ||
-c | ||
LDFLAGS = -isysroot $(SYSROOT) \ | ||
-w \ | ||
-dynamiclib \ | ||
-install_name /System/Library/Frameworks/$(TARGET).framework/$(TARGET) \ | ||
-lobjc \ | ||
-framework Foundation | ||
|
||
OBJECTS = RSSFeed.o RSSEntry.o RSSParser.o | ||
|
||
all: $(TARGET) | ||
|
||
$(TARGET): $(OBJECTS) | ||
$(LD) $(LDFLAGS) -o $(TARGET) $(OBJECTS) | ||
cp $(TARGET) /System/Library/Frameworks/$(TARGET).framework | ||
|
||
clean: | ||
rm -rf $(OBJECTS) $(TARGET) | ||
|
||
%.o: %.m | ||
$(CC) $(CFLAGS) -o $@ $^ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<html> | ||
<head> | ||
<title>RSSKit - Documentation</title> | ||
</head> | ||
<body> | ||
<h1>RSSKit</h1> | ||
<hr /> | ||
<p> | ||
RSSKit is an easy-to use iOS framework to make RSS feed processing simple. It consists of only 3 small classes, so it's extremely lightweight yet powerful. It supports both the RSS 2.0 and the Atom 1.0 feed formats. | ||
</p> | ||
<br> | ||
<h2>How to use the framework</h2> | ||
<ol> | ||
<li><pre><tt><code>#import < RSSKit/RSSKit.h ></code></tt></pre></li> | ||
<li>Define a class which conforms to the <tt>RSSParserDelegate</tt>, i. e.: <code><pre><tt>@interface MyParserDelegate: NSObject < RSSParserDelegate > </tt></pre></code></li> | ||
<li>Instantiate an <tt>RSSParser</tt> object using an NSString with an URL containing a valid RSS/Atom feed; e. g. <code><tt><pre>RSSParser *parser = [[RSSParser alloc] initWithUrl:@"http://example.com/feed"];</pre></tt></code></li> | ||
<li>Set an instance of your freshly declared deleate class as the parser's delegate, that is: <code><tt><pre>MyParserDelegate *theDelegateObject = [[MyParserDelegate alloc] init]; | ||
parser.delegate = theDelegateObject;</pre></tt></code></li> | ||
<li>Call <code><tt><pre>[parser parse];</pre></tt></code></li> | ||
<li>Implement the <tt>rssParser:parsedFeed:</tt> method in your delegate class. As the 2nd parameter it'll be passed an <tt>RSSFeed</tt> instance. The properties of this class are named meaningfully; the <tt>articles</tt> property will contain an <tt>NSArray</tt> of <tt>RSSEntry</tt> objects, representing the items/summaries of the feed, respectively (this class also has obviously-named properties).</li> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// | ||
// RSSDefines.h | ||
// RSSKit | ||
// | ||
// Created by Árpád Goretity on 01/11/2011. | ||
// Licensed under a CreativeCommons Attribution 3.0 Unported License | ||
// | ||
|
||
typedef enum { | ||
RSSFeedTypeRSS, | ||
RSSFeedTypeAtom | ||
} RSSFeedType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// RSSEntry.h | ||
// RSSKit | ||
// | ||
// Created by Árpád Goretity on 01/11/2011. | ||
// Licensed under a CreativeCommons Attribution 3.0 Unported License | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
|
||
@interface RSSEntry: NSObject <NSCopying> { | ||
NSString *title; | ||
NSString *url; | ||
NSString *uid; | ||
NSString *date; | ||
NSString *summary; | ||
} | ||
|
||
@property (retain) NSString *title; | ||
@property (retain) NSString *url; | ||
@property (retain) NSString *uid; | ||
@property (retain) NSString *date; | ||
@property (retain) NSString *summary; | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// RSSEntry.m | ||
// RSSKit | ||
// | ||
// Created by Árpád Goretity on 01/11/2011. | ||
// Licensed under a CreativeCommons Attribution 3.0 Unported License | ||
// | ||
|
||
#import "RSSEntry.h" | ||
|
||
|
||
@implementation RSSEntry | ||
|
||
@synthesize title; | ||
@synthesize url; | ||
@synthesize uid; | ||
@synthesize date; | ||
@synthesize summary; | ||
|
||
// NSCopying | ||
- (id) copyWithZone:(NSZone *)zone { | ||
RSSEntry *copy = [[RSSEntry alloc] init]; | ||
copy.title = self.title; | ||
copy.url = self.url; | ||
copy.uid = self.uid; | ||
copy.date = self.date; | ||
copy.summary = self.summary; | ||
return copy; | ||
} | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// RSSFeed.h | ||
// RSSKit | ||
// | ||
// Created by Árpád Goretity on 01/11/2011. | ||
// Licensed under a CreativeCommons Attribution 3.0 Unported License | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "RSSDefines.h" | ||
|
||
|
||
@interface RSSFeed: NSObject { | ||
RSSFeedType type; | ||
NSString *title; | ||
NSString *description; | ||
NSString *url; | ||
NSString *date; | ||
NSString *author; | ||
NSMutableArray *articles; | ||
} | ||
|
||
@property (assign) RSSFeedType type; | ||
@property (retain) NSString *title; | ||
@property (retain) NSString *description; | ||
@property (retain) NSString *url; | ||
@property (retain) NSString *date; | ||
@property (retain) NSString *author; | ||
@property (retain) NSMutableArray *articles; | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// RSSFeed.m | ||
// RSSKit | ||
// | ||
// Created by Árpád Goretity on 01/11/2011. | ||
// Licensed under a CreativeCommons Attribution 3.0 Unported License | ||
// | ||
|
||
#import "RSSFeed.h" | ||
|
||
|
||
@implementation RSSFeed | ||
|
||
- (id) init { | ||
self = [super init]; | ||
articles = [[NSMutableArray alloc] init]; | ||
return self; | ||
} | ||
|
||
- (void) dealloc { | ||
[articles release]; | ||
[super dealloc]; | ||
} | ||
|
||
@synthesize type; | ||
@synthesize title; | ||
@synthesize description; | ||
@synthesize url; | ||
@synthesize date; | ||
@synthesize author; | ||
@synthesize articles; | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// RSSKit.h | ||
// RSSKit | ||
// | ||
// Created by Árpád Goretity on 01/11/2011. | ||
// Licensed under a CreativeCommons Attribution 3.0 Unported License | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "RSSDefines.h" | ||
#import "RSSFeed.h" | ||
#import "RSSEntry.h" | ||
#import "RSSParser.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// RSSParser.h | ||
// RSSKit | ||
// | ||
// Created by Árpád Goretity on 01/11/2011. | ||
// Licensed under a CreativeCommons Attribution 3.0 Unported License | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "RSSDefines.h" | ||
#import "RSSFeed.h" | ||
#import "RSSEntry.h" | ||
|
||
@protocol RSSParserDelegate; | ||
|
||
|
||
@interface RSSParser: NSObject { | ||
NSString *url; | ||
NSXMLParser *xmlParser; | ||
NSMutableArray *tagStack; | ||
RSSFeed *feed; | ||
RSSEntry *entry; | ||
id <RSSParserDelegate> delegate; | ||
} | ||
|
||
@property (assign) id <RSSParserDelegate> delegate; | ||
|
||
- (id) initWithUrl:(NSString *)theUrl; | ||
- (void) parse; | ||
|
||
@end | ||
|
||
|
||
@protocol RSSParserDelegate <NSObject> | ||
@optional | ||
- (void) rssParser:(RSSParser *)parser parsedFeed:(RSSFeed *)feed; | ||
- (void) rssParser:(RSSParser *)parser errorOccurred:(NSError *)error; | ||
@end | ||
|
Oops, something went wrong.