Skip to content
Newer
Older
100644 74 lines (58 sloc) 2.19 KB
05eedb5 @itod initial add
authored Jan 25, 2010
1 // Copyright 2010 Todd Ditchendorf
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #import "PKJSUppercaseWord.h"
16 #import "PKJSUtils.h"
17 #import "PKJSWord.h"
18 #import <ParseKit/PKUppercaseWord.h>
19
20 #pragma mark -
21 #pragma mark Methods
22
23 #pragma mark -
24 #pragma mark Properties
25
26 #pragma mark -
27 #pragma mark Initializer/Finalizer
28
29 static void PKUppercaseWord_initialize(JSContextRef ctx, JSObjectRef this) {
30
31 }
32
33 static void PKUppercaseWord_finalize(JSObjectRef this) {
34 // released in PKParser_finalize
35 }
36
37 static JSStaticFunction PKUppercaseWord_staticFunctions[] = {
38 { 0, 0, 0 }
39 };
40
41 static JSStaticValue PKUppercaseWord_staticValues[] = {
42 { 0, 0, 0, 0 }
43 };
44
45 #pragma mark -
46 #pragma mark Public
47
48 JSClassRef PKUppercaseWord_class(JSContextRef ctx) {
49 static JSClassRef jsClass = NULL;
50 if (!jsClass) {
51 JSClassDefinition def = kJSClassDefinitionEmpty;
52 def.parentClass = PKWord_class(ctx);
53 def.staticFunctions = PKUppercaseWord_staticFunctions;
54 def.staticValues = PKUppercaseWord_staticValues;
55 def.initialize = PKUppercaseWord_initialize;
56 def.finalize = PKUppercaseWord_finalize;
57 jsClass = JSClassCreate(&def);
58 }
59 return jsClass;
60 }
61
62 JSObjectRef PKUppercaseWord_new(JSContextRef ctx, void *data) {
63 return JSObjectMake(ctx, PKUppercaseWord_class(ctx), data);
64 }
65
66 JSObjectRef PKUppercaseWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) {
67 PKPreconditionConstructorArgc(1, "PKUppercaseWord");
68
69 NSString *s = PKJSValueGetNSString(ctx, argv[0], ex);
70
71 PKUppercaseWord *data = [[PKUppercaseWord alloc] initWithString:s];
72 return PKUppercaseWord_new(ctx, data);
73 }
Something went wrong with that request. Please try again.