kate
katecmd.h
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 <tqdict.h> 00027 #include <tqstringlist.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 TQString &cmd); 00042 00043 TQStringList cmds (); 00044 void appendHistory( const TQString &cmd ); 00045 const TQString fromHistory( uint i ) const; 00046 uint historyLength() const { return m_history.count(); } 00047 00048 private: 00049 static KateCmd *s_self; 00050 TQDict<Kate::Command> m_dict; 00051 TQStringList m_cmds; 00052 TQStringList m_history; 00053 }; 00054 00061 class KATEPARTINTERFACES_EXPORT KateCmdShellCompletion : public TDECompletion 00062 { 00063 public: 00064 KateCmdShellCompletion(); 00065 00072 TQString makeCompletion(const TQString &text); 00073 00074 protected: 00075 // Called by TDECompletion 00076 void postProcessMatch( TQString *match ) const; 00077 void postProcessMatches( TQStringList *matches ) const; 00078 void postProcessMatches( TDECompletionMatches *matches ) const; 00079 00080 private: 00087 void splitText( const TQString &text, TQString &text_start, TQString &text_compl ) const; 00088 00089 TQChar m_word_break_char; 00090 TQChar m_quote_char1; 00091 TQChar m_quote_char2; 00092 TQChar m_escape_char; 00093 00094 TQString m_text_start; 00095 TQString m_text_compl; 00096 00097 }; 00098 00099 #endif