• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Kate

katejscript.h

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002    Copyright (C) 2005 Christoph Cullmann <cullmann@kde.org>
00003    Copyright (C) 2005 Joseph Wenninger <jowenn@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 version 2 as published by the Free Software Foundation.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef __kate_jscript_h__
00021 #define __kate_jscript_h__
00022 
00023 #include "../interfaces/document.h"
00024 #include "kateindentscriptabstracts.h"
00025 #include <qdict.h>
00026 #include <kdebug.h>
00030 class KateDocument;
00031 class KateView;
00032 class QString;
00033 class KateJSDocument;
00034 class KateJSView;
00035 class KateJSIndenter;
00036 class KateDocCursor;
00037 
00041 namespace KJS {
00042   class Object;
00043   class ObjectImp;
00044   class Interpreter;
00045   class ExecState;
00046 }
00047 
00052 class KateJScript
00053 {
00054   public:
00058     KateJScript ();
00059 
00063     virtual ~KateJScript ();
00064 
00071     KJS::ObjectImp *wrapDocument (KJS::ExecState *exec, KateDocument *doc);
00072 
00079     KJS::ObjectImp *wrapView (KJS::ExecState *exec, KateView *view);
00080 
00090     bool execute (KateView *view, const QString &script, QString &errorMsg);
00091 
00092   protected:
00096     KJS::Object *m_global;
00097 
00101     KJS::Interpreter *m_interpreter;
00102 
00106     KJS::Object *m_document;
00107 
00111     KJS::Object *m_view;
00112 };
00113 
00114 class KateJScriptManager : public Kate::Command
00115 {
00116   private:
00120     class Script
00121     {
00122       public:
00127         inline QString desktopFilename () { return filename.left(filename.length()-2).append ("desktop"); }
00128 
00129       public:
00133         QString name;
00134 
00138         QString filename;
00139 
00143         bool desktopFileExists;
00144     };
00145 
00146   public:
00147     KateJScriptManager ();
00148     ~KateJScriptManager ();
00149 
00150   private:
00155     void collectScripts (bool force = false);
00156 
00157   //
00158   // Here we deal with the Kate::Command stuff
00159   //
00160   public:
00168     bool exec( class Kate::View *view, const QString &cmd, QString &errorMsg );
00169 
00177     bool help( class Kate::View *view, const QString &cmd, QString &msg );
00178 
00183     QStringList cmds();
00184 
00185   private:
00189     QDict<KateJScriptManager::Script> m_scripts;
00190 };
00191 
00192 class KateIndentJScriptImpl: public KateIndentScriptImplAbstract {
00193   public:
00194     KateIndentJScriptImpl(const QString& internalName,
00195         const QString  &filePath, const QString &niceName,
00196         const QString &copyright, double version);
00197     ~KateIndentJScriptImpl();
00198     
00199     virtual bool processChar( class Kate::View *view, QChar c, QString &errorMsg );
00200     virtual bool processLine( class Kate::View *view, const KateDocCursor &line, QString &errorMsg );
00201     virtual bool processNewline( class Kate::View *view, const KateDocCursor &begin, bool needcontinue, QString &errorMsg );
00202   protected:
00203     virtual void decRef();
00204   private:
00205     KateJSView *m_viewWrapper;
00206     KateJSDocument *m_docWrapper;
00207     KJS::Object *m_indenter;
00208     KJS::Interpreter *m_interpreter;
00209     bool setupInterpreter(QString &errorMsg);
00210     void deleteInterpreter();
00211 };
00212 
00213 class KateIndentJScriptManager: public KateIndentScriptManagerAbstract
00214 {
00215 
00216   public:
00217     KateIndentJScriptManager ();
00218     virtual ~KateIndentJScriptManager ();
00219     virtual KateIndentScript script(const QString &scriptname);
00220   private:
00225     void collectScripts (bool force = false);
00226     void parseScriptHeader(const QString &filePath,
00227         QString *niceName,QString *copyright,double *version);
00228     QDict<KateIndentJScriptImpl> m_scripts;
00229 };
00230 
00231 #endif
00232 
00233 // kate: space-indent on; indent-width 2; replace-tabs on;

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal