CommandManager

Inherited from NULL

Inherited by NULL

Friend class NULL

Description

所有的命令都必须在CommandManager里注册之后才能被主程序使用,命令的创建以及销毁都通过CommandManager来完成。所有的命令中有一种比较特殊的命令,它不需要任何输入,它的输出也不改变任何持久性数据,这种命令称为OneClick命令,OneClick命令一般都通过调用MainFrame的executeCommand函数直接来完成,但是需要通过函数isOneClickCommand来判断它是否属于这一类命令。定制的命令管理器一般需重新实现registercommands和isOneClickCommand函数。

Members

Public interface

Protected interface

Private interface


ICommand* m_pExecutingCmd

当前正在执行的命令对象

deque<ICommand*> m_pCmdList

通过命令管理器生成的命令对象链表

vector<CmdHistory> m_pCmdHistory

命令执行的历史记录

unordered_map<string,ulong> m_pScriptMap

命令名与命令ID映射表

unordered_map<ulong, string> * m_pCmdStatus

命令窗口状态映射表

unordered_map<string, ScriptAPI> * m_pfAPIFunc

API命令映射表

unordered_map<string, vector<const CommandIndex*» * m_pModuleCmds

模块命令索引

Name m_strModule

当前模块名

TypeID m_iExecMode

命令执行模式

CmdIndexHash * m_pCmdIndices

命令索引表

ulong m_ulNextCid

用于注册下一个命令的ID号

ulong m_ulNextNewDocCid

用于注册下一个新建文档命令的ID号

ulong m_ulNextOpenDocCid

用于注册下一个打开文档命令的ID号


static CommandManager * instance()

static IMainFrame * getMainFrame()

static void setMainFrame(IMainFrame * mf)

virtual ~CommandManager()

ICommand * getCommand(int cid)

int getCommandIDByName(const char * name)

int getItemCommandID(int type,const XItem * pi)

ulong getCommandItemType(XDocument * doc, int cid)

ICommand * createCommand(int cid,IMainFrame * pApp, XDocument * doc, bool bScript = false)

const char * getCommandName(XDocument * doc, int cid)

ulong getCommandLicense(XDocument * doc, int cid)

void destroyCommand(ICommand * pCmd)

void clear(XDocument * doc = 0)

void registerOut()

const char * logCommand(ICommand * cmd)

void logAPI(XDocument*doc, const char * apiName, const char * apiArgs)

ICommand * createScriptCommand(const char * script,IMainFrame * frame, XDocument * doc)

bool registerCommand(int cid,int doc, CreateCommandFunc createF, DestroyCommandFunc destroyF, const char * name, ulong item_type = DItem_Unknown, ulong license = Lic_Base)

void registerOutCommand(CommandIndex * ci)

void setCommandLicense(int cid, int doc, ulong lic)

bool registerScriptAPI(const char * apiName, ScriptAPI apiFunc)

ScriptAPI getScriptAPI(const char * apiName)

void beginTransaction(ICommand * cmd)

void endTransaction(ICommand * cmd)

void rollback(ICommand * cmd)

bool undo(XDocument * doc)

bool redo(XDocument * doc)

void reproduce(XDocument * doc,const char * history,const char * record)

const CmdHistory & getHistory(int index) const

int getHistoryCount() const

void resetRecord(XDocument * doc)

virtual void registerCommands()

bool registerModule(const char * module)

void registerOutModule(const char * module)

int filterCmdScript(const char * keyword,vector<string> * cmd_list)

void serializeHistory(XDocument * doc, bool bSave = true)

void loadCmdStatus(XDocument * doc, const char * scheme)

void saveCmdStatus(XDocument * doc, const char * scheme)

const char * loadCmdStatus(XDocument * doc, ulong cid)

void saveCmdStatus(ICommand * cmd)

TypeID getExecMode() const

void setExecMode(int m)

void insertCommand(ICommand * cmd, int index = -1)

ICommand * getFirstCommand()

ICommand * getLastCommand()

void setExecutingCommand(ICommand * cmd)

ICommand * getExecutingCommand()

const CommandIndex * getCommandIndex(ulong cid, ulong doc) const

void bindCommandIndexIterator(CmdIndexIterator * itr)

ErrorCode executeScript(IMainFrame * frame, XDocument * doc, const char * name, const char * args, bool bCheckParam = false)

void saveDocumentCommandNames(const char * docStr, const char * fname)


bool registerCommand(int id,const char * name,ulong license = Lic_Base)


CommandManager()