Re: Obtaining an array of the names of the attributes and relations of a class
Re: Obtaining an array of the names of the attributes and relations of a class
- Subject: Re: Obtaining an array of the names of the attributes and relations of a class
- From: Francis Derive <email@hidden>
- Date: Tue, 22 Nov 2005 15:40:31 +0100
On Nov 22, 2005, at 11:37 AM, mmalcolm crawford wrote:
On Nov 22, 2005, at 2:21 AM, Francis Derive wrote:
It is where was my misunderstanding : I thought/beleived/hoped
that NSClassDescription would provide the class description info
"freely" (as it is the case with the Objective-C runtime functions
pointed to by mmalcomm, or with the Core Data's
NSEntityDescription pointed to by John Timmer ) - just because
everything of a class is known to the system through its class
declaration.
The runtime functions, though, do not provide the same level of
detail as NSClassDescription or NSEntityDescription. I was careful
in my reply to state, "If you need to get the *instance variables*
defined for a class..." and to contrast this information with
"which ivars are attributes and which are relationships". (There
may be heuristics you could use to examine the instance variables
to guess at whether they're likely to be attributes or
relationships (if something's an instance of a simple Foundation
class, for example, it's likely to be an attribute), but these may
be complex and error-prone...) You haven't yet said, though, why
you need this information, and why you could not provide it in a
simpler way?
mmalc
Sorry, mmalc, I had noticed your inquiry about the reason of my
question - why do I need this information ? - and because it is by
now only but pure and free questioning, that is without yet a
practical application to solve - which I miss -, it is always
embarrassing to have nothing but nothingness to give as an answer to
whom wants to help.
The thing is that I have started to learn Mac OS X development since
- say one year -, by working and reworking and rereworking the
exercices of Aaron Hillegass 's Cocoa Programming book with
variations of mine, alongside reading and re-reading Scott Anguish's
same title, and ADC documentation, as everybody does.
After these books, I came to fall into Core Data Management, another
novelty which seems to me quite important to master as it brings new
design concepts intended for more efficient programming. And so, from
Core Data to Key-value coding/observing and Cocoa bindings, all these
closely related, and each part being big enough to hide the other
parts which has been learnt before. So working and re-working.
I am/was aware of "introspection" capabilities of Objective-C and you
were right to point me to the Objective-C run-time functions, but
being aware is not enough and I have to exercise - if not put in
practice -.
Having a window open at the "Objective-C Runtime Reference", it does
"speak to me" about what I am interested in - but not fully as I
don't find anything to return directly a list of instances variables
of a class, if I don't miss something.
I look, and of course, it's there : with objc_ivar and
objc_ivar_list, but it appears there is some work to do, to tailor to
his own needs.
So, your question is quite understandable : why do I need this
information ?
OK, mmalc, I just want to learn - make up my mind to later find the
directions according to the situations - and by now I shall stay calm
before I decide to go further on with the Objective-C Runtime, OR
investigate with the gentle NSEntityDescription. Isn't wise ?
Anyway plenty of work to be done for mastering Cocoa programming.
Thanks for all.
Francis.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden