diff options
author | John Wiegley <johnw@newartisans.com> | 2007-04-19 20:31:46 +0000 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-04-13 03:38:28 -0400 |
commit | 0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c (patch) | |
tree | 0a2c2aca7100d045f491b03f0a5bda92378d3ef9 /register.cc | |
parent | 176b3044e355398a0c31e0c42a3cd7b8a2e3f3e5 (diff) | |
download | fork-ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.tar.gz fork-ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.tar.bz2 fork-ledger-0a6b5726ec3bf402a953ea8a03b98ecbf4b90b0c.zip |
Made the amount/balance/value interface a bit more rational; added
back a useless version of the register command (just to prove the
command sequence); and added smart XML semantics to the XPath
implementation so that nodes can be coerced to values.
Diffstat (limited to 'register.cc')
-rw-r--r-- | register.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/register.cc b/register.cc new file mode 100644 index 00000000..3e261522 --- /dev/null +++ b/register.cc @@ -0,0 +1,31 @@ +#include "register.h" +#include "journal.h" + +namespace ledger { + +void register_command::print_document(std::ostream& out, + xml::document_t * doc) +{ + value_t nodelist = xml::xpath_t::eval("//transaction", doc); + + value_t::sequence_t * xact_list = nodelist.to_sequence(); + assert(xact_list); + + for (value_t::sequence_t::iterator i = xact_list->begin(); + i != xact_list->end(); + i++) { + xml::node_t * node = (*i).to_xml_node(); + assert(node); + + xml::transaction_node_t * xact_node = + dynamic_cast<xml::transaction_node_t *>(node); + assert(xact_node); + + transaction_t * xact = xact_node->transaction; + assert(xact); + + std::cout << xact->account->fullname() << std::endl; + } +} + +} // namespace ledger |