ios CCPlistFileWritter.m

objectivec 复制代码
//
//  CCPlistFileWritter.h
//  CCFC
//
//


#import <Foundation/Foundation.h>
#import "CCPlistFileReader.h"


@interface CCPlistFileWritter : CCPlistFileReader
{
        id              _writterObj;
}


// for NSDictionary
- (void)removeObjectForKey:(id)key;
- (void)setObject:(id)object forKey:(id)key;


// for NSArray
- (void)addObject:(id)anObject;
- (void)insertObject:(id)anObject atIndex:(NSUInteger)index;
- (void)removeLastObject;
- (void)removeObjectAtIndex:(NSUInteger)index;
- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject;


@end
cpp 复制代码
//
//  CCPlistFileWritter.m
//  CCFC
//
//


#import "CCPlistFileWritter.h"




@implementation CCPlistFileWritter


- (void)initWritterObjOnce
{
        if(_writterObj == nil)
        {
                _writterObj = [[NSMutableDictionary alloc] initWithDictionary:_internal 
                                                                                                                        copyItems:YES];
                [_internal release];
                _internal = nil;
        }
}


- (void)removeObjectForKey:(id)key
{
        [self initWritterObjOnce];
        [_writterObj removeObjectForKey:key];
}


- (void)setObject:(id)object forKey:(id)key
{
        [self initWritterObjOnce];
        [_writterObj setObject:object forKey:key];
}




- (void)addObject:(id)object
{
        [self initWritterObjOnce];
        [_writterObj addObject:object];
}


- (void)insertObject:(id)object atIndex:(NSUInteger)index
{
        [self initWritterObjOnce];
        [_writterObj insertObject:object atIndex:index];
}


- (void)removeLastObject
{
        [self initWritterObjOnce];
        [_writterObj removeLastObject];
}


- (void)removeObjectAtIndex:(NSUInteger)index
{
        [self initWritterObjOnce];
        [_writterObj removeObjectAtIndex:index];
}


- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)object
{
        [self initWritterObjOnce];
        [_writterObj replaceObjectAtIndex:index withObject:object];
}


- (void)dealloc
{
        [_writterObj release];
        [super dealloc];
}


@end

微风不燥,阳光正好,你就像风一样经过这里,愿你停留的片刻温暖舒心。

我是程序员小迷(致力于C、C++、Java、Kotlin、Android、Shell、JavaScript、TypeScript、Python等编程技术的技巧经验分享),若作品对您有帮助,请关注、分享、点赞、收藏、在看、喜欢,您的支持是我们为您提供帮助的最大动力。

欢迎关注。助您在编程路上越走越好!

相关推荐
kebeiovo1 分钟前
项目必备流程图,类图,E-R图实例速通
开发语言·r语言·流程图
软件开发-NETKF88881 分钟前
JSP到Tomcat特详细教程
java·开发语言·tomcat·jsp·项目运行
ftswsfb22 分钟前
现代C++:现代C++?
开发语言·c++
乌萨奇也要立志学C++25 分钟前
【C++详解】C++ 智能指针:使用场景、实现原理与内存泄漏防治
开发语言·c++
minji...32 分钟前
C++ 详细讲解vector类
开发语言·c++
小鸡脚来咯1 小时前
一个Java的main方法在JVM中的执行流程
java·开发语言·jvm
江团1io01 小时前
深入解析三色标记算法
java·开发语言·jvm
m0_738120721 小时前
CTFshow系列——PHP特性Web97-100
开发语言·安全·web安全·php·ctfshow
你我约定有三1 小时前
java--泛型
java·开发语言·windows
小苏兮1 小时前
【C++】类与对象(下)
开发语言·c++·学习