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 分钟前
WEB安全--Java安全--LazyMap_CC1利用链
java·开发语言·网络·安全·web安全
酷炫码神26 分钟前
C#语法基础
开发语言·c#
ddd...e_bug27 分钟前
GMT之Bash语言使用
开发语言·bash
码农秋29 分钟前
填坑记: 古董项目Apache POI 依赖异常排除
开发语言·tomcat·jsp·poi·依赖冲突
qq_6536444630 分钟前
如何查看打开的 git bash 窗口是否是管理员权限打开
开发语言·windows·git·bash
sadoshi31 分钟前
phpstudy的Apache添加AddType application/x-httpd-php .php .php5配置无效的处理方式
开发语言·php·apache
阑梦清川1 小时前
关于Go语言的开发环境的搭建
开发语言·后端·golang
言之。1 小时前
Makefile 在 Go 项目中的实践
开发语言·elasticsearch·golang
Nobkins1 小时前
2023CCPC河南省赛暨河南邀请赛个人补题ABEFGHK
开发语言·数据结构·c++·算法·图论
南部余额1 小时前
Python 类变量与实例变量完全指南:区别、使用场景及常见陷阱
开发语言·python