• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kate
 

kate

katejscript.h
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 <tqdict.h>
00026 #include <kdebug.h>
00030 class KateDocument;
00031 class KateView;
00032 class TQString;
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 TQString &script, TQString &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 TQString desktopFilename () { return filename.left(filename.length()-2).append ("desktop"); }
00128 
00129       public:
00133         TQString name;
00134 
00138         TQString 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 TQString &cmd, TQString &errorMsg );
00169 
00177     bool help( class Kate::View *view, const TQString &cmd, TQString &msg );
00178 
00183     TQStringList cmds();
00184 
00185   private:
00189     TQDict<KateJScriptManager::Script> m_scripts;
00190 };
00191 
00192 class KateIndentJScriptImpl: public KateIndentScriptImplAbstract {
00193   public:
00194     KateIndentJScriptImpl(const TQString& internalName,
00195         const TQString  &filePath, const TQString &niceName,
00196         const TQString &copyright, double version);
00197     ~KateIndentJScriptImpl();
00198     
00199     virtual bool processChar( class Kate::View *view, TQChar c, TQString &errorMsg );
00200     virtual bool processLine( class Kate::View *view, const KateDocCursor &line, TQString &errorMsg );
00201     virtual bool processNewline( class Kate::View *view, const KateDocCursor &begin, bool needcontinue, TQString &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(TQString &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 TQString &scriptname);
00220   private:
00225     void collectScripts (bool force = false);
00226     void parseScriptHeader(const TQString &filePath,
00227         TQString *niceName,TQString *copyright,double *version);
00228     TQDict<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

kate

Skip menu "kate"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for kate by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.