diff options
author | Timothy Pearson <[email protected]> | 2011-12-05 15:55:57 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-12-05 15:55:57 -0600 |
commit | 9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch) | |
tree | c81c34dae2b3b1ea73801bf18a960265dc4207f7 /dcopperl/DCOP.xs | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'dcopperl/DCOP.xs')
-rw-r--r-- | dcopperl/DCOP.xs | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/dcopperl/DCOP.xs b/dcopperl/DCOP.xs index 509366af..02a8b19b 100644 --- a/dcopperl/DCOP.xs +++ b/dcopperl/DCOP.xs @@ -73,7 +73,7 @@ bool boolFromSV(SV *data) if (SvIOK(data)) return SvIV(data); if (SvPOK(data)) - return QCString(SvPV(data, PL_na)).lower() == "true"; + return TQCString(SvPV(data, PL_na)).lower() == "true"; croak("DCOP: Cannot convert to bool"); } @@ -82,87 +82,87 @@ SV *boolToSV(bool data, SV *self = 0) return newSViv(data ? 1 : 0); } -QCString QCStringFromSV(SV *data) +TTQCString TQCStringFromSV(SV *data) { if (!SvOK(data)) - return QCString(); + return TQCString(); if (!SvPOK(data)) - croak("DCOP: Cannot convert to QCString"); + croak("DCOP: Cannot convert to TQCString"); return SvPV(data, PL_na); } -SV *QCStringToSV(const QCString &data, SV * self = 0) +SV *TQCStringToSV(const TQCString &data, SV * self = 0) { return data.isNull() ? &PL_sv_undef : newSVpv(data.data(), 0); } -QString QStringFromSV(SV *data) +TTQString TQStringFromSV(SV *data) { if (!SvOK(data)) - return QString::null; + return TQString::null; if (!SvPOK(data)) - croak("DCOP: Cannot convert to QString"); + croak("DCOP: Cannot convert to TQString"); return SvPV(data, PL_na); } -SV *QStringToSV(const QString &data, SV * self = 0) +SV *TQStringToSV(const TQString &data, SV * self = 0) { return data.isNull() ? &PL_sv_undef : newSVpv((char *)data.latin1(), 0); } -QCStringList QCStringListFromSV(SV *data) +TTQCStringList TQCStringListFromSV(SV *data) { if (!SvROK(data)) croak("DCOP: Not reference"); if (SvTYPE(SvRV(data)) != SVt_PVAV) croak("DCOP: Not an array reference"); - QCStringList result; + TQCStringList result; for (int i = 0; i <= av_len((AV*)SvRV(data)); i++) - result.append(QCStringFromSV(av_fetch((AV*)SvRV(data), i, 0)[0])); + result.append(TQCStringFromSV(av_fetch((AV*)SvRV(data), i, 0)[0])); return result; } -SV *QCStringListToSV(const QCStringList &data, SV * self = 0) +SV *TQCStringListToSV(const TQCStringList &data, SV * self = 0) { AV *result = newAV(); - for (QCStringList::ConstIterator i = data.begin(); i != data.end(); i++) - av_push(result, QCStringToSV(*i)); + for (TQCStringList::ConstIterator i = data.begin(); i != data.end(); i++) + av_push(result, TQCStringToSV(*i)); return newRV((SV*)result); } -QStringList QStringListFromSV(SV *data) +TTQStringList TQStringListFromSV(SV *data) { if (!SvROK(data)) croak("DCOP: Not reference"); if (SvTYPE(SvRV(data)) != SVt_PVAV) croak("DCOP: Not an array reference"); - QStringList result; + TQStringList result; for (int i = 0; i <= av_len((AV*)SvRV(data)); i++) - result.append(QCStringFromSV(av_fetch((AV*)SvRV(data), i, 0)[0])); + result.append(TQCStringFromSV(av_fetch((AV*)SvRV(data), i, 0)[0])); return result; } -SV *QStringListToSV(const QStringList &data, SV * self = 0) +SV *TQStringListToSV(const TQStringList &data, SV * self = 0) { AV *result = newAV(); - for (QStringList::ConstIterator i = data.begin(); i != data.end(); i++) - av_push(result, QStringToSV(*i)); + for (TQStringList::ConstIterator i = data.begin(); i != data.end(); i++) + av_push(result, TQStringToSV(*i)); return newRV((SV*)result); } -QPoint QPointFromSV(SV *data) +TTQPoint TQPointFromSV(SV *data) { if (!SvROK(data)) croak("DCOP: Not reference"); if (SvTYPE(SvRV(data)) != SVt_PVAV) croak("DCOP: Not an array reference"); if (av_len((AV*)SvRV(data)) != 1) - croak("DCOP: A QPoint must have exactly 2 components"); + croak("DCOP: A TQPoint must have exactly 2 components"); SV **pts = av_fetch((AV*)SvRV(data), 0, 0); - return QPoint(intFromSV(pts[0]), intFromSV(pts[1])); + return TQPoint(intFromSV(pts[0]), intFromSV(pts[1])); } -SV *QPointToSV(const QPoint &data, SV * self = 0) +SV *TQPointToSV(const TQPoint &data, SV * self = 0) { SV *pts[2] = { intToSV(data.x()), @@ -171,19 +171,19 @@ SV *QPointToSV(const QPoint &data, SV * self = 0) return newRV((SV*)av_make(2, pts)); } -QSize QSizeFromSV(SV *data) +TTQSize TQSizeFromSV(SV *data) { if (!SvROK(data)) croak("DCOP: Not reference"); if (SvTYPE(SvRV(data)) != SVt_PVAV) croak("DCOP: Not an array reference"); if (av_len((AV*)SvRV(data)) != 1) - croak("DCOP: A QSize must have exactly 2 components"); + croak("DCOP: A TQSize must have exactly 2 components"); SV **ext = av_fetch((AV*)SvRV(data), 0, 0); - return QSize(intFromSV(ext[0]), intFromSV(ext[1])); + return TQSize(intFromSV(ext[0]), intFromSV(ext[1])); } -SV *QSizeToSV(const QSize &data, SV * self = 0) +SV *TQSizeToSV(const TQSize &data, SV * self = 0) { SV *ext[2] = { intToSV(data.width()), @@ -192,19 +192,19 @@ SV *QSizeToSV(const QSize &data, SV * self = 0) return newRV((SV*)av_make(2, ext)); } -QRect QRectFromSV(SV *data) +TTQRect TQRectFromSV(SV *data) { if (!SvROK(data)) croak("DCOP: Not a reference"); if (SvTYPE(SvRV(data)) != SVt_PVAV) croak("DCOP: Not an array reference"); if (av_len((AV*)SvRV(data)) != 1) - croak("DCOP: A QRect must have exactly 4 components"); + croak("DCOP: A TQRect must have exactly 4 components"); SV **rc = av_fetch((AV*)SvRV(data), 0, 0); - return QRect(intFromSV(rc[0]), intFromSV(rc[1]), intFromSV(rc[2]), intFromSV(rc[3])); + return TQRect(intFromSV(rc[0]), intFromSV(rc[1]), intFromSV(rc[2]), intFromSV(rc[3])); } -SV *QRectToSV(const QRect &data, SV * self = 0) +SV *TQRectToSV(const TQRect &data, SV * self = 0) { SV *rc[4] = { intToSV(data.left()), @@ -217,12 +217,12 @@ SV *QRectToSV(const QRect &data, SV * self = 0) KURL KURLFromSV(SV *data) { - return KURL(QStringFromSV(data)); + return KURL(TQStringFromSV(data)); } SV *KURLToSV(const KURL &data, SV * self = 0) { - return QStringToSV(data.url()); + return TQStringToSV(data.url()); } DCOPRef DCOPRefFromSV(SV *data) @@ -231,15 +231,15 @@ DCOPRef DCOPRefFromSV(SV *data) croak("DCOP: Not a DCOP::Object"); SV **app = hv_fetch((HV*)SvRV(data), "APP", 3, 0); SV **obj = hv_fetch((HV*)SvRV(data), "OBJ", 3, 0); - return DCOPRef(QCStringFromSV(app[0]), QCStringFromSV(obj[0])); + return DCOPRef(TQCStringFromSV(app[0]), TQCStringFromSV(obj[0])); } SV *DCOPRefToSV(const DCOPRef &data, SV * self) { SV *ref = newRV((SV*)newHV()); hv_store((HV*)SvRV(ref), "CLIENT", 6, SvREFCNT_inc(self), 0); - hv_store((HV*)SvRV(ref), "APP", 3, QCStringToSV(data.app()), 0); - hv_store((HV*)SvRV(ref), "OBJ", 3, QCStringToSV(data.object()), 0); + hv_store((HV*)SvRV(ref), "APP", 3, TQCStringToSV(data.app()), 0); + hv_store((HV*)SvRV(ref), "OBJ", 3, TQCStringToSV(data.object()), 0); return sv_bless(ref, gv_stashpv("DCOP::Object", 0)); } @@ -258,16 +258,16 @@ SV *DCOPRefToSV(const DCOPRef &data, SV * self) #define DATA(func, argn) mapArgs(func, &ST(argn), items - argn) -QByteArray mapArgs(const QCString &func, SV **data, int n) +TTQByteArray mapArgs(const TQCString &func, SV **data, int n) { int p = func.find('('), q = func.find(')'); if (p == -1 || q == -1 || q < p) croak("DCOP: Invalid function signature \"%s\"", func.data()); - QStringList types = QStringList::split(',', func.mid(p + 1, q - p - 1)); - QByteArray result; - QDataStream s(result, IO_WriteOnly); - QStringList::ConstIterator it = types.begin(); + TQStringList types = TQStringList::split(',', func.mid(p + 1, q - p - 1)); + TQByteArray result; + TQDataStream s(result, IO_WriteOnly); + TQStringList::ConstIterator it = types.begin(); for (int i = 0; i < n; ++i, ++it) { if (it == types.end()) @@ -275,13 +275,13 @@ QByteArray mapArgs(const QCString &func, SV **data, int n) CHECK_ARG(int) else CHECK_ARG(uint) else CHECK_ARG(bool) - else CHECK_ARG(QCString) - else CHECK_ARG(QString) - else CHECK_ARG(QCStringList) - else CHECK_ARG(QStringList) - else CHECK_ARG(QPoint) - else CHECK_ARG(QSize) - else CHECK_ARG(QRect) + else CHECK_ARG(TQCString) + else CHECK_ARG(TQString) + else CHECK_ARG(TQCStringList) + else CHECK_ARG(TQStringList) + else CHECK_ARG(TQPoint) + else CHECK_ARG(TQSize) + else CHECK_ARG(TQRect) else CHECK_ARG(KURL) else CHECK_ARG(DCOPRef) else @@ -292,43 +292,43 @@ QByteArray mapArgs(const QCString &func, SV **data, int n) return result; } -SV* mapReply(const QCString &replyType, const QByteArray &replyData, SV *self) +SV* mapReply(const TQCString &replyType, const TQByteArray &replyData, SV *self) { if (replyType == "void") return sv_newmortal(); - QDataStream s(replyData, IO_ReadOnly); + TQDataStream s(replyData, IO_ReadOnly); CHECK_REPLY(int) else CHECK_REPLY(uint) else CHECK_REPLY(bool) - else CHECK_REPLY(QCString) - else CHECK_REPLY(QString) - else CHECK_REPLY(QCStringList) - else CHECK_REPLY(QStringList) - else CHECK_REPLY(QPoint) - else CHECK_REPLY(QSize) - else CHECK_REPLY(QRect) + else CHECK_REPLY(TQCString) + else CHECK_REPLY(TQString) + else CHECK_REPLY(TQCStringList) + else CHECK_REPLY(TQStringList) + else CHECK_REPLY(TQPoint) + else CHECK_REPLY(TQSize) + else CHECK_REPLY(TQRect) else CHECK_REPLY(KURL) else CHECK_REPLY(DCOPRef) else croak("Sorry, receiving a %s is not implemented", replyType.data()); } -bool isMultiWordType(const QString &type) +bool isMultiWordType(const TQString &type) { return type == "unsigned" || type == "signed" || type == "long"; } -QCString canonicalizeSignature(const QCString &sig) +TTQCString canonicalizeSignature(const TQCString &sig) { - QCString normal = DCOPClient::normalizeFunctionSignature(sig); + TQCString normal = DCOPClient::normalizeFunctionSignature(sig); int p = normal.find('('), q = normal.find(')'); - QCString result = normal.left(p + 1); + TQCString result = normal.left(p + 1); result.remove(0, result.findRev(' ') + 1); - QStringList params = QStringList::split(',', normal.mid(p + 1, q - p - 1)); - for (QStringList::ConstIterator it = params.begin(); it != params.end(); ++it) + TQStringList params = TQStringList::split(',', normal.mid(p + 1, q - p - 1)); + for (TQStringList::ConstIterator it = params.begin(); it != params.end(); ++it) { - QStringList words = QStringList::split(' ', (*it).simplifyWhiteSpace()); - for (QStringList::ConstIterator wi = words.begin(); wi != words.end(); ++wi) + TQStringList words = TQStringList::split(' ', (*it).simplifyWhiteSpace()); + for (TQStringList::ConstIterator wi = words.begin(); wi != words.end(); ++wi) if (!isMultiWordType(*wi)) { result += *wi; @@ -370,9 +370,9 @@ DCOPClient::isAttached() RETVAL #if 0 -QCString +TTQCString DCOPClient::registerAs(appId, ...) - QCString appId + TQCString appId PREINIT: bool addPID = true; CODE: @@ -391,16 +391,16 @@ DCOPClient::isRegistered() #endif -QCString +TTQCString DCOPClient::appId() OUTPUT: RETVAL bool DCOPClient::send(app, obj, func, ...) - QCString app - QCString obj - QCString func + TQCString app + TQCString obj + TQCString func CODE: func = canonicalizeSignature(func); RETVAL = THIS->send(app, obj, func, DATA(func, 4)); @@ -409,13 +409,13 @@ DCOPClient::send(app, obj, func, ...) SV* DCOPClient::call(app, obj, func, ...) - QCString app - QCString obj - QCString func + TQCString app + TQCString obj + TQCString func PPCODE: func = canonicalizeSignature(func); - QCString replyType; - QByteArray replyData; + TQCString replyType; + TQByteArray replyData; bool success; if ((success = THIS->call(app, obj, func, DATA(func, 4), replyType, replyData))) PUSHs(mapReply(replyType, replyData, ST(0))); @@ -426,66 +426,66 @@ DCOPClient::call(app, obj, func, ...) SV* DCOPClient::findObject(app, obj, func, ...) - QCString app - QCString obj - QCString func + TQCString app + TQCString obj + TQCString func PPCODE: func = canonicalizeSignature(func); - QCString foundApp; - QCString foundObj; + TQCString foundApp; + TQCString foundObj; if (!THIS->findObject(app, obj, func, DATA(func, 4), foundApp, foundObj)) XSRETURN_UNDEF; - PUSHs(QCStringToSV(foundApp)); - PUSHs(QCStringToSV(foundObj)); + PUSHs(TQCStringToSV(foundApp)); + PUSHs(TQCStringToSV(foundObj)); void DCOPClient::emitDCOPSignal(obj, signal, ...) - QCString obj - QCString signal + TQCString obj + TQCString signal CODE: signal = canonicalizeSignature(signal); THIS->emitDCOPSignal(obj, signal, DATA(signal, 3)); bool DCOPClient::isApplicationRegistered(app) - QCString app + TQCString app OUTPUT: RETVAL -QCStringList +TTQCStringList DCOPClient::registeredApplications() OUTPUT: RETVAL -QCStringList +TTQCStringList DCOPClient::remoteObjects(app) - QCString app + TQCString app OUTPUT: RETVAL -QCStringList +TTQCStringList DCOPClient::remoteInterfaces(app, obj) - QCString app - QCString obj + TQCString app + TQCString obj OUTPUT: RETVAL -QCStringList +TTQCStringList DCOPClient::remoteFunctions(app, obj) - QCString app - QCString obj + TQCString app + TQCString obj OUTPUT: RETVAL -static QCString +static TQCString DCOPClient::normalizeFunctionSignature(sig) - QCString sig + TQCString sig OUTPUT: RETVAL -QCString +TTQCString canonicalizeSignature(sig) - QCString sig + TQCString sig CODE: RETVAL = canonicalizeSignature(sig); OUTPUT: |