summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project2/basics/caches/memoryCache.cpp4
-rw-r--r--project2/basics/unittests/testLibraries.cpp4
-rw-r--r--project2/basics/unittests/testViews.cpp14
-rw-r--r--project2/common/execContext.cpp23
-rw-r--r--project2/common/execContext.h7
-rw-r--r--project2/common/rowSet.cpp9
-rw-r--r--project2/common/rowSet.h7
-rw-r--r--project2/common/variables.cpp6
-rw-r--r--project2/files/fsRows.cpp2
-rw-r--r--project2/ice/iceRows.cpp15
-rw-r--r--project2/ice/iceRows.h3
-rw-r--r--project2/ice/slice2Rows.cpp2
-rw-r--r--project2/ice/unittests/testClient.cpp18
-rw-r--r--project2/ice/unittests/testClientCompile.cpp4
-rw-r--r--project2/ice/unittests/testDaemon.cpp4
-rw-r--r--project2/ice/unittests/testDaemonCompile.cpp4
-rw-r--r--project2/regex/regexRows.cpp2
-rw-r--r--project2/sql/sqlCache.cpp4
-rw-r--r--project2/sql/sqlMergeTask.cpp3
-rw-r--r--project2/sql/sqlRows.cpp2
-rw-r--r--project2/streams/streamNvpRows.cpp8
-rw-r--r--project2/streams/streamRows.cpp11
-rw-r--r--project2/ut/testAppInstance.cpp15
-rw-r--r--project2/ut/testAppInstance.h14
-rw-r--r--project2/xml/xmlRawRows.cpp4
-rw-r--r--project2/xml/xmlRows.cpp4
-rw-r--r--project2/xml/xpathRows.cpp2
27 files changed, 127 insertions, 68 deletions
diff --git a/project2/basics/caches/memoryCache.cpp b/project2/basics/caches/memoryCache.cpp
index 16bdfa8..6e5aab6 100644
--- a/project2/basics/caches/memoryCache.cpp
+++ b/project2/basics/caches/memoryCache.cpp
@@ -42,9 +42,9 @@ class MemoryCache : public RowSetCache {
{
}
- void execute(const Glib::ustring&, const RowProcessorCallback & rp, ExecContext *) const {
+ void execute(const Glib::ustring&, const RowProcessorCallback & rp, ExecContext * ec) const {
for (const DataCache::value_type & mcr : dataCache) {
- mcr->process(rp, false);
+ mcr->process(ec, rp, false);
}
}
diff --git a/project2/basics/unittests/testLibraries.cpp b/project2/basics/unittests/testLibraries.cpp
index b77b671..e48d77e 100644
--- a/project2/basics/unittests/testLibraries.cpp
+++ b/project2/basics/unittests/testLibraries.cpp
@@ -4,11 +4,11 @@
#include <testOptionsSource.h>
#include <exceptions.h>
#include <library.h>
-#include <appInstance.h>
+#include <testAppInstance.h>
const auto self = boost::filesystem::canonical("/proc/self/exe");
-BOOST_FIXTURE_TEST_SUITE( Core, AppInstance );
+BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance );
BOOST_AUTO_TEST_CASE( load_missing_library )
{
diff --git a/project2/basics/unittests/testViews.cpp b/project2/basics/unittests/testViews.cpp
index a74c9e3..a2ea224 100644
--- a/project2/basics/unittests/testViews.cpp
+++ b/project2/basics/unittests/testViews.cpp
@@ -5,10 +5,10 @@
#include <testOptionsSource.h>
#include <testScriptHost.h>
#include <definedDirs.h>
-#include <appInstance.h>
+#include <testAppInstance.h>
boost::intrusive_ptr<TestScriptHost>
-executeRowViewTest(const boost::filesystem::path & script, const boost::filesystem::path & expected)
+executeRowViewTest(ExecContext * ec, const boost::filesystem::path & script, const boost::filesystem::path & expected)
{
TestOptionsSource::LoadTestOptions({
{ "common.datasourceRoot", RootDir.string() },
@@ -18,27 +18,27 @@ executeRowViewTest(const boost::filesystem::path & script, const boost::filesyst
ScriptReaderPtr r = new XmlScriptParser(script);
boost::intrusive_ptr<TestScriptHost> sr = new TestScriptHost(r);
BOOST_TEST_CHECKPOINT("Execute");
- sr->process(NULL);
+ sr->process(ec);
BOOST_TEST_CHECKPOINT("Compare");
BOOST_REQUIRE_EQUAL(sr->GetPresenterData(), expected);
return sr;
}
-BOOST_FIXTURE_TEST_SUITE( Core, AppInstance );
+BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance );
BOOST_AUTO_TEST_CASE( test_rowview_unsetcolumns )
{
- executeRowViewTest(RootDir / "test_rowview_unsetcolumns.xml", RootDir / "expected" / "test_rowview_unsetcolumns.log");
+ executeRowViewTest(this, RootDir / "test_rowview_unsetcolumns.xml", RootDir / "expected" / "test_rowview_unsetcolumns.log");
}
BOOST_AUTO_TEST_CASE( test_rowview_nocolumns )
{
- executeRowViewTest(RootDir / "test_rowview_nocolumns.xml", RootDir / "expected" / "test_rowview_nocolumns.log");
+ executeRowViewTest(this, RootDir / "test_rowview_nocolumns.xml", RootDir / "expected" / "test_rowview_nocolumns.log");
}
BOOST_AUTO_TEST_CASE( test_rowview_columns )
{
- executeRowViewTest(RootDir / "test_rowview_columns.xml", RootDir / "expected" / "test_rowview_columns.log");
+ executeRowViewTest(this, RootDir / "test_rowview_columns.xml", RootDir / "expected" / "test_rowview_columns.log");
}
BOOST_AUTO_TEST_SUITE_END();
diff --git a/project2/common/execContext.cpp b/project2/common/execContext.cpp
index e39c72c..1349ab0 100644
--- a/project2/common/execContext.cpp
+++ b/project2/common/execContext.cpp
@@ -1,6 +1,7 @@
#include "execContext.h"
#include "logger.h"
#include "presenter.h"
+#include "rowSet.h"
void
ExecContext::logMessage(bool writeLog, const Glib::ustring & g, const Glib::ustring & m)
@@ -33,3 +34,25 @@ ExecContext::Message::Message(const Glib::ustring & g, const Glib::ustring & m)
{
}
+void
+ExecContext::RowValuesPush(const RowState * rs)
+{
+ rowValuesStack.push_back(rs);
+}
+
+void
+ExecContext::RowValuesPop()
+{
+ rowValuesStack.pop_back();
+}
+
+const RowState *
+ExecContext::RowValues(size_t depth) const
+{
+ if (depth > rowValuesStack.size()) {
+ throw RowSet::ParentOutOfRange(depth);
+ }
+ return rowValuesStack.at(rowValuesStack.size() - depth);
+}
+
+
diff --git a/project2/common/execContext.h b/project2/common/execContext.h
index 6018058..5bce0d7 100644
--- a/project2/common/execContext.h
+++ b/project2/common/execContext.h
@@ -8,6 +8,7 @@
#include "session.h"
class MultiRowSetPresenter;
+class RowState;
class ExecContext {
public:
@@ -20,6 +21,7 @@ class ExecContext {
};
typedef boost::intrusive_ptr<Message> MessagePtr;
typedef std::list<MessagePtr> Messages;
+ typedef std::vector<const RowState *> RowValuesStack;
virtual VariableType getParameter(const VariableType & key) const = 0;
virtual SessionPtr getSession() const = 0;
@@ -29,8 +31,13 @@ class ExecContext {
void addContextData(const MultiRowSetPresenter * p) const;
+ void RowValuesPush(const RowState *);
+ void RowValuesPop();
+ const RowState * RowValues(size_t depth) const;
+
private:
Messages messages;
+ RowValuesStack rowValuesStack;
};
#endif
diff --git a/project2/common/rowSet.cpp b/project2/common/rowSet.cpp
index 702aec1..cb7dd31 100644
--- a/project2/common/rowSet.cpp
+++ b/project2/common/rowSet.cpp
@@ -5,8 +5,7 @@
#include "logger.h"
#include "variables.h"
#include <boost/bind.hpp>
-
-RowState::RowValuesStack RowState::stack;
+#include "execContext.h"
RowSet::RowSet(ScriptNodePtr p) :
SourceObject(p)
@@ -19,11 +18,11 @@ RowState::RowState() :
}
void
-RowState::process(const RowProcessorCallback & rp, bool r)
+RowState::process(ExecContext * ec, const RowProcessorCallback & rp, bool r)
{
rowNum += 1;
- stack.push_back(this);
- ScopeObject s(boost::bind(&RowState::RowValuesStack::pop_back, &stack));
+ ec->RowValuesPush(this);
+ ScopeObject s(boost::bind(&ExecContext::RowValuesPop, ec));
rp(this);
if (r) {
reset();
diff --git a/project2/common/rowSet.h b/project2/common/rowSet.h
index e6793c5..f36f79f 100644
--- a/project2/common/rowSet.h
+++ b/project2/common/rowSet.h
@@ -40,7 +40,7 @@ class RowState {
SimpleMessageException(AttributeDoesNotExist);
VariableType getRowNum() const;
- void process(const RowProcessorCallback &, bool reset = true);
+ void process(ExecContext *, const RowProcessorCallback &, bool reset = true);
void blankRow();
void reset();
virtual VariableType getCurrentValue(ExecContext *, const Glib::ustring & id) const;
@@ -52,13 +52,8 @@ class RowState {
typedef std::vector<VariableType> FieldValues;
FieldValues fields;
-
- typedef std::vector<const RowState *> RowValuesStack;
- static const RowValuesStack & Stack() { return stack; }
-
private:
unsigned int rowNum;
- static RowValuesStack stack;
};
#endif
diff --git a/project2/common/variables.cpp b/project2/common/variables.cpp
index eb36d7a..87673a7 100644
--- a/project2/common/variables.cpp
+++ b/project2/common/variables.cpp
@@ -13,6 +13,7 @@
#include <boost/function.hpp>
#include <boost/bind.hpp>
#include "instanceStore.impl.h"
+#include "execContext.h"
VariableImplDyn::VariableImplDyn(ScriptNodePtr e)
{
@@ -45,10 +46,7 @@ class VariableParent : public VariableImplDyn {
VariableType value(ExecContext * ec) const
{
try {
- if (depth > RowState::Stack().size()) {
- throw RowSet::ParentOutOfRange(depth);
- }
- const auto & row = RowState::Stack()[RowState::Stack().size() - depth];
+ const auto & row = ec->RowValues(depth);
if (attr) {
return row->resolveAttr(name)();
}
diff --git a/project2/files/fsRows.cpp b/project2/files/fsRows.cpp
index 657973f..d22b6ea 100644
--- a/project2/files/fsRows.cpp
+++ b/project2/files/fsRows.cpp
@@ -104,7 +104,7 @@ FsRows::execute(SearchState & ss, const Path & dir, const RowProcessorCallback &
lstat(ss.curPathStr.c_str(), &ss.curStat);
if (boost::algorithm::all(ss.specs, boost::bind(&SpecBase::matches, _1, &ss, ec))) {
- ss.process(rp);
+ ss.process(ec, rp);
}
if (S_ISDIR(ss.curStat.st_mode) && boost::algorithm::all(ss.specs, boost::bind(&SpecBase::recurse, _1, &ss, ec))) {
diff --git a/project2/ice/iceRows.cpp b/project2/ice/iceRows.cpp
index e9c0e9e..6e2015d 100644
--- a/project2/ice/iceRows.cpp
+++ b/project2/ice/iceRows.cpp
@@ -26,7 +26,8 @@ class IceRowState : public RowState {
VariableType & vt;
};
- IceRowState(ModelPartPtr mp)
+ IceRowState(ExecContext * e, ModelPartPtr mp) :
+ ec(e)
{
unsigned int idx = 0;
mp->OnEachChild(boost::bind(&IceRowState::AddColumn, this, boost::ref(idx), _1));
@@ -44,7 +45,7 @@ class IceRowState : public RowState {
{
auto field = fields.begin();
mp->OnEachChild(boost::bind(&IceRowState::AssignFieldValue, this, boost::ref(field), _2));
- this->process(rp);
+ this->process(ec, rp);
}
void AssignFieldValue(FieldValues::iterator & field, ModelPartPtr domp)
@@ -56,10 +57,12 @@ class IceRowState : public RowState {
}
Columns columns;
+ ExecContext * ec;
};
-RowProcSerializer::RowProcSerializer(const RowProcessorCallback & r) :
- rpc(r)
+RowProcSerializer::RowProcSerializer(ExecContext * e, const RowProcessorCallback & r) :
+ rpc(r),
+ ec(e)
{
}
@@ -75,7 +78,7 @@ RowProcSerializer::Serialize(ModelPartPtr mp)
throw std::runtime_error("Not a sequence of things");
case mpt_Complex:
{
- IceRowState irs(mp);
+ IceRowState irs(ec, mp);
irs.IterateOver(mp, rpc);
break;
}
@@ -106,7 +109,7 @@ RowProcSerializer::SerializeRow(IceRowState * & irs, ModelPartPtr mp)
break;
case mpt_Complex:
if (!irs) {
- irs = new IceRowState(mp);
+ irs = new IceRowState(ec, mp);
}
irs->IterateOver(mp, rpc);
break;
diff --git a/project2/ice/iceRows.h b/project2/ice/iceRows.h
index 4c15217..dc729ff 100644
--- a/project2/ice/iceRows.h
+++ b/project2/ice/iceRows.h
@@ -11,7 +11,7 @@ class IceRowState;
class RowProcSerializer : public Slicer::Serializer {
public:
- RowProcSerializer(const RowProcessorCallback &);
+ RowProcSerializer(ExecContext *, const RowProcessorCallback &);
void Serialize(Slicer::ModelPartPtr) override;
@@ -19,6 +19,7 @@ class RowProcSerializer : public Slicer::Serializer {
void SerializeRow(IceRowState * &, Slicer::ModelPartPtr);
const RowProcessorCallback & rpc;
+ ExecContext * ec;
};
template <typename Interface>
diff --git a/project2/ice/slice2Rows.cpp b/project2/ice/slice2Rows.cpp
index 1001f4c..8c67222 100644
--- a/project2/ice/slice2Rows.cpp
+++ b/project2/ice/slice2Rows.cpp
@@ -54,7 +54,7 @@ Slice2Rows::visitOperation(const Slice::OperationPtr & o)
fprintf(code, "\t\t\t\t\tvoid execute(const Glib::ustring &, const RowProcessorCallback & rp, ExecContext * ec) const\n");
fprintf(code, "\t\t\t\t\t{\n");
FunctionBegin(o);
- fprintf(code, "\t\t\t\t\t\tSlicer::SerializerPtr toRpc = new RowProcSerializer(rp);\n");
+ fprintf(code, "\t\t\t\t\t\tSlicer::SerializerPtr toRpc = new RowProcSerializer(ec, rp);\n");
fprintf(code, "\t\t\t\t\t\tauto result = ");
CallOperation(o);
fprintf(code, ";\n");
diff --git a/project2/ice/unittests/testClient.cpp b/project2/ice/unittests/testClient.cpp
index 97acd0b..55663a0 100644
--- a/project2/ice/unittests/testClient.cpp
+++ b/project2/ice/unittests/testClient.cpp
@@ -13,7 +13,7 @@
#include <scopeObject.h>
#include <unittest.h>
#include <unittestComplex.h>
-#include <appInstance.h>
+#include <testAppInstance.h>
#define XSTR(s) STR(s)
#define STR(s) #s
@@ -103,7 +103,7 @@ class DummyComplex : public UnitTestComplex::ComplexInterface {
static
void
-commonTests()
+commonTests(ExecContext * ec)
{
BOOST_TEST_CHECKPOINT("Verify loaded");
BOOST_REQUIRE(ElementLoader::getFor("UnitTest-SimpleInterface-SomeTask"));
@@ -132,7 +132,7 @@ commonTests()
boost::intrusive_ptr<TestScriptHost> sr = new TestScriptHost(r);
BOOST_REQUIRE_EQUAL(dummy->execCount, 0);
BOOST_REQUIRE_EQUAL(dummyComplex->execCount, 0);
- sr->process(NULL);
+ sr->process(ec);
BOOST_REQUIRE_EQUAL(dummy->execCount, 4);
BOOST_REQUIRE_EQUAL(dummyComplex->execCount, 1);
BOOST_REQUIRE_EQUAL(sr->GetPresenterData(), iceroot / "expected" / "clientPresenter.log");
@@ -152,9 +152,9 @@ unloadTests()
BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTestComplex-ComplexInterface-ComplexRow"), NotSupported);
}
-void test_client_run(const boost::filesystem::path & tmpdir);
+void test_client_run(ExecContext *, const boost::filesystem::path & tmpdir);
-BOOST_FIXTURE_TEST_SUITE( Core, AppInstance );
+BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance );
BOOST_AUTO_TEST_CASE( test_client )
{
@@ -162,14 +162,14 @@ BOOST_AUTO_TEST_CASE( test_client )
BOOST_TEST_CHECKPOINT("Clean up");
boost::filesystem::remove_all(tmpdir);
- test_client_run(tmpdir);
- test_client_run(tmpdir);
+ test_client_run(this, tmpdir);
+ test_client_run(this, tmpdir);
boost::filesystem::remove_all(tmpdir);
}
BOOST_AUTO_TEST_SUITE_END();
-void test_client_run(const boost::filesystem::path & tmpdir)
+void test_client_run(ExecContext * ec, const boost::filesystem::path & tmpdir)
{
BOOST_TEST_CHECKPOINT("Configure, compile, link, load");
TestOptionsSource::LoadTestOptions({
@@ -186,7 +186,7 @@ void test_client_run(const boost::filesystem::path & tmpdir)
BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestTypes.client.so"));
BOOST_REQUIRE(!boost::filesystem::exists(tmpdir / "unittestComplex.so"));
BOOST_REQUIRE(boost::filesystem::exists(tmpdir / "unittestComplex.client.so"));
- commonTests();
+ commonTests(ec);
TestOptionsSource::LoadTestOptions({ });
unloadTests();
diff --git a/project2/ice/unittests/testClientCompile.cpp b/project2/ice/unittests/testClientCompile.cpp
index 3b27d63..ef4b0ea 100644
--- a/project2/ice/unittests/testClientCompile.cpp
+++ b/project2/ice/unittests/testClientCompile.cpp
@@ -8,7 +8,7 @@
#include <scripts.h>
#include <testScriptHost.h>
#include <scopeObject.h>
-#include <appInstance.h>
+#include <testAppInstance.h>
#define XSTR(s) STR(s)
#define STR(s) #s
@@ -41,7 +41,7 @@ unloadTests()
BOOST_REQUIRE_THROW(ElementLoader::getFor("UnitTest-SimpleInterface-SomeRowsParams"), NotSupported);
}
-BOOST_FIXTURE_TEST_SUITE( Core, AppInstance );
+BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance );
BOOST_AUTO_TEST_CASE( compile_client_full )
{
diff --git a/project2/ice/unittests/testDaemon.cpp b/project2/ice/unittests/testDaemon.cpp
index a01782e..3ca9261 100644
--- a/project2/ice/unittests/testDaemon.cpp
+++ b/project2/ice/unittests/testDaemon.cpp
@@ -8,7 +8,7 @@
#include <task.h>
#include <logger.h>
#include <variables.h>
-#include <appInstance.h>
+#include <testAppInstance.h>
#define XSTR(s) STR(s)
#define STR(s) #s
@@ -196,7 +196,7 @@ unloadTests()
BOOST_REQUIRE_THROW(IceDaemonAdapterHandlerLoader::createNew("UnitTest-SimpleInterface", NULL), NotSupported);
}
-BOOST_FIXTURE_TEST_SUITE( Core, AppInstance );
+BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance );
BOOST_AUTO_TEST_CASE( test_daemon )
{
diff --git a/project2/ice/unittests/testDaemonCompile.cpp b/project2/ice/unittests/testDaemonCompile.cpp
index 02c64d6..d93dbf0 100644
--- a/project2/ice/unittests/testDaemonCompile.cpp
+++ b/project2/ice/unittests/testDaemonCompile.cpp
@@ -4,7 +4,7 @@
#include <testOptionsSource.h>
#include <exceptions.h>
#include <iceDaemon.h>
-#include <appInstance.h>
+#include <testAppInstance.h>
#define XSTR(s) STR(s)
#define STR(s) #s
@@ -29,7 +29,7 @@ unloadTests()
BOOST_REQUIRE_THROW(IceDaemonAdapterHandlerLoader::createNew("UnitTest-SimpleInterface", NULL), NotSupported);
}
-BOOST_FIXTURE_TEST_SUITE( Core, AppInstance );
+BOOST_FIXTURE_TEST_SUITE( Core, TestAppInstance );
BOOST_AUTO_TEST_CASE( compile_daemon_full )
{
diff --git a/project2/regex/regexRows.cpp b/project2/regex/regexRows.cpp
index 514d47a..6d72ccc 100644
--- a/project2/regex/regexRows.cpp
+++ b/project2/regex/regexRows.cpp
@@ -31,7 +31,7 @@ RegexRows::execute(const Glib::ustring&, const RowProcessorCallback & rp, ExecCo
for (n = 1; n < cols; n += 1) {
cv.fields[n - 1] = matches.fetch(n);
}
- cv.process(rp);
+ cv.process(ec, rp);
} while (matches.next());
}
}
diff --git a/project2/sql/sqlCache.cpp b/project2/sql/sqlCache.cpp
index 3fca870..142bf6f 100644
--- a/project2/sql/sqlCache.cpp
+++ b/project2/sql/sqlCache.cpp
@@ -85,7 +85,7 @@ class SqlCache : public RowSetCache {
friend class SqlCacheRowSet;
const SqlCacheRowSet * sc;
};
- void execute(const Glib::ustring&, const RowProcessorCallback & rp, ExecContext *) const {
+ void execute(const Glib::ustring&, const RowProcessorCallback & rp, ExecContext * ec) const {
SqlCacheRowState ss(this);
HandleAsVariableType h;
do {
@@ -115,7 +115,7 @@ class SqlCache : public RowSetCache {
col.apply(h);
ss.fields[&c - &colCols.front()] = h.variable;
}
- ss.process(rp);
+ ss.process(ec, rp);
}
} while (s->fetch());
}
diff --git a/project2/sql/sqlMergeTask.cpp b/project2/sql/sqlMergeTask.cpp
index d0f6499..df4b0c0 100644
--- a/project2/sql/sqlMergeTask.cpp
+++ b/project2/sql/sqlMergeTask.cpp
@@ -7,6 +7,7 @@
#include "sqlVariableBinder.h"
#include "scriptLoader.h"
#include "scopeObject.h"
+#include "execContext.h"
#include <misc.h>
#include <stdio.h>
#include <stdexcept>
@@ -277,7 +278,7 @@ class Populate : public NoOutputExecute {
void execute(ExecContext * ec) const
{
unsigned int idx = 0;
- RowState::Stack().back()->foreachColumn(ec, boost::bind(&Populate::bind, this, boost::ref(idx), _3));
+ ec->RowValues(0)->foreachColumn(ec, boost::bind(&Populate::bind, this, boost::ref(idx), _3));
cmd->execute();
}
private:
diff --git a/project2/sql/sqlRows.cpp b/project2/sql/sqlRows.cpp
index 59aa0e8..f8a16e1 100644
--- a/project2/sql/sqlRows.cpp
+++ b/project2/sql/sqlRows.cpp
@@ -61,7 +61,7 @@ SqlRows::execute(const Glib::ustring & filter, const RowProcessorCallback & rp,
col.apply(h);
ss.fields[c] = h.variable;
}
- ss.process(rp);
+ ss.process(ec, rp);
}
}
diff --git a/project2/streams/streamNvpRows.cpp b/project2/streams/streamNvpRows.cpp
index 02d1adc..8bc5b87 100644
--- a/project2/streams/streamNvpRows.cpp
+++ b/project2/streams/streamNvpRows.cpp
@@ -33,9 +33,10 @@ class StreamNvpRows : public RowSet {
mutable size_t firstMatch;
};
- ParseState(const StreamNvpRows * rows, const RowProcessorCallback & proc) :
+ ParseState(const StreamNvpRows * rows, ExecContext * e, const RowProcessorCallback & proc) :
sr(rows),
rp(proc),
+ ec(e),
inQuotes(false),
inValue(false),
prevWasQuote(false)
@@ -99,7 +100,7 @@ class StreamNvpRows : public RowSet {
}
}
if (!columns.empty()) {
- process(rp);
+ process(ec, rp);
}
fields.clear();
columns.clear();
@@ -135,6 +136,7 @@ class StreamNvpRows : public RowSet {
const StreamNvpRows * sr;
const RowProcessorCallback & rp;
+ ExecContext * ec;
bool inQuotes;
bool inValue;
bool prevWasQuote;
@@ -161,7 +163,7 @@ class StreamNvpRows : public RowSet {
void execute(const Glib::ustring &, const RowProcessorCallback & rp, ExecContext * ec) const
{
- ParseState ps(this, rp);
+ ParseState ps(this, ec, rp);
TextReader::CharSink cs = boost::bind(&StreamNvpRows::ParseState::pushChar, &ps, _1);
TextReader t(encoding.c_str());
stream->runStream(boost::bind(&TextReader::read, &t, _1, _2, cs), ec);
diff --git a/project2/streams/streamRows.cpp b/project2/streams/streamRows.cpp
index 890e1d7..1b9063f 100644
--- a/project2/streams/streamRows.cpp
+++ b/project2/streams/streamRows.cpp
@@ -14,10 +14,11 @@ class StreamRows : public DefinedColumns, public RowSet {
public:
class ParseState : public ColumnValues {
public:
- ParseState(const StreamRows * rows, const RowProcessorCallback & proc) :
+ ParseState(const StreamRows * rows, ExecContext * e, const RowProcessorCallback & proc) :
ColumnValues(rows),
sr(rows),
rp(proc),
+ ec(e),
skipheader(rows->skipheader),
inQuotes(false),
prevWasQuote(false),
@@ -34,6 +35,7 @@ class StreamRows : public DefinedColumns, public RowSet {
const StreamRows * sr;
const RowProcessorCallback & rp;
+ ExecContext * ec;
size_t skipheader;
bool inQuotes;
bool prevWasQuote;
@@ -59,7 +61,7 @@ class StreamRows : public DefinedColumns, public RowSet {
void execute(const Glib::ustring &, const RowProcessorCallback & rp, ExecContext * ec) const
{
- ParseState ps(this, rp);
+ ParseState ps(this, ec, rp);
TextReader::CharSink cs = boost::bind(&StreamRows::pushChar, this, _1, boost::ref(ps));
TextReader t(encoding.c_str());
stream->runStream(boost::bind(&TextReader::read, &t, _1, _2, cs), ec);
@@ -80,7 +82,7 @@ class StreamRows : public DefinedColumns, public RowSet {
while (ps.curCol != ps.fields.end()) {
*ps.curCol++ = Null();
}
- ps.process(ps.rp);
+ ps.process(ps.ec, ps.rp);
}
else if (countBlankRows) {
ps.blankRow();
@@ -125,7 +127,7 @@ class StreamRows : public DefinedColumns, public RowSet {
while (ps.curCol != ps.fields.end()) {
*ps.curCol++ = Null();
}
- ps.process(ps.rp);
+ ps.process(ps.ec, ps.rp);
}
else if (countBlankRows) {
ps.blankRow();
@@ -141,7 +143,6 @@ class StreamRows : public DefinedColumns, public RowSet {
const Glib::ustring newline;
const std::string encoding;
const size_t skipheader;
- bool convertRequired;
};
DECLARE_LOADER("streamrows", StreamRows);
diff --git a/project2/ut/testAppInstance.cpp b/project2/ut/testAppInstance.cpp
new file mode 100644
index 0000000..21e9c38
--- /dev/null
+++ b/project2/ut/testAppInstance.cpp
@@ -0,0 +1,15 @@
+#include "testAppInstance.h"
+
+VariableType
+TestAppInstance::getParameter(const VariableType &) const
+{
+ throw std::runtime_error("TestAppInstance doesn't support parameters");
+}
+
+SessionPtr
+TestAppInstance::getSession() const
+{
+ throw std::runtime_error("TestAppInstance doesn't support sessions");
+}
+
+
diff --git a/project2/ut/testAppInstance.h b/project2/ut/testAppInstance.h
new file mode 100644
index 0000000..aa52227
--- /dev/null
+++ b/project2/ut/testAppInstance.h
@@ -0,0 +1,14 @@
+#ifndef TESTAPPINSTANCE_H
+#define TESTAPPINSTANCE_H
+
+#include <appInstance.h>
+#include <execContext.h>
+
+class TestAppInstance : public AppInstance, public ExecContext {
+ public:
+ VariableType getParameter(const VariableType & key) const override;
+ SessionPtr getSession() const override;
+};
+
+#endif
+
diff --git a/project2/xml/xmlRawRows.cpp b/project2/xml/xmlRawRows.cpp
index f9a236e..eb6e003 100644
--- a/project2/xml/xmlRawRows.cpp
+++ b/project2/xml/xmlRawRows.cpp
@@ -51,7 +51,7 @@ XmlRawRowsBase::XmlRawRowsBase() :
{
}
-void XmlRawRowsBase::execute(const xmlpp::Document * doc, const RowProcessorCallback & rp, ExecContext *) const
+void XmlRawRowsBase::execute(const xmlpp::Document * doc, const RowProcessorCallback & rp, ExecContext * ec) const
{
XmlRowState rs;
for (const xmlpp::Node * n : doc->get_root_node()->get_children()) {
@@ -76,7 +76,7 @@ void XmlRawRowsBase::execute(const xmlpp::Document * doc, const RowProcessorCall
col++;
}
}
- rs.process(rp);
+ rs.process(ec, rp);
}
}
}
diff --git a/project2/xml/xmlRows.cpp b/project2/xml/xmlRows.cpp
index e45ec03..e0ffb5b 100644
--- a/project2/xml/xmlRows.cpp
+++ b/project2/xml/xmlRows.cpp
@@ -87,7 +87,7 @@ XmlRows::execute(const Glib::ustring &, const RowProcessorCallback & rp, ExecCon
}
if (empty) {
if (position == trigger) {
- xs.process(rp, false);
+ xs.process(ec, rp, false);
}
if (position == root) {
xs.reset();
@@ -104,7 +104,7 @@ XmlRows::execute(const Glib::ustring &, const RowProcessorCallback & rp, ExecCon
case XML_READER_TYPE_END_ELEMENT:
if (enableCapture) {
if (position == trigger) {
- xs.process(rp, false);
+ xs.process(ec, rp, false);
}
if (position == root) {
xs.reset();
diff --git a/project2/xml/xpathRows.cpp b/project2/xml/xpathRows.cpp
index a73dd39..e97270f 100644
--- a/project2/xml/xpathRows.cpp
+++ b/project2/xml/xpathRows.cpp
@@ -111,7 +111,7 @@ XPathRows::execute(const Glib::ustring & filter, const RowProcessorCallback & rp
xs.fields[xp->idx] = str;
}
}
- xs.process(rp);
+ xs.process(ec, rp);
}
}