summaryrefslogtreecommitdiff
path: root/project2/fileRows.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project2/fileRows.cpp')
-rw-r--r--project2/fileRows.cpp19
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"