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

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

相关推荐
郭涤生几秒前
C++中设置函数与回调函数设值的性能差异及示例
开发语言·c++
m0_635647483 分钟前
Qt开发与MySQL数据库教程(二)——MySQL常用命令以及示例
java·开发语言·数据库·mysql
fie888913 分钟前
Spinal码MATLAB实现(采用One-at-a-Time哈希函数)
开发语言·matlab·哈希算法
ZHOUPUYU25 分钟前
PHP 8.6的底层革命。那些看不见的优化,才是真正的惊喜
开发语言·后端·php
白云如幻27 分钟前
【JDBC】集合、反射和泛型复习
java·开发语言
佩奇大王42 分钟前
P2118 排列字母
java·开发语言·算法
runfarther1 小时前
Java变量作用域详解
java·开发语言
java1234_小锋1 小时前
Java高频面试题:MyBatis与JPA有哪些不同?
java·开发语言·mybatis·jpa
confiself1 小时前
A2UI实时渲染展示
开发语言·javascript·css
NGC_66111 小时前
Java基础面试题2
java·开发语言·python