summaryrefslogtreecommitdiff
path: root/src/item.cc
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/item.cc
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/item.cc')
-rw-r--r--src/item.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/item.cc b/src/item.cc
index de5ffef2..5dc62096 100644
--- a/src/item.cc
+++ b/src/item.cc
@@ -581,4 +581,18 @@ string item_context(const item_t& item, const string& desc)
return out.str();
}
+void put_metadata(property_tree::ptree& pt, const item_t::string_map& metadata)
+{
+ property_tree::ptree& st(pt.put("metadata", ""));
+ foreach (const item_t::string_map::value_type& pair, metadata) {
+ if (pair.second.first) {
+ property_tree::ptree& vt(st.put("pair", ""));
+ vt.put("key", pair.first);
+ put_value(vt, *pair.second.first);
+ } else {
+ st.put("tag", pair.first);
+ }
+ }
+}
+
} // namespace ledger