summaryrefslogtreecommitdiff
path: root/src/value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-25 23:42:31 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-25 23:42:31 -0400
commit247cf58bfa348ba104afe9328945979c4b154e46 (patch)
tree390dccfc236fab43cc0b682f67ad70d26d13ebc0 /src/value.cc
parent55a6d588ff26aee98e0bde2f3dc71b626e11c048 (diff)
downloadfork-ledger-247cf58bfa348ba104afe9328945979c4b154e46.tar.gz
fork-ledger-247cf58bfa348ba104afe9328945979c4b154e46.tar.bz2
fork-ledger-247cf58bfa348ba104afe9328945979c4b154e46.zip
Allow sequences to be rounded and unrounded
The result is that every member of the sequence has the given operation applied.
Diffstat (limited to 'src/value.cc')
-rw-r--r--src/value.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/value.cc b/src/value.cc
index e3f3f01b..94bcfb20 100644
--- a/src/value.cc
+++ b/src/value.cc
@@ -1282,6 +1282,12 @@ value_t value_t::rounded() const
return as_amount().rounded();
case BALANCE:
return as_balance().rounded();
+ case SEQUENCE: {
+ value_t temp;
+ foreach (const value_t& value, as_sequence())
+ temp.push_back(value.rounded());
+ return temp;
+ }
default:
break;
}
@@ -1299,6 +1305,12 @@ value_t value_t::unrounded() const
return as_amount().unrounded();
case BALANCE:
return as_balance().unrounded();
+ case SEQUENCE: {
+ value_t temp;
+ foreach (const value_t& value, as_sequence())
+ temp.push_back(value.unrounded());
+ return temp;
+ }
default:
break;
}