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等编程技术的技巧经验分享),若作品对您有帮助,请关注、分享、点赞、收藏、在看、喜欢,您的支持是我们为您提供帮助的最大动力。

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

相关推荐
一个小白1几秒前
C++——list模拟实现
开发语言·c++
bug总结几秒前
新学一个JavaScript 的 classList API
开发语言·javascript·ecmascript
Nicole Potter8 分钟前
请说明C#中的List是如何扩容的?
开发语言·面试·c#
十八朵郁金香1 小时前
通俗易懂的DOM1级标准介绍
开发语言·前端·javascript
阿尔法波1 小时前
python与pycharm如何设置文件夹为源代码根目录
开发语言·python·pycharm
xing25161 小时前
pytest下allure
开发语言·python·pytest
眸笑丶1 小时前
使用 Python 调用 Ollama API 并调用 deepseek-r1:8b 模型
开发语言·python
enyp801 小时前
Qt QStackedWidget 总结
开发语言·qt
gu202 小时前
c#编程:学习Linq,重几个简单示例开始
开发语言·学习·c#·linq
lly2024062 小时前
SQLite 删除表
开发语言