summaryrefslogtreecommitdiff
path: root/project2/xmlStorage.h
diff options
context:
space:
mode:
Diffstat (limited to 'project2/xmlStorage.h')
-rw-r--r--project2/xmlStorage.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/project2/xmlStorage.h b/project2/xmlStorage.h
index 443ad81..9263b48 100644
--- a/project2/xmlStorage.h
+++ b/project2/xmlStorage.h
@@ -37,23 +37,35 @@ class Storer : public virtual IntrusivePtrBase {
};
template <class X>
-class StorerImpl : public Storer {
+class StorerBase : public Storer {
public:
- StorerImpl(typename Storage<X>::ObjectsPtr m) : map(m)
+ typedef typename Storage<X>::ObjectsPtr Map;
+ StorerBase()
{
}
- bool save(SourceObjectPtr obj, const xmlpp::Element *) const {
+ bool save(SourceObjectPtr obj, const xmlpp::Element * p) const {
boost::intrusive_ptr<X> O = boost::dynamic_pointer_cast<X>(obj);
if (O) {
- if (map->insert(O).second) {
+ if (getMap(p)->insert(O).second) {
return true;
}
throw StoreFailed(obj->name);
}
return false;
}
- typename Storage<X>::ObjectsPtr map;
+ virtual Map getMap(const xmlpp::Element *) const = 0;
+};
+
+template <class X>
+class StorerImpl : public StorerBase<X> {
+ public:
+ StorerImpl(typename StorerBase<X>::Map m) : map(m)
+ {
+ }
+
+ typename StorerBase<X>::Map getMap(const xmlpp::Element *) const { return map; }
+ typename StorerBase<X>::Map map;
};
template <class X>