summaryrefslogtreecommitdiff
path: root/src/unistring.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-19 01:22:22 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-19 01:22:22 -0400
commit1fa3c1956ff087a5621184e18b0d785e6c41646a (patch)
treee886aaca1028e0e2922fc3e5191ceea48013950c /src/unistring.h
parentec08dee745ee7c1bda63defa2828ce98e438370b (diff)
downloadfork-ledger-1fa3c1956ff087a5621184e18b0d785e6c41646a.tar.gz
fork-ledger-1fa3c1956ff087a5621184e18b0d785e6c41646a.tar.bz2
fork-ledger-1fa3c1956ff087a5621184e18b0d785e6c41646a.zip
Moved amount_t::right_justify to simply ::justify
Diffstat (limited to 'src/unistring.h')
-rw-r--r--src/unistring.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/unistring.h b/src/unistring.h
index 97156fde..b1c46cb3 100644
--- a/src/unistring.h
+++ b/src/unistring.h
@@ -90,4 +90,22 @@ public:
}
};
+inline void justify(std::ostream& out,
+ const std::string& str,
+ int width,
+ bool right = false)
+{
+ if (! right)
+ out << str;
+
+ unistring temp(str);
+
+ int spacing = width - int(temp.length());
+ while (spacing-- > 0)
+ out << ' ';
+
+ if (right)
+ out << str;
+}
+
#endif // _UNISTRING_H