• 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
Accessing self in a C static function within an implementation definition
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessing self in a C static function within an implementation definition


  • Subject: Accessing self in a C static function within an implementation definition
  • From: "email@hidden" <email@hidden>
  • Date: Mon, 07 Apr 2014 11:00:50 +0100

I have a function like macro:

#define DBDispatchMonoEvent(KLASS, NAME) \
do { \
    [DBManagedEvent dispatchEventFromMonoSender:monoSender \
                                      eventArgs:monoEventArgs \
                                    targetClass:[KLASS class] \
                             targetSelectorName: NAME]; \
} while (NO);


Which is used like so:

@interface MyObject : MyClass
@end

@implementation MyObject

static void managedEvent_ItemAdded(MonoObject* monoSender, MonoObject* monoEventArgs)
{
    DBDispatchMonoEvent(MyClass, @"eventSender:itemAdded:”);
}
@end

In every case the dispatch macro targets the surrounding class.
So I would like to reduce the call site invocation to:

static void managedEvent_ItemAdded(MonoObject* monoSender, MonoObject* monoEventArgs)
{
    DBDispatchMonoEvent(@"eventSender:itemAdded:”);
}

Can I do this?
Is there a macro in the vein of __FILE__, __FUNCTION__ that returns the encompassing class for any statement?
I have been unable to turn anything up.

Jonathan














_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Accessing self in a C static function within an implementation definition
      • From: Quincey Morris <email@hidden>
    • Re: Accessing self in a C static function within an implementation definition
      • From: Uli Kusterer <email@hidden>
  • Prev by Date: Re: Retain count in non ARC
  • Next by Date: Bindings for dynamically populated menu
  • Previous by thread: Re: Image scaling property of NSCell/NSButton - where is it?
  • Next by thread: Re: Accessing self in a C static function within an implementation definition
  • Index(es):
    • Date
    • Thread