-
Notifications
You must be signed in to change notification settings - Fork 1
/
KinemeStringWithURL.m
46 lines (37 loc) · 1.02 KB
/
KinemeStringWithURL.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "stdio.h"
#import "KinemeStringWithURL.h"
@implementation KinemeStringWithURL
+ (QCPatchExecutionMode)executionModeWithIdentifier:(id)fp8
{
return kQCPatchExecutionModeProvider;
}
+ (BOOL)allowsSubpatchesWithIdentifier:(id)fp8
{
return FALSE;
}
- (id)initWithIdentifier:(id)fp8
{
if(self=[super initWithIdentifier:fp8])
{
[[self userInfo] setObject:@"Kineme String With URL" forKey:@"name"];
}
return self;
}
- (BOOL)execute:(id)openglcontext time:(double)time arguments:(id)arguments
{
if([inputURL wasUpdated] || ([inputUpdate wasUpdated] && [inputUpdate booleanValue]))
{
NSData *d = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: [inputURL stringValue]]];
if(d)
{
NSString *s = [[NSString alloc] initWithData: d encoding: NSUTF8StringEncoding];
if(s == nil) // UTF8 fails for some ascii string (foundation bug?)
s = [[NSString alloc] initWithData: d encoding: NSASCIIStringEncoding];
[outputURLContent setStringValue: s];
[d release];
[s release];
}
}
return YES;
}
@end