summaryrefslogtreecommitdiff
path: root/src/balance.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2019-01-30 11:09:08 -0800
committerJohn Wiegley <johnw@newartisans.com>2019-01-30 11:09:08 -0800
commit557ab32d30bcca3622e06a6809a541a015e84aa3 (patch)
tree0ce7f56328fc86b6705966a52e89f75c3d40cbc1 /src/balance.h
parent2c61d41deaab0343f29b424dbcd1a751928b3056 (diff)
downloadfork-ledger-557ab32d30bcca3622e06a6809a541a015e84aa3.tar.gz
fork-ledger-557ab32d30bcca3622e06a6809a541a015e84aa3.tar.bz2
fork-ledger-557ab32d30bcca3622e06a6809a541a015e84aa3.zip
Expose a new utility function for balances: sorted_amounts
Diffstat (limited to 'src/balance.h')
-rw-r--r--src/balance.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/balance.h b/src/balance.h
index 8e773fc5..b9c9c2c8 100644
--- a/src/balance.h
+++ b/src/balance.h
@@ -81,6 +81,7 @@ class balance_t
{
public:
typedef std::map<commodity_t *, amount_t> amounts_map;
+ typedef std::vector<const amount_t *> amounts_array;
amounts_map amounts;
@@ -529,6 +530,12 @@ public:
balance_t strip_annotations(const keep_details_t& what_to_keep) const;
/**
+ * Given a balance, insert a commodity-wise sort of the amounts into the
+ * given amounts_array.
+ */
+ void sorted_amounts(amounts_array& sorted) const;
+
+ /**
* Iteration primitives. `map_sorted_amounts' allows one to visit
* each amount in balance in the proper order for displaying to the
* user. Mostly used by `print' and other routinse where the sort