Changeset View
Changeset View
Standalone View
Standalone View
src/script/katescript.h
Context not available. | |||||
21 | #ifndef KATE_SCRIPT_H | 21 | #ifndef KATE_SCRIPT_H | ||
---|---|---|---|---|---|
22 | #define KATE_SCRIPT_H | 22 | #define KATE_SCRIPT_H | ||
23 | 23 | | |||
24 | #include <QScriptValue> | 24 | #include <QtCore/QString> | ||
25 | #include <QString> | 25 | #include <QtCore/QMap> | ||
26 | #include <QMap> | 26 | #include <QtQml/QJSValue> | ||
27 | 27 | | |||
28 | class QScriptEngine; | 28 | class QJSEngine; | ||
29 | 29 | | |||
30 | namespace KTextEditor { class ViewPrivate; } | 30 | namespace KTextEditor { class ViewPrivate; } | ||
31 | 31 | | |||
Context not available. | |||||
122 | InputSCRIPT | 122 | InputSCRIPT | ||
123 | }; | 123 | }; | ||
124 | 124 | | |||
125 | typedef QMap<QString, QScriptValue> FieldMap; | 125 | typedef QMap<QString, QJSValue> FieldMap; | ||
126 | 126 | | |||
127 | /** | 127 | /** | ||
128 | * Create a new script representation, passing either a file or the script | 128 | * Create a new script representation, passing either a file or the script | ||
Context not available. | |||||
154 | bool setView(KTextEditor::ViewPrivate *view); | 154 | bool setView(KTextEditor::ViewPrivate *view); | ||
155 | 155 | | |||
156 | /** | 156 | /** | ||
157 | * Get a QScriptValue for a global item in the script given its name, or an | 157 | * Get a QJSValue for a global item in the script given its name, or an | ||
158 | * invalid QScriptValue if no such global item exists. | 158 | * invalid QJSValue if no such global item exists. | ||
159 | */ | 159 | */ | ||
160 | QScriptValue global(const QString &name); | 160 | QJSValue global(const QString &name); | ||
161 | 161 | | |||
162 | /** | 162 | /** | ||
163 | * Return a function in the script of the given name, or an invalid QScriptValue | 163 | * Return a function in the script of the given name, or an invalid QJSValue | ||
164 | * if no such function exists. | 164 | * if no such function exists. | ||
165 | */ | 165 | */ | ||
166 | QScriptValue function(const QString &name); | 166 | QJSValue function(const QString &name); | ||
167 | 167 | | |||
168 | /** Return a context-specific error message */ | 168 | /** Return a context-specific error message */ | ||
169 | const QString &errorMessage() | 169 | const QString &errorMessage() | ||
Context not available. | |||||
172 | } | 172 | } | ||
173 | 173 | | |||
174 | /** Returns the backtrace when a script has errored out */ | 174 | /** Returns the backtrace when a script has errored out */ | ||
175 | QString backtrace(const QScriptValue &error, const QString &header = QString()); | 175 | QString backtrace(const QJSValue &error, const QString &header = QString()); | ||
176 | 176 | | |||
177 | /** Execute a piece of code **/ | 177 | /** Execute a piece of code **/ | ||
178 | QScriptValue evaluate(const QString& program, const FieldMap& env = FieldMap()); | 178 | QJSValue evaluate(const QString& program, const FieldMap& env = FieldMap()); | ||
179 | 179 | | |||
180 | /** Displays the backtrace when a script has errored out */ | 180 | /** Displays the backtrace when a script has errored out */ | ||
181 | void displayBacktrace(const QScriptValue &error, const QString &header = QString()); | 181 | void displayBacktrace(const QJSValue &error, const QString &header = QString()); | ||
182 | 182 | | |||
183 | /** Clears any uncaught exceptions in the script engine. */ | 183 | /** Clears any uncaught exceptions in the script engine. */ | ||
184 | void clearExceptions(); | 184 | void clearExceptions(); | ||
Context not available. | |||||
190 | 190 | | |||
191 | protected: | 191 | protected: | ||
192 | /** Checks for exception and gives feedback on the console. */ | 192 | /** Checks for exception and gives feedback on the console. */ | ||
193 | bool hasException(const QScriptValue &object, const QString &file); | 193 | bool hasException(const QJSValue &object, const QString &file); | ||
194 | 194 | | |||
195 | private: | 195 | private: | ||
196 | /** Whether or not there has been a call to load */ | 196 | /** Whether or not there has been a call to load */ | ||
Context not available. | |||||
207 | 207 | | |||
208 | protected: | 208 | protected: | ||
209 | /** The Qt interpreter for this script */ | 209 | /** The Qt interpreter for this script */ | ||
210 | QScriptEngine *m_engine; | 210 | QJSEngine *m_engine; | ||
211 | 211 | | |||
212 | private: | 212 | private: | ||
213 | /** general header data */ | 213 | /** general header data */ | ||
Context not available. |