summaryrefslogtreecommitdiff
path: root/src/timelog.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-11 14:45:14 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-11 14:45:14 -0500
commita034435c4287aba7fd32ed63a745e560350c924a (patch)
treef0acb080410a32c215c2c1938811cc14d512b580 /src/timelog.h
parent5ffa987daf4d97c52066e4c28733d826d3726297 (diff)
parentf0f1b0cdfa3a0a73695eda52b25de71bd40adc5a (diff)
downloadfork-ledger-a034435c4287aba7fd32ed63a745e560350c924a.tar.gz
fork-ledger-a034435c4287aba7fd32ed63a745e560350c924a.tar.bz2
fork-ledger-a034435c4287aba7fd32ed63a745e560350c924a.zip
Merge branch 'next'
Diffstat (limited to 'src/timelog.h')
-rw-r--r--src/timelog.h30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/timelog.h b/src/timelog.h
index 7d79af3e..83256dfa 100644
--- a/src/timelog.h
+++ b/src/timelog.h
@@ -44,6 +44,7 @@
#include "utils.h"
#include "times.h"
+#include "item.h"
namespace ledger {
@@ -56,19 +57,25 @@ public:
datetime_t checkin;
account_t * account;
string desc;
+ string note;
+ position_t position;
time_xact_t() : account(NULL) {
TRACE_CTOR(time_xact_t, "");
}
- time_xact_t(const datetime_t& _checkin,
- account_t * _account = NULL,
- const string& _desc = "")
- : checkin(_checkin), account(_account), desc(_desc) {
- TRACE_CTOR(time_xact_t, "const datetime_t&, account_t *, const string&");
+ time_xact_t(const optional<position_t>& _position,
+ const datetime_t& _checkin,
+ account_t * _account = NULL,
+ const string& _desc = "",
+ const string& _note = "")
+ : checkin(_checkin), account(_account), desc(_desc), note(_note),
+ position(_position ? *_position : position_t()) {
+ TRACE_CTOR(time_xact_t,
+ "position_t, datetime_t, account_t *, string, string");
}
time_xact_t(const time_xact_t& xact)
: checkin(xact.checkin), account(xact.account),
- desc(xact.desc) {
+ desc(xact.desc), note(xact.note), position(xact.position) {
TRACE_CTOR(time_xact_t, "copy");
}
~time_xact_t() throw() {
@@ -79,7 +86,7 @@ public:
class time_log_t
{
std::list<time_xact_t> time_xacts;
- journal_t& journal;
+ journal_t& journal;
public:
time_log_t(journal_t& _journal) : journal(_journal) {
@@ -87,13 +94,8 @@ public:
}
~time_log_t();
- void clock_in(const datetime_t& checkin,
- account_t * account = NULL,
- const string& desc = "");
-
- void clock_out(const datetime_t& checkin,
- account_t * account = NULL,
- const string& desc = "");
+ void clock_in(time_xact_t event);
+ void clock_out(time_xact_t event);
};
} // namespace ledger