diff options
author | randomdan <randomdan@localhost> | 2010-08-05 00:47:01 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2010-08-05 00:47:01 +0000 |
commit | 6e58217deeaed4f14820a4744bef72b508937e30 (patch) | |
tree | 9b02ae03161e2a7463dc48ca149e03982ba6cbda /project2/fileRows.cpp | |
parent | Accept and run checks before presentation (diff) | |
download | project2-6e58217deeaed4f14820a4744bef72b508937e30.tar.bz2 project2-6e58217deeaed4f14820a4744bef72b508937e30.tar.xz project2-6e58217deeaed4f14820a4744bef72b508937e30.zip |
Add ProcRows as a direct extension of FileRows
Fix glaring bug in FileRows (vector.clear()/.empty() mixup)
Diffstat (limited to 'project2/fileRows.cpp')
-rw-r--r-- | project2/fileRows.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/project2/fileRows.cpp b/project2/fileRows.cpp index c2a3a09..239ad6b 100644 --- a/project2/fileRows.cpp +++ b/project2/fileRows.cpp @@ -1,5 +1,4 @@ #include "fileRows.h" -#include "fileStarGlibIoChannel.h" #include <stdexcept> _FileRows::_FileRows(const xmlpp::Element * p) : @@ -36,11 +35,7 @@ _FileRows::getColumnName(unsigned int col) const void _FileRows::execute() const { - FILE * f = fopen(path.c_str(), "r"); - if (!f) { - throw std::runtime_error("Could not open file"); - } - FileStarChannel c(f); + FileStarChannel c(doOpen()); c.set_encoding(encoding); c.set_line_term(newline); Glib::ustring line; @@ -94,7 +89,7 @@ _FileRows::execute() const } rowReady(); } - values.empty(); + values.clear(); } } @@ -131,6 +126,16 @@ _FileRows::addColumn(const Glib::ustring & rawtok) const } } +FileStarChannel +_FileRows::doOpen() const +{ + FILE * f = fopen(path.c_str(), "r"); + if (!f) { + throw std::runtime_error("Could not open file"); + } + return FileStarChannel(f, true, fclose); +} + #include "view.hpp" template class _GenericView<_FileRows>; #include "iterate.hpp" |