Boost logo

Boost Users :

Subject: [Boost-users] [property_tree] hex integer translator
From: Steve Hartmann (shartmann_at_[hidden])
Date: 2014-02-11 11:49:40


I am using property_tree to parse some xml files provided by outside sources. Within those xml files, sometimes integers are represented as decimal, others are represented as hex. Below is an example line where a property named Index uses a hex representation.

<Index>#x7000</Index>

So I tried to read this as an integer, with the following source line, but that throws an exception since it does not now how to translate the hex format from the xml file.

deviceList.second.get<int>("Index")

So my question is: is there a translator already included in the property_tree <that I just cannot find>, or do I need to write my own translator to deal with hex integers.

Thanks,

Steven



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net