Hey Eric, Le 27 juil. 08 à 09:31, Eric Wasylishen a écrit :
> Hey, > I committed the beginnings of a UTI framework to /branches/ericwa/ > ETUTI. :) Very nice :-) > Currently it loads a property list of UTI descriptions, and you can > ask for an ETUTI object by providing a UTI name, file extension, or > MIME type. With the object you can query its supertypes, and ask if it > conforms to another type. Sounds good :-) The API looks just fine to me. The only thing to tweak is -conformsTo: which should be -conformsToUTI:. The usual rule for OpenStep naming is to include the type names in the method keywords, for each parameter that is typed. The private interface declared in the API should probably be moved at the top of the implementation file, unless you think some other classes may need to call the initializer. The designated initializer could be made more safe by adding to check the validity of the arguments. If a wrong argument value can result in an invalid UTI instance, just raise an NSInvalidArgumentException. It's also a good idea to add a -init method which either returns nil or calls the designated initializer if that makes sense. In future, this will be useful for EtoileUI which is going to offer several acilities for instantiating new objects at runtime. To increase the code readibility, you may also break +initialize method in two methods. A method to get the plist from a file path and another to set up the UTIs dictionary. > I extracted the property list from the table at > http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/utilist/chapter_4_section_1.html > for testing purposes. I'm not sure how much of it we can use > without violating copyright, but I assume the basic type hierarchy can > be used, and we can throw out a lot of the very rare/proprietary stuff > and rewrite the extension/mime type bindings. I don't know for sure but I would say that the UTI hierarchy described in the doc isn't much different than an API, so it should be ok if you created the plist from scratch. The UTI plist used by Apple might even be open source as part of CoreFoundation or some other modules in Darwin. Cheers, Quentin. _______________________________________________ Etoile-dev mailing list [email protected] https://mail.gna.org/listinfo/etoile-dev
