diff options
author | randomdan <randomdan@localhost> | 2011-01-25 20:59:48 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2011-01-25 20:59:48 +0000 |
commit | 5b01add8dff1f92b33a319edc9efc51f54abfa2b (patch) | |
tree | 3dc7f7d36f4bab486e708f055e034ed493ca1aad | |
parent | Fix #if check for UUID implementation (diff) | |
download | project2-5b01add8dff1f92b33a319edc9efc51f54abfa2b.tar.bz2 project2-5b01add8dff1f92b33a319edc9efc51f54abfa2b.tar.xz project2-5b01add8dff1f92b33a319edc9efc51f54abfa2b.zip |
Only trim newline from lines that end with newline
-rw-r--r-- | project2/fileRows.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/project2/fileRows.cpp b/project2/fileRows.cpp index 7251a9f..600ab7c 100644 --- a/project2/fileRows.cpp +++ b/project2/fileRows.cpp @@ -2,6 +2,7 @@ #include "rowProcessor.h" #include "xmlObjectLoader.h" #include "exceptions.h" +#include <boost/algorithm/string/predicate.hpp> ElementLoaderImpl<FileRows> filerowsLoader("filerows"); @@ -59,7 +60,9 @@ FileRows::execute(const RowProcessor * rp) const c.set_line_term(newline); Glib::ustring line; while (c.read_line(line) == Glib::IO_STATUS_NORMAL) { - line.erase(line.length() - newline.length()); + if (boost::algorithm::ends_with(line, newline)) { + line.erase(line.length() - newline.length()); + } Columns::const_iterator curCol = columns.begin(); bool mkCols = columns.empty(); bool inQuotes = false; |