summaryrefslogtreecommitdiff
path: root/src/times.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-05-18 01:31:01 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-05-18 01:31:01 -0600
commita38ed141c1f33ecdad99b322acb1ae07b30a5da2 (patch)
treec6555946e2575a6bcb0ae7642673257954e38ac1 /src/times.h
parent3c3bda19d62eed165b9191dbf1adcb3e7c975356 (diff)
downloadfork-ledger-a38ed141c1f33ecdad99b322acb1ae07b30a5da2.tar.gz
fork-ledger-a38ed141c1f33ecdad99b322acb1ae07b30a5da2.tar.bz2
fork-ledger-a38ed141c1f33ecdad99b322acb1ae07b30a5da2.zip
Switched to Boost.PropertyTree for XML generation
Diffstat (limited to 'src/times.h')
-rw-r--r--src/times.h30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/times.h b/src/times.h
index 3bb95903..d6ab542d 100644
--- a/src/times.h
+++ b/src/times.h
@@ -111,26 +111,20 @@ 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,
- bool wrap = true)
-{
- if (wrap) {
- push_xml x(out, "datetime");
- out << format_datetime(when, FMT_WRITTEN);
- } else {
- out << format_datetime(when, FMT_WRITTEN);
- }
+inline void put_datetime(property_tree::ptree& pt, const datetime_t& when,
+ bool wrap = true) {
+ if (wrap)
+ pt.put("datetime", format_datetime(when, FMT_WRITTEN));
+ else
+ pt.put_value(format_datetime(when, FMT_WRITTEN));
}
-inline void to_xml(std::ostream& out, const date_t& when,
- bool wrap = true)
-{
- if (wrap) {
- push_xml x(out, "date");
- out << format_date(when, FMT_WRITTEN);
- } else {
- out << format_date(when, FMT_WRITTEN);
- }
+inline void put_date(property_tree::ptree& pt, const date_t& when,
+ bool wrap = true) {
+ if (wrap)
+ pt.put("date", format_date(when, FMT_WRITTEN));
+ else
+ pt.put_value(format_date(when, FMT_WRITTEN));
}
struct date_traits_t