On Sat, 2005-06-25 at 17:41 -0700, Asif Lodhi wrote:
I am an semi-intermediate level C++ user. Could you please elaborate as what C++ does not really do? I would certainly appreciate your reply in this respect.
You can't take an object of class A and simply modify it into an object of class B.
I'm not refering to references, pointers, or copies, but an actual singular object.
In this specific case, it would be an issue of changing an SPEllipse into an SPArc. To replace a <path> with an <ellipse> or vice-versa transparently on the fly as Alan had requested, we'd need to take the overlying SPArc and make it into an SPEllipse without disturbing its identity. Otherwise it won't be transparent (e.g. it would disrupt the current selection and tool state).
Of course just because C++ doesn't directly support something doesn't mean you can't do it with a suitable abstraction; we could:
1. go ahead and replace the SPEllipse with a new SPArc based on it, and use SPObject::successor() to repoint all references (theoretically doable, but very, very messy... it'd destroy the codebase architecturally)
2. Introduce opaque handles or facades which can be repointed behind the scenes instead of using SPObject * directly (feasible, but probably not worth the overhead, and would require major surgery throughout the codebase)
I don't think either of those two approaches are acceptable.
Ideally what we'd want to do instead would be to get rid of e.g. SPEllipse and roll _all_ the ellipse/circle stuff under SPArc. So no "class change" would be necessary. Then we can be free to rename the element as needed.
But we will still need a lot of other infrastructure in place to permit renaming existing XML nodes, because allowing them to be renamed in general still means that a different SPObject subclass may be required in the overlying layer after the rename.
It needn't be seamless in the case of blatantly differing element types, but it would still need to be done. And the code to do it has proven difficult design-wise.
So Alan's request isn't doable in the short-term. It's not necessarily a bad one in the future when we have more infrastructure to do it with.
-mental