How to put XmlElement* into var?


#1

What is the best way to wrap an XmlElement* (created via a factory method) into a ReferenceCountedObject so that it can be stored in a var? Thanks


#2

If performance isn’t an issue, then just convert it to a string?


#3

derp


#4

or convert it to a ValueTree and stream it into a memory-block should also work, and its binary compatible (floats!!) and maybe faster too, cause String-handling (re-parsing) is always very slow!


#5

If you’re suggesting doing this via “ValueTree::fromXml (const XmlElement &xml)”, it doesn’t work. It is a little picky and only seems to like XmlElements generated from a ValueTree. In fact, the final destination of the data is a ValueTree, but I decided to make the question title a little less specific.

Even more awesome would be if Jules added an interface to TreeView component allowing the user to get the openness-state data as a ValueTree, and making the TreeView a ValueTree::Listener . . . hint hint hint hint :wink:


#6

That is a pretty cool idea. ValueTrees didn’t exist when I first created the TreeView, which is why it just uses XML but it’d be a good use for them.


#7

It would certainly make the API that bit more cohesive looking at the Slider class etc. I’d be super grateful if you’d put it in (when convenient) :mrgreen:


#8

Bump. Any plans for Value enabled TreeView?


#9

sorry, too many other things to do right now!


#10

No problem. Was just enquiring so I can plan where to focus my efforts. Keep up the great work, Jules!