21 #include <kross/core/action.h>
22 #include <kross/core/manager.h>
27 _dataStructures = dataStructures;
42 qDebug() <<
"entering the Execute part";
44 if (_backend ==
"javascript") {
45 qDebug() <<
"implementing the jsDefaults";
47 }
else if (_backend ==
"python") {
48 qDebug() <<
"implementing the Python Defaults";
50 }
else if (_backend ==
"ruby") {
51 qDebug() <<
"implementing the Ruby Defaults ";
54 qDebug() <<
"Backend Not Implemented Yet.";
57 qDebug() <<
"creating the action";
58 Kross::Action *action =
new Kross::Action(0,
"myScript");
60 qDebug() <<
"setting the backend" << _backend.
toAscii();
61 action->setInterpreter(_backend);
62 qDebug() <<
"interpreter set.";
68 foreach(
const QVariant & v, (*_dataStructures)) {
69 qDebug() <<
"Got inside of the foreach";
72 qDebug() <<
"Graph is NULL";
96 codeToBeExecuted += _autoGeneratedScript;
97 codeToBeExecuted += _script;
98 qDebug() <<
"Code to be Executed: \n" << codeToBeExecuted.
toAscii();
99 qDebug() <<
" \nsetting the code";
100 action->setCode(codeToBeExecuted.
toAscii());
102 qDebug() <<
"triggering the code";
105 qDebug() <<
"triggering the action";
110 void KrossBackend::javaDefaults()
115 void KrossBackend::raptorDefaults()
120 void KrossBackend::pyDefaults()
122 _autoGeneratedScript.
clear();
127 foreach(
const QVariant & v, (*_dataStructures)) {
129 _autoGeneratedScript +=
"# -*- coding: utf-8 -*- \n";
131 _autoGeneratedScript +=
"import ";
133 _autoGeneratedScript +=
'\n';
139 void KrossBackend::rbDefaults()
141 _autoGeneratedScript.
clear();
146 foreach(
const QVariant & v, (*_dataStructures)) {
149 _autoGeneratedScript +=
"require '";
151 _autoGeneratedScript +=
"' \n";
157 void KrossBackend::jsDefaults()
162 void KrossBackend::luaDefaults()
167 void KrossBackend::csDefaults()
174 qDebug() <<
"Got in here";
178 if (!f.
open(QIODevice::ReadOnly | QIODevice::Text)) {
179 qDebug() <<
"File not found";
183 while (! f.
atEnd()) {
void loadFile(const QString &file)
void setScript(const QString &s)
QVariant property(const char *name) const
virtual bool open(QFlags< QIODevice::OpenModeFlag > mode)
virtual bool atEnd() const
Kross::Action * execute()
void setBackend(const QString &backend)
KrossBackend(QVariantList *dataStructures)
QByteArray toAscii() const
qint64 readLine(char *data, qint64 maxSize)