From 2c109226140a99a07af079c70e54fb396bb3484e Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 4 Oct 2003 07:48:21 +0000 Subject: Moved definition of virtual accounts into the ledger data file itself. They are now called "automated transactions". Some rearchitecting. --- equity.cc | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'equity.cc') 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); } -- cgit v1.2.3