58 #ifndef RPCWRAPPERS_HH 59 #define RPCWRAPPERS_HH 111 QScriptValue
callFunction( QString _plugin, QString _functionName );
122 QScriptValue
callFunction( QString _plugin, QString _functionName , std::vector< QScriptValue > _parameters );
139 template <
typename T0>
142 std::vector< QScriptValue > parameters;
160 parameters.push_back( engine->toScriptValue(_t0) );
171 template <
typename T0,
typename T1>
172 void callFunction( QString _plugin, QString _functionName, T0 _t0 , T1 _t1) {
174 std::vector< QScriptValue > parameters;
175 parameters.push_back( engine->toScriptValue( _t0 ) );
176 parameters.push_back( engine->toScriptValue( _t1 ) );
188 template <
typename T0,
typename T1 ,
typename T2>
189 void callFunction( QString _plugin, QString _functionName, T0 _t0 , T1 _t1 , T2 _t2 ) {
191 std::vector< QScriptValue > parameters;
192 parameters.push_back( engine->toScriptValue(_t0 ) );
193 parameters.push_back( engine->toScriptValue( _t1 ) );
194 parameters.push_back( engine->toScriptValue( _t2 ) );
207 template <
typename T0,
typename T1 ,
typename T2,
typename T3>
208 void callFunction( QString _plugin, QString _functionName, T0 _t0 , T1 _t1 , T2 _t2 , T3 _t3 ) {
210 std::vector< QScriptValue > parameters;
211 parameters.push_back( engine->toScriptValue( _t0 ) );
212 parameters.push_back( engine->toScriptValue( _t1 ) );
213 parameters.push_back( engine->toScriptValue( _t2 ) );
214 parameters.push_back( engine->toScriptValue( _t3 ) );
228 template <
typename T0,
typename T1 ,
typename T2,
typename T3,
typename T4>
229 void callFunction( QString _plugin, QString _functionName, T0 _t0 , T1 _t1 , T2 _t2 , T3 _t3 , T4 _t4) {
231 std::vector< QScriptValue > parameters;
232 parameters.push_back( engine->toScriptValue( _t0 ) );
233 parameters.push_back( engine->toScriptValue( _t1 ) );
234 parameters.push_back( engine->toScriptValue( _t2 ) );
235 parameters.push_back( engine->toScriptValue( _t3 ) );
236 parameters.push_back( engine->toScriptValue( _t4 ) );
251 template <
typename T0,
typename T1 ,
typename T2,
typename T3,
typename T4,
typename T5>
252 void callFunction( QString _plugin, QString _functionName, T0 _t0 , T1 _t1 , T2 _t2 , T3 _t3 , T4 _t4, T5 _t5) {
254 std::vector< QScriptValue > parameters;
255 parameters.push_back( engine->toScriptValue( _t0 ) );
256 parameters.push_back( engine->toScriptValue( _t1 ) );
257 parameters.push_back( engine->toScriptValue( _t2 ) );
258 parameters.push_back( engine->toScriptValue( _t3 ) );
259 parameters.push_back( engine->toScriptValue( _t4 ) );
260 parameters.push_back( engine->toScriptValue( _t5 ) );
280 template <
typename ReturnValue >
282 return qscriptvalue_cast< ReturnValue >(
callFunction(_plugin,_functionName) );
292 template <
typename ReturnValue ,
typename T0>
295 std::vector< QScriptValue > parameters;
296 parameters.push_back( engine->toScriptValue( _t0 ) );
297 return qscriptvalue_cast<ReturnValue>(
callFunction(_plugin,_functionName,parameters) );
308 template <
typename ReturnValue ,
typename T0,
typename T1>
311 std::vector< QScriptValue > parameters;
312 parameters.push_back( engine->toScriptValue( _t0 ) );
313 parameters.push_back( engine->toScriptValue( _t1 ) );
314 return qscriptvalue_cast<ReturnValue>(
callFunction(_plugin,_functionName,parameters) );
326 template <
typename ReturnValue ,
typename T0,
typename T1 ,
typename T2 >
327 ReturnValue
callFunctionValue( QString _plugin, QString _functionName, T0 _t0 , T1 _t1 , T2 _t2 ) {
329 std::vector< QScriptValue > parameters;
330 parameters.push_back( engine->toScriptValue( _t0 ) );
331 parameters.push_back( engine->toScriptValue( _t1 ) );
332 parameters.push_back( engine->toScriptValue( _t2 ) );
333 return qscriptvalue_cast<ReturnValue>(
callFunction(_plugin,_functionName,parameters) );
346 template <
typename ReturnValue ,
typename T0,
typename T1 ,
typename T2,
typename T3>
347 ReturnValue
callFunctionValue( QString _plugin, QString _functionName, T0 _t0 , T1 _t1 , T2 _t2 , T3 _t3 ) {
349 std::vector< QScriptValue > parameters;
350 parameters.push_back( engine->toScriptValue( _t0 ) );
351 parameters.push_back( engine->toScriptValue( _t1 ) );
352 parameters.push_back( engine->toScriptValue( _t2 ) );
353 parameters.push_back( engine->toScriptValue( _t3 ) );
354 return qscriptvalue_cast<ReturnValue>(
callFunction(_plugin,_functionName,parameters) );
368 template <
typename ReturnValue ,
typename T0,
typename T1 ,
typename T2,
typename T3,
typename T4>
369 ReturnValue
callFunctionValue( QString _plugin, QString _functionName, T0 _t0 , T1 _t1 , T2 _t2 , T3 _t3, T4 _t4 ) {
371 std::vector< QScriptValue > parameters;
372 parameters.push_back( engine->toScriptValue( _t0 ) );
373 parameters.push_back( engine->toScriptValue( _t1 ) );
374 parameters.push_back( engine->toScriptValue( _t2 ) );
375 parameters.push_back( engine->toScriptValue( _t3 ) );
376 parameters.push_back( engine->toScriptValue( _t4 ) );
377 return qscriptvalue_cast<ReturnValue>(
callFunction(_plugin,_functionName,parameters) );
392 template <
typename ReturnValue ,
typename T0,
typename T1 ,
typename T2,
typename T3,
typename T4,
typename T5>
393 ReturnValue
callFunctionValue( QString _plugin, QString _functionName, T0 _t0 , T1 _t1 , T2 _t2 , T3 _t3, T4 _t4 , T5 _t5 ) {
395 std::vector< QScriptValue > parameters;
396 parameters.push_back( engine->toScriptValue( _t0 ) );
397 parameters.push_back( engine->toScriptValue( _t1 ) );
398 parameters.push_back( engine->toScriptValue( _t2 ) );
399 parameters.push_back( engine->toScriptValue( _t3 ) );
400 parameters.push_back( engine->toScriptValue( _t4 ) );
401 parameters.push_back( engine->toScriptValue( _t5 ) );
402 return qscriptvalue_cast<ReturnValue>(
callFunction(_plugin,_functionName,parameters) );
410 #endif // RPCWRAPPERS_HH void setScriptEngine(QScriptEngine *_engine)
DONT USE! (Function to set the internal reference to the script Engine)
QScriptEngine * getScriptEngine()
get a pointer to OpenFlippers core scripting engine
QScriptValue callFunction(QString _plugin, QString _functionName, std::vector< QScriptValue > _parameters)
Call a function provided by a plugin getting multiple parameters.
ReturnValue callFunctionValue(QString _plugin, QString _functionName)
call a function in another plugin and get a return parameter