[Property Message] How to store variant in property tree
Hi I want to store variant object in my property tree. The variant for now will have only 3dPoint object, but it should vary multiple types in future. I tried the following code , and I am getting compiler errors. I know that maybe I need to write some kind of translation code for this to work,but don't know how to do that exactly and having hard time to grasp the concept. So how can I do this if possibly at all ? A code example would be great class 3dPoint { public: 3dPoint(double,double,double); double x; double y; double z; }; typedef boost::variant<ON_3dPoint> MyVariant; using namespace boost::property_tree; typedef basic_ptree<std::string,MyVariant> my_ptree; my_ptree pt; MyVariant point_variant = 3dPoint(1,2,3); pt.put("point",point_variant); MyVariant point_variant2 = pt.get("point"); boost::property_tree::xml_writer_settings<char> settings('\t', 1); write_xml("C:\\property.xml",pt,std::locale(),settings);
Hi I want to store variant object in my property tree. The variant for now will have only 3dPoint object, but it should vary multiple types in future. I tried the following code , and I am getting compiler errors. I know that maybe I need to write some kind of translation code for this to work,but don't know how to do that exactly and having hard time to grasp the concept. So how can I do this if possibly at all ? A code example would be great The serializations of property_tree are not tested for tree's that don't use some basic_string instantiation as key and value type. It's very
On 21.12.2012 08:27, Elizabeta wrote: likely that they just don't work. Sorry. This is somewhere on my plans for the future, but don't hold your breath. Sebastian
On 12/21/2012 11:33 AM, Sebastian Redl wrote:
Hi I want to store variant object in my property tree. The variant for now will have only 3dPoint object, but it should vary multiple types in future. I tried the following code , and I am getting compiler errors. I know that maybe I need to write some kind of translation code for this to work,but don't know how to do that exactly and having hard time to grasp the concept. So how can I do this if possibly at all ? A code example would be great The serializations of property_tree are not tested for tree's that don't use some basic_string instantiation as key and value type. It's very
On 21.12.2012 08:27, Elizabeta wrote: likely that they just don't work. Sorry.
This is somewhere on my plans for the future, but don't hold your breath.
Sebastian
Thank you, good to know
participants (2)
-
Elizabeta
-
Sebastian Redl