diff options
author | Johann Klähn <kljohann@gmail.com> | 2013-03-08 21:45:56 +0100 |
---|---|---|
committer | Johann Klähn <kljohann@gmail.com> | 2013-03-08 22:56:01 +0100 |
commit | a875940a93848d4b18b5bed45049edc901ad07a2 (patch) | |
tree | 33dcb08c5cb43ada33c4c4af9b11cb7c0bf6b3ef /src/account.cc | |
parent | 8f4b0e89627b082f9c5d4bd2b506661aab732b0b (diff) | |
download | fork-ledger-a875940a93848d4b18b5bed45049edc901ad07a2.tar.gz fork-ledger-a875940a93848d4b18b5bed45049edc901ad07a2.tar.bz2 fork-ledger-a875940a93848d4b18b5bed45049edc901ad07a2.zip |
fix ledger xml output, remove ledger json command
As the format used by property trees to represent valid JSON
and that for valid XML is too different and given that there are
more requests for valid XML output I decided to pursue a quick fix
and remove the json command in favor of a working xml command.
See bug #782, #909, recent discussion on mailing list.
JSON support is postponed until I or someone else finds time to work on
this or the python bindings are more stable.
Diffstat (limited to 'src/account.cc')
-rw-r--r-- | src/account.cc | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/account.cc b/src/account.cc index 7dcd5faa..c3fc80f1 100644 --- a/src/account.cc +++ b/src/account.cc @@ -692,12 +692,10 @@ void account_t::xdata_t::details_t::update(post_t& post, } } -void put_account(property_tree::ptree& pt, const account_t& acct, +void put_account(property_tree::ptree& st, const account_t& acct, function<bool(const account_t&)> pred) { if (pred(acct)) { - property_tree::ptree& st(pt.put("account", "")); - std::ostringstream buf; buf.width(sizeof(unsigned long) * 2); buf.fill('0'); @@ -709,18 +707,15 @@ void put_account(property_tree::ptree& pt, const account_t& acct, st.put("fullname", acct.fullname()); value_t total = acct.amount(); - if (! total.is_null()) { - property_tree::ptree& t(st.put("account-amount", "")); - put_value(t, total); - } + if (! total.is_null()) + put_value(st.put("account-amount", ""), total); + total = acct.total(); - if (! total.is_null()) { - property_tree::ptree& t(st.put("account-total", "")); - put_value(t, total); - } + if (! total.is_null()) + put_value(st.put("account-total", ""), total); foreach (const accounts_map::value_type& pair, acct.accounts) - put_account(st, *pair.second, pred); + put_account(st.add("account", ""), *pair.second, pred); } } |