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

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

相关推荐
普通网友2 分钟前
云计算数据加密选型:合规要求(GDPR / 等保)下的方法选择
开发语言·云计算·perl
bugu___3 分钟前
仿muduo库实现并发服务器(3)
开发语言·c++
betazhou4 分钟前
借用Deepseek写一个定期清理备份文件的ps脚本
开发语言·前端·javascript·ps·deepseek·清理备份文件
瑞雪兆丰年兮6 分钟前
[从0开始学Java|第一天]Java入门
java·开发语言
沈雅馨7 分钟前
SQL语言的云计算
开发语言·后端·golang
人道领域13 分钟前
javaWeb从入门到进阶(SpringBoot基础案例)
java·开发语言·spring
小二·15 分钟前
Go 语言系统编程与云原生开发实战(第2篇):并发编程深度实战 —— Goroutine、Channel 与 Context 构建高并发 API 网关
开发语言·云原生·golang
u01040583616 分钟前
利用Java CompletableFuture优化企业微信批量消息发送的异步编排
java·开发语言·企业微信
m0_6860416118 分钟前
C++中的装饰器模式变体
开发语言·c++·算法
一杯清茶52018 分钟前
Python中ttkbootstrap的介绍与基本使用
开发语言·python