QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RScriptHandlerRegistry.h
Go to the documentation of this file.
1 
20 #ifndef RSCRIPTHANDLERREGISTRY_H
21 #define RSCRIPTHANDLERREGISTRY_H
22 
23 #include "core_global.h"
24 
25 #include <QList>
26 #include <QMetaType>
27 #include <QString>
28 
29 #include "RNonCopyable.h"
30 #include "RDocumentInterface.h"
31 #include "RAction.h"
32 #include "RGuiAction.h"
33 #include "RScriptAction.h"
34 #include "RMainWindow.h"
35 #include "RSingleton.h"
36 
37 
44 
45  friend class RSingleton;
46 
47 public:
48  typedef RScriptHandler* (*FactoryFunction)();
49 
50  virtual ~RScriptHandlerRegistry();
51 
52  static void registerScriptHandler(FactoryFunction factoryFunction,
53  const QList<QString>& fileExtensions);
54 
55  static RScriptHandler* createScriptHandler(const QString& extension);
56  static RScriptHandler* getGlobalScriptHandler(const QString& extension);
57 
58 protected:
59  static QMap<QString, RScriptHandler*> globalScriptHandlers;
60  static QMap<QString, FactoryFunction> factoryFunctions;
61 };
62 
63 #endif