summaryrefslogtreecommitdiff
path: root/gnucash.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-07-30 21:57:02 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-07-30 21:57:02 -0400
commit94e76ae87e883291d13320738fe165c7a2a2415b (patch)
treeb90eff2ee3737ecdfea96dbee52ecd239fcb2578 /gnucash.cc
parent5087a60deef7c618a07562511e9a1fbf2414776c (diff)
downloadledger-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.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/gnucash.cc b/gnucash.cc
index df3ebbf3..7c8589f0 100644
--- a/gnucash.cc
+++ b/gnucash.cc
@@ -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;