diff options
author | deva <deva> | 2011-01-25 12:17:47 +0000 |
---|---|---|
committer | deva <deva> | 2011-01-25 12:17:47 +0000 |
commit | 13f286925b1e9e34fe71413edcba23686c005f8a (patch) | |
tree | d1ea04756f6eb198fb18a367423670734e6e062a /server/src/journal.cc | |
parent | 1680325095c79bd66c13e6e0bd9fb6340c83a1e0 (diff) |
New database layout.
Diffstat (limited to 'server/src/journal.cc')
-rw-r--r-- | server/src/journal.cc | 36 |
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*/ |