diff options
author | John Wiegley <johnw@newartisans.com> | 2004-09-10 20:08:07 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-09-10 20:08:07 -0400 |
commit | ff4589caae7b5bd40350eac605916d085b5106cc (patch) | |
tree | 6a7b67074fc314adb6d961a9347d8face512b11b /format.cc | |
parent | 435b9ed7794958626a66b2490a7ec67033508eaa (diff) | |
download | fork-ledger-ff4589caae7b5bd40350eac605916d085b5106cc.tar.gz fork-ledger-ff4589caae7b5bd40350eac605916d085b5106cc.tar.bz2 fork-ledger-ff4589caae7b5bd40350eac605916d085b5106cc.zip |
added support for ValueExpr objects to python.
Diffstat (limited to 'format.cc')
-rw-r--r-- | format.cc | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -14,11 +14,11 @@ std::string truncated(const std::string& str, unsigned int width) return buf; } -std::string partial_account_name(const account_t * account) +std::string partial_account_name(const account_t& account) { std::string name; - for (const account_t * acct = account; + for (const account_t * acct = &account; acct && acct->parent; acct = acct->parent) { if (acct->data && ACCT_DATA(acct)->dflags & ACCOUNT_DISPLAYED) @@ -284,7 +284,7 @@ void format_t::format(std::ostream& out, const details_t& details) const if (details.account) { std::string name = (elem->type == element_t::ACCOUNT_FULLNAME ? details.account->fullname() : - partial_account_name(details.account)); + partial_account_name(*details.account)); if (details.xact && details.xact->flags & TRANSACTION_VIRTUAL) { if (elem->max_width > 2) @@ -454,6 +454,11 @@ void export_format() .def("format", py_format<entry_t>) .def("format", py_format<transaction_t>) ; + + def("truncated", truncated); +#if 0 + def("partial_account_name", partial_account_name); +#endif } #endif // USE_BOOST_PYTHON |