• 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: Vended Object Setters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vended Object Setters


  • Subject: Re: Vended Object Setters
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Thu, 17 Apr 2008 17:24:28 +0200

To declare a vended object, you should first declare a protocol that contains the methods you want to expose and that defines the methods behaviors (bycopy, byref, in, out, etc...)
Then, you create a class that conforms to this protocol. You may omit the bycopy, byref and other modifiers in your class interface.


@protocol MyProtocol

- (onway void)foo:(bycopy NSString *)bar;

@end

@interface VendedObject <MyProtocol>

- (void)foo:(NSString *)bar;

@end


And then, instead of vending your object directly, you may export a protocol checker. This will prevent unexpected call of methods on your vended object.


NSProtocolChecker *checker = [[NSProtocolChecker alloc] initWithTarget:myVendedObject
protocol:@protocol(MyProtocol)];
[[NSConnection defaultConnection] setRootObject:checker];
[checker release];


Note that keywords like bycopy are ignored by the runtime for simple methods calls and are usefull only when you send messages using a proxy object, so you can safely call methods with thoses modifier internaly.

Le 17 avr. 08 à 17:01, Justin Giboney a écrit :

bycopy worked, thank you.

Does this mean though that I need to duplicate all of methods, with one set for internal commands and one for remote commands?

Thank

Justin Giboney
_______________________________________________

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


_______________________________________________

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


References: 
 >Vended Object Setters (From: Justin Giboney <email@hidden>)
 >Re: Vended Object Setters (From: Ken Thomases <email@hidden>)
 >Re: Vended Object Setters (From: Justin Giboney <email@hidden>)

  • Prev by Date: Re: to make NSOutlineView faster
  • Next by Date: Re: Vended Object Setters
  • Previous by thread: Re: Vended Object Setters
  • Next by thread: Re: Vended Object Setters
  • Index(es):
    • Date
    • Thread