diff options
author | John Wiegley <johnw@newartisans.com> | 2009-01-28 20:49:44 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-01-28 20:49:44 -0400 |
commit | 094c64b67cedc080bf8dcf218105f31f5b479296 (patch) | |
tree | 661ce7fec77219948703f143ad1f9680cede5973 /src/amount.cc | |
parent | e851c02d2747be0acc336bc278da9e0460b75738 (diff) | |
download | ledger-094c64b67cedc080bf8dcf218105f31f5b479296.tar.gz ledger-094c64b67cedc080bf8dcf218105f31f5b479296.tar.bz2 ledger-094c64b67cedc080bf8dcf218105f31f5b479296.zip |
amount_t and commodity_t objects can now stream themselves to XML.
Diffstat (limited to 'src/amount.cc')
-rw-r--r-- | src/amount.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/amount.cc b/src/amount.cc index 591b0901..dced0625 100644 --- a/src/amount.cc +++ b/src/amount.cc @@ -1396,6 +1396,22 @@ void amount_t::write(std::ostream& out, unsigned int index) const } } +void amount_t::read_xml(std::istream& in) +{ +} + +void amount_t::write_xml(std::ostream& out, const int depth) const +{ + xml_print(out, "<amount>\n", depth); + + commodity().write_xml(out, depth + 1); + + xml_print(out, "<quantity>", depth + 1); + out << quantity_string() << "</quantity>\n"; + + xml_print(out, "</amount>\n", depth); +} + bool amount_t::valid() const { if (quantity) { |