//
// News.h
// NewsReader
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import
<Foundation/Foundation.h>
@interface News :
NSObject <NSCoding,NSCopying>
{
NSString* subject;
//NSURL* link;
NSString* description;
}
@property(nonatomic,copy)NSString*
subject;
//@property(nonatomic,copy)NSURL* link;
@property(nonatomic,copy)NSString*
description;
-(id)initwithsubject:(NSString*)_subject
anddescription:(NSString*)_description;
-(void)dealloc;
- (id)copyWithZone:(NSZone *)zone;
-(void)encodeWithCoder:(NSCoder *)aCoder;
-(id)initWithCoder:(NSCoder *)aDecoder;
-(NSString*)description;
@end
//
// News.m
// NewsReader
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import
"News.h"
@implementation News
@synthesize subject;
@synthesize description;
-(id)initwithsubject:(NSString*)_subject
anddescription:(NSString*)_description{
if(!_subject||!_description){
[self
release];
return nil;
}
self=[super
init];
if(!self){
return nil;
}
subject=[NSString
stringWithString:_subject];
description=[NSString
stringWithString:_description];
return self;
}
-(void)dealloc{
[super
dealloc];
}
- (id)copyWithZone:(NSZone *)zone{
News* n=[[News
allocWithZone:zone]initwithsubject:@"科技"
anddescription:@"日新月异"];
return n;
}
-(void)encodeWithCoder:(NSCoder *)aCoder{
[aCoder
encodeObject:subject
forKey:@"subject"];
[aCoder
encodeObject:description
forKey:@"description"];
}
-(id)initWithCoder:(NSCoder *)aDecoder{
if (self=[super
init]) {
self.subject= [aDecoder
decodeObjectForKey:@"subject"];
self.description=[aDecoder
decodeObjectForKey:@"description"];
}
return self;
}
-(NSString*)description{
NSString* d=[[NSString
alloc]initWithFormat:@"subject is %@,description is %@",subject,description];
return d;
}
@end
//
// Channel.h
// NewsReader
//
// Created by
zz
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import
<Foundation/Foundation.h>
#import
"News.h"
@class
News;
@interface Channel :
NSObject
{
NSMutableArray *newslist;
NSString * description;
}
@property(nonatomic,copy)NSMutableArray*
newslist;
@property(nonatomic,copy)NSString*
description;
-(id)initwithdescription:(NSString*)_description;
-(void)Addnews:(News*)_new;
-(void)Removenews:(NSInteger)index;
-(News*)newsatindex:(NSInteger)index;
-(void)dealloc;
-(NSString* )description;
@end
//
// Channel.m
// NewsReader
//
// Created by
zz
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import
"Channel.h"
#import
"News.h"
@implementation Channel
@synthesize description;
@synthesize newslist;
-(id)initwithdescription:(NSString*)_description{
if(!_description){
[self
release];
return nil;
}
self=[super
init];
if(!self){
return nil;
}
description=[NSString
stringWithString:_description];
newslist=[[NSMutableArray
alloc]init];
return self;
}
-(void)Addnews:(News*)_new{
[newslist
addObject:_new];
}
-(void)Removenews:(NSInteger)index{
[newslist
removeObjectAtIndex:index];
}
-(News*)newsatindex:(NSInteger)index{
return [newslist
objectAtIndex:index];
}
-(void)dealloc{
[newslist
release];
[super
dealloc];
}
-(NSString* )description{
NSMutableString* ns=[[NSMutableString
alloc]init];
for(id item
in newslist){
[ns
appendFormat:@"%@\n",[item
description]];
}
return ns;
}
@end
//
// Channelmanager.h
// NewsReader
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import
<Foundation/Foundation.h>
@class
Channel;
@interface Channelmanager :
NSObject <NSCoding>
{
NSMutableDictionary* Channellist;
NSString* filename;
}
@property(nonatomic,copy)NSMutableDictionary*
Channellist;
@property(nonatomic,copy)NSString*
filename;
-(id)initwithfilename:(NSString*)_filename;
-(void)Addchannel:(Channel*)_channel forKey:(NSString*)_key;
-(void)RemovechannelForKey:(NSString*)_key;
-(Channel*)channelForKey:(NSString*)_key;
-(void)save;
-(void)read;
-(void)dealloc;
-(NSString*)description;
-(void)encodeWithCoder:(NSCoder *)aCoder;
-(id)initWithCoder:(NSCoder *)aDecoder;
@end
//
// Channelmanager.m
// NewsReader
//
//
// Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//
#import
"Channelmanager.h"
#import
"Channel.h"
@implementation Channelmanager
@synthesize Channellist;
@synthesize filename;
-(id)initwithfilename:(NSString*)_filename{
if(!_filename){
[self
release];
return nil;
}
self=[super
init];
if(!self){
return nil;
}
filename=[NSString
stringWithString:_filename];
Channellist=[NSMutableDictionary
dictionary];
return self;
}
-(void)Addchannel:(Channel*)_channel forKey:(NSString*)_key{
[Channellist
setObject:_channel
forKey:_key];
}
-(void)RemovechannelForKey:(NSString*)_key{
[Channellist
removeObjectForKey:_key];
}
-(Channel*)channelForKey:(NSString*)_key{
return [Channellist
valueForKey:_key];
}
-(void)save{
//[Channellist writeToFile:filename atomically:YES];
// NSLog(@"chalist =====%@",Channellist);
[NSKeyedArchiver
archiveRootObject:[self
description]
toFile:filename];
}
-(void)read{
Channellist= [NSKeyedUnarchiver
unarchiveObjectWithFile:filename];
[Channellist
writeToFile:@"/tmp/qq.txt"
atomically:YES];
NSLog(@"%@",Channellist);
}
-(void)dealloc{
[filename
release];
[super
dealloc];
}
-(NSString*)description{
NSMutableString* ns=[[NSMutableString
alloc]init];
for(id item
in Channellist){
[ns
appendFormat:@"%@",[Channellist
valueForKey:item]];
// NSLog(@"909090_____---%@",item);
}
//NSLog(@"---------------------55======value is %@",[Channellist valueForKey:@"cc1"]);
[ns
autorelease];
return ns;
}
-(void)encodeWithCoder:(NSCoder *)aCoder{
[aCoder
encodeObject:Channellist
forKey:@"Channellist"];
[aCoder
encodeObject:filename
forKey:@"filename"];
}
-(id)initWithCoder:(NSCoder *)aDecoder{
if((self=[super
init])){
self.Channellist=[aDecoder
decodeObjectForKey:@"Channellist"];
self.filename=[aDecoder
decodeObjectForKey:@"filename"];
}
return self;
}
@end
分享到:
相关推荐
evil-newsreader
附带新闻订阅,夜间模式,字号切换。无服务器端
Newsreader项目的时间和因果关系提取模块。 检查test.sh,以给出列格式的数据集(例如“ data”目录中的Wikinews数据集),如何使用两个模块(TempRelPro和CauseRelPro)提取事件之间的关系。 YAMCHA(可执行文件...
用C#编写的NewsReader——很适合初学者
newsReader阅读器,源码下载newsReader阅读器,源码下载newsReader阅读器,源码下载
NewsReader是一款免费软件应用程序,可读取,管理,保存Internet新闻源(基于XML的RSS和ATOM(将来)新闻源)
NewsReader局域网程序详细代码!
弹性盒 Flexbox 新闻阅读器示例。 — 来源: — html — css — js 使用 Brunch.io 构建。 ()
newsreader_lite_wap_dl_8.apk
新闻阅读器 支持rest-api的wordpress平台的Android新闻阅读器
NewsReader -- 新闻AppNewsReader 是使用Objective-C开发的iOS新闻客户端基本内容:搭建系统框架设置应用图标和启动图片建模Model建立操作Operation建立视图View建立控制器Controller登录功能实现显示广告设置状态栏...
Gigi的Own Newsreader是完全使用C#编写的.NET平台的简单直观的多线程脱机NNTP客户端。
slrn源代码在位于http://www.jedsoft.org/snapshots/的git存储库中维护。
Yanoff是PalmOS平台的新闻阅读器,它允许NNTP下载新闻文章,发布文章,评分并提供管道。
会费该项目由位于巴黎和上海的数字字体设计机构Production Type领导。 要发表想法和反馈,请参阅制作说明在sources目录中运行sh build-static.sh以构建静态字体。 在sources目录中运行sh build-VF.sh来构建可变字体...
NewzRider是一本完整的新闻阅读器,并由Php和PhpGtk库编写。 易于配置和改进...
F_202110_NewsReader 带有BLoC的《卫报》的新Flutter项目
项目4(ch09_ex4_NewsReader) 完全工作的项目 4 (如果它在模拟器关闭并重新打开时第一次不起作用) (从来没有在我的三星 Note 4 上工作过) 以前的项目 下一个项目 [项目 5] ( )