Boost logo

Boost :

Subject: [boost] [property_tree] Assign and Lua parser
From: Renato Florentino Garcia (fgarcia.renato_at_[hidden])
Date: 2011-11-15 00:18:45


In my use of Boost Property Tree library I have coded some extensions,
which are in a GitHub repository (http://github.com/renatoGarcia/boost-extensions).

I would like to know if there are any interest in make any of then part of
Boost Property Tree itself, probably after a suggest improvement.

The more useful in my view is a Boost Assign Property Tree alike.
Code: http://github.com/renatoGarcia/boost-extensions/blob/master/property_tree/include/golld/property_tree/assign.hpp

For instance, to build in C++ code a ptree like:

key1 value1
key2
{
    key3 12345
    {
        key4 "value4 with spaces"
    }
    key5 value5
    "" 10
    "" 11
    "" 12
}

Instead the current:

ptree pt;
pt.add("key1", "value1");
ptree tmpPt1;
tmpPt1.add("key3", 12345);
ptree tmpPt2;
tmpPt2.add("key4", "value4 with spaces");
tmpPt1.push_back(std::make_pair("", tmpPt2));
tmpPt1.add("key5", "value5");
ptree tmpPt3;
tmpPt3.put_value(10);
tmpPt1.push_back(std::make_pair("", tmpPt3));
ptree tmpPt4;
tmpPt4.put_value(11);
tmpPt1.push_back(std::make_pair("", tmpPt4));
ptree tmpPt5;
tmpPt5.put_value(12);
tmpPt1.push_back(std::make_pair("", tmpPt5));
pt.add_child("key2", tmpPt1);

Would be a code like:

ptree pt =
    tree()
    ("key1", "value1")
    ("key2", tree()
        ("key3", 12345)
        (tree()
            ("key4", "value4 with spaces"))
        ("key5", "value5")
        (10)(11)(12));

Another extension is a Lua parser, like the XML or JSON. But in this case I
don't think that is desirable include it in the Boost, because of the
needed of Lua libraries (at least not in a mandatory way).
Code: http://github.com/renatoGarcia/boost-extensions/blob/master/property_tree/include/golld/property_tree/lua_parser.hpp

Regards,

Renato Garcia


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk