summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project2/cgi/cgiAppEngine.cpp3
-rw-r--r--project2/cgi/cgiAppEngine.h4
-rw-r--r--project2/commonObjects.cpp3
-rw-r--r--project2/commonObjects.h6
-rw-r--r--project2/console/consoleAppEngine.cpp5
-rw-r--r--project2/console/consoleAppEngine.h5
-rw-r--r--project2/console/p2consoleMain.cpp2
-rw-r--r--project2/dataSource.h3
-rw-r--r--project2/if.cpp5
-rw-r--r--project2/if.h1
-rw-r--r--project2/iterate.cpp2
-rw-r--r--project2/iterate.h9
-rw-r--r--project2/noOutputExecute.h2
-rw-r--r--project2/paramChecker.cpp1
-rw-r--r--project2/paramChecker.h5
-rw-r--r--project2/presenter.cpp3
-rw-r--r--project2/presenter.h1
-rw-r--r--project2/rawView.cpp2
-rw-r--r--project2/rdbmsDataSource.cpp1
-rw-r--r--project2/rdbmsDataSource.h1
-rw-r--r--project2/regexCheck.h1
-rw-r--r--project2/rowProcessor.h2
-rw-r--r--project2/rowSet.h5
-rw-r--r--project2/rowView.cpp4
-rw-r--r--project2/rowView.h4
-rw-r--r--project2/sqlCheck.cpp1
-rw-r--r--project2/sqlMergeTask.cpp10
-rw-r--r--project2/sqlMergeTask.h3
-rw-r--r--project2/sqlRows.cpp1
-rw-r--r--project2/task.h2
-rw-r--r--project2/view.h5
-rw-r--r--project2/xmlObjectLoader.cpp3
-rw-r--r--project2/xmlObjectLoader.h65
-rw-r--r--project2/xmlPresenter.cpp2
-rw-r--r--project2/xmlPresenter.h1
-rw-r--r--project2/xmlRows.cpp1
-rw-r--r--project2/xmlStorage.h66
-rw-r--r--project2/xslRows.cpp1
38 files changed, 135 insertions, 106 deletions
diff --git a/project2/cgi/cgiAppEngine.cpp b/project2/cgi/cgiAppEngine.cpp
index 345932a..40d1431 100644
--- a/project2/cgi/cgiAppEngine.cpp
+++ b/project2/cgi/cgiAppEngine.cpp
@@ -7,6 +7,7 @@
#include "../iterate.h"
#include <boost/bind.hpp>
#include <boost/regex.hpp>
+#include <boost/foreach.hpp>
#include "../sessionXml.h"
const std::string SESSIONID = "sessionID";
@@ -169,7 +170,7 @@ CgiApplicationEngine::RequestStage::run()
}
}
try {
- BOOST_FOREACH(const NoOutputExecutes::value_type & t, tasks.get<bySOOrder>()) {
+ BOOST_FOREACH(const Tasks::value_type & t, tasks.get<bySOOrder>()) {
t->execute();
}
// Commit data source transactions (without invoking a connection)
diff --git a/project2/cgi/cgiAppEngine.h b/project2/cgi/cgiAppEngine.h
index 2bef0f6..1425207 100644
--- a/project2/cgi/cgiAppEngine.h
+++ b/project2/cgi/cgiAppEngine.h
@@ -65,8 +65,10 @@ class CgiApplicationEngine : public ApplicationEngine {
virtual StagePtr run();
std::string present;
protected:
+ typedef Storage<ParamChecker>::Objects ParamCheckers;
ParamCheckers parameterChecks;
- NoOutputExecutes tasks;
+ typedef Storage<NoOutputExecute>::Objects Tasks;
+ Tasks tasks;
};
class PresentStage : public Stage, public XmlPresenter {
diff --git a/project2/commonObjects.cpp b/project2/commonObjects.cpp
index 89eb913..fcf479c 100644
--- a/project2/commonObjects.cpp
+++ b/project2/commonObjects.cpp
@@ -1,4 +1,5 @@
#include "commonObjects.h"
+#include "xmlObjectLoader.h"
#include <libxml++/parsers/domparser.h>
#include <libxml/xinclude.h>
@@ -18,7 +19,7 @@ CommonObjects::getSource(const std::string & name) const
throw CommonObjects::DataSourceNotFound(name);
}
-DataSources::index<bySOName>::type::const_iterator
+CommonObjects::DataSources::index<bySOName>::type::const_iterator
CommonObjects::loadDataSource(const std::string & name) const
{
xmlpp::DomParser xml("datasources/" + name + ".xml");
diff --git a/project2/commonObjects.h b/project2/commonObjects.h
index 32be835..dccdb20 100644
--- a/project2/commonObjects.h
+++ b/project2/commonObjects.h
@@ -3,9 +3,13 @@
#include "dataSource.h"
#include "rowSet.h"
+#include "xmlStorage.h"
class CommonObjects : public virtual IntrusivePtrBase {
public:
+ typedef Storage<RowSet>::Objects RowSets;
+ typedef Storage<DataSource>::Objects DataSources;
+
SimpleMessageException(DataSourceNotFound);
SimpleMessageException(DataSourceNotCompatible);
@@ -15,7 +19,7 @@ class CommonObjects : public virtual IntrusivePtrBase {
template <class DataSourceType>
const DataSourceType * dataSource(const std::string & name) const
{
- DataSources::index<bySOName>::type::const_iterator i = datasources.get<bySOName>().find(name);
+ Storage<DataSource>::Objects::index<bySOName>::type::const_iterator i = datasources.get<bySOName>().find(name);
if (i == datasources.get<bySOName>().end()) {
i = loadDataSource(name);
}
diff --git a/project2/console/consoleAppEngine.cpp b/project2/console/consoleAppEngine.cpp
index c0eac5e..7ef1ad0 100644
--- a/project2/console/consoleAppEngine.cpp
+++ b/project2/console/consoleAppEngine.cpp
@@ -1,9 +1,10 @@
#include "consoleAppEngine.h"
#include "consoleEnvironment.h"
#include "../iterate.h"
-#include <stdexcept>
+#include "../xmlObjectLoader.h"
#include <libxml/xinclude.h>
#include <libxml++/parsers/domparser.h>
+#include <boost/foreach.hpp>
SimpleMessageException(UnknownPlatformAlias);
@@ -82,7 +83,7 @@ ConsoleApplicationEngine::process() const
}
}
try {
- BOOST_FOREACH(const NoOutputExecutes::value_type & t, tasks.get<bySOOrder>()) {
+ BOOST_FOREACH(const Tasks::value_type & t, tasks.get<bySOOrder>()) {
t->execute();
}
// Commit data source transactions (without invoking a connection)
diff --git a/project2/console/consoleAppEngine.h b/project2/console/consoleAppEngine.h
index 44d90bd..d8cdca5 100644
--- a/project2/console/consoleAppEngine.h
+++ b/project2/console/consoleAppEngine.h
@@ -44,8 +44,11 @@ class ConsoleApplicationEngine : public ApplicationEngine, public Presenter {
private:
mutable unsigned int indent;
+ typedef Storage<ParamChecker>::Objects ParamCheckers;
ParamCheckers parameterChecks;
- NoOutputExecutes tasks;
+ typedef Storage<NoOutputExecute>::Objects Tasks;
+ Tasks tasks;
+ typedef Storage<View>::Objects Views;
Views views;
SessionPtr runtime;
FileStreamVariableWriter out;
diff --git a/project2/console/p2consoleMain.cpp b/project2/console/p2consoleMain.cpp
index eee7603..4584126 100644
--- a/project2/console/p2consoleMain.cpp
+++ b/project2/console/p2consoleMain.cpp
@@ -1,7 +1,9 @@
#include <libxml/tree.h>
#include "consoleEnvironment.h"
#include "consoleAppEngine.h"
+#include "../xmlObjectLoader.h"
#include "../logger.h"
+#include <boost/foreach.hpp>
int
main(int argc, char ** argv)
diff --git a/project2/dataSource.h b/project2/dataSource.h
index 890dc9a..81a59ad 100644
--- a/project2/dataSource.h
+++ b/project2/dataSource.h
@@ -2,13 +2,10 @@
#define DATASOURCE_H
#include <boost/intrusive_ptr.hpp>
-#include <map>
#include "sourceObject.h"
-#include "xmlObjectLoader.h"
class DataSource;
typedef boost::intrusive_ptr<DataSource> DataSourcePtr;
-typedef Storage<DataSource>::Objects DataSources;
class DataSource : public virtual SourceObject {
public:
diff --git a/project2/if.cpp b/project2/if.cpp
index 4531b89..fe47059 100644
--- a/project2/if.cpp
+++ b/project2/if.cpp
@@ -1,6 +1,7 @@
#include "if.h"
#include "logger.h"
#include "xmlObjectLoader.h"
+#include <boost/foreach.hpp>
DECLARE_LOADER("if", If);
@@ -54,7 +55,7 @@ If::execute(const Presenter * presenter) const
{
if (passes()) {
Logger()->messagef(LOG_DEBUG, "IfSet passed, showing %zu views", subViews.size());
- BOOST_FOREACH(const Views::value_type & sq, subViews) {
+ BOOST_FOREACH(const SubViews::value_type & sq, subViews) {
sq->execute(presenter);
}
}
@@ -65,7 +66,7 @@ If::execute() const
{
if (passes()) {
Logger()->message(LOG_DEBUG, "IfSet passed");
- BOOST_FOREACH(const NoOutputExecutes::value_type & sq, subNOEs.get<bySOOrder>()) {
+ BOOST_FOREACH(const SubNOEs::value_type & sq, subNOEs.get<bySOOrder>()) {
sq->execute();
}
}
diff --git a/project2/if.h b/project2/if.h
index 26aef1a..87fc1ee 100644
--- a/project2/if.h
+++ b/project2/if.h
@@ -14,6 +14,7 @@ class IfSet : public virtual IntrusivePtrBase {
virtual const std::string & getName() const = 0;
enum Mode { And, Or };
Mode mode;
+ typedef Storage<ParamChecker>::Objects ParamCheckers;
ParamCheckers checks;
};
diff --git a/project2/iterate.cpp b/project2/iterate.cpp
index fc24ed7..f0097c8 100644
--- a/project2/iterate.cpp
+++ b/project2/iterate.cpp
@@ -51,7 +51,7 @@ Iterate::execute() const
void
Iterate::executeChildren() const
{
- BOOST_FOREACH(const NoOutputExecutes::value_type & sq, subNOEs.get<bySOOrder>()) {
+ BOOST_FOREACH(const SubNOEs::value_type & sq, subNOEs.get<bySOOrder>()) {
if (dynamic_cast<const RowProcessor *>(sq.get())) {
sq->execute();
}
diff --git a/project2/iterate.h b/project2/iterate.h
index 0152ffc..2c7eeba 100644
--- a/project2/iterate.h
+++ b/project2/iterate.h
@@ -2,16 +2,12 @@
#define ITERATE_H
#include <libxml++/nodes/element.h>
-#include <boost/intrusive_ptr.hpp>
-#include <map>
-#include "sourceObject.h"
-#include "xmlObjectLoader.h"
#include "rowProcessor.h"
#include "noOutputExecute.h"
+#include "xmlStorage.h"
class Iterate;
typedef boost::intrusive_ptr<Iterate> IteratePtr;
-typedef Storage<Iterate>::Objects Iterates;
class Iterate : public NoOutputExecute, public RowProcessor {
public:
@@ -22,7 +18,8 @@ class Iterate : public NoOutputExecute, public RowProcessor {
void rowReady() const;
void execute() const;
- NoOutputExecutes subNOEs;
+ typedef Storage<NoOutputExecute>::Objects SubNOEs;
+ SubNOEs subNOEs;
protected:
void executeChildren() const;
diff --git a/project2/noOutputExecute.h b/project2/noOutputExecute.h
index 4795ae6..ec73ce1 100644
--- a/project2/noOutputExecute.h
+++ b/project2/noOutputExecute.h
@@ -2,14 +2,12 @@
#define NOOUTPUTEXECUTE_H
#include "sourceObject.h"
-#include "xmlObjectLoader.h"
class ApplicationEngine;
class PerRowValues;
class NoOutputExecute;
typedef boost::intrusive_ptr<NoOutputExecute> NoOutputExecutePtr;
-typedef Storage<NoOutputExecute>::Objects NoOutputExecutes;
class NoOutputExecute : public virtual SourceObject {
public:
diff --git a/project2/paramChecker.cpp b/project2/paramChecker.cpp
index 71b5a74..aa1dbff 100644
--- a/project2/paramChecker.cpp
+++ b/project2/paramChecker.cpp
@@ -1,4 +1,5 @@
#include "paramChecker.h"
+#include "xmlObjectLoader.h"
ParamChecker::ParamChecker(const xmlpp::Element * p) :
SourceObject(p),
diff --git a/project2/paramChecker.h b/project2/paramChecker.h
index 179ff37..219396c 100644
--- a/project2/paramChecker.h
+++ b/project2/paramChecker.h
@@ -2,16 +2,11 @@
#define PARAMCHECKER_H
#include <libxml/tree.h>
-#include <boost/intrusive_ptr.hpp>
-#include <map>
#include "sourceObject.h"
-#include "xmlObjectLoader.h"
-#include "variables.h"
class ApplicationEngine;
class ParamChecker;
typedef boost::intrusive_ptr<ParamChecker> ParamCheckerPtr;
-typedef Storage<ParamChecker>::Objects ParamCheckers;
class ParamChecker : public virtual SourceObject {
public:
diff --git a/project2/presenter.cpp b/project2/presenter.cpp
index 37ae223..11f2996 100644
--- a/project2/presenter.cpp
+++ b/project2/presenter.cpp
@@ -1,6 +1,7 @@
#include "presenter.h"
#include "dataSource.h"
#include "appEngine.h"
+#include <boost/foreach.hpp>
Presenter::Presenter()
{
@@ -13,7 +14,7 @@ Presenter::~Presenter()
void
Presenter::execute() const
{
- BOOST_FOREACH(const Views::value_type & s, views) {
+ BOOST_FOREACH(const Storage<View>::Objects::value_type & s, views) {
s->execute(this);
}
// These were for debug... but why not pass them on?
diff --git a/project2/presenter.h b/project2/presenter.h
index 4c54a7b..6b75c5a 100644
--- a/project2/presenter.h
+++ b/project2/presenter.h
@@ -25,6 +25,7 @@ class Presenter : public virtual CommonObjects, public virtual IntrusivePtrBase
void execute() const;
protected:
+ typedef Storage<View>::Objects Views;
Views views;
};
diff --git a/project2/rawView.cpp b/project2/rawView.cpp
index 325460a..d9ca15b 100644
--- a/project2/rawView.cpp
+++ b/project2/rawView.cpp
@@ -4,6 +4,8 @@
#include "xmlObjectLoader.h"
#include "environment.h"
#include "appEngine.h"
+#include <boost/foreach.hpp>
+#include <libxml++/nodes/textnode.h>
DECLARE_LOADER("rawview", RawView);
diff --git a/project2/rdbmsDataSource.cpp b/project2/rdbmsDataSource.cpp
index 9ffcc93..7ff4408 100644
--- a/project2/rdbmsDataSource.cpp
+++ b/project2/rdbmsDataSource.cpp
@@ -5,6 +5,7 @@
#include "logger.h"
#include <errno.h>
#include <sqlext.h>
+#include <boost/foreach.hpp>
static const int NOTSET = 0;
#ifdef WITH_PQ
diff --git a/project2/rdbmsDataSource.h b/project2/rdbmsDataSource.h
index f105eed..4026f48 100644
--- a/project2/rdbmsDataSource.h
+++ b/project2/rdbmsDataSource.h
@@ -4,6 +4,7 @@
#include <libxml/tree.h>
#include <boost/shared_ptr.hpp>
#include <map>
+#include <set>
#include "dataSource.h"
#include "../libdbpp/connection.h"
#include "../libdbpp/error.h"
diff --git a/project2/regexCheck.h b/project2/regexCheck.h
index be55e9b..41bb2c8 100644
--- a/project2/regexCheck.h
+++ b/project2/regexCheck.h
@@ -2,6 +2,7 @@
#define REGEXCHECK_H
#include "paramChecker.h"
+#include "variables.h"
class RegexCheck : public ParamChecker {
public:
diff --git a/project2/rowProcessor.h b/project2/rowProcessor.h
index f47d04e..e4377bd 100644
--- a/project2/rowProcessor.h
+++ b/project2/rowProcessor.h
@@ -16,7 +16,7 @@ class RowProcessor : public IHaveParameters, public virtual SourceObject {
const Glib::ustring filter;
protected:
- RowSetPtr source;
+ boost::intrusive_ptr<RowSet> source;
};
#endif
diff --git a/project2/rowSet.h b/project2/rowSet.h
index 9a74719..d2e4b1f 100644
--- a/project2/rowSet.h
+++ b/project2/rowSet.h
@@ -1,12 +1,10 @@
#ifndef ROWSET_H
#define ROWSET_H
-#include <glibmm/ustring.h>
#include <vector>
#include <set>
-#include <boost/intrusive_ptr.hpp>
#include "sourceObject.h"
-#include "xmlObjectLoader.h"
+#include "exceptions.h"
#include <boost/function.hpp>
class RowProcessor;
@@ -15,7 +13,6 @@ class RowUser;
class VariableType;
typedef boost::intrusive_ptr<RowSet> RowSetPtr;
typedef boost::intrusive_ptr<const RowSet> ConstRowSetPtr;
-typedef Storage<RowSet>::Objects RowSets;
class RowSet : public virtual SourceObject {
public:
diff --git a/project2/rowView.cpp b/project2/rowView.cpp
index 864580a..e036dd7 100644
--- a/project2/rowView.cpp
+++ b/project2/rowView.cpp
@@ -1,6 +1,8 @@
#include "rowView.h"
#include "presenter.h"
+#include "xmlObjectLoader.h"
#include <boost/foreach.hpp>
+#include <libxml++/nodes/textnode.h>
DECLARE_LOADER("view", RowView);
@@ -77,7 +79,7 @@ RowView::execute(const Presenter * p) const
void
RowView::executeChildren() const
{
- BOOST_FOREACH(Views::value_type sq, subViews) {
+ BOOST_FOREACH(const SubViews::value_type & sq, subViews) {
sq->execute(presenter);
}
}
diff --git a/project2/rowView.h b/project2/rowView.h
index fb22b2b..a866558 100644
--- a/project2/rowView.h
+++ b/project2/rowView.h
@@ -3,7 +3,6 @@
#include <libxml++/nodes/element.h>
#include <boost/intrusive_ptr.hpp>
-#include "sourceObject.h"
#include "rowProcessor.h"
#include "view.h"
@@ -24,7 +23,8 @@ class RowView : public View, public RowProcessor {
Columns viewColumns;
void executeChildren() const;
- Views subViews;
+ typedef Storage<View>::Objects SubViews;
+ SubViews subViews;
mutable const Presenter * presenter;
};
diff --git a/project2/sqlCheck.cpp b/project2/sqlCheck.cpp
index a6e71a1..766f16d 100644
--- a/project2/sqlCheck.cpp
+++ b/project2/sqlCheck.cpp
@@ -6,6 +6,7 @@
#include <boost/regex.hpp>
#include "commonObjects.h"
#include "sqlVariableBinder.h"
+#include <boost/foreach.hpp>
DECLARE_LOADER("sqlcheck", SqlCheck);
diff --git a/project2/sqlMergeTask.cpp b/project2/sqlMergeTask.cpp
index e3a28f1..a2dfe72 100644
--- a/project2/sqlMergeTask.cpp
+++ b/project2/sqlMergeTask.cpp
@@ -8,13 +8,15 @@
#include <stdio.h>
#include <stdexcept>
#include <boost/algorithm/string/join.hpp>
+#include <boost/foreach.hpp>
+#include <libxml++/nodes/textnode.h>
bool SqlMergeTask::defaultUseTempTable = true;
static void attach(IteratePtr i, ModifyCommand * insert);
class SqlMergeInsert;
typedef boost::intrusive_ptr<SqlMergeInsert> SqlMergeInsertPtr;
-class SqlMergeInsert : public IHaveParameters, public virtual SourceObject, public Task {
+class SqlMergeInsert : public IHaveParameters, public Task {
public:
SqlMergeInsert(const xmlpp::Element * p) :
SourceObject(p),
@@ -91,7 +93,7 @@ SqlMergeTask::loadComplete(const CommonObjects * co)
{
destdb = &co->dataSource<RdbmsDataSource>(dataSource())->getWritable();
insCmd = insertCommand();
- BOOST_FOREACH(const Iterates::value_type & i, sources) {
+ BOOST_FOREACH(const Sources::value_type & i, sources) {
attach(i, insCmd);
}
}
@@ -288,7 +290,7 @@ attach(IteratePtr i, ModifyCommand * insert)
i->subNOEs.insert(new Populate(insert));
}
else {
- BOOST_FOREACH(const NoOutputExecutes::value_type & n, i->subNOEs.get<bySOOrder>()) {
+ BOOST_FOREACH(const Iterate::SubNOEs::value_type & n, i->subNOEs.get<bySOOrder>()) {
attach(boost::dynamic_pointer_cast<Iterate>(n), insert);
attach(boost::dynamic_pointer_cast<SqlMergeInsert>(n), insert);
}
@@ -299,7 +301,7 @@ void
SqlMergeTask::copyToTempTable() const
{
if (useView) return;
- BOOST_FOREACH(const Iterates::value_type & i, sources) {
+ BOOST_FOREACH(const Sources::value_type & i, sources) {
i->execute();
}
BOOST_FOREACH(const std::string & sql, sqls) {
diff --git a/project2/sqlMergeTask.h b/project2/sqlMergeTask.h
index 85a6b4e..fc33bc5 100644
--- a/project2/sqlMergeTask.h
+++ b/project2/sqlMergeTask.h
@@ -57,7 +57,8 @@ class SqlMergeTask : public Task {
void createTempKey() const;
mutable bool tempTableCreated;
- Iterates sources;
+ typedef Storage<Iterate>::Objects Sources;
+ Sources sources;
std::list<std::string> sqls;
protected:
ModifyCommand * insertCommand() const;
diff --git a/project2/sqlRows.cpp b/project2/sqlRows.cpp
index 5a57fc7..14bdd41 100644
--- a/project2/sqlRows.cpp
+++ b/project2/sqlRows.cpp
@@ -11,6 +11,7 @@
#include "sqlVariableBinder.h"
#include <boost/date_time/gregorian/gregorian_types.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/foreach.hpp>
DECLARE_LOADER("sqlrows", SqlRows);
diff --git a/project2/task.h b/project2/task.h
index dc47b07..f9fd1ff 100644
--- a/project2/task.h
+++ b/project2/task.h
@@ -5,7 +5,7 @@
#include "sourceObject.h"
#include "noOutputExecute.h"
-class Task : public virtual SourceObject, public NoOutputExecute {
+class Task : public NoOutputExecute {
public:
Task(const xmlpp::Element * p);
virtual ~Task();
diff --git a/project2/view.h b/project2/view.h
index cfee85b..a6ae565 100644
--- a/project2/view.h
+++ b/project2/view.h
@@ -2,12 +2,9 @@
#define VIEW_H
#include "sourceObject.h"
-#include "xmlObjectLoader.h"
+#include "xmlStorage.h"
class Presenter;
-class View;
-typedef boost::intrusive_ptr<View> ViewPtr;
-typedef Storage<View>::Objects Views;
class View : public virtual SourceObject {
public:
diff --git a/project2/xmlObjectLoader.cpp b/project2/xmlObjectLoader.cpp
index 17e59d4..e16c9e1 100644
--- a/project2/xmlObjectLoader.cpp
+++ b/project2/xmlObjectLoader.cpp
@@ -1,7 +1,10 @@
#include "xmlObjectLoader.h"
+#include "xmlStorage.h"
#include "exceptions.h"
#include "logger.h"
#include <boost/shared_ptr.hpp>
+#include <boost/foreach.hpp>
+#include <libxml++/nodes/textnode.h>
unsigned int LoaderBase::depth = 0;
std::set<SourceObjectPtr> LoaderBase::loadedObjects;
diff --git a/project2/xmlObjectLoader.h b/project2/xmlObjectLoader.h
index 4568124..9fba5bd 100644
--- a/project2/xmlObjectLoader.h
+++ b/project2/xmlObjectLoader.h
@@ -3,77 +3,20 @@
#include <set>
#include <string>
-#include <libxml++/nodes/element.h>
#include <boost/intrusive_ptr.hpp>
-#include <libxml++/nodes/textnode.h>
-#include <boost/foreach.hpp>
#include "intrusivePtrBase.h"
#include "sourceObject.h"
#include "exceptions.h"
-#include <boost/multi_index_container.hpp>
-#include <boost/multi_index/member.hpp>
-#include <boost/multi_index/ordered_index.hpp>
+namespace xmlpp {
+ class Element;
+}
Glib::ustring xmlChildText(const xmlpp::Node * p, const Glib::ustring & n);
-SimpleMessageException(StoreFailed);
-
-struct bySOName { };
-struct bySOOrder { };
-
+enum UnsupportedHandling { ErrorOnUnsupported, WarnOnUnsupported, IgnoreUnsupported };
class ElementLoader;
class CommonObjects;
-
-template <class X>
-class Storage {
- public:
- typedef boost::multi_index::multi_index_container<
- boost::intrusive_ptr<X>,
- boost::multi_index::indexed_by<
- boost::multi_index::ordered_unique<
- boost::multi_index::tag<bySOOrder>, BOOST_MULTI_INDEX_MEMBER(SourceObject, const unsigned int, order)>,
- boost::multi_index::ordered_unique<
- boost::multi_index::tag<bySOName>, BOOST_MULTI_INDEX_MEMBER(SourceObject, const std::string, name)>
- > > Objects;
- typedef Objects * ObjectsPtr;
-};
class Storer;
-typedef boost::intrusive_ptr<Storer> StorerPtr;
-class Storer : public virtual IntrusivePtrBase {
- public:
- template <class X>
- static StorerPtr into(X * map);
-
- virtual bool save(SourceObjectPtr o) const = 0;
-};
-
-template <class X>
-class StorerImpl : public Storer {
- public:
- StorerImpl(typename Storage<X>::ObjectsPtr m) : map(m)
- {
- }
-
- bool save(SourceObjectPtr obj) const {
- boost::intrusive_ptr<X> O = boost::dynamic_pointer_cast<X>(obj);
- if (O) {
- if (map->insert(O).second) {
- return true;
- }
- throw StoreFailed(obj->name);
- }
- return false;
- }
- typename Storage<X>::ObjectsPtr map;
-};
-
-template <class X>
-StorerPtr
-Storer::into(X * map) {
- return new StorerImpl<typename X::value_type::element_type>(map);
-}
-
-enum UnsupportedHandling { ErrorOnUnsupported, WarnOnUnsupported, IgnoreUnsupported };
class LoaderBase {
public:
diff --git a/project2/xmlPresenter.cpp b/project2/xmlPresenter.cpp
index a8db552..906d2c9 100644
--- a/project2/xmlPresenter.cpp
+++ b/project2/xmlPresenter.cpp
@@ -1,5 +1,7 @@
#include "xmlPresenter.h"
+#include "xmlObjectLoader.h"
#include <libxml/xinclude.h>
+#include "variables.h"
XmlPresenter::~XmlPresenter()
{
diff --git a/project2/xmlPresenter.h b/project2/xmlPresenter.h
index 1c520a8..effa713 100644
--- a/project2/xmlPresenter.h
+++ b/project2/xmlPresenter.h
@@ -25,6 +25,7 @@ class XmlPresenter : public Presenter {
const Glib::ustring contentType;
protected:
+ typedef Storage<ParamChecker>::Objects ParamCheckers;
ParamCheckers parameterChecks;
private:
diff --git a/project2/xmlRows.cpp b/project2/xmlRows.cpp
index 0056084..6cf7da0 100644
--- a/project2/xmlRows.cpp
+++ b/project2/xmlRows.cpp
@@ -9,6 +9,7 @@
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/predicate.hpp>
+#include <boost/foreach.hpp>
DECLARE_LOADER("xmlrows", XmlRows);
diff --git a/project2/xmlStorage.h b/project2/xmlStorage.h
new file mode 100644
index 0000000..d35a182
--- /dev/null
+++ b/project2/xmlStorage.h
@@ -0,0 +1,66 @@
+#ifndef XMLSTORAGE_H
+#define XMLSTORAGE_H
+
+#include "sourceObject.h"
+#include "exceptions.h"
+#include <boost/intrusive_ptr.hpp>
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/member.hpp>
+#include <boost/multi_index/ordered_index.hpp>
+
+SimpleMessageException(StoreFailed);
+
+struct bySOName { };
+struct bySOOrder { };
+
+template <class X>
+class Storage {
+ public:
+ typedef boost::multi_index::multi_index_container<
+ boost::intrusive_ptr<X>,
+ boost::multi_index::indexed_by<
+ boost::multi_index::ordered_unique<
+ boost::multi_index::tag<bySOOrder>, BOOST_MULTI_INDEX_MEMBER(SourceObject, const unsigned int, order)>,
+ boost::multi_index::ordered_unique<
+ boost::multi_index::tag<bySOName>, BOOST_MULTI_INDEX_MEMBER(SourceObject, const std::string, name)>
+ > > Objects;
+ typedef Objects * ObjectsPtr;
+};
+class Storer;
+typedef boost::intrusive_ptr<Storer> StorerPtr;
+class Storer : public virtual IntrusivePtrBase {
+ public:
+ template <class X>
+ static StorerPtr into(X * map);
+
+ virtual bool save(SourceObjectPtr o) const = 0;
+};
+
+template <class X>
+class StorerImpl : public Storer {
+ public:
+ StorerImpl(typename Storage<X>::ObjectsPtr m) : map(m)
+ {
+ }
+
+ bool save(SourceObjectPtr obj) const {
+ boost::intrusive_ptr<X> O = boost::dynamic_pointer_cast<X>(obj);
+ if (O) {
+ if (map->insert(O).second) {
+ return true;
+ }
+ throw StoreFailed(obj->name);
+ }
+ return false;
+ }
+ typename Storage<X>::ObjectsPtr map;
+};
+
+template <class X>
+StorerPtr
+Storer::into(X * map) {
+ return new StorerImpl<typename X::value_type::element_type>(map);
+}
+
+#endif
+
diff --git a/project2/xslRows.cpp b/project2/xslRows.cpp
index 7f53e91..e00d8b7 100644
--- a/project2/xslRows.cpp
+++ b/project2/xslRows.cpp
@@ -9,6 +9,7 @@
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include "../libmisc/curlsup.h"
+#include <boost/foreach.hpp>
DECLARE_LOADER("xslrows", XslRows);