summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--project2/cache.cpp4
-rw-r--r--project2/cache.h5
-rw-r--r--project2/xmlCache.cpp11
-rw-r--r--project2/xmlObjectLoader.cpp6
4 files changed, 20 insertions, 6 deletions
diff --git a/project2/cache.cpp b/project2/cache.cpp
index 0db108b..bdf012b 100644
--- a/project2/cache.cpp
+++ b/project2/cache.cpp
@@ -4,7 +4,9 @@
#include "logger.h"
Cache::Cache(const xmlpp::Element * p) :
- SourceObject(p)
+ IHaveParameters(p),
+ SourceObject(p),
+ inherit(p->get_attribute_value("inherit") != "false")
{
}
diff --git a/project2/cache.h b/project2/cache.h
index 358d933..9678356 100644
--- a/project2/cache.h
+++ b/project2/cache.h
@@ -3,14 +3,14 @@
#include "sourceObject.h"
#include "presenter.h"
+#include "iHaveParameters.h"
class RowProcessor;
-class IHaveParameters;
class RowSet;
class RowState;
typedef boost::intrusive_ptr<const RowSet> RowSetCPtr;
-class Cache : public SourceObject {
+class Cache : public IHaveParameters, public SourceObject {
public:
Cache(const xmlpp::Element * p);
@@ -20,6 +20,7 @@ class Cache : public SourceObject {
protected:
virtual RowSetCPtr getCachedRowSet(const Glib::ustring &, const Glib::ustring &, const IHaveParameters *) const = 0;
+ const bool inherit;
};
typedef boost::intrusive_ptr<Cache> CachePtr;
diff --git a/project2/xmlCache.cpp b/project2/xmlCache.cpp
index 0a166e8..22937d6 100644
--- a/project2/xmlCache.cpp
+++ b/project2/xmlCache.cpp
@@ -61,13 +61,20 @@ class XmlCache : public Cache {
boost::filesystem::path getCacheFile(const Glib::ustring & n, const Glib::ustring & f, const IHaveParameters * ps) const
{
boost::filesystem::path cache = Store / n.raw() / f.raw();
+ appendPath(cache, this);
+ if (inherit) {
+ appendPath(cache, ps);
+ }
+ cache /= FileName;
+ return cache;
+ }
+ static void appendPath(boost::filesystem::path & cache, const IHaveParameters * ps)
+ {
BOOST_FOREACH(const IHaveParameters::Parameters::value_type & p, ps->allParameters()) {
std::string v = p.second->value();
cache /= p.first.raw();
cache /= v;
}
- cache /= FileName;
- return cache;
}
XmlPresenterPtr writeTo;
diff --git a/project2/xmlObjectLoader.cpp b/project2/xmlObjectLoader.cpp
index 5cc28f0..14d2972 100644
--- a/project2/xmlObjectLoader.cpp
+++ b/project2/xmlObjectLoader.cpp
@@ -106,7 +106,11 @@ void
LoaderBase::onAllComponents(const boost::function1<void, ComponentLoader *> & func)
{
BOOST_FOREACH(ComponentLoaderSet::value_type l, *componentLoaders()) {
- func(l.get());
+ try {
+ func(l.get());
+ }
+ catch (...) {
+ }
}
}