summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-28 20:49:44 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-28 20:49:44 -0400
commit094c64b67cedc080bf8dcf218105f31f5b479296 (patch)
tree661ce7fec77219948703f143ad1f9680cede5973 /src/utils.h
parente851c02d2747be0acc336bc278da9e0460b75738 (diff)
downloadfork-ledger-094c64b67cedc080bf8dcf218105f31f5b479296.tar.gz
fork-ledger-094c64b67cedc080bf8dcf218105f31f5b479296.tar.bz2
fork-ledger-094c64b67cedc080bf8dcf218105f31f5b479296.zip
amount_t and commodity_t objects can now stream themselves to XML.
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
index 0d511a38..c761f277 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -535,6 +535,18 @@ inline char peek_next_nonws(std::istream& in) {
return c;
}
+inline void xml_space(std::ostream& out, const int depth = 0) {
+ for (int i = 0; i < depth; i++)
+ out << " ";
+}
+
+inline void xml_print(std::ostream& out,
+ const string& str,
+ const int depth = 0) {
+ xml_space(out, depth);
+ out << str;
+}
+
#define READ_INTO(str, targ, size, var, cond) { \
char * _p = targ; \
var = str.peek(); \