summaryrefslogtreecommitdiff
path: root/session.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-27 00:10:35 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-27 00:10:35 -0400
commit713f89679070e2fe2aa529c4eade1f9efd697898 (patch)
tree775d1e7ba478399385914d38cde41a06e9e7753e /session.h
parent162d982b0cf1a5ac2e67012a3b8eadae3c1ac59f (diff)
downloadfork-ledger-713f89679070e2fe2aa529c4eade1f9efd697898.tar.gz
fork-ledger-713f89679070e2fe2aa529c4eade1f9efd697898.tar.bz2
fork-ledger-713f89679070e2fe2aa529c4eade1f9efd697898.zip
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.
Diffstat (limited to 'session.h')
-rw-r--r--session.h31
1 files changed, 30 insertions, 1 deletions
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<journal_t> journals;
ptr_list<parser_t> 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() {
@@ -130,6 +137,28 @@ class session_t : public expr::symbol_scope_t
}
//
+ // 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
//