Kate
katecommandlinescript.h
Go to the documentation of this file.00001 /* This file is part of the KDE libraries and the Kate part. 00002 * 00003 * Copyright (C) 2009 Dominik Haumann <dhaumann kde org> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public License 00016 * along with this library; see the file COPYING.LIB. If not, write to 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 * Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KATE_COMMANDLINE_SCRIPT_H 00022 #define KATE_COMMANDLINE_SCRIPT_H 00023 00024 #include "katescript.h" 00025 #include "kateview.h" 00026 00027 #include <QtCore/QPair> 00028 #include <ktexteditor/commandinterface.h> 00029 00030 class KateScriptDocument; 00031 00032 class KateCommandLineScriptHeader : public KateScriptHeader 00033 { 00034 public: 00035 KateCommandLineScriptHeader() : KateScriptHeader() 00036 {} 00037 00038 KateCommandLineScriptHeader(const KateScriptHeader& scriptHeader) 00039 : KateScriptHeader() 00040 { 00041 *static_cast<KateScriptHeader*>(this) = scriptHeader; 00042 } 00043 00044 inline void setFunctions(const QStringList& functions) 00045 { m_functions = functions; } 00046 inline const QStringList& functions() const 00047 { return m_functions; } 00048 00049 private: 00050 QStringList m_functions; 00051 }; 00052 00057 class KateCommandLineScript : public KateScript, public KTextEditor::Command 00058 { 00059 public: 00060 KateCommandLineScript(const QString &url, const KateCommandLineScriptHeader &header); 00061 virtual ~KateCommandLineScript(); 00062 00063 const KateCommandLineScriptHeader& header(); 00064 00065 bool callFunction(const QString& cmd, const QStringList args, QString &errorMessage); 00066 00067 // 00068 // KTextEditor::Command interface 00069 // 00070 public: 00071 virtual const QStringList &cmds (); 00072 virtual bool exec (KTextEditor::View *view, const QString &cmd, QString &msg); 00073 virtual bool help (KTextEditor::View *view, const QString &cmd, QString &msg); 00074 00075 private: 00076 KateCommandLineScriptHeader m_header; 00077 }; 00078 00079 #endif 00080 00081 // kate: space-indent on; indent-width 2; replace-tabs on;
KDE 4.5 API Reference