katecmd.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "katecmd.h"
00020
00021 #include <kstaticdeleter.h>
00022
00023 KateCmd *KateCmd::s_self = 0;
00024
00025 KateCmd::KateCmd ()
00026 {
00027 }
00028
00029 KateCmd::~KateCmd ()
00030 {
00031 }
00032
00033 bool KateCmd::registerCommand (Kate::Command *cmd)
00034 {
00035 QStringList l = cmd->cmds ();
00036
00037 for (uint z=0; z<l.count(); z++)
00038 if (m_dict[l[z]])
00039 return false;
00040
00041 for (uint z=0; z<l.count(); z++)
00042 m_dict.insert (l[z], cmd);
00043
00044 m_cmds += l;
00045
00046 return true;
00047 }
00048
00049 bool KateCmd::unregisterCommand (Kate::Command *)
00050 {
00051 return true;
00052 }
00053
00054 Kate::Command *KateCmd::queryCommand (const QString &cmd)
00055 {
00056 uint f = 0;
00057 while ( ! cmd[f].isSpace() && f < cmd.length() )
00058 f++;
00059
00060 return m_dict[cmd.left(f)];
00061 }
00062
00063 QStringList KateCmd::cmds ()
00064 {
00065 return m_cmds;
00066 }
00067
00068 static KStaticDeleter<KateCmd> sdCmd;
00069
00070 KateCmd *KateCmd::self ()
00071 {
00072 if (!s_self)
00073 sdCmd.setObject(s_self, new KateCmd ());
00074
00075 return s_self;
00076 }
This file is part of the documentation for kate Library Version 3.3.90.