boost-propertytree Questions

4

Solved

I'm using boost::property_tree to read and write XML configuration files in my application. But when I write the file the output looks kind of ugly with lots of empty lines in the file. The problem...
Tango asked 4/7, 2011 at 14:5

5

Solved

I'm trying to write an XML parser, parsing the XML file to a boost::property_tree and came upon this problem. How can I check (quickly) if a child of a certain property exists? Obviously I could i...
Moselle asked 27/9, 2011 at 11:49

2

Solved

Is there any way to write comments in an ini file using boost::property::ptree? Something like that: void save_ini(const std::string& path) { boost::property_tree::ptree pt; int first_value...
Odalisque asked 8/12, 2014 at 9:21

1

Is there an alternative to to "boost/property_tree" ? Actually I'm trying to remove all boost implementations of C++ and use standard library functions. I've been able to find alternatives to som...
Unhealthy asked 24/1, 2020 at 10:18

3

Solved

I am fairly new to C++ and I apologise beforehand if you find this very easy. I have the following files POST1.h #ifndef POST1_HH #define POST1_HH #include <iostream> #include <boost/p...
Hygroscopic asked 31/3, 2015 at 7:50

7

I'm trying to create a JSON array using boost property trees. The documentation says: "JSON arrays are mapped to nodes. Each element is a child node with an empty name." So I'd like to create a ...
Profuse asked 22/1, 2010 at 1:58

2

Solved

Ok, so here's a sample of the XML structure: <config> <Ignored> <Ignore name="Test A"> <Criteria> <value>actual value</value> </Criteria> </Ignor...
Grath asked 15/12, 2011 at 2:29

3

Solved

Introduction std::string text = "á"; "á" is two-byte character (assuming a UTF-8 encoding). So following line prints 2. std::cout << text.size() << "\n"; But std::cout still prin...
Dowel asked 21/4, 2012 at 16:7

3

Solved

I'm newbie to C++. What's the easiest way to serialize and deserialize data of type std::Map using boost. I've found some examples with using PropertyTree but they are obscure for me.
Boswall asked 12/9, 2012 at 18:49

7

Solved

I'm trying to serialize using boost property tree write_json, it saves everything as strings, it's not that data are wrong, but I need to cast them explicitly every time and I want to use them some...
Ferrosilicon asked 18/5, 2010 at 8:52

3

Solved

I would like to share with you an issue I'm having while trying to process some attributes from XML elements in C++ with Boost libraries (version 1.52.0). Given the following code: #define ATTR_SE...
Culdesac asked 23/12, 2012 at 11:9

5

Solved

I am know approaching to boost property tree and saw that it is a good feature of boost libs for c++ programming. Well, I have one doubt? how to iterate a property tree using iterators or similar?...
Epistle asked 3/1, 2011 at 17:37

5

This should be simple (I'm just learning boost so I'm missing something) I have read in some simple JSON using json_read and now have a ptree. All the examples on the web show using ptree.get("ent...
Avigdor asked 14/4, 2011 at 14:24

4

How would you remove a node from boost xml property tree? I have a document like this: <folders> <folder>some/folder</folder> <folder>some/folder</folder> <fol...
Manteltree asked 15/6, 2012 at 9:24

3

Solved

Is it possible, via the xml_writer_settings used as third parameter in the write_xml call, to omit the xml declaration when the function saves the xml? I mean, I would like not to have the initial ...
Favian asked 17/4, 2013 at 10:57

4

I'm looking for a data structure which behaves similar to boost::property_tree but (optionally) leaves the get/set implementation for each value item to the developer. You should be able to do som...
Kristiankristiansand asked 25/5, 2015 at 14:51

3

Solved

Boost has a tutorial on how to load XML from a file. How do I feed it with a string that I either create in code or receive from a user (e.g. with cin)?
Halpern asked 13/3, 2011 at 11:32

1

Sometimes it is very useful to create JSON encoded strings for representing and exchanging data. What is be best way of encoding a Boost property tree into a JSON string?
Apotheosis asked 26/4, 2016 at 14:44

3

Consider the following code using boost::property_tree: #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/xml_parser.hpp> using namespace boost::property_tree; in...
Irrecoverable asked 30/11, 2013 at 19:30

1

Solved

I've been using boost libraries to parse XML files and I have to create a ptree manually. I need to add an XML attribute to the ptree. This is what the boost documentation suggests: ptree pt; pt.p...
Odelsting asked 22/7, 2015 at 16:51

3

Solved

I am using boost property tree to load/dump json file. However, the performance is very bad. For example, I have a json file whose size is 1.8M. The boost C++ program spends 3 seconds to load the ...
Lenticular asked 7/8, 2013 at 8:22

1

Solved

In order to pretty print my XML output with boost::property_tree, I wrote the following code: #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/xml_parser.hpp> in...
Yukyukaghir asked 31/3, 2015 at 14:13

1

Solved

When I put_value using an int, it gets written as a string. Does anyone know how to get it to print as an int? #include <iostream> #include <boost/property_tree/ptree.hpp> #include &lt...
Splitlevel asked 24/3, 2015 at 21:57

2

Solved

I have some JSON with a handful of integer array variables, like so: {"a": [8, 6, 2], "b": [2, 2, 1]} I would like to use boost property_tree, for instance: std::stringstream ss; boost::propert...
Tempestuous asked 5/5, 2014 at 20:29

2

Solved

How do I get an enum from a boost::property_tree? This is my "non-working" example. config.xml <root> <fooEnum>EMISSION::EMIT1</fooEnum> <fooDouble>42</fooDouble&gt...
Toadinthehole asked 10/12, 2013 at 23:37

© 2022 - 2024 — McMap. All rights reserved.