summaryrefslogtreecommitdiff
path: root/src/textual.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-11 01:17:29 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-11 01:17:29 -0500
commiteb772893b00119ead26d8662d73460651cafe11d (patch)
treee901434a5079b09cd67ea46e87c6a0bddc7f7ac4 /src/textual.cc
parentb62b03335f33a6a0ae422605b8b6271add849aa6 (diff)
downloadfork-ledger-eb772893b00119ead26d8662d73460651cafe11d.tar.gz
fork-ledger-eb772893b00119ead26d8662d73460651cafe11d.tar.bz2
fork-ledger-eb772893b00119ead26d8662d73460651cafe11d.zip
Timeclock entries can now have notes
Example of a tagged entry: i 2009/11/01 12:00:00 Account Payee ; :Foo: o 2009/11/01 13:00:00 Two spaces or a tab must separate account from payee, and payee from note.
Diffstat (limited to 'src/textual.cc')
-rw-r--r--src/textual.cc22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/textual.cc b/src/textual.cc
index bd7333d2..844edad3 100644
--- a/src/textual.cc
+++ b/src/textual.cc
@@ -413,11 +413,18 @@ void instance_t::clock_in_directive(char * line,
{
string datetime(line, 2, 19);
- char * p = skip_ws(line + 22);
- char * n = next_element(p, true);
+ char * p = skip_ws(line + 22);
+ char * n = next_element(p, true);
+ char * end = n ? next_element(n, true) : NULL;
+
+ if (end && *end == ';')
+ end = skip_ws(end + 1);
+ else
+ end = NULL;
timelog.clock_in(parse_datetime(datetime, current_year),
- account_stack.front()->find_account(p), n ? n : "");
+ account_stack.front()->find_account(p),
+ n ? n : "", end ? end : "");
}
void instance_t::clock_out_directive(char * line,
@@ -427,9 +434,16 @@ void instance_t::clock_out_directive(char * line,
char * p = skip_ws(line + 22);
char * n = next_element(p, true);
+ char * end = n ? next_element(n, true) : NULL;
+
+ if (end && *end == ';')
+ end = skip_ws(end + 1);
+ else
+ end = NULL;
timelog.clock_out(parse_datetime(datetime, current_year),
- p ? account_stack.front()->find_account(p) : NULL, n ? n : "");
+ p ? account_stack.front()->find_account(p) : NULL,
+ n ? n : "", end ? end : "");
count++;
}