X-Git-Url: http://git.ithinksw.org/MenuTunes.git/blobdiff_plain/fce120b94a1adc6b9c6e1796217d8065bc105fbb..9234efdd6caadd01f9b28637b44b7f88c42e0cec:/PlaylistNode.m diff --git a/PlaylistNode.m b/PlaylistNode.m new file mode 100644 index 0000000..12ae00b --- /dev/null +++ b/PlaylistNode.m @@ -0,0 +1,95 @@ +/* + * MenuTunes + * PlaylistNode + * Helper class for keeping track of sources, playlists and folders + * + * Original Author : Kent Sutherland + * Responsibility : Kent Sutherland + * + * Copyright (c) 2005 iThink Software. + * All Rights Reserved + * + */ + +#import "PlaylistNode.h" + + +@implementation PlaylistNode + ++ (PlaylistNode *)playlistNodeWithName:(NSString *)n type:(ITMTNodeType)t index:(int)i +{ + return [[[PlaylistNode alloc] initWithName:n type:t index:i] autorelease]; +} + +- (id)initWithName:(NSString *)n type:(ITMTNodeType)t index:(int)i +{ + if ( (self = [super init]) ) { + _name = [n retain]; + _type = t; + _index = i; + _children = [[NSMutableArray alloc] init]; + _parent = nil; + } + return self; +} + +- (void)dealloc +{ + [_name release]; + [_children release]; + [_parent release]; + [super dealloc]; +} + +- (NSString *)description +{ + return [NSString stringWithFormat:@"{%@, index: %i, type: %i, parent: %@, children: %@}", _name, _index, _type, [_parent name], _children]; +} + +- (NSString *)name +{ + return _name; +} + +- (NSMutableArray *)children +{ + return _children; +} + +- (int)index +{ + return _index; +} + +- (void)setType:(ITMTNodeType)t +{ + _type = t; +} + +- (ITMTNodeType)type +{ + return _type; +} + +- (PlaylistNode *)parent +{ + return _parent; +} + +- (void)setParent:(PlaylistNode *)p +{ + [_parent release]; + _parent = [p retain]; +} + +- (ITMTRemotePlayerSource)sourceType +{ + return _sourceType; +} + +- (void)setSourceType:(ITMTRemotePlayerSource)t +{ + _sourceType = t; +} + +@end