Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
validating properties for NSCreateCommand
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

validating properties for NSCreateCommand



i'm attempting to do some "generic" validation,in cocoa, of properties specified in a make script command. e.g:

	make new foo with properties { prop1: value,...}

cocoa will gladly give me a dictionary for the properties via

	NSDictionary* props = -[NSCreateCommand resolvedKeyDictionary]

from that dictionary, i can iterate over the keys and use

NSScriptClassDescription* cd = -[NSCreateCommand createClassDescription];
for (NSString* aPropertyKey in props)
NSString* pType = [cd typeForKey: aPropertyKey];


and then i could check the type of the object value in the (props) dictionary to make sure it is the same type as specified in my sdef.

quoting from the documentation for typeForKey:

Return Value
The name of the declared type of the attribute or relationship identified by key; for example, "NSString". Searches in the receiver first, then in any superclass. Returns nil if no match is found.

however, i'm not finding this to be the case. intead, i'm getting the intrinsic name for common properties, eg, "text" (not NSString) and "integer" (not NSNumber).


i've tried parsing the sdef xml, but the intrinsics are apparently not part of the sdef xml. for this purpose, i've been creating an xml document via:

NSXMLDocument* sdefDoc = [[NSXMLDocument alloc] initWithContentsOfURL: sdefURL options: 0 error: &error];
(where sdefURL points to the sdef file in my app's bundle)


so... how can i find out the cocoa class for the built-in types? and does anyone know if this is a bug in NSScriptClassDescription or a bug in the documentation?

thanx,
ken

ps. note that i know my code for exploring the xml doc works as i can pass it the names of some value-types declared explicity in my sdef file, and i can find them fine.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-implementors mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.