diff options
Diffstat (limited to 'src/commodity.cc')
-rw-r--r-- | src/commodity.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/commodity.cc b/src/commodity.cc index d674833c..09e9deca 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -739,6 +739,40 @@ void annotated_commodity_t::write_annotations(std::ostream& out, out << " (" << *info.tag << ')'; } +void commodity_t::read_xml(std::istream& in) +{ +} + +void commodity_t::write_xml(std::ostream& out, const int depth) const +{ + xml_print(out, "<commodity flags=\"", depth); + + if (! (flags() & COMMODITY_STYLE_SUFFIXED)) out << 'P'; + if (flags() & COMMODITY_STYLE_SEPARATED) out << 'S'; + if (flags() & COMMODITY_STYLE_THOUSANDS) out << 'T'; + if (flags() & COMMODITY_STYLE_EUROPEAN) out << 'E'; + out << "\">\n"; + +#if 0 + // jww (2006-03-02): !!! + if (price) { + for (int i = 0; i < depth + 2; i++) out << ' '; + out << "<symbol>" << base->symbol << "</symbol>\n"; + for (int i = 0; i < depth + 2; i++) out << ' '; + out << "<price>\n"; + xml_write_amount(out, *price, depth + 4); + for (int i = 0; i < depth + 2; i++) out << ' '; + out << "</price>\n"; + } else +#endif + { + xml_print(out, "<symbol>", depth + 1); + out << symbol() << "</symbol>\n"; + } + + xml_print(out, "</commodity>\n", depth); +} + bool compare_amount_commodities::operator()(const amount_t * left, const amount_t * right) const { |