mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 06:06:10 -04:00
jsonapi-generator fix support for void methods
Thanks sehraf for reporting retroshare://forum?name=fucking%20genius&id=8fd22bd8f99754461e7ba1ca8a727995&msgid=503d75bf7ed7fa7568eeae4db5c8d31a7e124c98
This commit is contained in:
parent
cb11ad92ea
commit
d14a455cf1
4 changed files with 27 additions and 17 deletions
|
@ -188,7 +188,14 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if(retvalType != "void") hasOutput = true;
|
||||
QString functionCall("\t\t");
|
||||
if(retvalType != "void")
|
||||
{
|
||||
functionCall += retvalType + " retval = ";
|
||||
hasOutput = true;
|
||||
}
|
||||
functionCall += instanceName + "->" + methodName + "(";
|
||||
functionCall += orderedParamNames.join(", ") + ");\n";
|
||||
|
||||
qDebug() << instanceName << apiPath << retvalType << typeName
|
||||
<< methodName;
|
||||
|
@ -236,15 +243,12 @@ int main(int argc, char *argv[])
|
|||
if(hasOutput) outputParamsSerialization += "\t\t}\n";
|
||||
|
||||
QMap<QString,QString> substitutionsMap;
|
||||
substitutionsMap.insert("instanceName", instanceName);
|
||||
substitutionsMap.insert("methodName", methodName);
|
||||
substitutionsMap.insert("paramsDeclaration", paramsDeclaration);
|
||||
substitutionsMap.insert("inputParamsDeserialization", inputParamsDeserialization);
|
||||
substitutionsMap.insert("outputParamsSerialization", outputParamsSerialization);
|
||||
substitutionsMap.insert("retvalType", retvalType);
|
||||
substitutionsMap.insert("callParamsList", orderedParamNames.join(", "));
|
||||
substitutionsMap.insert("wrapperName", wrapperName);
|
||||
substitutionsMap.insert("headerFileName", headerFileName);
|
||||
substitutionsMap.insert("functionCall", functionCall);
|
||||
|
||||
QFile templFile(sourcePath + "/method-wrapper-template.cpp.tmpl");
|
||||
templFile.open(QIODevice::ReadOnly);
|
||||
|
|
|
@ -50,7 +50,7 @@ $%paramsDeclaration%$
|
|||
$%inputParamsDeserialization%$
|
||||
|
||||
// call retroshare C++ API
|
||||
$%retvalType%$ retval = $%instanceName%$->$%methodName%$($%callParamsList%$);
|
||||
$%functionCall%$
|
||||
|
||||
// serialize out parameters and return value to JSON
|
||||
$%outputParamsSerialization%$
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue