Kate
katecmd.h
Go to the documentation of this file.00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2001, 2003 Christoph Cullmann <cullmann@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef _KATE_CMD_H 00020 #define _KATE_CMD_H 00021 00022 #include "document.h" 00023 00024 #include <kcompletion.h> 00025 00026 #include <qdict.h> 00027 #include <qstringlist.h> 00028 00029 class KATEPARTINTERFACES_EXPORT KateCmd 00030 { 00031 private: 00032 KateCmd (); 00033 00034 public: 00035 ~KateCmd (); 00036 00037 static KateCmd *self (); 00038 00039 bool registerCommand (Kate::Command *cmd); 00040 bool unregisterCommand (Kate::Command *cmd); 00041 Kate::Command *queryCommand (const QString &cmd); 00042 00043 QStringList cmds (); 00044 void appendHistory( const QString &cmd ); 00045 const QString fromHistory( uint i ) const; 00046 uint historyLength() const { return m_history.count(); } 00047 00048 private: 00049 static KateCmd *s_self; 00050 QDict<Kate::Command> m_dict; 00051 QStringList m_cmds; 00052 QStringList m_history; 00053 }; 00054 00061 class KATEPARTINTERFACES_EXPORT KateCmdShellCompletion : public KCompletion 00062 { 00063 public: 00064 KateCmdShellCompletion(); 00065 00072 QString makeCompletion(const QString &text); 00073 00074 protected: 00075 // Called by KCompletion 00076 void postProcessMatch( QString *match ) const; 00077 void postProcessMatches( QStringList *matches ) const; 00078 void postProcessMatches( KCompletionMatches *matches ) const; 00079 00080 private: 00087 void splitText( const QString &text, QString &text_start, QString &text_compl ) const; 00088 00089 QChar m_word_break_char; 00090 QChar m_quote_char1; 00091 QChar m_quote_char2; 00092 QChar m_escape_char; 00093 00094 QString m_text_start; 00095 QString m_text_compl; 00096 00097 }; 00098 00099 #endif