int QtRpc::ProxyBase::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { if (_id >= 1000) { QMutexLocker locker(&qxt_d().mutex); // Make sure this isn't being run from the wrong thread.... Q_ASSERT(thread() == QThread::currentThread()); if (thread() != QThread::currentThread()) { qCritical() << "You cannot call functions from other threads in QtRpc2"; } //make sure the function exists if (qxt_d().functions.keys().contains(_id)) { Arguments args; Signature sig = qxt_d().functions[_id]; //check to see if the function is an async function if (qxt_d().asyncfunctions.contains(_id)) { //create argument list for (int i = 0; i < sig.numArgs(); i++) { args.append(convertQVariant(sig.arg(i), _a[i+3])); } // _a[0] = new ReturnValue(functionCalled(*(QObject **)_a[1], *(char **)_a[2], sig, args, qxt_d().functiontypes[_id])); *static_cast<ReturnValue*>(_a[0]) = functionCalled(*(QObject **)_a[1], *(char **)_a[2], sig, args, qxt_d().functiontypes[_id]); return(-1); } else { //create argument list for (int i = 0; i < sig.numArgs(); i++) { args.append(convertQVariant(sig.arg(i), _a[i+1])); } *static_cast<ReturnValue*>(_a[0]) = this->functionCalled(sig, args, qxt_d().functiontypes[_id]); // _a[0] = new ReturnValue(functionCalled(sig, args, qxt_d().functiontypes[_id])); // memcpy(_a[0], ret, sizeof(ReturnValue)); return -1; } } } _id = QObject::qt_metacall(_c, _id, _a); return _id; }
KexiUserAction * KexiUserAction::fromCurrentRecord(KActionCollection *parent, KexiDB::Cursor *c) { if (!c || c->bof() || c->eof()) return 0; KexiUserAction *a = new KexiUserAction(parent, c->value(1).toString(), c->value(2).toString(), c->value(3).toString()); QString args = c->value(5).toString(); bool quote = false; Arguments arg; QString tmp; const int len = args.length(); for (int i = 0; i < len; i++) { if (args[i] == '"') { // if current char is quoted unqote or other way round quote = !quote; } else if (args[i] == ',' && !quote) { //if item end add tmp to argumentstack and strip quotes if nessesery if (tmp.left(1) == "\"" && tmp.right(1) == "\"") tmp = tmp.mid(1, tmp.length() - 2); arg.append(QVariant(tmp)); tmp = ""; } else { //else simply add char to tmp tmp += args[i]; } } if (tmp.left(1) == "\"" && tmp.right(1) == "\"") tmp = tmp.mid(1, tmp.length() - 2); arg.append(QVariant(tmp)); a->setMethod(c->value(4).toInt(), arg); return a; }