summaryrefslogtreecommitdiff
path: root/equity.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2003-10-04 07:48:21 +0000
committerJohn Wiegley <johnw@newartisans.com>2003-10-04 07:48:21 +0000
commit2c109226140a99a07af079c70e54fb396bb3484e (patch)
tree9d8b23ebd636bb3e8e350fa9509bd931cb60eb94 /equity.cc
parentcb9de0d695c89e03a926451f7ccf2f634e7be436 (diff)
downloadfork-ledger-2c109226140a99a07af079c70e54fb396bb3484e.tar.gz
fork-ledger-2c109226140a99a07af079c70e54fb396bb3484e.tar.bz2
fork-ledger-2c109226140a99a07af079c70e54fb396bb3484e.zip
Moved definition of virtual accounts into the ledger data file
itself. They are now called "automated transactions". Some rearchitecting.
Diffstat (limited to 'equity.cc')
-rw-r--r--equity.cc21
1 files changed, 6 insertions, 15 deletions
diff --git a/equity.cc b/equity.cc
index 1a4500b5..accbfd7c 100644
--- a/equity.cc
+++ b/equity.cc
@@ -2,7 +2,7 @@
namespace ledger {
-static void equity_entry(account * acct, regexps_t& regexps,
+static void equity_entry(account * acct, regexps_map& regexps,
std::ostream& out)
{
if (! acct->balance.is_zero() &&
@@ -27,7 +27,7 @@ static void equity_entry(account * acct, regexps_t& regexps,
opening.xacts.push_back(xact);
xact = new transaction();
- xact->acct = main_ledger.find_account("Equity:Opening Balances");
+ xact->acct = main_ledger->find_account("Equity:Opening Balances");
xact->cost = (*i).second->street();
xact->cost->negate();
opening.xacts.push_back(xact);
@@ -38,7 +38,7 @@ static void equity_entry(account * acct, regexps_t& regexps,
// Display balances for all child accounts
- for (accounts_iterator i = acct->children.begin();
+ for (accounts_map_iterator i = acct->children.begin();
i != acct->children.end();
i++)
equity_entry((*i).second, regexps, out);
@@ -51,23 +51,14 @@ static void equity_entry(account * acct, regexps_t& regexps,
// balances.
//
-void equity_ledger(int argc, char ** argv, regexps_t& regexps,
- std::ostream& out)
+void equity_ledger(std::ostream& out, regexps_map& regexps)
{
- optind = 1;
-
- // Compile the list of specified regular expressions, which can be
- // specified on the command line, or using an include/exclude file
-
- for (; optind < argc; optind++)
- record_regexp(argv[optind], regexps);
-
// The account have their current totals already generated as a
// result of parsing. We just have to output those values.
// totals
- for (accounts_iterator i = main_ledger.accounts.begin();
- i != main_ledger.accounts.end();
+ for (accounts_map_iterator i = main_ledger->accounts.begin();
+ i != main_ledger->accounts.end();
i++)
equity_entry((*i).second, regexps, out);
}