*** empty log message ***

This commit is contained in:
John Wiegley 2003-10-01 23:06:13 +00:00
parent 637e28b5e7
commit 3afa81857a
5 changed files with 25 additions and 26 deletions

View file

@ -42,12 +42,12 @@ static bool account_matches(const account * acct,
}
static void display_total(std::ostream& out, totals& balance,
const account * acct, bool top_level,
account * acct, bool top_level,
const std::list<mask>& regexps)
{
bool displayed = false;
if (acct->display && (show_empty || acct->balance)) {
if (acct->checked == 1 && (show_empty || acct->balance)) {
displayed = true;
out << acct->balance;
@ -65,7 +65,7 @@ static void display_total(std::ostream& out, totals& balance,
// Display balances for all child accounts
for (account::const_iterator i = acct->children.begin();
for (accounts_iterator i = acct->children.begin();
i != acct->children.end();
i++)
display_total(out, balance, (*i).second, ! displayed, regexps);
@ -134,7 +134,7 @@ void report_balances(int argc, char **argv, std::ostream& out)
else if (acct->checked == 3)
continue;
acct->display = true;
acct->checked = 1;
acct->balance.credit((*x)->cost->street());
}
}

View file

@ -2,7 +2,7 @@
namespace ledger {
static void equity_entry(std::ostream& out, const account * acct,
static void equity_entry(std::ostream& out, account * acct,
const std::list<mask>& regexps)
{
if (acct->balance &&
@ -37,7 +37,7 @@ static void equity_entry(std::ostream& out, const account * acct,
// Display balances for all child accounts
for (account::const_iterator i = acct->children.begin();
for (accounts_iterator i = acct->children.begin();
i != acct->children.end();
i++)
equity_entry(out, (*i).second, regexps);

View file

@ -139,7 +139,7 @@ static void dataHandler(void *userData, const char *s, int len)
accounts_iterator i = accounts_by_id.find(std::string(s, len));
assert(i != accounts_by_id.end());
curr_account->parent = (*i).second;
(*i).second->children.insert(account::pair(curr_account->name,
(*i).second->children.insert(accounts_entry(curr_account->name,
curr_account));
break;
}
@ -239,12 +239,18 @@ bool parse_gnucash(std::istream& in, bool compute_balances)
{
char buf[BUFSIZ];
action = NO_ACTION;
do_compute = compute_balances;
curr_account = NULL;
curr_entry = NULL;
curr_value = NULL;
curr_comm = NULL;
do_compute = compute_balances;
entry_comm = NULL;
action = NO_ACTION;
// GnuCash uses the USD commodity without defining it, which really
// means to use $.
commodity * usd = new commodity("$", true, false, true, false, 2);
main_ledger.commodities.insert(commodities_entry("USD", usd));
XML_Parser parser = XML_ParserCreate(NULL);
current_parser = parser;

View file

@ -302,7 +302,7 @@ account * state::find_account(const char * name, bool create)
current = (*i).second;
}
} else {
account::iterator i = current->children.find(tok);
accounts_iterator i = current->children.find(tok);
if (i == current->children.end()) {
if (! create)
return NULL;

View file

@ -1,5 +1,5 @@
#ifndef _LEDGER_H
#define _LEDGER_H "$Revision: 1.14 $"
#define _LEDGER_H "$Revision: 1.15 $"
//////////////////////////////////////////////////////////////////////
//
@ -275,29 +275,27 @@ operator<<(std::basic_ostream<char, Traits>& out, const totals& t) {
}
typedef std::map<const std::string, account *> accounts_t;
typedef accounts_t::iterator accounts_iterator;
typedef std::pair<const std::string, account *> accounts_entry;
struct account
{
struct account * parent;
account * parent;
std::string name;
commodity * comm; // default commodity for this account
totals balance;
bool display;
int checked;
#ifdef HUQUQULLAH
bool exempt_or_necessary;
#endif
typedef std::map<const std::string, struct account *> map;
typedef map::iterator iterator;
typedef map::const_iterator const_iterator;
typedef std::pair<const std::string, struct account *> pair;
map children;
accounts_t children;
account(const std::string& _name, struct account * _parent = NULL)
: parent(_parent), name(_name), display(false), checked(0) {
: parent(_parent), name(_name), checked(0) {
#ifdef HUQUQULLAH
exempt_or_necessary = false;
#endif
@ -318,11 +316,6 @@ operator<<(std::basic_ostream<char, Traits>& out, const account& a) {
}
typedef std::map<const std::string, account *> accounts_t;
typedef accounts_t::iterator accounts_iterator;
typedef std::pair<const std::string, account *> accounts_entry;
struct state
{
commodities_t commodities;