• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Iterating over a classes methods?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Iterating over a classes methods?


  • Subject: Re: Iterating over a classes methods?
  • From: Timothy Ritchey <email@hidden>
  • Date: Tue, 24 Dec 2002 09:33:47 -0500

You can find the underlying obj-c runtime methods for accessing class information here:

file:///Developer/Documentation/Cocoa/ObjectiveC/ 9objc_runtime_reference/_Accessing_Methods.html

Check out the "Accessing Methods" section.

You could alternatively look up each class method yourself in the objc_class structure. There is a pointer methodLists that holds a number of objc_method_list structures:

struct objc_class {
struct objc_class *isa;
struct objc_class *super_class;
const char *name;
long version;

long info;
long instance_size;
struct objc_ivar_list *ivars;
struct objc_method_list **methodLists;
struct objc_cache *cache;
struct objc_protocol_list *protocols;
};

struct objc_method_list {
struct objc_method_list *obsolete;

int method_count;
#ifdef __alpha__
int space;
#endif
struct objc_method method_list[1]; /* variable length structure */
};

struct objc_method {
SEL method_name;
char *method_types;
IMP method_imp;
};






On Tuesday, December 24, 2002, at 02:47 AM, Victor Ng wrote:

Is there a way to iterate over the list of messages that an object will respond to?

From my digging around in the Cocoa docs - it looks like I can only check :

- if an object is an instance of some class
- if an object conforms to some protocol
- or if an object can respond to a selector that I know of before hand.

I want to just get a list of all messages that an object can respond to and print those method names.

vic
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Iterating over a classes methods? (From: Victor Ng <email@hidden>)

  • Prev by Date: Re: Distinguishing between HFS and HFS+
  • Next by Date: storing passwords
  • Previous by thread: Iterating over a classes methods?
  • Next by thread: Re: Iterating over a classes methods?
  • Index(es):
    • Date
    • Thread