Moved StringToURLTransformer initialize code.

CQTexperiment
vspader 2008-02-17 21:18:01 +00:00
parent 3ba929f51a
commit c2a2f531a8
2 changed files with 8 additions and 4 deletions

View File

@ -14,7 +14,6 @@
#import "NSString+CogSort.h" #import "NSString+CogSort.h"
#import "NSNumber+CogSort.h" #import "NSNumber+CogSort.h"
#import "SpotlightTransformers.h" #import "SpotlightTransformers.h"
#import "StringToURLTransformer.h"
// Minimum length of a search string (searching for very small strings gets ugly) // Minimum length of a search string (searching for very small strings gets ugly)
#define MINIMUM_SEARCH_STRING_LENGTH 3 #define MINIMUM_SEARCH_STRING_LENGTH 3
@ -40,9 +39,6 @@ static NSPredicate * musicOnlyPredicate = nil;
forKey:@"spotlightSearchPath"]; forKey:@"spotlightSearchPath"];
// Register value transformers // Register value transformers
NSValueTransformer *stringToURLTransformer = [[[StringToURLTransformer alloc]init]autorelease];
[NSValueTransformer setValueTransformer:stringToURLTransformer
forName:@"StringToURLTransformer"];
NSValueTransformer *pausingQueryTransformer = [[[PausingQueryTransformer alloc] init] autorelease]; NSValueTransformer *pausingQueryTransformer = [[[PausingQueryTransformer alloc] init] autorelease];
[NSValueTransformer setValueTransformer:pausingQueryTransformer forName:@"PausingQueryTransformer"]; [NSValueTransformer setValueTransformer:pausingQueryTransformer forName:@"PausingQueryTransformer"];

View File

@ -9,6 +9,14 @@
#import "StringToURLTransformer.h" #import "StringToURLTransformer.h"
@implementation StringToURLTransformer @implementation StringToURLTransformer
+ (void)initialize
{
NSValueTransformer *stringToURLTransformer = [[[StringToURLTransformer alloc] init]autorelease];
[NSValueTransformer setValueTransformer:stringToURLTransformer
forName:@"StringToURLTransformer"];
}
+ (Class)transformedValueClass { return [NSURL class]; } + (Class)transformedValueClass { return [NSURL class]; }
+ (BOOL)allowsReverseTransformation { return YES; } + (BOOL)allowsReverseTransformation { return YES; }