Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Mobile User committed Nov 3, 2011
0 parents commit b174680
Show file tree
Hide file tree
Showing 14 changed files with 474 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Info.plist
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>

31 changes: 31 additions & 0 deletions Makefile
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 $@ $^

22 changes: 22 additions & 0 deletions README.html
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>
12 changes: 12 additions & 0 deletions RSSDefines.h
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;
27 changes: 27 additions & 0 deletions RSSEntry.h
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

32 changes: 32 additions & 0 deletions RSSEntry.m
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

32 changes: 32 additions & 0 deletions RSSFeed.h
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

34 changes: 34 additions & 0 deletions RSSFeed.m
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

14 changes: 14 additions & 0 deletions RSSKit.h
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"

39 changes: 39 additions & 0 deletions RSSParser.h
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

Loading

0 comments on commit b174680

Please sign in to comment.