diff options
author | John Wiegley <johnw@newartisans.com> | 2012-05-18 01:31:01 -0600 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-05-18 01:31:01 -0600 |
commit | a38ed141c1f33ecdad99b322acb1ae07b30a5da2 (patch) | |
tree | c6555946e2575a6bcb0ae7642673257954e38ac1 /src/annotate.cc | |
parent | 3c3bda19d62eed165b9191dbf1adcb3e7c975356 (diff) | |
download | fork-ledger-a38ed141c1f33ecdad99b322acb1ae07b30a5da2.tar.gz fork-ledger-a38ed141c1f33ecdad99b322acb1ae07b30a5da2.tar.bz2 fork-ledger-a38ed141c1f33ecdad99b322acb1ae07b30a5da2.zip |
Switched to Boost.PropertyTree for XML generation
Diffstat (limited to 'src/annotate.cc')
-rw-r--r-- | src/annotate.cc | 21 |
1 files changed, 21 insertions, 0 deletions
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() || |