Skip to content

Commit

Permalink
update headers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasper Blues committed Jan 30, 2014
1 parent a66e490 commit 3051577
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
11 changes: 7 additions & 4 deletions Source/Factory/Pool/TyphoonWeekComponentsPool.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
////////////////////////////////////////////////////////////////////////////////
//
// TyphoonWeekComponentsPool.h
// A-Typhoon
// TYPHOON FRAMEWORK
// Copyright 2013, Jasper Blues & Contributors
// All Rights Reserved.
//
// Created by Aleksey Garbarev on 29.01.14.
// Copyright (c) 2014 Jasper Blues. All rights reserved.
// NOTICE: The authors permit you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////

#import <Foundation/Foundation.h>
#import "TyphoonComponentsPool.h"
Expand Down
40 changes: 23 additions & 17 deletions Source/Factory/Pool/TyphoonWeekComponentsPool.m
Original file line number Diff line number Diff line change
@@ -1,53 +1,59 @@
////////////////////////////////////////////////////////////////////////////////
//
// TyphoonWeekComponentsPool.m
// A-Typhoon
// TYPHOON FRAMEWORK
// Copyright 2013, Jasper Blues & Contributors
// All Rights Reserved.
//
// Created by Aleksey Garbarev on 29.01.14.
// Copyright (c) 2014 Jasper Blues. All rights reserved.
// NOTICE: The authors permit you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////

#import "TyphoonWeekComponentsPool.h"
#import "NSObject+DeallocNotification.h"

@implementation TyphoonWeekComponentsPool {
NSMutableDictionary *dictionaryWithUnretainedObjects;
@implementation TyphoonWeekComponentsPool
{
NSMutableDictionary* dictionaryWithUnretainedObjects;
}

- (id)init
{
self = [super init];
if (self) {
if (self)
{
CFDictionaryValueCallBacks callbacks = {0, NULL, NULL, NULL, NULL};
dictionaryWithUnretainedObjects = (__bridge_transfer id)CFDictionaryCreateMutable(NULL,
0,
&kCFTypeDictionaryKeyCallBacks,
&callbacks);
0,
&kCFTypeDictionaryKeyCallBacks,
&callbacks);
}
return self;
}

- (void) setObject:(id)object forKey:(id<NSCopying>)aKey
- (void)setObject:(id)object forKey:(id <NSCopying>)aKey
{
__weak typeof (dictionaryWithUnretainedObjects) weakDict = dictionaryWithUnretainedObjects;

[object setDeallocNotificationInBlock:^{

[object setDeallocNotificationInBlock:^
{
[weakDict removeObjectForKey:aKey];
}];

[dictionaryWithUnretainedObjects setObject:object forKey:aKey];
}

- (id) objectForKey:(id<NSCopying>)aKey
- (id)objectForKey:(id <NSCopying>)aKey
{
return [dictionaryWithUnretainedObjects objectForKey:aKey];
}

- (NSArray *) allValues
- (NSArray*)allValues
{
return [dictionaryWithUnretainedObjects allValues];
}

- (void) removeAllObjects
- (void)removeAllObjects
{
[dictionaryWithUnretainedObjects removeAllObjects];
}
Expand Down

0 comments on commit 3051577

Please sign in to comment.