diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-12-05 15:55:57 -0600 |
commit | 9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch) | |
tree | c81c34dae2b3b1ea73801bf18a960265dc4207f7 /dcoppython/shell/pcop.cpp | |
parent | 1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff) | |
download | tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip |
Initial TQt conversion
Diffstat (limited to 'dcoppython/shell/pcop.cpp')
-rw-r--r-- | dcoppython/shell/pcop.cpp | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/dcoppython/shell/pcop.cpp b/dcoppython/shell/pcop.cpp index 4989d863..42a75b4e 100644 --- a/dcoppython/shell/pcop.cpp +++ b/dcoppython/shell/pcop.cpp @@ -36,7 +36,7 @@ namespace PythonDCOP { } PCOPObject::PCOPObject(PyObject *py_obj, const char *objid) : - DCOPObject(TQCString(objid)), m_py_obj(py_obj) + DCOPObject(TTQCString(objid)), m_py_obj(py_obj) { m_methods.setAutoDelete(true); } @@ -45,8 +45,8 @@ namespace PythonDCOP { { } - bool PCOPObject::process(const TQCString &fun, const TQByteArray &data, - TQCString& replyType, TQByteArray &replyData) + bool PCOPObject::process(const TTQCString &fun, const TTQByteArray &data, + TTQCString& replyType, TTQByteArray &replyData) { bool result = py_process(fun,data,replyType,replyData); if (PyErr_Occurred()) { @@ -59,8 +59,8 @@ namespace PythonDCOP { return result; } - bool PCOPObject::py_process(const TQCString &fun, const TQByteArray &data, - TQCString& replyType, TQByteArray &replyData) + bool PCOPObject::py_process(const TTQCString &fun, const TTQByteArray &data, + TTQCString& replyType, TTQByteArray &replyData) { kdDebug(70001) << "PCOPObject::process - fun=" << fun << " replyType=" << replyType << endl; @@ -79,7 +79,7 @@ namespace PythonDCOP { // return false; // } - TQDataStream str_arg(data, IO_ReadOnly); + TTQDataStream str_arg(data, IO_ReadOnly); PyObject *args = PyTuple_New( meth->paramCount() ); for(int c=0;c<meth->paramCount();c++) { kdDebug(70001) << "Demarshalling type: " << meth->param(c)->signature() << endl; @@ -118,7 +118,7 @@ namespace PythonDCOP { replyType = meth->type()->signature(); PCOPType repl(replyType); if (repl.isMarshallable(result)) { - TQDataStream str_repl(replyData, IO_WriteOnly); + TTQDataStream str_repl(replyData, IO_WriteOnly); repl.marshal(result,str_repl); Py_DECREF(result); return true; @@ -139,15 +139,15 @@ namespace PythonDCOP { } - bool PCOPObject::setMethodList(TQAsciiDict<PyObject> meth_list) { + bool PCOPObject::setMethodList(TTQAsciiDict<PyObject> meth_list) { bool ok = true; - for(TQAsciiDictIterator<PyObject> it(meth_list); + for(TTQAsciiDictIterator<PyObject> it(meth_list); it.current(); ++it) { PCOPMethod *meth = NULL; if (ok) { - meth = new PCOPMethod(TQCString(it.currentKey())); + meth = new PCOPMethod(TTQCString(it.currentKey())); if (!meth || !meth->setPythonMethod(it.current())) { if (meth) delete meth; @@ -165,12 +165,12 @@ namespace PythonDCOP { return ok; } - QCStringList PCOPObject::functions() { - QCStringList funcs = DCOPObject::functions(); - for(TQAsciiDictIterator<PCOPMethod> it(m_methods); + TQCStringList PCOPObject::functions() { + TQCStringList funcs = DCOPObject::functions(); + for(TTQAsciiDictIterator<PCOPMethod> it(m_methods); it.current(); ++it) { PCOPMethod *meth = it.current(); - TQCString func = meth->type()->signature(); + TTQCString func = meth->type()->signature(); func += ' '; func += meth->signature(); funcs << func; @@ -184,7 +184,7 @@ namespace PythonDCOP { PyObject *PCOPObject::methodList() { PyObject *result = PyList_New(m_methods.count()); int c=0; - for(TQAsciiDictIterator<PCOPMethod> it(m_methods); + for(TTQAsciiDictIterator<PCOPMethod> it(m_methods); it.current(); ++it, ++c) { PyObject *tuple = PyTuple_New(2); PyList_SetItem(result, c, tuple); @@ -194,12 +194,12 @@ namespace PythonDCOP { return result; } - PCOPMethod *PCOPObject::matchMethod(const TQCString &fun) { + PCOPMethod *PCOPObject::matchMethod(const TTQCString &fun) { return m_methods.find(fun); } - PCOPType::PCOPType( const TQCString& type ) + PCOPType::PCOPType( const TTQCString& type ) { m_leftType = NULL; m_rightType = NULL; @@ -236,9 +236,9 @@ namespace PythonDCOP { if (m_rightType) delete m_rightType; } - TQCString PCOPType::signature() const + TTQCString PCOPType::signature() const { - TQCString str = m_type; + TTQCString str = m_type; if ( m_leftType ) { str += "<"; @@ -256,7 +256,7 @@ namespace PythonDCOP { return str; } - bool PCOPType::marshal( PyObject* obj, TQDataStream& str ) const + bool PCOPType::marshal( PyObject* obj, TTQDataStream& str ) const { return Marshaller::instance()->marshal(*this, obj, str); } @@ -266,12 +266,12 @@ namespace PythonDCOP { return Marshaller::instance()->canMarshal(*this, obj); } - PyObject* PCOPType::demarshal( TQDataStream& str ) const + PyObject* PCOPType::demarshal( TTQDataStream& str ) const { return Marshaller::instance()->demarshal(*this, str); } - PCOPMethod::PCOPMethod( const TQCString& signature ) : + PCOPMethod::PCOPMethod( const TTQCString& signature ) : m_py_method(NULL) { @@ -298,7 +298,7 @@ namespace PythonDCOP { m_name = signature.mid( k + 1, i - k - 1 ); // Strip the parameters - TQCString p = signature.mid( i + 1, j - i - 1 ).stripWhiteSpace(); + TTQCString p = signature.mid( i + 1, j - i - 1 ).stripWhiteSpace(); if ( !p.isEmpty() ) { // Make the algorithm terminate @@ -335,7 +335,7 @@ namespace PythonDCOP { m_signature = m_name; m_signature += "("; - QListIterator<PCOPType> it( m_params ); + TQListIterator<PCOPType> it( m_params ); for( ; it.current(); ++it ) { if ( !it.atFirst() ) @@ -385,11 +385,11 @@ namespace PythonDCOP { return ((PCOPMethod*)this)->m_params.at( i ); } - PCOPClass::PCOPClass( const QCStringList& methods ) + PCOPClass::PCOPClass( const TQCStringList& methods ) { m_methods.setAutoDelete( true ); - QCStringList::ConstIterator it = methods.begin(); + TQCStringList::ConstIterator it = methods.begin(); for( ; it != methods.end(); ++it ) { PCOPMethod* m = new PCOPMethod( *it ); @@ -401,12 +401,12 @@ namespace PythonDCOP { { } - const PCOPMethod* PCOPClass::method( const TQCString &name, PyObject *argTuple ) + const PCOPMethod* PCOPClass::method( const TTQCString &name, PyObject *argTuple ) { if ( !argTuple ) return m_methods[ name ]; - TQAsciiDictIterator<PCOPMethod> it( m_methods ); + TTQAsciiDictIterator<PCOPMethod> it( m_methods ); for (; it.current(); ++it ) if ( it.currentKey() == name && it.current()->paramCount() == PyTuple_Size( argTuple ) ) @@ -440,7 +440,7 @@ namespace PythonDCOP { ImportedModules::setInstance( new ImportedModules ); int argc = 0; char **argv = NULL; - m_qapp = new TQApplication(argc,argv,false); + m_qapp = new TTQApplication(argc,argv,false); } Client::~Client() @@ -488,14 +488,14 @@ namespace PythonDCOP { if ( !PyTuple_Check( tuple ) ) return NULL; - TQByteArray replyData; - TQCString replyType; - TQByteArray data; - TQDataStream params( data, IO_WriteOnly ); + TTQByteArray replyData; + TTQCString replyType; + TTQByteArray data; + TTQDataStream params( data, IO_WriteOnly ); - TQCString appname( arg1 ); - TQCString objname( arg2 ); - TQCString funcname( arg3 ); + TTQCString appname( arg1 ); + TTQCString objname( arg2 ); + TTQCString funcname( arg3 ); // // Remove escape characters @@ -511,14 +511,14 @@ namespace PythonDCOP { // Determine which functions are available. // bool ok = false; - QCStringList funcs = dcop->remoteFunctions( appname, objname, &ok ); + TQCStringList funcs = dcop->remoteFunctions( appname, objname, &ok ); if ( !ok ) { PyErr_SetString( PyExc_RuntimeError, "Object is not accessible." ); return NULL; } - // for ( QCStringList::Iterator it = funcs.begin(); it != funcs.end(); ++it ) { + // for ( TQCStringList::Iterator it = funcs.begin(); it != funcs.end(); ++it ) { // qDebug( "%s", (*it).data() ); // } @@ -538,7 +538,7 @@ namespace PythonDCOP { return NULL; } - TQCString signature = m->signature(); + TTQCString signature = m->signature(); kdDebug(70001) << "The signature is " << signature.data() << endl; kdDebug(70001) << "The method takes " << m->paramCount() << " parameters" << endl; @@ -578,19 +578,19 @@ namespace PythonDCOP { // // ### Check wether that was sane PCOPType type( replyType ); - TQDataStream reply(replyData, IO_ReadOnly); + TTQDataStream reply(replyData, IO_ReadOnly); return type.demarshal( reply ); } PyObject* application_list( PyObject */*self*/, PyObject */*args*/ ) { - QCStringList apps = Client::instance()->dcop()->registeredApplications(); + TQCStringList apps = Client::instance()->dcop()->registeredApplications(); PyObject *l = PyList_New( apps.count() ); - QCStringList::ConstIterator it = apps.begin(); - QCStringList::ConstIterator end = apps.end(); + TQCStringList::ConstIterator it = apps.begin(); + TQCStringList::ConstIterator end = apps.end(); unsigned int i = 0; for (; it != end; ++it, i++ ) PyList_SetItem( l, i, PyString_FromString( (*it).data() ) ); @@ -601,7 +601,7 @@ namespace PythonDCOP { PyObject *object_list( PyObject */*self*/, PyObject *args) { const char *app; if (PyArg_ParseTuple(args, (char*)"s", &app)) { - QCStringList objects = Client::instance()->dcop()->remoteObjects(TQCString(app)); + TQCStringList objects = Client::instance()->dcop()->remoteObjects(TTQCString(app)); return make_py_list(objects); } return NULL; @@ -610,7 +610,7 @@ namespace PythonDCOP { PyObject *method_list( PyObject */*self*/, PyObject *args) { const char *app, *obj; if (PyArg_ParseTuple(args, (char*)"ss", &app, &obj)) { - QCStringList methods = Client::instance()->dcop()->remoteFunctions(TQCString(app), TQCString(obj) ); + TQCStringList methods = Client::instance()->dcop()->remoteFunctions(TTQCString(app), TTQCString(obj) ); return make_py_list(methods); } return NULL; @@ -620,7 +620,7 @@ namespace PythonDCOP { const char *appid; int add_pid = 1; if (PyArg_ParseTuple(args, (char*)"s|i", &appid, &add_pid)) { - TQCString actual_appid = Client::instance()->dcop()->registerAs(TQCString(appid), add_pid!=0); + TTQCString actual_appid = Client::instance()->dcop()->registerAs(TTQCString(appid), add_pid!=0); return PyString_FromString(actual_appid.data()); } return NULL; @@ -650,7 +650,7 @@ namespace PythonDCOP { PyList_Check(method_list)) { // extract each tuple from the list, aborting if any is invalid - TQAsciiDict<PyObject> meth_list; + TTQAsciiDict<PyObject> meth_list; int size = PyList_Size(method_list); for(int c=0;c<size;c++) { PyObject *tuple = PyList_GetItem(method_list,c); @@ -692,7 +692,7 @@ namespace PythonDCOP { int volint = 0; if (PyArg_ParseTuple(args, (char*)"sssss|i", &sender, &senderObj, &signal, &receiverObj, &slot, &volint)) { - bool success = Client::instance()->dcop()->connectDCOPSignal(TQCString(sender), TQCString(senderObj), TQCString(signal), TQCString(receiverObj), TQCString(slot), (volint == 1)?true:false); + bool success = Client::instance()->dcop()->connectDCOPSignal(TTQCString(sender), TTQCString(senderObj), TTQCString(signal), TTQCString(receiverObj), TTQCString(slot), (volint == 1)?true:false); return Py_BuildValue("i", success?1:0); } return NULL; @@ -706,7 +706,7 @@ namespace PythonDCOP { const char *slot; if (PyArg_ParseTuple(args, (char*)"sssss", &sender, &senderObj, &signal, &receiverObj, &slot)) { - bool success = Client::instance()->dcop()->disconnectDCOPSignal(TQCString(sender), TQCString(senderObj), TQCString(signal), TQCString(receiverObj), TQCString(slot)); + bool success = Client::instance()->dcop()->disconnectDCOPSignal(TTQCString(sender), TTQCString(senderObj), TTQCString(signal), TTQCString(receiverObj), TTQCString(slot)); return Py_BuildValue("i", success?1:0); } return NULL; @@ -730,10 +730,10 @@ namespace PythonDCOP { // helpers - PyObject *make_py_list( const QCStringList &qt_list) { + PyObject *make_py_list( const TQCStringList &qt_list) { PyObject *l = PyList_New(qt_list.count()); uint c=0; - for(QCStringList::ConstIterator it = qt_list.begin(); + for(TQCStringList::ConstIterator it = qt_list.begin(); it!=qt_list.end(); ++it,c++) PyList_SetItem(l, c, PyString_FromString( (*it).data() ) ); |