Re: Protocols on the fly?
Re: Protocols on the fly?
- Subject: Re: Protocols on the fly?
- From: Lloyd Dupont <email@hidden>
- Date: Tue, 29 Apr 2003 09:49:34 +1000
let's imagine your object follow to protocol.
a yet unknown protocol and the
@protocol DescribeProtocol
- (Protocol *) implementedProtocol;
@end
you first call the 'implementedProtocol' method and the use the
returned protocol object.
you should construct the other protocol before sending the object ...
On Monday, April 28, 2003, at 09:19 PM, Owen Anderson wrote:
OK, I see your point. But that requires compile-time knowledge of the
class. As far as I am aware, the only way to access such private
variables is to declare a struct with the @defs of the class.
Unfortunately, this can only be done at compile-time, which helps me
not at all.
I'm receiving an object of type id that I know nothing about. I want
to create a protocol * of methods. I think I see basically how to do
this if I have access to its private variables. However, I don't see
how to access the private variables of either the object or the Class*
without compile-tile knowledge of the class's name.
Owen Anderson
On Monday, April 28, 2003, at 01:53 AM, Lloyd Dupont wrote:
every object have an 'isa' ivar which is a 'Class' object or a 'struct
objc_class *'
'struct objc_class' is defined in /ursr/include/objc/objc-class.h and
it has
its methodList as 'struct objc_method_list **' which is the main thing
in the protocol class.
wel, a bit of cooking, and you should be able to do something.
I suggest you create the protocol as an instance of the object, and
query it on the other side ....
, define in
On Monday, April 28, 2003, at 03:25 PM, Owen Anderson wrote:
Unfortunately, that doesn't help much. I have an object whose
interface I am not aware of, and I want to get a Protocol* object
describing its interface. Is this possible?
Owen Anderson
On Monday, April 28, 2003, at 12:49 AM, Lloyd Dupont wrote:
/usr/include/objc/Protocol.h
you could always create your custom subclass of Protocol,
interesting Objective-C runtime exercise.
beware, Protocol inherit from Object, not NSObject (and so has no
retain/release method)
you could always generate
On Monday, April 28, 2003, at 01:59 PM, Owen Anderson wrote:
Hey folks,
I'm working on a framework that involves passing an object supplied
by the host application to another computer via Distributed
Objects. Now, the object being passed can be of any type, so I
don't have a protocol to attach to it when it is received on the
other side. I can think of two solutions to this: require the
host application to provide a copy of the protocol, or find a way
to generate a protocol from the object. So, folks, is this
possible? Given an object, can I generate a Protocol* for its
methods?
Thanks,
Owen Anderson
_______________________________________________
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.
_______________________________________________
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.
_______________________________________________
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.