swfactionobject.m

来自「flirt 一款纯c的flash解码程序。」· M 代码 · 共 70 行

M
70
字号
/*
 Flirt, an SWF rendering library
 Copyright (c) 2004-2006 Dave Hayden <dave@opaque.net>
 All rights reserved.
 
 http://www.opaque.net/flirt/

 This code is distributed under the two-clause BSD license.
 Read the LICENSE file or visit the URL above for details
*/

#import "SWFActionObject.h"
#import "SWFActionValue.h"

@implementation SWFActionObject

+ (id)objectWithDDActionObject:(ddActionObject*)inObject
{
	return [[[self alloc] initWithDDActionObject:inObject] autorelease];
}

- (id)initWithDDActionObject:(ddActionObject*)inObject
{
	if ( (self = [super init]) == nil )
		return nil;
	
	object = inObject;

	return self;
}


- (void)dealloc
{
	[values release];
	
	[super dealloc];
}


- (NSArray*)values
{
	if ( values != nil )
		return values;

	char** nameList;
	ddActionValue* valueList;
	int nValues;
	int i;

	ddActionObject_getProperties(object, &nameList, &valueList, &nValues);

	values = [[NSMutableArray alloc] initWithCapacity:nValues];

	for ( i = 0; i < nValues; ++i )
	{
		NSString* name = [NSString stringWithCString:nameList[i]];
		SWFActionValue* value = [SWFActionValue valueWithDDActionValue:valueList[i]];
		
		[values addObject:[NSDictionary dictionaryWithObjectsAndKeys:name, @"Name", value, @"Value", nil]];
	}

	free(nameList);
	free(valueList);

	return values;
}

@end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?