summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project2/basics/functions/dates.cpp8
-rw-r--r--project2/basics/functions/strings.cpp2
-rw-r--r--project2/cgi/cgiRequestID.cpp3
-rw-r--r--project2/cgi/cgiUriParam.cpp2
-rw-r--r--project2/common/unittests/testConfig.cpp2
-rw-r--r--project2/common/variables.cpp5
-rw-r--r--project2/common/variables.h6
-rw-r--r--project2/common/variables/config.cpp4
-rw-r--r--project2/common/variables/literal.cpp5
-rw-r--r--project2/common/variables/localparam.cpp2
-rw-r--r--project2/common/variables/lookup.cpp2
-rw-r--r--project2/common/variables/param.cpp2
-rw-r--r--project2/common/variables/session.cpp2
-rw-r--r--project2/files/functions/pwd.cpp2
-rw-r--r--project2/files/presenterCache.cpp2
-rw-r--r--project2/xml/xmlScriptParser.cpp8
16 files changed, 27 insertions, 30 deletions
diff --git a/project2/basics/functions/dates.cpp b/project2/basics/functions/dates.cpp
index b19b921..91a7077 100644
--- a/project2/basics/functions/dates.cpp
+++ b/project2/basics/functions/dates.cpp
@@ -35,7 +35,7 @@ class ParseDate : public VariableImpl {
Variable string;
Variable format;
};
-DECLARE_COMPONENT_LOADER("parsedate", ParseDate, VariableLoader);
+NAMEDFACTORY("parsedate", ParseDate, VariableFactory);
class FormatDate : public VariableImpl {
public:
@@ -57,7 +57,7 @@ class FormatDate : public VariableImpl {
Variable date;
Variable format;
};
-DECLARE_COMPONENT_LOADER("formatdate", FormatDate, VariableLoader);
+NAMEDFACTORY("formatdate", FormatDate, VariableFactory);
class AdjustDate : public VariableImpl {
public:
@@ -74,7 +74,7 @@ class AdjustDate : public VariableImpl {
Variable date;
Variable offset;
};
-DECLARE_COMPONENT_LOADER("adjustdate", AdjustDate, VariableLoader);
+NAMEDFACTORY("adjustdate", AdjustDate, VariableFactory);
class CurrentDate : public VariableImpl {
public:
@@ -86,5 +86,5 @@ class CurrentDate : public VariableImpl {
return boost::posix_time::microsec_clock::universal_time();
}
};
-DECLARE_COMPONENT_LOADER("currentdate", CurrentDate, VariableLoader);
+NAMEDFACTORY("currentdate", CurrentDate, VariableFactory);
diff --git a/project2/basics/functions/strings.cpp b/project2/basics/functions/strings.cpp
index 735a781..640cfb3 100644
--- a/project2/basics/functions/strings.cpp
+++ b/project2/basics/functions/strings.cpp
@@ -23,6 +23,6 @@ class Trim : public VariableImpl {
private:
Variable string;
};
-DECLARE_COMPONENT_LOADER("trim", Trim, VariableLoader);
+NAMEDFACTORY("trim", Trim, VariableFactory);
diff --git a/project2/cgi/cgiRequestID.cpp b/project2/cgi/cgiRequestID.cpp
index 038fff5..88c212c 100644
--- a/project2/cgi/cgiRequestID.cpp
+++ b/project2/cgi/cgiRequestID.cpp
@@ -50,6 +50,5 @@ class CgiRequestID : public VariableImplDyn {
return hashstr.str();
}
};
-DECLARE_COMPONENT_LOADER("requestid", CgiRequestID, VariableLoader);
-
+NAMEDFACTORY("requestid", CgiRequestID, VariableFactory);
diff --git a/project2/cgi/cgiUriParam.cpp b/project2/cgi/cgiUriParam.cpp
index 985048d..edce6f8 100644
--- a/project2/cgi/cgiUriParam.cpp
+++ b/project2/cgi/cgiUriParam.cpp
@@ -27,5 +27,5 @@ class VariableUri : public VariableImplDyn {
private:
Variable index;
};
-DECLARE_COMPONENT_LOADER("uri", VariableUri, VariableLoader);
+NAMEDFACTORY("uri", VariableUri, VariableFactory);
diff --git a/project2/common/unittests/testConfig.cpp b/project2/common/unittests/testConfig.cpp
index 8c25394..10e2a04 100644
--- a/project2/common/unittests/testConfig.cpp
+++ b/project2/common/unittests/testConfig.cpp
@@ -9,7 +9,7 @@ BOOST_AUTO_TEST_CASE( config_application_value )
TestOptionsSource::LoadTestOptions({
{ "application.data", "testvalue" }
});
- Variable::VariableImplPtr c = VariableLoader::createNew("config", new TestScriptNode({
+ Variable::VariableImplPtr c = VariableFactory::createNew("config", new TestScriptNode({
{ "name", VariableType("data") }
}));
BOOST_REQUIRE(c);
diff --git a/project2/common/variables.cpp b/project2/common/variables.cpp
index 87673a7..71cc36b 100644
--- a/project2/common/variables.cpp
+++ b/project2/common/variables.cpp
@@ -14,6 +14,7 @@
#include <boost/bind.hpp>
#include "instanceStore.impl.h"
#include "execContext.h"
+#include <factory.impl.h>
VariableImplDyn::VariableImplDyn(ScriptNodePtr e)
{
@@ -72,7 +73,7 @@ class VariableParent : public VariableImplDyn {
const bool attr;
const Glib::ustring name;
};
-DECLARE_COMPONENT_LOADER("parent", VariableParent, VariableLoader);
+NAMEDFACTORY("parent", VariableParent, VariableFactory);
Variable::Variable(VariableType def) :
@@ -116,5 +117,5 @@ Variable::fromScriptNode(ScriptNodePtr p)
return p->variable();
}
-INSTANTIATESTORE(std::string, VariableLoader);
+INSTANTIATEFACTORY(VariableImpl, ScriptNodePtr);
diff --git a/project2/common/variables.h b/project2/common/variables.h
index cee9037..89aeeaf 100644
--- a/project2/common/variables.h
+++ b/project2/common/variables.h
@@ -5,15 +5,13 @@
#include <boost/optional.hpp>
#include <stdint.h>
#include "intrusivePtrBase.h"
-#include "genLoader.h"
+#include <factory.h>
#include "scripts.h"
#include "variableType.h"
#include <boost/shared_ptr.hpp>
class ExecContext;
-SimpleMessageException(UnknownVariableSource);
-
/// Base class for Project2 variable accessors
class VariableImpl : public IntrusivePtrBase {
public:
@@ -55,7 +53,7 @@ class VariableImplDyn : public VariableImpl {
};
/// Base class to create variables
-typedef GenLoader<VariableImpl, std::string, ScriptNodePtr> VariableLoader;
+typedef AdHoc::Factory<VariableImpl, ScriptNodePtr> VariableFactory;
#endif
diff --git a/project2/common/variables/config.cpp b/project2/common/variables/config.cpp
index e134d07..273b5aa 100644
--- a/project2/common/variables/config.cpp
+++ b/project2/common/variables/config.cpp
@@ -32,7 +32,7 @@ class VariableConfig : public VariableImplDyn {
const Glib::ustring name;
};
-class VariableConfigLoader : public VariableLoader::For<VariableConfig> {
+class VariableConfigLoader : public VariableFactory::For<VariableConfig> {
public:
class AppSettings : public Options::Option {
public:
@@ -88,5 +88,5 @@ class VariableConfigLoader : public VariableLoader::For<VariableConfig> {
Options * opts;
};
-DECLARE_CUSTOM_COMPONENT_LOADER("config", VariableConfigLoader, VariableConfigLoader, VariableLoader);
+NAMEDPLUGIN("config", VariableConfigLoader, VariableFactory);
diff --git a/project2/common/variables/literal.cpp b/project2/common/variables/literal.cpp
index 529be6e..4f8e029 100644
--- a/project2/common/variables/literal.cpp
+++ b/project2/common/variables/literal.cpp
@@ -72,8 +72,7 @@ VariableLiteral::VarPart::value(ExecContext * ec) const
return (*this)(ec);
}
-DECLARE_COMPONENT_LOADER("literal", VariableLiteral, VariableLoader);
-DECLARE_CUSTOM_COMPONENT_LOADER("", VariableLiteralDef, VariableLoader::For<VariableLiteral>, VariableLoader);
-
+NAMEDFACTORY("literal", VariableLiteral, VariableFactory);
+NAMEDFACTORY("", VariableLiteral, VariableFactory);
diff --git a/project2/common/variables/localparam.cpp b/project2/common/variables/localparam.cpp
index cf2f165..63d6f55 100644
--- a/project2/common/variables/localparam.cpp
+++ b/project2/common/variables/localparam.cpp
@@ -28,5 +28,5 @@ class VariableLocalParam : public VariableImplDyn {
private:
const Glib::ustring name;
};
-DECLARE_COMPONENT_LOADER("local", VariableLocalParam, VariableLoader);
+NAMEDFACTORY("local", VariableLocalParam, VariableFactory);
diff --git a/project2/common/variables/lookup.cpp b/project2/common/variables/lookup.cpp
index 42ddff2..eac3317 100644
--- a/project2/common/variables/lookup.cpp
+++ b/project2/common/variables/lookup.cpp
@@ -70,4 +70,4 @@ class VariableLookup : public VariableImplDyn, public RowProcessor {
RowSets rowSets;
const Glib::ustring name;
};
-DECLARE_COMPONENT_LOADER("lookup", VariableLookup, VariableLoader);
+NAMEDFACTORY("lookup", VariableLookup, VariableFactory);
diff --git a/project2/common/variables/param.cpp b/project2/common/variables/param.cpp
index a1ef9b7..8e4125a 100644
--- a/project2/common/variables/param.cpp
+++ b/project2/common/variables/param.cpp
@@ -27,5 +27,5 @@ class VariableParam : public VariableImplDyn {
private:
const VariableType name;
};
-DECLARE_COMPONENT_LOADER("param", VariableParam, VariableLoader);
+NAMEDFACTORY("param", VariableParam, VariableFactory);
diff --git a/project2/common/variables/session.cpp b/project2/common/variables/session.cpp
index ed2077d..d3331c0 100644
--- a/project2/common/variables/session.cpp
+++ b/project2/common/variables/session.cpp
@@ -27,5 +27,5 @@ class VariableSession : public VariableImplDyn {
private:
const Glib::ustring name;
};
-DECLARE_COMPONENT_LOADER("session", VariableSession, VariableLoader);
+NAMEDFACTORY("session", VariableSession, VariableFactory);
diff --git a/project2/files/functions/pwd.cpp b/project2/files/functions/pwd.cpp
index 644c934..af06fe7 100644
--- a/project2/files/functions/pwd.cpp
+++ b/project2/files/functions/pwd.cpp
@@ -16,6 +16,6 @@ class Pwd : public VariableImplDyn {
return boost::filesystem::current_path().string();
}
};
-DECLARE_COMPONENT_LOADER("pwd", Pwd, VariableLoader);
+NAMEDFACTORY("pwd", Pwd, VariableFactory);
diff --git a/project2/files/presenterCache.cpp b/project2/files/presenterCache.cpp
index 1c6cae6..9e3c8ad 100644
--- a/project2/files/presenterCache.cpp
+++ b/project2/files/presenterCache.cpp
@@ -87,7 +87,7 @@ class FilePresenterCache : public PresenterCache {
FilePresenterCache(ScriptNodePtr s) :
PresenterCache(s),
- idProvider(VariableLoader::createNew(Provider, s)) {
+ idProvider(VariableFactory::createNew(Provider, s)) {
}
~FilePresenterCache()
{
diff --git a/project2/xml/xmlScriptParser.cpp b/project2/xml/xmlScriptParser.cpp
index 1c4c798..66b6b0b 100644
--- a/project2/xml/xmlScriptParser.cpp
+++ b/project2/xml/xmlScriptParser.cpp
@@ -187,7 +187,7 @@ XmlScriptNode::variable(const Glib::ustring & n) const
if (cs.size() == 1) {
if (const xmlpp::Element * c = dynamic_cast<const xmlpp::Element *>(cs.front())) {
if (const xmlpp::Attribute * source = c->get_attribute("source")) {
- return InstanceMap<VariableLoader, std::string>::Get<UnknownVariableSource>(source->get_value())->create(new XmlScriptNode(c, script));
+ return VariableFactory::createNew(source->get_value(), new XmlScriptNode(c, script));
}
else {
return new VariableLiteral(new XmlScriptNode(c, script));
@@ -201,10 +201,10 @@ VariableImpl *
XmlScriptNode::variable(const boost::optional<Glib::ustring> & defaultSource) const
{
if (const xmlpp::Attribute * source = element->get_attribute("source")) {
- return InstanceMap<VariableLoader, std::string>::Get<UnknownVariableSource>(source->get_value())->create(new XmlScriptNode(element, script));
+ return VariableFactory::createNew(source->get_value(), new XmlScriptNode(element, script));
}
else if (defaultSource) {
- return InstanceMap<VariableLoader, std::string>::Get<UnknownVariableSource>(defaultSource.get())->create(new XmlScriptNode(element, script));
+ return VariableFactory::createNew(defaultSource.get(), new XmlScriptNode(element, script));
}
else {
return new VariableLiteral(new XmlScriptNode(element, script));
@@ -223,7 +223,7 @@ XmlScriptNode::applyValue(const Glib::ustring & n, VariableType & val, ExecConte
if (const xmlpp::Element * c = dynamic_cast<const xmlpp::Element *>(cs.front())) {
boost::intrusive_ptr<VariableImpl> v;
if (const xmlpp::Attribute * source = c->get_attribute("source")) {
- v = InstanceMap<VariableLoader, std::string>::Get<UnknownVariableSource>(source->get_value())->create(new XmlScriptNode(c, script));
+ v = VariableFactory::createNew(source->get_value(), new XmlScriptNode(c, script));
}
else {
v = new VariableLiteral(new XmlScriptNode(c, script));