#import #import #import #import "TickerWindow.h" @interface RSSNode: NSObject { RSSNode *parent; NSMutableArray *children; NSMutableDictionary *attributes; NSString *name, *value; unsigned long offset; } + nodeWithParent:(RSSNode *)theParent; - initWithParent:(RSSNode *)theParent; - setOffset:(unsigned long)pos; - (unsigned long)offset; - setName:(NSString *)theName; - setValue:(NSString *)theValue; - setAttributes:(NSMutableDictionary *)attribs; - (NSString *)name; - (NSString *)value; - attributeNamed:(NSString *)aName; - addChild:(RSSNode *)child; - (NSArray *)children; - (RSSNode *)parent; - (RSSNode *)childNamed:(NSString *)theName; - (RSSNode *)childNamed:(NSString *)theName withAttribute:(NSString *)theAttr atValue:(NSString *)theValue; - (NSString *)description; - (void)dealloc; @end @interface RSSHandler: GSSAXHandler { RSSNode *current; NSMutableArray *messages; } + (RSSHandler *)rssHandler; - init; - (void)startElement:(NSString *)elementName attributes:(NSMutableDictionary *)elementAttributes; - (void)characters:(NSString *)name; - (void)cdataBlock: (NSData*)value; - (void)endElement:(NSString *)elementName; - (void)error:(NSString*)e colNumber:(int)colNumber lineNumber:(int)lineNumber; - (void)fatalError:(NSString*)e colNumber:(int)colNumber lineNumber:(int)lineNumber; - (RSSNode *)root; - (NSMutableArray *)messages; - (void)dealloc; @end #define ART_FIELD_TITLE @"title" #define ART_FIELD_SUMMARY @"summary" #define ART_FIELD_DESC @"description" #define ART_FIELD_CONTENT @"content" #define ART_FIELD_GUID @"guid" #define ART_FIELD_ID @"id" #define ART_FIELD_LINK @"link" #define ART_FIELD_CDATA @"cdata" #define ART_FIELD_DATE @"pubDate" #define ART_FIELD_DATE1 @"date" #define CHAN_FIELD_ATHRMANAG @"managingEditor" #define CHAN_FIELD_ATHRWEBMSTR @"webMaster" #define ART_FIELD_ATHRAUTHOR @"author" #define ART_FIELD_ATHRCREATOR @"creator" #define ART_FIELD_AUPDATED @"updated" #define ART_FIELD_AMODIFIED @"modified" #define ART_FIELD_ACREATED @"created" #define ART_FIELD_AISSUED @"issued" #define ART_FIELD_APUBLISHED @"published" typedef enum { ART_HAS_TITLE = 1, ART_HAS_DESC = 2, ART_HAS_GUID = 4, ART_HAS_LINK = 8, ART_HAS_DATE = 16, ART_HAS_AUTHOR = 32 } ART_FLAGS; #define TEXTLEN_FOR_UNIQUEID 128 #define TEXTLEN_FOR_TITLE 256 #define RSS_CALFORMAT1 @"%a, %e %b %Y %H:%M:%S %z" // Tue, 28 Feb 2006 12:46:51 +0100 #define RSS_CALFORMAT2 @"%a, %e %b %Y %H:%M:%S %Z" // Tue, 28 Feb 2006 12:46:51 GMT #define ATOM_CALFORMAT1 @"%Y-%m-%d %H:%M:%S%z" // 2006-03-08 13:58:00-0800 #define ATOM_CALFORMAT2 @"%Y-%m-%d %H:%M:%S.%F%z" // 2006-03-08 13:58:00.123-0800 #define ART_NODATE_SECS 5 @interface GenericArticle: NSObject { NSString *title, *desc, *text, *author; NSString *guid, *uniqueid, *link; NSDate *date; unsigned int flags; TickerWindow *window; } + (NSDictionary *)englishLocale; + (NSString *)authorFromAtomAuthor:(RSSNode *)subnode; + (NSDate *)dateFromAtomDate:(RSSNode *)subnode; + newWithNode:(RSSNode *)node inWindow:(TickerWindow *)win; - initWithNode:(RSSNode *)node inWindow:(TickerWindow *)win; - concludeInit; - buildTitle; - buildText; - buildUniqueid; - (NSString *)title; - (NSString *)desc; - (NSString *)text; - (NSString *)author; - (NSString *)uniqueid; - (NSString *)link; - (NSAttributedString *)contentWithTitleFont:(NSFont *)aFont foreground:(NSColor *)fg background:(NSColor *)bg; - setAuthor:(NSString *)anAuthor; - setDate:(NSDate *)aDate; - (NSDate *)date; - (NSComparisonResult)compareByDate:(GenericArticle *)anArticle; - (void)dealloc; @end @interface RSSArticle: GenericArticle - initWithNode:(RSSNode *)node inWindow:(TickerWindow *)win; @end @interface AtomArticle: GenericArticle - initWithNode:(RSSNode *)node inWindow:(TickerWindow *)win; @end