Add 'data' member to account/journal objects

This commit is contained in:
John Wiegley 2012-04-12 02:39:23 -05:00
parent 6a5360e2b5
commit 1e572d508d
3 changed files with 23 additions and 5 deletions

View file

@ -70,13 +70,20 @@ public:
optional<expr_t> value_expr; optional<expr_t> value_expr;
mutable string _fullname; mutable string _fullname;
#ifdef DOCUMENT_MODEL
mutable void * data;
#endif
account_t(account_t * _parent = NULL, account_t(account_t * _parent = NULL,
const string& _name = "", const string& _name = "",
const optional<string>& _note = none) const optional<string>& _note = none)
: supports_flags<>(), scope_t(), parent(_parent), : supports_flags<>(), scope_t(), parent(_parent),
name(_name), note(_note), name(_name), note(_note),
depth(static_cast<unsigned short>(parent ? parent->depth + 1 : 0)) { depth(static_cast<unsigned short>(parent ? parent->depth + 1 : 0))
#ifdef DOCUMENT_MODEL
, data(NULL)
#endif
{
TRACE_CTOR(account_t, "account_t *, const string&, const string&"); TRACE_CTOR(account_t, "account_t *, const string&, const string&");
} }
account_t(const account_t& other) account_t(const account_t& other)
@ -85,10 +92,14 @@ public:
name(other.name), name(other.name),
note(other.note), note(other.note),
depth(other.depth), depth(other.depth),
accounts(other.accounts) { accounts(other.accounts)
#ifdef DOCUMENT_MODEL
, data(NULL)
#endif
{
TRACE_CTOR(account_t, "copy"); TRACE_CTOR(account_t, "copy");
} }
~account_t(); virtual ~account_t();
virtual string description() { virtual string description() {
return string(_("account ")) + fullname(); return string(_("account ")) + fullname();

View file

@ -487,6 +487,9 @@ bool xact_base_t::verify()
xact_t::xact_t(const xact_t& e) xact_t::xact_t(const xact_t& e)
: xact_base_t(e), code(e.code), payee(e.payee) : xact_base_t(e), code(e.code), payee(e.payee)
#ifdef DOCUMENT_MODEL
, data(NULL)
#endif
{ {
TRACE_CTOR(xact_t, "copy"); TRACE_CTOR(xact_t, "copy");
} }

View file

@ -110,10 +110,14 @@ public:
string payee; string payee;
#ifdef DOCUMENT_MODEL #ifdef DOCUMENT_MODEL
void * data; mutable void * data;
#endif #endif
xact_t() { xact_t()
#ifdef DOCUMENT_MODEL
: data(NULL)
#endif
{
TRACE_CTOR(xact_t, ""); TRACE_CTOR(xact_t, "");
} }
xact_t(const xact_t& e); xact_t(const xact_t& e);