summaryrefslogtreecommitdiff
path: root/server/src/journal.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/journal.cc')
-rw-r--r--server/src/journal.cc36
1 files changed, 32 insertions, 4 deletions
diff --git a/server/src/journal.cc b/server/src/journal.cc
index 1f79c9f..70dba2f 100644
--- a/server/src/journal.cc
+++ b/server/src/journal.cc
@@ -79,14 +79,19 @@ void Journal::addEntry(std::string resume, std::string macro, int index)
std::string r = resume;
std::string m = macro;
+ DEBUG(journal, "Add: %p %s - %s\n", this, m.c_str(), r.c_str());
+
ResumeEntry re;
re.resume = r;
re.macro = m;
+ re.dirty = false;
entrylist[index] = re;
}
std::string Journal::getEntry(std::string macro)
{
+ DEBUG(journal, "Get: %p %s\n", this, macro.c_str());
+
std::map< int, ResumeEntry >::iterator i = entrylist.begin();
while(i != entrylist.end()) {
if(i->second.macro == macro) return i->second.resume;
@@ -97,6 +102,8 @@ std::string Journal::getEntry(std::string macro)
void Journal::removeEntry(std::string macro)
{
+ DEBUG(journal, "Remove: %p %s\n", this, macro.c_str());
+
std::map< int, ResumeEntry >::iterator i = entrylist.begin();
while(i != entrylist.end()) {
if(i->second.macro == macro) {
@@ -107,6 +114,31 @@ void Journal::removeEntry(std::string macro)
}
}
+void Journal::setDirty(std::string macro)
+{
+ std::map< int, ResumeEntry >::iterator i = entrylist.begin();
+ while(i != entrylist.end()) {
+ if(i->second.macro == macro) {
+ i->second.dirty = true;
+ break;
+ }
+ i++;
+ }
+}
+
+bool Journal::dirty(std::string macro)
+{
+ std::map< int, ResumeEntry >::iterator i = entrylist.begin();
+ while(i != entrylist.end()) {
+ if(i->second.macro == macro) {
+ return i->second.dirty;
+ break;
+ }
+ i++;
+ }
+ return false;
+}
+
void Journal::setUser(std::string usr)
{
_user = usr;
@@ -126,7 +158,3 @@ std::string Journal::patientID()
{
return _patientid;
}
-
-#ifdef TEST_JOURNAL
-
-#endif/*TEST_JOURNAL*/