Re: NSOutlineViews and C++ objects
Re: NSOutlineViews and C++ objects
- Subject: Re: NSOutlineViews and C++ objects
- From: kelvSYC <email@hidden>
- Date: Fri, 13 May 2005 22:02:22 -0600
I want to write a class that implement NSOutlineViewDataSource,
but the problem is that all my data for the outline view is stored
as C++ classes. What is the best way to do this?
You can mix Obj-C and C++ in the same file, just give the file
a .mm extension and Xcode will compile it as an Objective-C++ file.
Then just implement the NSOutlineViewDataSource as wrappers around
the C++ classes. i.e. you have a Cocoa object that is the
datasource of the OutlineView and which has whatever C++ objects
are needed as instance variables.
The problem is that my information is stored in a structure like so:
class A;
class B;
class A {
std::vector<B> bList;
};
std::vector<A> aList;
The idea is that the children of nil are the NSValues representing
elements in aList, and their children are NSValues representing the
elements in their respective bList. However, it seems that if I do
so, I lose key information such as whether a given NSValue represents
an A or a B (plus, I'm not overly comfortable working with void*).
What's the most elegant solution to do so? Typefields,
NSDictionary<NSString, NSValue>, C++ RTTI, or something completely
different?
_______________________________________________
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