summaryrefslogtreecommitdiff
path: root/project2/fileRows.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project2/fileRows.cpp')
-rw-r--r--project2/fileRows.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/project2/fileRows.cpp b/project2/fileRows.cpp
index 28de335..036cf4c 100644
--- a/project2/fileRows.cpp
+++ b/project2/fileRows.cpp
@@ -10,10 +10,11 @@ ElementLoaderImpl<FileRows> filerowsLoader("filerows");
FileRows::FileRows(const xmlpp::Element * p) :
SourceObject(p),
RowSet(p),
- path(p->get_attribute_value("path")),
+ path(p, "path"),
fieldSep(p->get_attribute_value("fieldSep")[0]),
quoteChar(p->get_attribute_value("quoteChar")[0]),
keepBlankRows(p->get_attribute_value("keepBlankRows") == "true"),
+ countBlankRows(p->get_attribute_value("keepBlankRows") == "count"),
newline(p->get_attribute_value("newline")),
encoding(p->get_attribute_value("encoding"))
{
@@ -106,13 +107,18 @@ FileRows::execute(const RowProcessor * rp) const
curCol++;
}
}
- if (!mkCols && (keepBlankRows || !values.empty())) {
- while (values.size() < columns.size()) {
- values.push_back(ValPtr(new Glib::ustring()));
- curCol++;
+ if (!mkCols) {
+ if (keepBlankRows || !values.empty()) {
+ while (values.size() < columns.size()) {
+ values.push_back(ValPtr(new Glib::ustring()));
+ curCol++;
+ }
+ rp->rowReady();
+ rowNum += 1;
+ }
+ else if (countBlankRows) {
+ rowNum +=1;
}
- rp->rowReady();
- rowNum += 1;
}
values.clear();
}
@@ -166,7 +172,7 @@ FileRows::addColumn(const Glib::ustring & rawtok) const
FileStarChannel
FileRows::doOpen() const
{
- FILE * f = LexicalCall<const char *, FILE *>(boost::bind(&popen, _1, "r"), path());
+ FILE * f = LexicalCall<const char *, FILE *>(boost::bind(&fopen, _1, "r"), path());
if (!f) {
throw FileNotReadable();
}