diff options
author | John Wiegley <johnw@newartisans.com> | 2004-07-30 21:57:02 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-07-30 21:57:02 -0400 |
commit | 94e76ae87e883291d13320738fe165c7a2a2415b (patch) | |
tree | b90eff2ee3737ecdfea96dbee52ecd239fcb2578 /gnucash.cc | |
parent | 5087a60deef7c618a07562511e9a1fbf2414776c (diff) | |
download | ledger-94e76ae87e883291d13320738fe165c7a2a2415b.tar.gz ledger-94e76ae87e883291d13320738fe165c7a2a2415b.tar.bz2 ledger-94e76ae87e883291d13320738fe165c7a2a2415b.zip |
two major changes
Complete changed the way format strings are handled. They are now
compiled first, which is far more efficient than what was being done
before.
Also, there is now a global ledger::commodity_t::commodities map,
which saves me from having to pass the current journal around to a
zillion different functions, for the sole purpose of making sure that
all commodity symbols that are parsed refer to the same commodity
object.
Diffstat (limited to 'gnucash.cc')
-rw-r--r-- | gnucash.cc | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -113,7 +113,7 @@ static void endElement(void *userData, const char *name) } else if (std::strcmp(name, "gnc:commodity") == 0) { assert(curr_comm); - curr_ledger->add_commodity(curr_comm); + commodity_t::add_commodity(curr_comm); curr_comm = NULL; } else if (std::strcmp(name, "gnc:transaction") == 0) { @@ -166,9 +166,9 @@ static void dataHandler(void *userData, const char *s, int len) if (curr_comm) curr_comm->symbol = std::string(s, len); else if (curr_account) - curr_account_comm = curr_ledger->find_commodity(std::string(s, len)); + curr_account_comm = commodity_t::find_commodity(std::string(s, len)); else if (curr_entry) - entry_comm = curr_ledger->find_commodity(std::string(s, len)); + entry_comm = commodity_t::find_commodity(std::string(s, len)); break; case COMM_NAME: @@ -271,8 +271,8 @@ int parse_gnucash(std::istream& in, ledger_t * ledger, account_t * master) // GnuCash uses the USD commodity without defining it, which really // means $. commodity_t * usd = new commodity_t("$", 2, COMMODITY_STYLE_THOUSANDS); - ledger->add_commodity(usd); - ledger->add_commodity(usd, "USD"); + commodity_t::add_commodity(usd); + commodity_t::add_commodity(usd, "USD"); XML_Parser parser = XML_ParserCreate(NULL); current_parser = parser; |