summaryrefslogtreecommitdiff
path: root/journal.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2006-08-22 00:52:08 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 02:41:33 -0400
commit04dfda2282bfb3686336600cfafd1d9653369445 (patch)
tree9ee02db5c2d33290dfa6060475973f7c378ce643 /journal.cc
parentdb0ef2e25731a824aa728315f2f7f6e8a41a5ddf (diff)
downloadfork-ledger-04dfda2282bfb3686336600cfafd1d9653369445.tar.gz
fork-ledger-04dfda2282bfb3686336600cfafd1d9653369445.tar.bz2
fork-ledger-04dfda2282bfb3686336600cfafd1d9653369445.zip
Made separate modules for the csv command, since the prior method was
not fully correct.
Diffstat (limited to 'journal.cc')
-rw-r--r--journal.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/journal.cc b/journal.cc
index 017f82c5..065825f2 100644
--- a/journal.cc
+++ b/journal.cc
@@ -281,6 +281,27 @@ entry_t::entry_t(const entry_t& e)
(*i)->entry = this;
}
+bool entry_t::get_state(transaction_t::state_t * state) const
+{
+ bool first = true;
+ bool hetero = false;
+
+ for (transactions_list::const_iterator i = transactions.begin();
+ i != transactions.end();
+ i++) {
+ if (first) {
+ *state = (*i)->state;
+ first = false;
+ }
+ else if (*state != (*i)->state) {
+ hetero = true;
+ break;
+ }
+ }
+
+ return ! hetero;
+}
+
void entry_t::add_transaction(transaction_t * xact)
{
xact->entry = this;