From a38ed141c1f33ecdad99b322acb1ae07b30a5da2 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 18 May 2012 01:31:01 -0600 Subject: Switched to Boost.PropertyTree for XML generation --- src/annotate.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/annotate.cc') diff --git a/src/annotate.cc b/src/annotate.cc index 41e7a752..b2df0d34 100644 --- a/src/annotate.cc +++ b/src/annotate.cc @@ -216,6 +216,27 @@ void annotation_t::print(std::ostream& out, bool keep_base, out << " ((" << *value_expr << "))"; } +void put_annotation(property_tree::ptree& pt, const annotation_t& details) +{ + property_tree::ptree& st(pt.put("annotation", "")); + + if (details.price) { + property_tree::ptree& t(st.put("price", "")); + put_amount(t, *details.price, false); + } + + if (details.date) { + property_tree::ptree& t(st.put("date", "")); + put_date(t, *details.date, false); + } + + if (details.tag) + st.put("tag", *details.tag); + + if (details.value_expr) + st.put("value_expr", details.value_expr->text()); +} + bool keep_details_t::keep_all(const commodity_t& comm) const { return (! comm.has_annotation() || -- cgit v1.2.3