X-Git-Url: http://git.ithinksw.org/ITFoundation.git/blobdiff_plain/5edc719e9181e04faaa247bfa389471bc57b9402..3d646c75403df6d5324833a701723a765555177f:/ITOSAComponent.m diff --git a/ITOSAComponent.m b/ITOSAComponent.m deleted file mode 100755 index 9ab1a7f..0000000 --- a/ITOSAComponent.m +++ /dev/null @@ -1,95 +0,0 @@ -/* - * ITFoundation - * ITOSAComponent - * A Cocoa wrapper for scripting components. - * - * Original Author : Kent Sutherland - * Responsibility : Kent Sutherland - * Responsibility : Joseph Spiros - * - * Copyright (c) 2002 - 2004 iThink Software. - * All Rights Reserved - * - */ - -#import "ITOSAComponent.h" - -@implementation ITOSAComponent - -+ (NSArray *)availableComponents -{ - Component currentComponent = 0; - ComponentDescription cd; - - cd.componentType = kOSAComponentType; - cd.componentSubType = 0; - cd.componentManufacturer = 0; - cd.componentFlags = 0; - cd.componentFlagsMask = 0; - - while ((currentComponent = FindNextComponent(0, &cd)) != 0) { - } - return [NSArray array]; -} - -- (id)initWithSubtype:(unsigned long)subtype -{ - ComponentDescription cd; - cd.componentType = kOSAComponentType; - cd.componentSubType = subtype; - cd.componentManufacturer = 0; - cd.componentFlags = 0; - cd.componentFlagsMask = 0; - Component temp = FindNextComponent(0, &cd); - if ( (self = [self initWithComponent:temp]) ) { - } - return self; -} - -- (id)initWithComponent:(Component)component; -{ - if ( (self = [super init]) ) { - Handle componentName = NewHandle(0); - Handle componentInfo = NewHandle(0); - ComponentDescription description; - NSMutableDictionary *information; - - _component = component; - _componentInstance = OpenComponent(component); - - if (GetComponentInfo(component, &description, componentName, componentInfo, nil) != 0) { - NSLog(@"FATAL ERROR!"); - return nil; - } - - information = [[NSMutableDictionary alloc] init]; - [information setObject:[[[NSString alloc] initWithBytes:componentName length:GetHandleSize(componentName) encoding:NSASCIIStringEncoding] autorelease] forKey:@"ITComponentName"]; - [information setObject:[[[NSString alloc] initWithBytes:componentInfo length:GetHandleSize(componentInfo) encoding:NSASCIIStringEncoding] autorelease] forKey:@"ITComponentInfo"]; - [information setObject:[NSNumber numberWithUnsignedLong:description.componentSubType] forKey:@"ITComponentSubtype"]; - [information setObject:[NSNumber numberWithUnsignedLong:description.componentManufacturer] forKey:@"ITComponentManufacturer"]; - - } - return self; -} - -- (void)dealloc -{ - [_information release]; -} - -- (Component)component -{ - return _component; -} - -- (ComponentInstance)componentInstance -{ - return _componentInstance; -} - -- (NSDictionary *)information -{ - return _information; -} - -@end