ios CCPlistFileWritter.m

//
//  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

 

//
//  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. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-10 10:10:02       99 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-10 10:10:02       107 阅读
  3. 在Django里面运行非项目文件

    2024-07-10 10:10:02       90 阅读
  4. Python语言-面向对象

    2024-07-10 10:10:02       98 阅读

热门阅读

  1. C#实现Winform程序右下角弹窗消息提示

    2024-07-10 10:10:02       28 阅读
  2. 【PyTorch单点知识】自动求导机制的原理与实践

    2024-07-10 10:10:02       30 阅读
  3. 大数据平台之Hive Metastore

    2024-07-10 10:10:02       27 阅读
  4. 《框架封装 · Redis 事件监听》

    2024-07-10 10:10:02       28 阅读
  5. Knife4j的原理及应用详解(四)

    2024-07-10 10:10:02       32 阅读
  6. Stable Diffusion 深入浅出,一看就会

    2024-07-10 10:10:02       29 阅读
  7. Oracle 动态编译数据库对象

    2024-07-10 10:10:02       29 阅读
  8. 从“技术驱动”向“应用驱动”

    2024-07-10 10:10:02       35 阅读