OpenMW
apps/opencs/view/doc/subviewfactoryimp.hpp
Go to the documentation of this file.
00001 #ifndef CSV_DOC_SUBVIEWFACTORYIMP_H
00002 #define CSV_DOC_SUBVIEWFACTORYIMP_H
00003 
00004 #include "../../model/doc/document.hpp"
00005 
00006 #include "subviewfactory.hpp"
00007 
00008 namespace CSVDoc
00009 {
00010     template<class SubViewT>
00011     class SubViewFactory : public SubViewFactoryBase
00012     {
00013         public:
00014 
00015             virtual CSVDoc::SubView *makeSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document);
00016     };
00017 
00018     template<class SubViewT>
00019     CSVDoc::SubView *SubViewFactory<SubViewT>::makeSubView (const CSMWorld::UniversalId& id,
00020         CSMDoc::Document& document)
00021     {
00022         return new SubViewT (id, document);
00023     }
00024 
00025 
00026     template<class SubViewT, class CreatorFactoryT>
00027     class SubViewFactoryWithCreator : public SubViewFactoryBase
00028     {
00029             bool mSorting;
00030 
00031         public:
00032 
00033             SubViewFactoryWithCreator (bool sorting = true);
00034 
00035             virtual CSVDoc::SubView *makeSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document);
00036     };
00037 
00038     template<class SubViewT, class CreatorFactoryT>
00039     SubViewFactoryWithCreator<SubViewT, CreatorFactoryT>::SubViewFactoryWithCreator (bool sorting)
00040     : mSorting (sorting)
00041     {}
00042 
00043     template<class SubViewT, class CreatorFactoryT>
00044     CSVDoc::SubView *SubViewFactoryWithCreator<SubViewT, CreatorFactoryT>::makeSubView (
00045         const CSMWorld::UniversalId& id, CSMDoc::Document& document)
00046     {
00047         return new SubViewT (id, document, CreatorFactoryT(), mSorting);
00048     }
00049 }
00050 
00051 #endif