summaryrefslogtreecommitdiff
path: root/src/amount.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/amount.cc')
-rw-r--r--src/amount.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/amount.cc b/src/amount.cc
index 3fb8ddaf..ffeaeea6 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -31,6 +31,7 @@
#include "amount.h"
#include "commodity.h"
+#include "unistring.h"
namespace ledger {
@@ -1001,6 +1002,20 @@ void amount_t::print(std::ostream& _out) const
_out << out.str();
}
+void amount_t::right_justify(std::ostream& out, int width) const
+{
+ std::ostringstream buf;
+ buf << *this;
+
+ unistring temp(buf.str());
+
+ int spacing = width - int(temp.length());
+ while (spacing-- > 0)
+ out << ' ';
+
+ out << temp.extract();
+}
+
bool amount_t::valid() const
{
if (quantity) {