2012-12-11 13:22:43 +01:00
|
|
|
#ifndef CSV_DOC_SUBVIEWFACTORYIMP_H
|
|
|
|
#define CSV_DOC_SUBVIEWFACTORYIMP_H
|
|
|
|
|
|
|
|
#include "../../model/doc/document.hpp"
|
|
|
|
|
|
|
|
#include "subviewfactory.hpp"
|
|
|
|
|
|
|
|
namespace CSVDoc
|
|
|
|
{
|
|
|
|
template <class SubViewT>
|
|
|
|
class SubViewFactory : public SubViewFactoryBase
|
|
|
|
{
|
|
|
|
public:
|
2020-10-16 22:18:54 +04:00
|
|
|
CSVDoc::SubView* makeSubView(const CSMWorld::UniversalId& id, CSMDoc::Document& document) override;
|
2012-12-11 13:22:43 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
template <class SubViewT>
|
|
|
|
CSVDoc::SubView* SubViewFactory<SubViewT>::makeSubView(const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
|
|
|
{
|
|
|
|
return new SubViewT(id, document);
|
|
|
|
}
|
|
|
|
|
2013-07-26 12:34:30 +02:00
|
|
|
template <class SubViewT, class CreatorFactoryT>
|
|
|
|
class SubViewFactoryWithCreator : public SubViewFactoryBase
|
|
|
|
{
|
2013-10-31 13:40:14 +01:00
|
|
|
bool mSorting;
|
2012-12-11 13:22:43 +01:00
|
|
|
|
2022-09-22 21:26:05 +03:00
|
|
|
public:
|
2013-10-31 13:40:14 +01:00
|
|
|
SubViewFactoryWithCreator(bool sorting = true);
|
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
CSVDoc::SubView* makeSubView(const CSMWorld::UniversalId& id, CSMDoc::Document& document) override;
|
2012-12-11 13:22:43 +01:00
|
|
|
};
|
|
|
|
|
2013-10-31 13:40:14 +01:00
|
|
|
template <class SubViewT, class CreatorFactoryT>
|
|
|
|
SubViewFactoryWithCreator<SubViewT, CreatorFactoryT>::SubViewFactoryWithCreator(bool sorting)
|
|
|
|
: mSorting(sorting)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-26 12:34:30 +02:00
|
|
|
template <class SubViewT, class CreatorFactoryT>
|
|
|
|
CSVDoc::SubView* SubViewFactoryWithCreator<SubViewT, CreatorFactoryT>::makeSubView(
|
|
|
|
const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
2012-12-11 13:22:43 +01:00
|
|
|
{
|
2013-10-31 13:40:14 +01:00
|
|
|
return new SubViewT(id, document, CreatorFactoryT(), mSorting);
|
2012-12-11 13:22:43 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-11 10:54:45 -04:00
|
|
|
#endif
|