File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed
Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ namespace JSON
1818
1919 PropertyTree (boost::property_tree::ptree tree = {});
2020 };
21+
2122 PropertyTree parse_json (std::istream& stream);
2223 PropertyTree parse_json (std::string const & str);
2324 boost::optional<PropertyTree> parse_auto (std::istream& stream);
Original file line number Diff line number Diff line change 1+ #include " xml_converter.h"
2+ #include " ../parse/jsd_generic_parser.h"
3+
4+ #include < boost/property_tree/xml_parser.hpp>
5+
6+ #include < iostream>
7+
8+ namespace JSON
9+ {
10+ std::ostream& convertJsonToXml (std::ostream& ostream, std::istream& istream)
11+ {
12+ auto tree = parse_json (istream);
13+
14+ boost::property_tree::write_xml (ostream, tree.tree );
15+
16+ return ostream;
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ #ifndef XML_CONVERTER_H_INCLUDED
2+ #define XML_CONVERTER_H_INCLUDED
3+
4+ #include < iosfwd>
5+
6+ namespace JSON
7+ {
8+ /* *
9+ * Converts the json istream contents to xml and writes it to the ostream.
10+ * It is not defined, what happens when streams overlap.
11+ *
12+ * @param ostream A stream to write to
13+ * @param istream A stream to read from
14+ *
15+ * @return The ostream passed as parameter;
16+ */
17+ std::ostream& convertJsonToXml (std::ostream& ostream, std::istream& istream);
18+ }
19+
20+ #endif // XML_CONVERTER_H_INCLUDED
You can’t perform that action at this time.
0 commit comments