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

Kate

katescript.h

Go to the documentation of this file.
00001 // This file is part of the KDE libraries
00002 // Copyright (C) 2008 Paul Giannaros <paul@giannaros.org>
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) version 3.
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 #ifndef KATE_SCRIPT_H
00021 #define KATE_SCRIPT_H
00022 
00023 #include <QtCore/QObject>
00024 #include <QtCore/QHash>
00025 #include <QtCore/QStringList>
00026 
00027 #include <QtScript/QScriptValue>
00028 #include <QtScript/QScriptable>
00029 
00030 class QScriptEngine;
00031 class QScriptContext;
00032 
00033 class KateDocument;
00034 class KateView;
00035 
00036 class KateScriptDocument;
00037 class KateScriptView;
00038 
00039 namespace Kate {
00040   enum ScriptType {
00042     IndentationScript,
00044     CommandLineScript,
00046     UnknownScript
00047   };
00048 
00050   namespace Script {
00051     QScriptValue debug(QScriptContext *context, QScriptEngine *engine);
00052   }
00053 }
00054 
00055 //BEGIN KateScriptHeader
00056 
00057 class KateScriptHeader
00058 {
00059   public:
00060     KateScriptHeader() : m_revision(0), m_scriptType(Kate::UnknownScript)
00061     {}
00062 
00063     inline void setLicense(const QString& license)
00064     { m_license = license; }
00065     inline const QString& license() const
00066     { return m_license; }
00067 
00068     inline void setAuthor(const QString& author)
00069     { m_author = author; }
00070     inline const QString& author() const
00071     { return m_author; }
00072 
00073     inline void setRevision(int revision)
00074     { m_revision = revision; }
00075     inline int revision() const
00076     { return m_revision; }
00077 
00078     inline void setKateVersion(const QString& kateVersion)
00079     { m_kateVersion = kateVersion; }
00080     inline const QString& kateVersion() const
00081     { return m_kateVersion; }
00082 
00083     inline void setScriptType(Kate::ScriptType scriptType)
00084     { m_scriptType = scriptType; }
00085     inline Kate::ScriptType scriptType() const
00086     { return m_scriptType; }
00087 
00088   private:
00089     QString m_license;        
00090     QString m_author;         
00091     int m_revision;           
00092     QString m_kateVersion;    
00093     Kate::ScriptType m_scriptType;  
00094 };
00095 //END
00096 
00097 //BEGIN KateScript
00098 
00102 class KateScript {
00103   public:
00108     KateScript(const QString &url);
00109     ~KateScript();
00110 
00112     const QString &url() { return m_url; }
00113 
00121     bool load();
00122 
00127     bool setView (KateView *view);
00128 
00133     QScriptValue global(const QString &name);
00134 
00139     QScriptValue function(const QString &name);
00140 
00142     const QString &errorMessage() { return m_errorMessage; }
00143 
00145     void displayBacktrace(const QScriptValue &error, const QString &header = QString());
00146 
00148     void clearExceptions();
00149 
00150   protected:
00152     bool hasException(const QScriptValue& object, const QString& file);
00153 
00155     static bool readFile(const QString& sourceUrl, QString& sourceCode);
00156 
00157   private:
00159     bool initApi ();
00160     
00162     void initEngine();
00163 
00165     bool m_loaded;
00167     bool m_loadSuccessful;
00169     QString m_url;
00171     QString m_errorMessage;
00172 
00173   protected:
00175     QScriptEngine *m_engine;
00176 
00177   private:
00179     KateScriptDocument *m_document;
00180     KateScriptView *m_view;
00181 
00182   public:
00183     static void reloadScriptingApi();
00184 
00185   private:
00187     static bool s_scriptingApiLoaded;
00188 };
00189 
00190 //END
00191 
00192 #endif
00193 
00194 // 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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  •     Sodep
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.9-20090814
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