• 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
C function to a Selector ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C function to a Selector ?


  • Subject: C function to a Selector ?
  • From: Aurélien Hugelé <email@hidden>
  • Date: Fri, 23 Apr 2004 10:42:57 +0200

hi !

i have *a lots* of C functions defined as this :
static int _ascendingFirstNameOrder(id firstElt,id secondElt);
static int _ascendingLastNameOrder(id firstElt,id secondElt);
...

I m coding a sort of autosortedArray using binary search to sort items
as they are inserted in the array.
by default the selector will be @selector(compare:), but can be changed
using a sort of setSelector:

I can't honestly convert all the previous C function to selector by
rewritting them, it would be *VERY* long...

so basically i want my autosortedArray to be based on selector. You
would be able to init the autosortedArray with a Selector OR a C
function. At init, the class would transform the C function to the
matching selector...

i have looked at NSInvocation etc.. but it is incomprehensible, at
least for me !

could someone give me an example to convert one of those C function
above to a simple selector, something that could be used like this :
[firstElt ascendingFirstName:secondElt];

thanks !
_______________________________________________
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.


  • Follow-Ups:
    • Re: C function to a Selector ?
      • From: "M. Uli Kusterer" <email@hidden>
    • Re: C function to a Selector ?
      • From: Chris Giordano <email@hidden>
  • Prev by Date: Re: Is Concatenation that complex?
  • Next by Date: Problems with DO+rendezvous
  • Previous by thread: Re: Not able to place the cursor at required character index in mytextview(subclass of NSTextView).
  • Next by thread: Re: C function to a Selector ?
  • Index(es):
    • Date
    • Thread