summaryrefslogtreecommitdiff
path: root/src/times.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-09 03:42:06 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-09 03:42:35 -0500
commit6cdb79e2a611d99fa6e13dd224a92dc8badaf2ac (patch)
tree967464fc8bda9543a108d83d3fc96ecdffb4e04c /src/times.h
parent2c80227339538154ad0869e746f52db805325589 (diff)
downloadfork-ledger-6cdb79e2a611d99fa6e13dd224a92dc8badaf2ac.tar.gz
fork-ledger-6cdb79e2a611d99fa6e13dd224a92dc8badaf2ac.tar.bz2
fork-ledger-6cdb79e2a611d99fa6e13dd224a92dc8badaf2ac.zip
XML reporting now works via the "xml" command
Diffstat (limited to 'src/times.h')
-rw-r--r--src/times.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/times.h b/src/times.h
index c2c2530e..3cd359d2 100644
--- a/src/times.h
+++ b/src/times.h
@@ -116,16 +116,26 @@ std::string format_date(const date_t& when,
void set_date_format(const char * format);
void set_input_date_format(const char * format);
-inline void to_xml(std::ostream& out, const datetime_t& when)
+inline void to_xml(std::ostream& out, const datetime_t& when,
+ bool wrap = true)
{
- push_xml x(out, "datetime");
- out << format_datetime(when, FMT_WRITTEN);
+ if (wrap) {
+ push_xml x(out, "datetime");
+ out << format_datetime(when, FMT_WRITTEN);
+ } else {
+ out << format_datetime(when, FMT_WRITTEN);
+ }
}
-inline void to_xml(std::ostream& out, const date_t& when)
+inline void to_xml(std::ostream& out, const date_t& when,
+ bool wrap = true)
{
- push_xml x(out, "date");
- out << format_date(when, FMT_WRITTEN);
+ if (wrap) {
+ push_xml x(out, "date");
+ out << format_date(when, FMT_WRITTEN);
+ } else {
+ out << format_date(when, FMT_WRITTEN);
+ }
}
class date_interval_t : public equality_comparable<date_interval_t>