summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-11 14:45:14 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-11 14:45:14 -0500
commita034435c4287aba7fd32ed63a745e560350c924a (patch)
treef0acb080410a32c215c2c1938811cc14d512b580 /src/value.cc
parent5ffa987daf4d97c52066e4c28733d826d3726297 (diff)
parentf0f1b0cdfa3a0a73695eda52b25de71bd40adc5a (diff)
downloadfork-ledger-a034435c4287aba7fd32ed63a745e560350c924a.tar.gz
fork-ledger-a034435c4287aba7fd32ed63a745e560350c924a.tar.bz2
fork-ledger-a034435c4287aba7fd32ed63a745e560350c924a.zip
Merge branch 'next'
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/value.cc b/src/value.cc
index b4060a1c..ae86eb7c 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -35,7 +35,7 @@
#include "commodity.h"
#include "annotate.h"
#include "pool.h"
-#include "unistring.h"
+#include "unistring.h" // for justify()
namespace ledger {
@@ -1439,6 +1439,31 @@ void value_t::in_place_truncate()
throw_(value_error, _("Cannot truncate %1") << label());
}
+void value_t::in_place_floor()
+{
+ switch (type()) {
+ case INTEGER:
+ return;
+ case AMOUNT:
+ as_amount_lval().in_place_floor();
+ return;
+ case BALANCE:
+ as_balance_lval().in_place_floor();
+ return;
+ case SEQUENCE: {
+ value_t temp;
+ foreach (const value_t& value, as_sequence())
+ temp.push_back(value.floored());
+ *this = temp;
+ return;
+ }
+ default:
+ break;
+ }
+
+ throw_(value_error, _("Cannot floor %1") << label());
+}
+
void value_t::in_place_unround()
{
switch (type()) {