1
0
mirror of https://github.com/thes3m/XNI synced 2024-12-26 13:26:06 +01:00
XNI/Classes/Retronator/Xni/Framework/Content/Pipeline/NamedValueDictionary.m.h
Matej Jan d5b2897d8b Added 3D Model support.
git-svn-id: http://xni.googlecode.com/svn/XNI@42 ac433895-eea3-a490-d80a-17149a75e588
2010-11-30 23:26:03 +00:00

64 lines
1.1 KiB
Objective-C

//
// NamedValueDictionary.m.h
// XNI
//
// Created by Matej Jan on 29.11.10.
// Copyright 2010 Retronator. All rights reserved.
//
// #define NamedValueDictionary NamedValueDictionaryName
// #define T DataType
@implementation NamedValueDictionary
- (id) init
{
self = [super init];
if (self != nil) {
dictionary = [[NSMutableDictionary alloc] init];
}
return self;
}
- (int) count {
return [dictionary count];
}
- (T) itemForKey:(NSString*)key {
return [dictionary objectForKey:key];
}
- (void) set:(T)value forKey:(NSString*)key {
if (value) {
[dictionary setObject:value forKey:key];
} else {
[dictionary removeObjectForKey:key];
}
}
- (void) add:(T)value forKey:(NSString*)key {
[dictionary setObject:value forKey:key];
}
- (void) remove:(NSString*)key {
[dictionary removeObjectForKey:key];
}
- (void) clear {
[dictionary removeAllObjects];
}
- (BOOL) containsKey:(NSString*)key {
return [dictionary objectForKey:key] != nil;
}
- (void) dealloc
{
[dictionary release];
[super dealloc];
}
@end
// #undef NamedValueDictionary
// #undef T