Skip to content
Snippets Groups Projects
Commit a123db10 authored by Jan Möbius's avatar Jan Möbius
Browse files

RPC Interface extension to support up to 6 parameters with return value

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15190 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 43d5749c
No related branches found
No related tags found
No related merge requests found
......@@ -347,6 +347,54 @@ ReturnValue callFunctionValue( QString _plugin, QString _functionName, T0 _t0 ,
return qscriptvalue_cast<ReturnValue>( callFunction(_plugin,_functionName,parameters) );
}
/** \brief call a function in another plugin and get a return parameter
*
* @param _plugin Plugin name ( Scripting name of the plugin )
* @param _functionName Name of the remote function
* @param _t0 Parameter 1 passed to the function
* @param _t1 Parameter 2 passed to the function
* @param _t2 Parameter 3 passed to the function
* @param _t3 Parameter 4 passed to the function
* @param _t4 Parameter 5 passed to the function
* @return value returned by the called function
*/
template <typename ReturnValue , typename T0, typename T1 , typename T2, typename T3, typename T4>
ReturnValue callFunctionValue( QString _plugin, QString _functionName, T0 _t0 , T1 _t1 , T2 _t2 , T3 _t3, T4 _t4 ) {
QScriptEngine* engine = getScriptEngine();
std::vector< QScriptValue > parameters;
parameters.push_back( engine->toScriptValue( _t0 ) );
parameters.push_back( engine->toScriptValue( _t1 ) );
parameters.push_back( engine->toScriptValue( _t2 ) );
parameters.push_back( engine->toScriptValue( _t3 ) );
parameters.push_back( engine->toScriptValue( _t4 ) );
return qscriptvalue_cast<ReturnValue>( callFunction(_plugin,_functionName,parameters) );
}
/** \brief call a function in another plugin and get a return parameter
*
* @param _plugin Plugin name ( Scripting name of the plugin )
* @param _functionName Name of the remote function
* @param _t0 Parameter 1 passed to the function
* @param _t1 Parameter 2 passed to the function
* @param _t2 Parameter 3 passed to the function
* @param _t3 Parameter 4 passed to the function
* @param _t4 Parameter 5 passed to the function
* @param _t5 Parameter 6 passed to the function
* @return value returned by the called function
*/
template <typename ReturnValue , typename T0, typename T1 , typename T2, typename T3, typename T4, typename T5>
ReturnValue callFunctionValue( QString _plugin, QString _functionName, T0 _t0 , T1 _t1 , T2 _t2 , T3 _t3, T4 _t4 , T5 _t5 ) {
QScriptEngine* engine = getScriptEngine();
std::vector< QScriptValue > parameters;
parameters.push_back( engine->toScriptValue( _t0 ) );
parameters.push_back( engine->toScriptValue( _t1 ) );
parameters.push_back( engine->toScriptValue( _t2 ) );
parameters.push_back( engine->toScriptValue( _t3 ) );
parameters.push_back( engine->toScriptValue( _t4 ) );
parameters.push_back( engine->toScriptValue( _t5 ) );
return qscriptvalue_cast<ReturnValue>( callFunction(_plugin,_functionName,parameters) );
}
/** @} */
......
......@@ -98,10 +98,28 @@ void Core::slotObjectUpdated(int _identifier, const UpdateType& _type) {
}
}
// just inform the plugins as we dont do anything else (Do deprecated and new updatedObjects here)
// If the identifier is -1 we force an update of all objects in the scene (Bad idea for scenes with many objects)
if ( _identifier == -1 ) {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::ALL_OBJECTS,DATA_ALL ) ; o_it != PluginFunctions::objectsEnd(); ++o_it) {
// just inform the plugins as we don't do anything else (Do deprecated and new updatedObjects here)
emit signalObjectUpdated(o_it->id());
emit signalObjectUpdated(o_it->id(), _type);
// Call the objects update function
o_it->update();
}
} else {
// just inform the plugins as we don't do anything else (Do deprecated and new updatedObjects here)
emit signalObjectUpdated(_identifier);
emit signalObjectUpdated(_identifier, _type);
}
// If we have an single object, call it's update function
if ( object != 0 )
object->update(_type);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment