#include <rubyscript.h>
Inheritance diagram for Kross::Ruby::RubyScript:


Definition at line 36 of file rubyscript.h.
Public Member Functions | |
| RubyScript (Kross::Api::Interpreter *interpreter, Kross::Api::ScriptContainer *scriptcontainer) | |
| ~RubyScript () | |
| virtual const QStringList & | getFunctionNames () |
| virtual Kross::Api::Object::Ptr | execute () |
| virtual Kross::Api::Object::Ptr | callFunction (const QString &name, Kross::Api::List::Ptr args) |
| virtual const QStringList & | getClassNames () |
| virtual Kross::Api::Object::Ptr | classInstance (const QString &name) |
| bool | hadException () |
| Exception::Ptr | getException () |
| void | setException (Exception::Ptr e) |
| void | clearException () |
Protected Attributes | |
| Interpreter *const | m_interpreter |
| The Interpreter used to create this Script instance. | |
| ScriptContainer *const | m_scriptcontainer |
| The ScriptContainer associated with this Script. | |
|
||||||||||||
|
Constructor.
Definition at line 50 of file rubyscript.cpp. 00051 : Kross::Api::Script(interpreter, scriptcontainer), d(new RubyScriptPrivate()) 00052 { 00053 }
|
|
|
Destructor. Definition at line 56 of file rubyscript.cpp.
|
|
||||||||||||
|
Call a function. Implements Kross::Api::Script. Definition at line 139 of file rubyscript.cpp. References Kross::Ruby::RubyScriptPrivate::m_compile. 00140 { 00141 #ifdef KROSS_RUBY_SCRIPT_DEBUG 00142 kdDebug() << "RubyScript::callFunction()" << endl; 00143 #endif 00144 if(d->m_compile == 0) 00145 { 00146 compile(); 00147 } 00148 selectScript(); 00149 unselectScript(); 00150 return 0; 00151 }
|
|
|
Create and return a new class instance. Implements Kross::Api::Script. Definition at line 165 of file rubyscript.cpp. References Kross::Ruby::RubyScriptPrivate::m_compile. 00166 { 00167 #ifdef KROSS_RUBY_SCRIPT_DEBUG 00168 kdDebug() << "RubyScript::classInstance()" << endl; 00169 #endif 00170 if(d->m_compile == 0) 00171 { 00172 compile(); 00173 } 00174 selectScript(); 00175 unselectScript(); 00176 return 0; 00177 }
|
|
|
Clear previous exceptions. If called hadException() will return false again. Definition at line 55 of file script.cpp.
|
|
|
Execute the script. Implements Kross::Api::Script. Definition at line 109 of file rubyscript.cpp. References Kross::Ruby::RubyScriptPrivate::m_compile, and Kross::Api::Script::setException(). 00110 { 00111 #ifdef KROSS_RUBY_SCRIPT_DEBUG 00112 kdDebug() << "RubyScript::execute()" << endl; 00113 #endif 00114 if(d->m_compile == 0) 00115 { 00116 compile(); 00117 } 00118 #ifdef KROSS_RUBY_SCRIPT_DEBUG 00119 kdDebug() << "Start execution" << endl; 00120 #endif 00121 selectScript(); 00122 int result = ruby_exec(); 00123 if (result != 0) 00124 { 00125 #ifdef KROSS_RUBY_SCRIPT_DEBUG 00126 kdDebug() << "Execution has failed" << endl; 00127 #endif 00128 setException( new Kross::Api::Exception(QString("Failed to execute ruby code: %1").arg(STR2CSTR( rb_obj_as_string(ruby_errinfo) )), 0) ); // TODO: get the error 00129 d->m_compile = 0; 00130 } 00131 00132 unselectScript(); 00133 #ifdef KROSS_RUBY_SCRIPT_DEBUG 00134 kdDebug() << "Execution is finished" << endl; 00135 #endif 00136 return 0; 00137 }
|
|
|
Return a list of class types this script supports. Implements Kross::Api::Script. Definition at line 153 of file rubyscript.cpp. References Kross::Ruby::RubyScriptPrivate::m_classes, and Kross::Ruby::RubyScriptPrivate::m_compile. 00154 { 00155 #ifdef KROSS_RUBY_SCRIPT_DEBUG 00156 kdDebug() << "RubyScript::getClassNames()" << endl; 00157 #endif 00158 if(d->m_compile == 0) 00159 { 00160 compile(); 00161 } 00162 return d->m_classes; 00163 }
|
|
|
Definition at line 45 of file script.cpp. Referenced by Kross::Api::ScriptContainer::classInstance(), and Kross::Api::ScriptContainer::execute().
|
|
|
Return a list of callable functionnames this script spends. Implements Kross::Api::Script. Definition at line 97 of file rubyscript.cpp. References Kross::Ruby::RubyScriptPrivate::m_compile, and Kross::Ruby::RubyScriptPrivate::m_functions. 00098 { 00099 #ifdef KROSS_RUBY_SCRIPT_DEBUG 00100 kdDebug() << "RubyScript::getFunctionNames()" << endl; 00101 #endif 00102 if(d->m_compile == 0) 00103 { 00104 compile(); 00105 } 00106 return d->m_functions; 00107 }
|
|
|
Definition at line 40 of file script.cpp. Referenced by Kross::Python::PythonScript::callFunction(), Kross::Api::ScriptContainer::classInstance(), Kross::Python::PythonScript::classInstance(), and Kross::Api::ScriptContainer::execute().
|
|
|
Set a new exception this script throwed.
Definition at line 50 of file script.cpp. Referenced by Kross::Python::PythonScript::callFunction(), Kross::Python::PythonScript::classInstance(), and execute().
|
1.4.6