On Wed, Mar 26, 2008 at 10:01 PM, Graham Cox <[EMAIL PROTECTED]> wrote:
> Is there a way to obtain from the runtime a list of all classes that > are subclasses of a given class, or failing that, a list of all > classes that I can iterate and test with isKindOfClass:? Here's the function I use in CamelBones to iterate through all registered classes. It hasn't been updated to Leopard's new ObjC 2.0 runtime yet, but neither have most Mac users. :-) // Create Perl wrappers for all registered ObjC classes void REAL_CBWrapRegisteredClasses(void) { int numClasses; Class *classes; int i; classes = NULL; numClasses = objc_getClassList(NULL, 0); if (numClasses > 0) { classes = malloc(sizeof(Class) * numClasses); objc_getClassList(classes, numClasses); for(i=0; i < numClasses; i++) { REAL_CBWrapObjectiveCClass(classes[i]); } free(classes); } } sherm-- _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]