From 713f89679070e2fe2aa529c4eade1f9efd697898 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 27 Jul 2008 00:10:35 -0400 Subject: A large body of work to get the register report printing again, but still fails due to the fact that 2.x value expression syntax is not restored. --- session.h | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'session.h') diff --git a/session.h b/session.h index bfaeb299..edfa8d9c 100644 --- a/session.h +++ b/session.h @@ -79,9 +79,16 @@ class session_t : public expr::symbol_scope_t ptr_list journals; ptr_list parsers; + account_t * master; + mutable accounts_map accounts_cache; + session_t(); - virtual ~session_t() throw() { + + virtual ~session_t() { TRACE_DTOR(session_t); + + assert(master); + checked_delete(master); } journal_t * create_journal() { @@ -129,6 +136,28 @@ class session_t : public expr::symbol_scope_t checked_delete(parser); } + // + // Dealing with accounts + // + + void add_account(account_t * acct) { + master->add_account(acct); + } + bool remove_account(account_t * acct) { + return master->remove_account(acct); + } + + account_t * find_account(const string& name, bool auto_create = true) { + accounts_map::iterator c = accounts_cache.find(name); + if (c != accounts_cache.end()) + return (*c).second; + + account_t * account = master->find_account(name, auto_create); + accounts_cache.insert(accounts_map::value_type(name, account)); + return account; + } + account_t * find_account_re(const string& regexp); + // // Scope members // -- cgit v1.2.3