Search for usage in LXR

#include <katescript.h>

Inheritance diagram for KateScript:

Public Types

typedef QMap< QString, QJSValueFieldMap
enum  InputType { InputURL, InputSCRIPT }

Public Member Functions

 KateScript (const QString &urlOrScript, enum InputType inputType=InputURL)
QString backtrace (const QJSValue &error, const QString &header=QString())
void clearExceptions ()
void displayBacktrace (const QJSValue &error, const QString &header=QString())
const QStringerrorMessage ()
QJSValue evaluate (const QString &program, const FieldMap &env=FieldMap())
QJSValue function (const QString &name)
KateScriptHeader & generalHeader ()
QJSValue global (const QString &name)
bool load ()
void setGeneralHeader (const KateScriptHeader &generalHeader)
bool setView (KTextEditor::ViewPrivate *view)
const QStringurl ()

Protected Member Functions

bool hasException (const QJSValue &object, const QString &file)

Protected Attributes

QJSEnginem_engine = nullptr

Detailed Description

KateScript objects represent a script that can be executed and inspected.

Definition at line 106 of file katescript.h.

Constructor & Destructor Documentation

KateScript::KateScript ( const QString urlOrScript,
enum InputType  inputType = InputURL 

Create a new script representation, passing either a file or the script content urlOrScript to it.

In case of a file, loading of the script will happen lazily.

Definition at line 26 of file katescript.cpp.

Member Function Documentation

QString KateScript::backtrace ( const QJSValue error,
const QString header = QString() 

Returns the backtrace when a script has errored out.

Definition at line 44 of file katescript.cpp.

void KateScript::clearExceptions ( )

Clears any uncaught exceptions in the script engine.

Definition at line 66 of file katescript.cpp.

void KateScript::displayBacktrace ( const QJSValue error,
const QString header = QString() 

Displays the backtrace when a script has errored out.

Definition at line 57 of file katescript.cpp.

const QString& KateScript::errorMessage ( )

Return a context-specific error message.

Definition at line 155 of file katescript.h.

QJSValue KateScript::evaluate ( const QString program,
const FieldMap env = FieldMap() 

Execute a piece of code.

Definition at line 179 of file katescript.cpp.

QJSValue KateScript::function ( const QString name)

Return a function in the script of the given name, or an invalid QJSValue if no such function exists.

Definition at line 82 of file katescript.cpp.

KateScriptHeader & KateScript::generalHeader ( )

Return the general header.

Definition at line 234 of file katescript.cpp.

QJSValue KateScript::global ( const QString name)

Get a QJSValue for a global item in the script given its name, or an invalid QJSValue if no such global item exists.

Definition at line 73 of file katescript.cpp.

bool KateScript::hasException ( const QJSValue object,
const QString file 

Checks for exception and gives feedback on the console.

Definition at line 205 of file katescript.cpp.

bool KateScript::load ( )

Load the script.

If loading is successful, returns true. Otherwise, returns returns false and an error message will be set (see errorMessage()). Note that you don't have to call this – it is called as necessary by the functions that require it. Subsequent calls to load will return the value it returned the first time.

Definition at line 91 of file katescript.cpp.

void KateScript::setGeneralHeader ( const KateScriptHeader &  generalHeader)

set the general header after construction of the script

Definition at line 229 of file katescript.cpp.

bool KateScript::setView ( KTextEditor::ViewPrivate *  view)

set view for this script for the execution will trigger load!

Definition at line 218 of file katescript.cpp.

const QString& KateScript::url ( )

The script's URL.

Definition at line 122 of file katescript.h.

Member Data Documentation

QJSEngine* KateScript::m_engine = nullptr

The Qt interpreter for this script.

Definition at line 196 of file katescript.h.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Jun 18 2021 22:57:20 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.