1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 20:23:53 +00:00
openmw/apps/opencs/view/doc/subviewfactoryimp.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

49 lines
1.4 KiB
C++
Raw Normal View History

2012-12-11 12:22:43 +00: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:
CSVDoc::SubView* makeSubView(const CSMWorld::UniversalId& id, CSMDoc::Document& document) override;
2012-12-11 12:22:43 +00:00
};
template <class SubViewT>
CSVDoc::SubView* SubViewFactory<SubViewT>::makeSubView(const CSMWorld::UniversalId& id, CSMDoc::Document& document)
{
return new SubViewT(id, document);
}
template <class SubViewT, class CreatorFactoryT>
class SubViewFactoryWithCreator : public SubViewFactoryBase
{
bool mSorting;
2012-12-11 12:22:43 +00:00
2022-09-22 18:26:05 +00:00
public:
SubViewFactoryWithCreator(bool sorting = true);
CSVDoc::SubView* makeSubView(const CSMWorld::UniversalId& id, CSMDoc::Document& document) override;
2012-12-11 12:22:43 +00:00
};
template <class SubViewT, class CreatorFactoryT>
SubViewFactoryWithCreator<SubViewT, CreatorFactoryT>::SubViewFactoryWithCreator(bool sorting)
: mSorting(sorting)
{
}
template <class SubViewT, class CreatorFactoryT>
CSVDoc::SubView* SubViewFactoryWithCreator<SubViewT, CreatorFactoryT>::makeSubView(
const CSMWorld::UniversalId& id, CSMDoc::Document& document)
2012-12-11 12:22:43 +00:00
{
return new SubViewT(id, document, CreatorFactoryT(), mSorting);
2012-12-11 12:22:43 +00:00
}
}
2015-03-11 14:54:45 +00:00
#endif