OpenMW
apps/opencs/view/doc/subviewfactory.hpp
Go to the documentation of this file.
00001 #ifndef CSV_DOC_SUBVIEWFACTORY_H
00002 #define CSV_DOC_SUBVIEWFACTORY_H
00003 
00004 #include <map>
00005 
00006 #include "../../model/world/universalid.hpp"
00007 
00008 namespace CSMDoc
00009 {
00010     class Document;
00011 }
00012 
00013 namespace CSVDoc
00014 {
00015     class SubView;
00016 
00017     class SubViewFactoryBase
00018     {
00019             // not implemented
00020             SubViewFactoryBase (const SubViewFactoryBase&);
00021             SubViewFactoryBase& operator= (const SubViewFactoryBase&);
00022 
00023         public:
00024 
00025             SubViewFactoryBase();
00026 
00027             virtual ~SubViewFactoryBase();
00028 
00029             virtual SubView *makeSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document) = 0;
00031     };
00032 
00033     class SubViewFactoryManager
00034     {
00035             std::map<CSMWorld::UniversalId::Type, SubViewFactoryBase *> mSubViewFactories;
00036 
00037             // not implemented
00038             SubViewFactoryManager (const SubViewFactoryManager&);
00039             SubViewFactoryManager& operator= (const SubViewFactoryManager&);
00040 
00041         public:
00042 
00043             SubViewFactoryManager();
00044 
00045             ~SubViewFactoryManager();
00046 
00047             void add (const CSMWorld::UniversalId::Type& id, SubViewFactoryBase *factory);
00049 
00050             SubView *makeSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document);
00052     };
00053 }
00054 
00055 #endif