summaryrefslogtreecommitdiff
path: root/journal.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-02-16 21:10:50 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:24 -0400
commitf43370cae5d9297487fedeefa427d42ab869df48 (patch)
tree247b3e1f9628fd62e19f0758d8f7265308b1d8e2 /journal.h
parentb0414258467a1216f69dc01ae7a7ad8af2751b8b (diff)
downloadfork-ledger-f43370cae5d9297487fedeefa427d42ab869df48.tar.gz
fork-ledger-f43370cae5d9297487fedeefa427d42ab869df48.tar.bz2
fork-ledger-f43370cae5d9297487fedeefa427d42ab869df48.zip
Transactions now track their beginning and ending position, as do
entries. The new format strings %xB %xE %xb %xe can be used to display those values relative to a transaction. The Emacs module now relies on this support to exactly determine where a transaction is, rather than the Elisp logic it relied on previously.
Diffstat (limited to 'journal.h')
-rw-r--r--journal.h31
1 files changed, 18 insertions, 13 deletions
diff --git a/journal.h b/journal.h
index f4619bb1..54486c9d 100644
--- a/journal.h
+++ b/journal.h
@@ -31,23 +31,27 @@ class transaction_t
public:
enum state_t { UNCLEARED, CLEARED, PENDING };
- entry_t * entry;
- std::time_t _date;
- std::time_t _date_eff;
- account_t * account;
- amount_t amount;
- amount_t * cost;
- state_t state;
- unsigned short flags;
- std::string note;
- mutable void * data;
+ entry_t * entry;
+ std::time_t _date;
+ std::time_t _date_eff;
+ account_t * account;
+ amount_t amount;
+ amount_t * cost;
+ state_t state;
+ unsigned short flags;
+ std::string note;
+ istream_pos_type beg_pos;
+ unsigned long beg_line;
+ istream_pos_type end_pos;
+ unsigned long end_line;
+ mutable void * data;
static bool use_effective_date;
transaction_t(account_t * _account = NULL)
: entry(NULL), _date(0), _date_eff(0), account(_account),
cost(NULL), state(UNCLEARED), flags(TRANSACTION_NORMAL),
- data(NULL) {
+ data(NULL), beg_pos(0), beg_line(0), end_pos(0), end_line(0) {
DEBUG_PRINT("ledger.memory.ctors", "ctor transaction_t");
}
@@ -57,7 +61,8 @@ class transaction_t
const std::string& _note = "")
: entry(NULL), _date(0), _date_eff(0), account(_account),
amount(_amount), cost(NULL), state(UNCLEARED), flags(_flags),
- note(_note), data(NULL) {
+ note(_note), data(NULL), beg_pos(0), beg_line(0), end_pos(0),
+ end_line(0) {
DEBUG_PRINT("ledger.memory.ctors", "ctor transaction_t");
}
@@ -66,7 +71,7 @@ class transaction_t
account(xact.account), amount(xact.amount),
cost(xact.cost ? new amount_t(*xact.cost) : NULL),
state(xact.state), flags(xact.flags), note(xact.note),
- data(NULL) {
+ data(NULL), beg_pos(0), beg_line(0), end_pos(0), end_line(0) {
DEBUG_PRINT("ledger.memory.ctors", "ctor transaction_t");
}