summaryrefslogtreecommitdiff
path: root/project2/basics
diff options
context:
space:
mode:
Diffstat (limited to 'project2/basics')
-rw-r--r--project2/basics/aggregates/avg.cpp2
-rw-r--r--project2/basics/aggregates/count.cpp2
-rw-r--r--project2/basics/aggregates/countDistinct.cpp2
-rw-r--r--project2/basics/aggregates/distinct.cpp2
-rw-r--r--project2/basics/aggregates/join.cpp4
-rw-r--r--project2/basics/aggregates/max.cpp2
-rw-r--r--project2/basics/aggregates/min.cpp2
-rw-r--r--project2/basics/aggregates/sum.cpp2
-rw-r--r--project2/basics/functions/dates.cpp20
-rw-r--r--project2/basics/functions/strings.cpp4
-rw-r--r--project2/basics/pch.hpp1
-rw-r--r--project2/basics/tests/compoundTest.cpp16
-rw-r--r--project2/basics/tests/equals.cpp4
-rw-r--r--project2/basics/tests/isdistinct.cpp6
-rw-r--r--project2/basics/tests/isuniq.cpp8
-rw-r--r--project2/basics/tests/validDateCheck.cpp8
16 files changed, 42 insertions, 43 deletions
diff --git a/project2/basics/aggregates/avg.cpp b/project2/basics/aggregates/avg.cpp
index 62239b3..900bc5f 100644
--- a/project2/basics/aggregates/avg.cpp
+++ b/project2/basics/aggregates/avg.cpp
@@ -12,7 +12,7 @@ class Average : public ValueAggregate {
{
vals.clear();
}
- void pushValue(const VariableType & v) const
+ void pushValue(const VariableType & v, ExecContext *) const
{
if (!v.isNull()) {
vals.push_back(v);
diff --git a/project2/basics/aggregates/count.cpp b/project2/basics/aggregates/count.cpp
index 725be72..be22783 100644
--- a/project2/basics/aggregates/count.cpp
+++ b/project2/basics/aggregates/count.cpp
@@ -11,7 +11,7 @@ class Count : public ValueAggregate {
{
c = 0;
}
- void pushValue(const VariableType & v) const
+ void pushValue(const VariableType & v, ExecContext *) const
{
if (!v.isNull()) {
c += 1;
diff --git a/project2/basics/aggregates/countDistinct.cpp b/project2/basics/aggregates/countDistinct.cpp
index b471911..205b932 100644
--- a/project2/basics/aggregates/countDistinct.cpp
+++ b/project2/basics/aggregates/countDistinct.cpp
@@ -10,7 +10,7 @@ class CountDistinct : public ValueAggregate {
{
result.clear();
}
- void pushValue(const VariableType & v) const
+ void pushValue(const VariableType & v, ExecContext *) const
{
result.insert(v);
}
diff --git a/project2/basics/aggregates/distinct.cpp b/project2/basics/aggregates/distinct.cpp
index ebac934..6039588 100644
--- a/project2/basics/aggregates/distinct.cpp
+++ b/project2/basics/aggregates/distinct.cpp
@@ -11,7 +11,7 @@ class Distinct : public SetAggregate {
{
result.clear();
}
- void pushValue(const VariableType & v) const
+ void pushValue(const VariableType & v, ExecContext *) const
{
result.insert(v);
}
diff --git a/project2/basics/aggregates/join.cpp b/project2/basics/aggregates/join.cpp
index 841eb9a..405c093 100644
--- a/project2/basics/aggregates/join.cpp
+++ b/project2/basics/aggregates/join.cpp
@@ -13,10 +13,10 @@ class Join : public ValueAggregate {
sum.clear();
first = true;
}
- void pushValue(const VariableType & v) const
+ void pushValue(const VariableType & v, ExecContext * ec) const
{
if (!first) {
- sum += sep().as<Glib::ustring>();
+ sum += sep(ec).as<Glib::ustring>();
}
sum += v.as<Glib::ustring>();
first = false;
diff --git a/project2/basics/aggregates/max.cpp b/project2/basics/aggregates/max.cpp
index ef904ed..6304647 100644
--- a/project2/basics/aggregates/max.cpp
+++ b/project2/basics/aggregates/max.cpp
@@ -8,7 +8,7 @@ class Max : public ValueAggregate {
{
result = VariableType();
}
- void pushValue(const VariableType & v) const
+ void pushValue(const VariableType & v, ExecContext *) const
{
if (result < v) {
result = v;
diff --git a/project2/basics/aggregates/min.cpp b/project2/basics/aggregates/min.cpp
index ee0bf3d..75b0b87 100644
--- a/project2/basics/aggregates/min.cpp
+++ b/project2/basics/aggregates/min.cpp
@@ -12,7 +12,7 @@ class Min : public ValueAggregate {
result = VariableType();
first = true;
}
- void pushValue(const VariableType & v) const
+ void pushValue(const VariableType & v, ExecContext *) const
{
if (first || v < result) {
result = v;
diff --git a/project2/basics/aggregates/sum.cpp b/project2/basics/aggregates/sum.cpp
index 9bc1120..68a9cd4 100644
--- a/project2/basics/aggregates/sum.cpp
+++ b/project2/basics/aggregates/sum.cpp
@@ -11,7 +11,7 @@ class Sum : public ValueAggregate {
{
sum = 0;
}
- void pushValue(const VariableType & v) const
+ void pushValue(const VariableType & v, ExecContext *) const
{
sum += v.as<double>();
}
diff --git a/project2/basics/functions/dates.cpp b/project2/basics/functions/dates.cpp
index f2dcb20..b19b921 100644
--- a/project2/basics/functions/dates.cpp
+++ b/project2/basics/functions/dates.cpp
@@ -16,10 +16,10 @@ class ParseDate : public VariableImpl {
format(e, "format")
{
}
- VariableType value() const
+ VariableType value(ExecContext * ec) const
{
- const char * s = string();
- const char * f = format();
+ const char * s = string(ec);
+ const char * f = format(ec);
struct tm tm;
memset(&tm, 0, sizeof(struct tm));
mktime(&tm);
@@ -27,7 +27,7 @@ class ParseDate : public VariableImpl {
if (!e || *e) {
Logger()->messagef(LOG_ERR, "%s: check failed (parse) for '%s' against '%s' (remaining chars='%s')",
__PRETTY_FUNCTION__, s, f, e);
- throw DateParseError(string(), format());
+ throw DateParseError(string(ec), format(ec));
}
return boost::posix_time::ptime(boost::posix_time::ptime_from_tm(tm));
}
@@ -44,13 +44,13 @@ class FormatDate : public VariableImpl {
format(e, "format")
{
}
- VariableType value() const
+ VariableType value(ExecContext * ec) const
{
std::stringstream ss;
boost::date_time::time_facet<boost::posix_time::ptime, char> * ft = new boost::date_time::time_facet<boost::posix_time::ptime, char>();
ss.imbue(std::locale(ss.getloc(), ft));
- ft->format(format());
- ss << boost::get<boost::posix_time::ptime>(date());
+ ft->format(format(ec));
+ ss << boost::get<boost::posix_time::ptime>(date(ec));
return ss.str();
}
private:
@@ -66,9 +66,9 @@ class AdjustDate : public VariableImpl {
offset(e, "offset")
{
}
- VariableType value() const
+ VariableType value(ExecContext * ec) const
{
- return boost::get<boost::posix_time::ptime>(date()) + boost::posix_time::duration_from_string(offset());
+ return boost::get<boost::posix_time::ptime>(date(ec)) + boost::posix_time::duration_from_string(offset(ec));
}
private:
Variable date;
@@ -81,7 +81,7 @@ class CurrentDate : public VariableImpl {
CurrentDate(ScriptNodePtr)
{
}
- VariableType value() const
+ VariableType value(ExecContext *) const
{
return boost::posix_time::microsec_clock::universal_time();
}
diff --git a/project2/basics/functions/strings.cpp b/project2/basics/functions/strings.cpp
index d4ba7b7..735a781 100644
--- a/project2/basics/functions/strings.cpp
+++ b/project2/basics/functions/strings.cpp
@@ -10,9 +10,9 @@ class Trim : public VariableImpl {
string(e, "string")
{
}
- VariableType value() const
+ VariableType value(ExecContext * ec) const
{
- Glib::ustring str = string();
+ Glib::ustring str = string(ec);
Glib::ustring::const_iterator b = str.begin();
while (Glib::Unicode::isspace(*b)) ++b;
Glib::ustring::const_iterator e = str.end();
diff --git a/project2/basics/pch.hpp b/project2/basics/pch.hpp
index d52b275..0421cfb 100644
--- a/project2/basics/pch.hpp
+++ b/project2/basics/pch.hpp
@@ -4,7 +4,6 @@
#include <aggregate.h>
#include <algorithm>
-#include <appEngine.h>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/bind.hpp>
#include <boost/date_time.hpp>
diff --git a/project2/basics/tests/compoundTest.cpp b/project2/basics/tests/compoundTest.cpp
index b361db5..119026e 100644
--- a/project2/basics/tests/compoundTest.cpp
+++ b/project2/basics/tests/compoundTest.cpp
@@ -20,11 +20,11 @@ class All : public CompoundTest {
SourceObject(s),
CompoundTest(s) {
}
- bool passes() const {
+ bool passes(ExecContext * ec) const {
if (tests.empty()) {
throw NoTestsToPerform();
}
- return (std::find_if(tests.begin(), tests.end(), !boost::bind(&Test::passes, _1)) == tests.end());
+ return (std::find_if(tests.begin(), tests.end(), !boost::bind(&Test::passes, _1, ec)) == tests.end());
}
};
DECLARE_LOADER("all", All);
@@ -35,11 +35,11 @@ class Any : public CompoundTest {
SourceObject(s),
CompoundTest(s) {
}
- bool passes() const {
+ bool passes(ExecContext * ec) const {
if (tests.empty()) {
throw NoTestsToPerform();
}
- return (std::find_if(tests.begin(), tests.end(), boost::bind(&Test::passes, _1)) != tests.end());
+ return (std::find_if(tests.begin(), tests.end(), boost::bind(&Test::passes, _1, ec)) != tests.end());
}
};
DECLARE_LOADER("any", Any);
@@ -50,11 +50,11 @@ class None : public CompoundTest {
SourceObject(s),
CompoundTest(s) {
}
- bool passes() const {
+ bool passes(ExecContext * ec) const {
if (tests.empty()) {
throw NoTestsToPerform();
}
- return (std::find_if(tests.begin(), tests.end(), boost::bind(&Test::passes, _1)) == tests.end());
+ return (std::find_if(tests.begin(), tests.end(), boost::bind(&Test::passes, _1, ec)) == tests.end());
}
};
DECLARE_LOADER("none", None);
@@ -67,11 +67,11 @@ class Not : public Test {
{
s->script->loader.addLoadTarget(s, Storer::into<ElementLoader>(&test));
}
- bool passes() const {
+ bool passes(ExecContext * ec) const {
if (!test) {
throw NoTestsToPerform();
}
- return !test->passes();
+ return !test->passes(ec);
}
private:
TestPtr test;
diff --git a/project2/basics/tests/equals.cpp b/project2/basics/tests/equals.cpp
index ba8c695..6c7a74f 100644
--- a/project2/basics/tests/equals.cpp
+++ b/project2/basics/tests/equals.cpp
@@ -13,8 +13,8 @@ class Equals : public Test {
{
}
- bool passes() const {
- return (a() == b());
+ bool passes(ExecContext * ec) const {
+ return (a(ec) == b(ec));
}
private:
diff --git a/project2/basics/tests/isdistinct.cpp b/project2/basics/tests/isdistinct.cpp
index ab7bf1b..303f88d 100644
--- a/project2/basics/tests/isdistinct.cpp
+++ b/project2/basics/tests/isdistinct.cpp
@@ -17,13 +17,13 @@ class IsDistinct : public Test, IHaveParameters {
void loadComplete(const CommonObjects *)
{
- findComponent(scope())->registerFor(RowProcessor::Complete, boost::bind(&IsDistinct::reset, this));
+ findComponent(scope(NULL))->registerFor(RowProcessor::Complete, boost::bind(&IsDistinct::reset, this));
}
- bool passes() const {
+ bool passes(ExecContext * ec) const {
Vars row;
BOOST_FOREACH(const Parameters::value_type & p, parameters) {
- row.push_back(p.second());
+ row.push_back(p.second(ec));
}
return previous.insert(row).second;
}
diff --git a/project2/basics/tests/isuniq.cpp b/project2/basics/tests/isuniq.cpp
index c14ea84..e33aba8 100644
--- a/project2/basics/tests/isuniq.cpp
+++ b/project2/basics/tests/isuniq.cpp
@@ -17,21 +17,21 @@ class IsUniq : public Test, IHaveParameters {
void loadComplete(const CommonObjects *)
{
- findComponent(scope())->registerFor(RowProcessor::Complete, boost::bind(&IsUniq::reset, this));
+ findComponent(scope(NULL))->registerFor(RowProcessor::Complete, boost::bind(&IsUniq::reset, this));
}
- bool passes() const {
+ bool passes(ExecContext * ec) const {
if (previous.size() > 0) {
Vars row;
BOOST_FOREACH(const Parameters::value_type & p, parameters) {
- row.push_back(p.second());
+ row.push_back(p.second(ec));
}
std::swap(row, previous);
return row != previous;
}
else {
BOOST_FOREACH(const Parameters::value_type & p, parameters) {
- previous.push_back(p.second());
+ previous.push_back(p.second(ec));
}
return true;
}
diff --git a/project2/basics/tests/validDateCheck.cpp b/project2/basics/tests/validDateCheck.cpp
index 8dffd9d..b1ab5a3 100644
--- a/project2/basics/tests/validDateCheck.cpp
+++ b/project2/basics/tests/validDateCheck.cpp
@@ -13,7 +13,7 @@ class ValidDateTest : public Test {
Test(p),
applyTo(p, "apply-to"),
format(p, "format"),
- warnLev(p->value("warn", true).as<bool>() ? LOG_WARNING : LOG_INFO)
+ warnLev(p->value("warn", true, NULL).as<bool>() ? LOG_WARNING : LOG_INFO)
{
}
@@ -22,13 +22,13 @@ class ValidDateTest : public Test {
}
bool
- passes() const
+ passes(ExecContext * ec) const
{
struct tm tm, ftm;
memset(&tm, 0, sizeof(struct tm));
mktime(&tm);
- const char * at = applyTo();
- const char * f = format();
+ const char * at = applyTo(ec);
+ const char * f = format(ec);
const char * s = strptime(at, f, &tm);
if (!s || *s) {
Logger()->messagef(warnLev, "%s: check failed (parse) for '%s' against '%s'",