// Copyright (c) 2002, Peter Bentley // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // The name Peter Bentley may not be used to endorse or promote // products derived from this software without specific prior // written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // #import "OmdGroupInfo.h" #import "OmdTocCtlr.h" #import "OmdToc.h" CVSID( "$Id: OmdGroupInfo.m,v 1.13 2003/08/25 16:43:16 pete Exp $" ); @implementation OmdGroupInfo - (id) initWithId: (int) i andToc: (OmdToc *) toc { if( (self = [super init]) != nil ) { grpid = i; omdToc = toc; [self findChildren]; } return self; } - (void) dealloc { [children release]; [super dealloc]; } - (int) first { omd_group_t *group = [self getGroup]; return group->start; } - (int) last { omd_group_t *group = [self getGroup]; return group->finish; } // Outline view data - (void) findChildren { int track; if( children ) { [children release]; } // Arbitrary initial capacity... children = [[NSMutableArray alloc] initWithCapacity: 8]; for( track = [self first]; track <= [self last]; track++ ) { [children addObject: [omdToc trackInfo: track]]; } } - (int) numberOfChildren { if( children == nil ) { [self findChildren]; } return [children count]; } - (id) childAtIndex: (int) index { return [children objectAtIndex: index]; } - (int) id { return grpid + 1; } - (NSString *) idString { //NSString *str = [[NSString alloc] initWithFormat: @"G%d", [self id]]; //return str; return @""; } - (NSString *) groupString { return @""; } - (NSString *) titleString { omd_group_t *group = [self getGroup]; NSString *str; str = [[NSString alloc] initWithCString: group->name]; return str; } - (void) setTitleString: (NSString *) str { [omdToc setTitle: str forGroup: grpid]; } - (NSString *) lengthString { omd_group_t *group = [self getGroup]; NSString *str; str = [[NSString alloc] initWithFormat: @"(%d-%d)", group->start + 1, group->finish + 1]; return str; } - (NSString *) codecString { return @""; } - (NSString *) rateString { return @""; } - (NSString *) lockedString { return @""; } - (NSString *) nodeType { return kOmdGroupNode; } - (omd_group_t *) getGroup { return [omdToc rawGroupInfo: grpid]; } @end