diff options
author | John Wiegley <johnw@newartisans.com> | 2004-08-29 04:31:59 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-08-29 04:31:59 -0400 |
commit | 2d62f7b633bdaa39c650bb67425514cf1e66a4dd (patch) | |
tree | ffe42356e5e83f2cbc2cce74a8566ea1ac738e8b /journal.cc | |
parent | 032afa5657bd600476cde256b6d7db84fde7d038 (diff) | |
download | fork-ledger-2d62f7b633bdaa39c650bb67425514cf1e66a4dd.tar.gz fork-ledger-2d62f7b633bdaa39c650bb67425514cf1e66a4dd.tar.bz2 fork-ledger-2d62f7b633bdaa39c650bb67425514cf1e66a4dd.zip |
redid the way amount_t::commodity is handled; no more direct access
Diffstat (limited to 'journal.cc')
-rw-r--r-- | journal.cc | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -246,12 +246,9 @@ bool journal_t::add_entry(entry_t * entry) i != entry->transactions.end(); i++) { (*i)->account->add_transaction(*i); - - if ((*i)->cost) { - assert((*i)->cost->commodity); - (*i)->amount.commodity->add_price(entry->date, - *(*i)->cost / (*i)->amount); - } + if ((*i)->cost) + (*i)->amount.commodity().add_price(entry->date, + *(*i)->cost / (*i)->amount); } return true; @@ -330,8 +327,8 @@ entry_t * journal_t::derive_entry(strings_list::iterator i, first = xact = new transaction_t(m_xact->account, amt); added->add_transaction(xact); - if (xact->amount.commodity->symbol.empty()) - xact->amount.commodity = m_xact->amount.commodity; + if (xact->amount.commodity().symbol.empty()) + xact->amount.set_commodity(m_xact->amount.commodity()); m_xact = matching->transactions.back(); @@ -355,7 +352,7 @@ entry_t * journal_t::derive_entry(strings_list::iterator i, x++) { if (acct_regex.match((*x)->account->fullname())) { acct = (*x)->account; - cmdty = (*x)->amount.commodity; + cmdty = &(*x)->amount.commodity(); break; } } @@ -379,8 +376,8 @@ entry_t * journal_t::derive_entry(strings_list::iterator i, transaction_t * xact = new transaction_t(acct, amt); added->add_transaction(xact); - if (! xact->amount.commodity) - xact->amount.commodity = cmdty; + if (! xact->amount.commodity()) + xact->amount.set_commodity(*cmdty); } if (i != end && std::string(*i++) == "-from" && i != end) { |