diff options
Diffstat (limited to 'dcoppython')
-rw-r--r-- | dcoppython/shell/marshaller.cpp | 36 | ||||
-rw-r--r-- | dcoppython/shell/marshaller.h | 36 | ||||
-rw-r--r-- | dcoppython/shell/pcop.cpp | 78 | ||||
-rw-r--r-- | dcoppython/shell/pcop.h | 44 | ||||
-rw-r--r-- | dcoppython/test/README-server | 6 | ||||
-rw-r--r-- | dcoppython/test/dcopserver/kdedcoptest.cpp | 2 |
6 files changed, 101 insertions, 101 deletions
diff --git a/dcoppython/shell/marshaller.cpp b/dcoppython/shell/marshaller.cpp index ff9843d4..ff018021 100644 --- a/dcoppython/shell/marshaller.cpp +++ b/dcoppython/shell/marshaller.cpp @@ -43,18 +43,18 @@ namespace PythonDCOP { bool Marshaller::marsh_private(const PCOPType &type, PyObject *obj, - TTQDataStream *str) const + TQDataStream *str) const { - TTQString ty = type.type(); + TQString ty = type.type(); - if (ty=="TTQStringList") - return marshalList(PCOPType("TTQString"), obj, str); + if (ty=="TQStringList") + return marshalList(PCOPType("TQString"), obj, str); if (ty=="TQCStringList") - return marshalList(PCOPType("TTQCString"), obj, str); - if (ty=="TTQValueList" && type.leftType()) + return marshalList(PCOPType("TQCString"), obj, str); + if (ty=="TQValueList" && type.leftType()) return marshalList(*type.leftType(), obj, str); - if (ty=="TTQMap" && type.leftType() && type.rightType()) + if (ty=="TQMap" && type.leftType() && type.rightType()) return marshalDict(*type.leftType(), *type.rightType(), obj, str); if (!m_marsh_funcs.contains(ty)) return false; @@ -62,17 +62,17 @@ namespace PythonDCOP { } PyObject *Marshaller::demarsh_private(const PCOPType &type, - TTQDataStream *str) const + TQDataStream *str) const { - TTQString ty = type.type(); + TQString ty = type.type(); - if (ty=="TTQStringList") - return demarshalList(PCOPType("TTQString"), str); + if (ty=="TQStringList") + return demarshalList(PCOPType("TQString"), str); if (ty=="TQCStringList") - return demarshalList(PCOPType("TTQCString"), str); - if (ty=="TTQValueList" && type.leftType()) + return demarshalList(PCOPType("TQCString"), str); + if (ty=="TQValueList" && type.leftType()) return demarshalList(*type.leftType(), str); - if (ty=="TTQMap" && type.leftType() && type.rightType()) + if (ty=="TQMap" && type.leftType() && type.rightType()) return demarshalDict(*type.leftType(), *type.rightType(), str); if (!m_demarsh_funcs.contains(ty)) { @@ -91,7 +91,7 @@ namespace PythonDCOP { bool Marshaller::marshalList(const PCOPType &list_type, PyObject *obj, - TTQDataStream *str) const { + TQDataStream *str) const { if (!PyList_Check(obj)) return false; int count = PyList_Size(obj); @@ -110,7 +110,7 @@ namespace PythonDCOP { } PyObject *Marshaller::demarshalList(const PCOPType &list_type, - TTQDataStream *str) const { + TQDataStream *str) const { Q_UINT32 count; (*str) >> count; @@ -124,7 +124,7 @@ namespace PythonDCOP { bool Marshaller::marshalDict(const PCOPType &key_type, const PCOPType &value_type, PyObject *obj, - TTQDataStream *str) const { + TQDataStream *str) const { if (!PyDict_Check(obj)) return false; @@ -149,7 +149,7 @@ namespace PythonDCOP { PyObject *Marshaller::demarshalDict(const PCOPType &key_type, const PCOPType &value_type, - TTQDataStream *str) const { + TQDataStream *str) const { PyObject *obj = PyDict_New(); Q_INT32 count; (*str) >> count; diff --git a/dcoppython/shell/marshaller.h b/dcoppython/shell/marshaller.h index 5eefc800..6cb16d89 100644 --- a/dcoppython/shell/marshaller.h +++ b/dcoppython/shell/marshaller.h @@ -15,7 +15,7 @@ #include <Python.h> #include <tqstring.h> -class TTQDataStream; +class TQDataStream; namespace PythonDCOP { // class Marshaller; @@ -25,23 +25,23 @@ namespace PythonDCOP { public: Marshaller(); ~Marshaller(); - bool marshal(const PCOPType &type, PyObject *obj, TTQDataStream &str) const + bool marshal(const PCOPType &type, PyObject *obj, TQDataStream &str) const { return marsh_private(type,obj,&str); } bool canMarshal(const PCOPType &type, PyObject *obj) const { return marsh_private(type,obj,NULL); } - bool marshalList(const PCOPType &list_type, PyObject *obj, TTQDataStream *str) const; - PyObject *demarshal(const PCOPType &type, TTQDataStream &str) const + bool marshalList(const PCOPType &list_type, PyObject *obj, TQDataStream *str) const; + PyObject *demarshal(const PCOPType &type, TQDataStream &str) const { return demarsh_private(type, &str); } - PyObject *demarshalList(const PCOPType &list_type, TTQDataStream *str) const; + PyObject *demarshalList(const PCOPType &list_type, TQDataStream *str) const; bool marshalDict(const PCOPType &key_type, const PCOPType &value_type, - PyObject *obj, TTQDataStream *str) const; + PyObject *obj, TQDataStream *str) const; PyObject *demarshalDict(const PCOPType &key_type, const PCOPType &value_type, - TTQDataStream *str) const; + TQDataStream *str) const; static Marshaller *instance() { return m_instance; } protected: - TTQMap<TTQString,bool(*)(PyObject*,TTQDataStream*)> m_marsh_funcs; - TTQMap<TTQString,PyObject*(*)(TTQDataStream*)> m_demarsh_funcs; + TQMap<TQString,bool(*)(PyObject*,TQDataStream*)> m_marsh_funcs; + TQMap<TQString,PyObject*(*)(TQDataStream*)> m_demarsh_funcs; static Marshaller *m_instance; @@ -49,21 +49,21 @@ namespace PythonDCOP { private: bool marsh_private(const PCOPType &type, PyObject *obj, - TTQDataStream *str) const; + TQDataStream *str) const; PyObject *demarsh_private(const PCOPType &type, - TTQDataStream *str) const; + TQDataStream *str) const; }; -// bool marshall_bool(PyObject *obj, TTQDataStream *str); -// bool marshall_int(PyObject *obj, TTQDataStream *str); -// bool marshall_uint(PyObject *obj, TTQDataStream *str); -// bool marshall_double(PyObject *obj, TTQDataStream *str); -// bool marshall_QByteArray(PyObject *obj, TTQDataStream *str); -// bool marshall_QString(PyObject *obj, TTQDataStream *str); -// bool marshall_QCString(PyObject *obj, TTQDataStream *str); +// bool marshall_bool(PyObject *obj, TQDataStream *str); +// bool marshall_int(PyObject *obj, TQDataStream *str); +// bool marshall_uint(PyObject *obj, TQDataStream *str); +// bool marshall_double(PyObject *obj, TQDataStream *str); +// bool marshall_QByteArray(PyObject *obj, TQDataStream *str); +// bool marshall_QString(PyObject *obj, TQDataStream *str); +// bool marshall_QCString(PyObject *obj, TQDataStream *str); } diff --git a/dcoppython/shell/pcop.cpp b/dcoppython/shell/pcop.cpp index 42a75b4e..ea2d53ba 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(TTQCString(objid)), m_py_obj(py_obj) + DCOPObject(TQCString(objid)), m_py_obj(py_obj) { m_methods.setAutoDelete(true); } @@ -45,8 +45,8 @@ namespace PythonDCOP { { } - bool PCOPObject::process(const TTQCString &fun, const TTQByteArray &data, - TTQCString& replyType, TTQByteArray &replyData) + bool PCOPObject::process(const TQCString &fun, const TQByteArray &data, + TQCString& replyType, TQByteArray &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 TTQCString &fun, const TTQByteArray &data, - TTQCString& replyType, TTQByteArray &replyData) + bool PCOPObject::py_process(const TQCString &fun, const TQByteArray &data, + TQCString& replyType, TQByteArray &replyData) { kdDebug(70001) << "PCOPObject::process - fun=" << fun << " replyType=" << replyType << endl; @@ -79,7 +79,7 @@ namespace PythonDCOP { // return false; // } - TTQDataStream str_arg(data, IO_ReadOnly); + TQDataStream 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)) { - TTQDataStream str_repl(replyData, IO_WriteOnly); + TQDataStream str_repl(replyData, IO_WriteOnly); repl.marshal(result,str_repl); Py_DECREF(result); return true; @@ -139,15 +139,15 @@ namespace PythonDCOP { } - bool PCOPObject::setMethodList(TTQAsciiDict<PyObject> meth_list) { + bool PCOPObject::setMethodList(TQAsciiDict<PyObject> meth_list) { bool ok = true; - for(TTQAsciiDictIterator<PyObject> it(meth_list); + for(TQAsciiDictIterator<PyObject> it(meth_list); it.current(); ++it) { PCOPMethod *meth = NULL; if (ok) { - meth = new PCOPMethod(TTQCString(it.currentKey())); + meth = new PCOPMethod(TQCString(it.currentKey())); if (!meth || !meth->setPythonMethod(it.current())) { if (meth) delete meth; @@ -167,10 +167,10 @@ namespace PythonDCOP { TQCStringList PCOPObject::functions() { TQCStringList funcs = DCOPObject::functions(); - for(TTQAsciiDictIterator<PCOPMethod> it(m_methods); + for(TQAsciiDictIterator<PCOPMethod> it(m_methods); it.current(); ++it) { PCOPMethod *meth = it.current(); - TTQCString func = meth->type()->signature(); + TQCString 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(TTQAsciiDictIterator<PCOPMethod> it(m_methods); + for(TQAsciiDictIterator<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 TTQCString &fun) { + PCOPMethod *PCOPObject::matchMethod(const TQCString &fun) { return m_methods.find(fun); } - PCOPType::PCOPType( const TTQCString& type ) + PCOPType::PCOPType( const TQCString& type ) { m_leftType = NULL; m_rightType = NULL; @@ -236,9 +236,9 @@ namespace PythonDCOP { if (m_rightType) delete m_rightType; } - TTQCString PCOPType::signature() const + TQCString PCOPType::signature() const { - TTQCString str = m_type; + TQCString str = m_type; if ( m_leftType ) { str += "<"; @@ -256,7 +256,7 @@ namespace PythonDCOP { return str; } - bool PCOPType::marshal( PyObject* obj, TTQDataStream& str ) const + bool PCOPType::marshal( PyObject* obj, TQDataStream& str ) const { return Marshaller::instance()->marshal(*this, obj, str); } @@ -266,12 +266,12 @@ namespace PythonDCOP { return Marshaller::instance()->canMarshal(*this, obj); } - PyObject* PCOPType::demarshal( TTQDataStream& str ) const + PyObject* PCOPType::demarshal( TQDataStream& str ) const { return Marshaller::instance()->demarshal(*this, str); } - PCOPMethod::PCOPMethod( const TTQCString& signature ) : + PCOPMethod::PCOPMethod( const TQCString& signature ) : m_py_method(NULL) { @@ -298,7 +298,7 @@ namespace PythonDCOP { m_name = signature.mid( k + 1, i - k - 1 ); // Strip the parameters - TTQCString p = signature.mid( i + 1, j - i - 1 ).stripWhiteSpace(); + TQCString p = signature.mid( i + 1, j - i - 1 ).stripWhiteSpace(); if ( !p.isEmpty() ) { // Make the algorithm terminate @@ -401,12 +401,12 @@ namespace PythonDCOP { { } - const PCOPMethod* PCOPClass::method( const TTQCString &name, PyObject *argTuple ) + const PCOPMethod* PCOPClass::method( const TQCString &name, PyObject *argTuple ) { if ( !argTuple ) return m_methods[ name ]; - TTQAsciiDictIterator<PCOPMethod> it( m_methods ); + TQAsciiDictIterator<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 TTQApplication(argc,argv,false); + m_qapp = new TQApplication(argc,argv,false); } Client::~Client() @@ -488,14 +488,14 @@ namespace PythonDCOP { if ( !PyTuple_Check( tuple ) ) return NULL; - TTQByteArray replyData; - TTQCString replyType; - TTQByteArray data; - TTQDataStream params( data, IO_WriteOnly ); + TQByteArray replyData; + TQCString replyType; + TQByteArray data; + TQDataStream params( data, IO_WriteOnly ); - TTQCString appname( arg1 ); - TTQCString objname( arg2 ); - TTQCString funcname( arg3 ); + TQCString appname( arg1 ); + TQCString objname( arg2 ); + TQCString funcname( arg3 ); // // Remove escape characters @@ -538,7 +538,7 @@ namespace PythonDCOP { return NULL; } - TTQCString signature = m->signature(); + TQCString signature = m->signature(); kdDebug(70001) << "The signature is " << signature.data() << endl; kdDebug(70001) << "The method takes " << m->paramCount() << " parameters" << endl; @@ -578,7 +578,7 @@ namespace PythonDCOP { // // ### Check wether that was sane PCOPType type( replyType ); - TTQDataStream reply(replyData, IO_ReadOnly); + TQDataStream reply(replyData, IO_ReadOnly); return type.demarshal( reply ); } @@ -601,7 +601,7 @@ namespace PythonDCOP { PyObject *object_list( PyObject */*self*/, PyObject *args) { const char *app; if (PyArg_ParseTuple(args, (char*)"s", &app)) { - TQCStringList objects = Client::instance()->dcop()->remoteObjects(TTQCString(app)); + TQCStringList objects = Client::instance()->dcop()->remoteObjects(TQCString(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)) { - TQCStringList methods = Client::instance()->dcop()->remoteFunctions(TTQCString(app), TTQCString(obj) ); + TQCStringList methods = Client::instance()->dcop()->remoteFunctions(TQCString(app), TQCString(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)) { - TTQCString actual_appid = Client::instance()->dcop()->registerAs(TTQCString(appid), add_pid!=0); + TQCString actual_appid = Client::instance()->dcop()->registerAs(TQCString(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 - TTQAsciiDict<PyObject> meth_list; + TQAsciiDict<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(TTQCString(sender), TTQCString(senderObj), TTQCString(signal), TTQCString(receiverObj), TTQCString(slot), (volint == 1)?true:false); + bool success = Client::instance()->dcop()->connectDCOPSignal(TQCString(sender), TQCString(senderObj), TQCString(signal), TQCString(receiverObj), TQCString(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(TTQCString(sender), TTQCString(senderObj), TTQCString(signal), TTQCString(receiverObj), TTQCString(slot)); + bool success = Client::instance()->dcop()->disconnectDCOPSignal(TQCString(sender), TQCString(senderObj), TQCString(signal), TQCString(receiverObj), TQCString(slot)); return Py_BuildValue("i", success?1:0); } return NULL; diff --git a/dcoppython/shell/pcop.h b/dcoppython/shell/pcop.h index ee4e3094..35beef1c 100644 --- a/dcoppython/shell/pcop.h +++ b/dcoppython/shell/pcop.h @@ -20,7 +20,7 @@ #include <dcopclient.h> #include <dcopobject.h> -class TTQDataStream; +class TQDataStream; namespace PythonDCOP { class Client; @@ -58,7 +58,7 @@ namespace PythonDCOP { DCOPClient *m_dcop; // ImportedModules *m_module; static Client *s_instance; - TTQApplication *m_qapp; + TQApplication *m_qapp; }; /** @@ -85,7 +85,7 @@ namespace PythonDCOP { * Process method fun, whose arguments are marshalled in data. * Set replyType to be the reply type and marshall the reply data into replyData. */ - virtual bool process(const TTQCString &fun, const TTQByteArray &data, TTQCString& replyType, TTQByteArray &replyData); + virtual bool process(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData); /** * Return list of supported functions (methods). @@ -97,7 +97,7 @@ namespace PythonDCOP { * The key of the QT dictionary is the method signature; the data in * the dictionary is a pointer to the python method to which it corresponds. */ - virtual bool setMethodList(TTQAsciiDict<PyObject> meth_list); + virtual bool setMethodList(TQAsciiDict<PyObject> meth_list); /** * Returns the current list of methods, as set by setMethodList. @@ -108,10 +108,10 @@ namespace PythonDCOP { * Matches an 'incoming' method signature (fun) and returns a PCOPMethod pointer, * or NULL if none match. */ - PCOPMethod *matchMethod(const TTQCString &fun); + PCOPMethod *matchMethod(const TQCString &fun); private: - virtual bool py_process(const TTQCString &fun, const TTQByteArray &data, TTQCString& replyType, TTQByteArray &replyData); + virtual bool py_process(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData); /** * The Python object holding this CObject. @@ -121,7 +121,7 @@ namespace PythonDCOP { /** * The list of methods this object supports. */ - TTQAsciiDict<PCOPMethod> m_methods; + TQAsciiDict<PCOPMethod> m_methods; }; @@ -131,23 +131,23 @@ namespace PythonDCOP { class PCOPType { public: - PCOPType( const TTQCString& dcop_representation); + PCOPType( const TQCString& dcop_representation); ~PCOPType(); - TTQCString signature() const; + TQCString signature() const; - PyObject* demarshal( TTQDataStream& str ) const; - bool marshal( PyObject* obj, TTQDataStream& str ) const; + PyObject* demarshal( TQDataStream& str ) const; + bool marshal( PyObject* obj, TQDataStream& str ) const; // checks if the given PyObject can be marshalled as this PCOPType bool isMarshallable( PyObject *obj ) const; - const TTQCString &type() const { return m_type; } + const TQCString &type() const { return m_type; } const PCOPType *leftType() const { return m_leftType; } const PCOPType *rightType() const { return m_rightType; } // TODO: make these private - TTQCString m_type; + TQCString m_type; PCOPType* m_leftType; PCOPType* m_rightType; @@ -159,23 +159,23 @@ namespace PythonDCOP { class PCOPMethod { public: - PCOPMethod( const TTQCString& dcop_signature ); + PCOPMethod( const TQCString& dcop_signature ); ~PCOPMethod(); int paramCount() const; -// TTQCString signature() const; -// TTQCString name() const; +// TQCString signature() const; +// TQCString name() const; PCOPType* param( int ); const PCOPType* param( int ) const; bool setPythonMethod(PyObject *py_method); PyObject *pythonMethod() const { return m_py_method; } - const TTQCString &signature() const { return m_signature; } - const TTQCString &name() const { return m_name; } + const TQCString &signature() const { return m_signature; } + const TQCString &name() const { return m_name; } const PCOPType *type() const { return m_type; } - TTQCString m_signature; - TTQCString m_name; + TQCString m_signature; + TQCString m_name; PCOPType* m_type; TQList<PCOPType> m_params; private: @@ -191,10 +191,10 @@ namespace PythonDCOP { PCOPClass( const TQCStringList& dcop_style_methods); ~PCOPClass(); - const PCOPMethod* method( const TTQCString &name, PyObject *argTuple = 0 ); + const PCOPMethod* method( const TQCString &name, PyObject *argTuple = 0 ); TQCStringList m_ifaces; - TTQAsciiDict<PCOPMethod> m_methods; + TQAsciiDict<PCOPMethod> m_methods; }; } diff --git a/dcoppython/test/README-server b/dcoppython/test/README-server index b11aa07f..7e73875a 100644 --- a/dcoppython/test/README-server +++ b/dcoppython/test/README-server @@ -6,9 +6,9 @@ Run python server.py, then in another console: qt parrot [julian] julian$ dcop `dcop | grep petshop` parrot -TTQCStringList interfaces() -TTQCStringList functions() -TTQString squawk(TQString) +TQCStringList interfaces() +TQCStringList functions() +TQString squawk(TQString) void setAge(int) int age() [julian] julian$ dcop `dcop | grep petshop` parrot setAge 5 diff --git a/dcoppython/test/dcopserver/kdedcoptest.cpp b/dcoppython/test/dcopserver/kdedcoptest.cpp index 849c9abc..e7c8b49a 100644 --- a/dcoppython/test/dcopserver/kdedcoptest.cpp +++ b/dcoppython/test/dcopserver/kdedcoptest.cpp @@ -15,7 +15,7 @@ KDEDcopTest::KDEDcopTest() // set the shell's ui resource file //setXMLFile("kdedcoptestui.rc"); - //new TTQLabel( "Hello World", this, "hello label" ); + //new TQLabel( "Hello World", this, "hello label" ); m_mainClass = new MainClass(); } |