diff options
Diffstat (limited to 'server/src/journalwriter.cc')
-rw-r--r-- | server/src/journalwriter.cc | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/server/src/journalwriter.cc b/server/src/journalwriter.cc index 4b2b4be..5858de4 100644 --- a/server/src/journalwriter.cc +++ b/server/src/journalwriter.cc @@ -217,7 +217,7 @@ void JournalWriter::addEntry(Transaction &transaction, Commit &commit, void JournalWriter::addEntry(std::string resume, std::string macro, int index) { // Strip trailing whitespace, and add newlines. - std::string r = stripTrailingWhitepace(addNewlines(resume, 60)); + std::string r = resume; std::string m = macro; ResumeEntry re; @@ -235,7 +235,7 @@ void JournalWriter::commit() while(i != entrylist.end()) { if(resume != "") resume += "\n\n"; // resume += i->macro + "\n"; - resume += i->second.resume; + resume += stripTrailingWhitepace(addNewlines(i->second.resume, 60)); i++; } @@ -247,6 +247,29 @@ void JournalWriter::commit() resume.c_str(), resume.size()); } +std::string JournalWriter::getEntry(std::string macro) +{ + std::map< int, ResumeEntry >::iterator i = entrylist.begin(); + while(i != entrylist.end()) { + if(i->second.macro == macro) return i->second.resume; + i++; + } + return ""; +} + +void JournalWriter::removeEntry(std::string macro) +{ + std::map< int, ResumeEntry >::iterator i = entrylist.begin(); + while(i != entrylist.end()) { + if(i->second.macro == macro) { + entrylist.erase(i); + break; + } + i++; + } +} + + #ifdef TEST_JOURNALWRITER //deps: debug.cc journal_commit.cc //cflags: -I.. |