Questions tagged [boost-propertytree]

The Boost PropertyTree library provides a data structure that stores an arbitrarily deeply nested tree of values, indexed at each level by some key. It serializes and emulates XML, JSON and INI file structures.

The Boost PropertyTree library provides a data structure that stores an arbitrarily deeply nested tree of values, indexed at each level by some key. It serializes and emulates XML, JSON and INI file structures.

Note: Boost.PropertyTree is not a generic XML parser. It is not intended to be used as a fast-and-dirty way to load arbitrary XML files into memory. It's XML serialization capabilities are for serialization. It is intended to read the XML that it has written.

Please stop using Boost.PropertyTree as a generic XML parser.

354 questions
0
votes
1 answer

How to not have any error when try to get a not existing node

Could somebody knows what kind of exception return the following code inside the "try" ? I try to use the 3 kind of "catch (exception)" and no one seems to work. try { std::cout << "try to get not existing path" << std::endl; std::string…
Miwa
  • 45
  • 1
  • 1
  • 5
0
votes
0 answers

Load JSON returned from server into Protobufs?

I am developing a C++ client and they have used protobufs to convert JSON (that client send) to Protobuf and send response back again in JSON format. The thing is I need a powerful json parser and I feel Google protocol buffers are the best. Till…
CMouse
  • 130
  • 3
  • 19
0
votes
0 answers

How to access JSON values without knowing the child node?

Trying to create JSONs on the fly for my application, but the JSON I recieve does not remain constant. std::string ResponseJson::getValue(std::string filter, std::string filterName, std::string jsonIndex) { …
CMouse
  • 130
  • 3
  • 19
0
votes
0 answers

C++ - static const variable initialization from .ini file with boost::property_tree

For reading INI configuration file boost:property_tree can be used in the way as follows: #include #include int main() boost::property_tree::ptree pt; …
Jakub Wagner
  • 428
  • 1
  • 5
  • 15
0
votes
1 answer

Boost::ptree - Accessing a property tree node contained in a list

I'm trying go get data from some weather API which returns a JSON. I read that every item in a list is considered as a node without "label", but, here, inside the list are contained two nodes. How do I access to the description label, since…
user7254608
0
votes
1 answer

ofstream(mode ios::out) wipes existing file blank when system halt

The usage scenario is industrial (unstable power supply and other buggy programs/hardware). It is required that the program should come back unaffected when power is off (or blue-screen crash). OS is Windows 7 with NTFS. I use boost::property_tree…
Guangyu
  • 25
  • 7
0
votes
1 answer

boost property tree value (de-)serialization

tl;dr Is there a way to overwrite the way boost.property_tree serializes bool (other built in) values? I'm about to replace a self-written key-value storage by boost.property_tree. Therefore in the first run I changed the implementation to use…
An Ky
  • 113
  • 11
0
votes
1 answer

Testing if boost property tree stores a primitive or a subtree

I'm parsing a JSON file in which the value corresponding to a key can be a primitive (string) or a subtree. Useful for example for storing information about people with a single employer, for example { "employer" : "NASA"; } or people with…
Olumide
  • 5,397
  • 10
  • 55
  • 104
0
votes
0 answers

Boost property_tree and libjsoncpp.so linking troubles.

I am using boost::property_tree to read and write json files from a CMake C++ project. On machines I can install libjsoncpp and boost to the system, everything compiles, links, and works properly/as expected. However, I am now working on a machine I…
Chris
  • 1,532
  • 10
  • 19
0
votes
1 answer

Boost PTree used just for reading file or for storing the values too?

I have a configuration file, that is a json. I have created a class (ConfigFile) that reads that file and store the values (using boost parser and ptree). I am wandering is it a good practice to use the ptree as a member of the ConfigFile class, or…
sop
  • 3,445
  • 8
  • 41
  • 84
0
votes
0 answers

Wrap getter and setter with "operator[]"

Many libraries provide us getter and setters to access and modify there processed variables. One of the libraries is Boost PropertyTree. I want to wrap getter and setter in boost::property_tree::ptree with operator[]. Source: class XMLDocument { …
LeeGom
  • 201
  • 3
  • 10
0
votes
1 answer

How is equal_range supposed to work?

#include #include #include int main() { boost::property_tree::ptree ptree; const std::string entry = "server.url"; ptree.add( entry, "foo.com" ); auto range = ptree.equal_range(…
qdii
  • 12,505
  • 10
  • 59
  • 116
0
votes
1 answer

Writing binary chunk to boost property tree stored as json

Is it possible to write a binary chunk, serialized as "(uint32 numbytes) (chunk)" via stream operators, to json via a boost property tree? To be more specific, lets say the binary chunk is a std::vector of floats, and my iostream serializer parses…
Viktor Sehr
  • 12,825
  • 5
  • 58
  • 90
0
votes
1 answer

changing the data type of boost property tree

Based on my previous post here, I take it that it is not possible to read an xml file directly into a property tree of char16_t. https://stackoverflow.com/questions/28689003/using-boost-xml-parser-to-load-a-property-tree-with-char16-t So I am…
ashish g
  • 429
  • 1
  • 7
  • 16
0
votes
0 answers

Why is node insertion into Boost PTNode/PTree not working in MSVC C++?

I'm currently working on a Microsoft (unmanaged) C++ project which utilitizes Boost C++ libraries. It's been quite a while since I've done C++ and I have no previous experience using the Boost libraries. We are using Boost 1.55 and MSVC 2013. We…
JohnB
  • 3,921
  • 8
  • 49
  • 99