mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-08 19:08:46 -05: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
@ -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
|
qDebug() << instanceName << apiPath << retvalType << typeName
|
||||||
<< methodName;
|
<< methodName;
|
||||||
@ -236,15 +243,12 @@ int main(int argc, char *argv[])
|
|||||||
if(hasOutput) outputParamsSerialization += "\t\t}\n";
|
if(hasOutput) outputParamsSerialization += "\t\t}\n";
|
||||||
|
|
||||||
QMap<QString,QString> substitutionsMap;
|
QMap<QString,QString> substitutionsMap;
|
||||||
substitutionsMap.insert("instanceName", instanceName);
|
|
||||||
substitutionsMap.insert("methodName", methodName);
|
|
||||||
substitutionsMap.insert("paramsDeclaration", paramsDeclaration);
|
substitutionsMap.insert("paramsDeclaration", paramsDeclaration);
|
||||||
substitutionsMap.insert("inputParamsDeserialization", inputParamsDeserialization);
|
substitutionsMap.insert("inputParamsDeserialization", inputParamsDeserialization);
|
||||||
substitutionsMap.insert("outputParamsSerialization", outputParamsSerialization);
|
substitutionsMap.insert("outputParamsSerialization", outputParamsSerialization);
|
||||||
substitutionsMap.insert("retvalType", retvalType);
|
|
||||||
substitutionsMap.insert("callParamsList", orderedParamNames.join(", "));
|
|
||||||
substitutionsMap.insert("wrapperName", wrapperName);
|
substitutionsMap.insert("wrapperName", wrapperName);
|
||||||
substitutionsMap.insert("headerFileName", headerFileName);
|
substitutionsMap.insert("headerFileName", headerFileName);
|
||||||
|
substitutionsMap.insert("functionCall", functionCall);
|
||||||
|
|
||||||
QFile templFile(sourcePath + "/method-wrapper-template.cpp.tmpl");
|
QFile templFile(sourcePath + "/method-wrapper-template.cpp.tmpl");
|
||||||
templFile.open(QIODevice::ReadOnly);
|
templFile.open(QIODevice::ReadOnly);
|
||||||
|
@ -50,7 +50,7 @@ $%paramsDeclaration%$
|
|||||||
$%inputParamsDeserialization%$
|
$%inputParamsDeserialization%$
|
||||||
|
|
||||||
// call retroshare C++ API
|
// call retroshare C++ API
|
||||||
$%retvalType%$ retval = $%instanceName%$->$%methodName%$($%callParamsList%$);
|
$%functionCall%$
|
||||||
|
|
||||||
// serialize out parameters and return value to JSON
|
// serialize out parameters and return value to JSON
|
||||||
$%outputParamsSerialization%$
|
$%outputParamsSerialization%$
|
||||||
|
@ -100,7 +100,11 @@ std::string pgp_pwd_callback(void * /*hook*/, const char *uid_title, const char
|
|||||||
return password ;
|
return password ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthGPG::init(const std::string& path_to_public_keyring,const std::string& path_to_secret_keyring,const std::string& path_to_trustdb,const std::string& pgp_lock_file)
|
void AuthGPG::init(
|
||||||
|
const std::string& path_to_public_keyring,
|
||||||
|
const std::string& path_to_secret_keyring,
|
||||||
|
const std::string& path_to_trustdb,
|
||||||
|
const std::string& pgp_lock_file)
|
||||||
{
|
{
|
||||||
if(_instance != NULL)
|
if(_instance != NULL)
|
||||||
{
|
{
|
||||||
@ -108,8 +112,11 @@ void AuthGPG::init(const std::string& path_to_public_keyring,const std::string&
|
|||||||
std::cerr << "AuthGPG::init() called twice!" << std::endl ;
|
std::cerr << "AuthGPG::init() called twice!" << std::endl ;
|
||||||
}
|
}
|
||||||
|
|
||||||
PGPHandler::setPassphraseCallback(pgp_pwd_callback) ;
|
// if(cb) PGPHandler::setPassphraseCallback(cb);else
|
||||||
_instance = new AuthGPG(path_to_public_keyring,path_to_secret_keyring,path_to_trustdb,pgp_lock_file) ;
|
PGPHandler::setPassphraseCallback(pgp_pwd_callback);
|
||||||
|
_instance = new AuthGPG( path_to_public_keyring,
|
||||||
|
path_to_secret_keyring,
|
||||||
|
path_to_trustdb, pgp_lock_file );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthGPG::exit()
|
void AuthGPG::exit()
|
||||||
|
@ -89,8 +89,8 @@ public:
|
|||||||
class AuthGPGService
|
class AuthGPGService
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AuthGPGService() {};
|
AuthGPGService() {}
|
||||||
~AuthGPGService() {};
|
~AuthGPGService() {}
|
||||||
|
|
||||||
virtual AuthGPGOperation *getGPGOperation() = 0;
|
virtual AuthGPGOperation *getGPGOperation() = 0;
|
||||||
virtual void setGPGOperation(AuthGPGOperation *operation) = 0;
|
virtual void setGPGOperation(AuthGPGOperation *operation) = 0;
|
||||||
@ -98,12 +98,11 @@ public:
|
|||||||
|
|
||||||
class AuthGPG: public p3Config, public RsTickingThread, public PGPHandler
|
class AuthGPG: public p3Config, public RsTickingThread, public PGPHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static void init(const std::string& path_to_pubring,
|
||||||
static void init( const std::string& path_to_pubring,
|
const std::string& path_to_secring,
|
||||||
const std::string& path_to_secring,
|
const std::string& path_to_trustdb,
|
||||||
const std::string& path_to_trustdb,
|
const std::string& pgp_lock_file);
|
||||||
const std::string& pgp_lock_file);
|
|
||||||
|
|
||||||
static void exit();
|
static void exit();
|
||||||
static AuthGPG *getAuthGPG() { return _instance ; }
|
static AuthGPG *getAuthGPG() { return _instance ; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user