• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

C:/CVUT/diplomka/Automata_editor/sources/stateManager.h

Go to the documentation of this file.
00001 #ifndef _STATEMANAGER_H_4684351181311_
00002 #define _STATEMANAGER_H_4684351181311_
00003 
00004 class State;
00005 class StateDialog;
00006 class Editor;
00007 
00008 class QPoint;
00009 #include <QList>
00010 #include <QMap>
00011 
00012 /*!
00013  * Creates concrete state and returns State supertype.
00014  * Implemented as singelton.
00015  */
00016 class StateManager
00017 {
00018 private:
00019     static bool instantiated;
00020     static StateManager *manager;
00021     StateManager();
00022 
00023 public:
00024     ~StateManager()
00025     {
00026         instantiated = false;
00027     }
00028 
00029     //! returns states type list, used for dialog (filling comboBox)
00030     const QList<QString> &getTypeNameList() const;
00031 
00032     //! returns typeID by given typeName - important to hold elements's types consistent
00033     int getTypeNameId(const QString &typeName) const;    
00034 
00035     static StateManager* getInstance(); //!< returns instance of StateManager
00036 
00037     State* createState(Editor *editor, const QPoint& pos, const StateDialog& sd);   //!< returns State type
00038     //! overloaded function for parser needs
00039     State* createState(const QString& typeName, Editor *editor, const QPoint& pos, 
00040                        const QString& label, const QString& name, bool dimmed);
00041 
00042 protected:
00043     //! createConcreteState methods
00044     State* createStateNormal(Editor *editor, const QPoint& pos, const QString& label, 
00045                              const QString& name, bool dimmed);
00046     State* createStateNormalFinal(Editor *editor, const QPoint& pos, const QString& label, 
00047                                   const QString& name, bool dimmed);
00048     State* createStateVar(Editor *editor, const QPoint& pos, const QString& label, 
00049                           const QString& name, bool dimmed);
00050     State* createStateVarFinal(Editor *editor, const QPoint& pos, const QString& label, 
00051                                const QString& name, bool dimmed);
00052 
00053     QList<QString> stateTypeList;
00054     //! pointer to StateManager::createConcreteState
00055     typedef State* (StateManager::*StateConstructor)
00056         (Editor *editor, const QPoint& pos, const QString&, const QString&, bool);
00057     typedef QMap<QString, StateConstructor> TypeNameToInstanceMap;
00058     TypeNameToInstanceMap typeNameToInstanceMap; //!< maps type name to State createConcreteState function
00059 };
00060 
00061 #endif //_STATEMANAGER_H_4684351181311_

Generated on Tue Jan 4 2011 03:03:24 for Autoamata editor by  doxygen 1.7.0