feat: LogosResult (#14)

* Add LogosResult

* Add documentation for complex types

* Add get type util function

* Add more shorthand functions

* Add bool support

* Provide more shorthand functions

* Throw exception on bad access

* Fix typo in doc
This commit is contained in:
Arnaud
2026-02-25 09:13:43 -05:00
committed by GitHub
parent 30ef7986f4
commit 4fdf157120
10 changed files with 297 additions and 5 deletions
+23 -2
View File
@@ -94,7 +94,7 @@ namespace {
);
break;
}
case QMetaType::QUrl: {
case QMetaType::QUrl: {
auto value = new QUrl{arg.toUrl()};
scopedArgs.emplace_back(
Q_ARG(QUrl, *value),
@@ -104,6 +104,16 @@ namespace {
);
break;
}
case QMetaType::Bool: {
auto value = new bool{arg.toBool()};
scopedArgs.emplace_back(
Q_ARG(bool, *value),
[](const void* data) {
delete static_cast<const bool*>(data);
}
);
break;
}
case QMetaType::QString:
default: {
auto value = new QString{arg.toString()};
@@ -155,6 +165,8 @@ namespace {
INVOKE_METHOD_WITH_RETURN(int, int);
} else if (strcmp(returnTypeName, "QString") == 0) {
INVOKE_METHOD_WITH_RETURN(QString, QString);
} else if (strcmp(returnTypeName, "LogosResult") == 0) {
INVOKE_METHOD_WITH_RETURN(LogosResult, LogosResult);
} else if (strcmp(returnTypeName, "QVariant") == 0) {
INVOKE_METHOD_WITH_RETURN(QVariant, QVariant);
} else if (strcmp(returnTypeName, "QJsonArray") == 0) {
@@ -344,7 +356,16 @@ QVariant ModuleProxy::callRemoteMethod(const QString& authToken, const QString&
if (success) {
result = QVariant(stringResult);
}
} else if (returnType == QMetaType::fromType<QVariant>()) {
}
else if (returnType == QMetaType::fromType<LogosResult>()) {
// LogosResult return type
LogosResult logosResult;
success = invokeMethodByArgCount(m_module, methodName, args, &logosResult, "LogosResult");
if (success) {
result = QVariant::fromValue(logosResult);
}
}
else if (returnType == QMetaType::fromType<QVariant>()) {
// QVariant return type
QVariant variantResult;
success = invokeMethodByArgCount(m_module, methodName, args, &variantResult, "QVariant");