diff --git a/dcop/client/marshall.cpp b/dcop/client/marshall.cpp index c78a1569d..0df014f75 100644 --- a/dcop/client/marshall.cpp +++ b/dcop/client/marshall.cpp @@ -145,31 +145,31 @@ TQCString demarshal( TQDataStream &stream, const TQString &type ) bool b; stream >> b; result = b ? "true" : "false"; - } else if ( type == "TQString" ) + } else if ( type == TQSTRING_OBJECT_NAME_STRING ) { TQString s; stream >> s; result = s.local8Bit(); - } else if ( type == "TQCString" ) + } else if ( type == TQCSTRING_OBJECT_NAME_STRING ) { stream >> result; } else if ( type == "QCStringList" ) { - return demarshal( stream, "TQValueList" ); - } else if ( type == "TQStringList" ) + return demarshal( stream, TQVALUELIST_OBJECT_NAME_STRING "<" TQCSTRING_OBJECT_NAME_STRING ">" ); + } else if ( type == TQSTRINGLIST_OBJECT_NAME_STRING ) { - return demarshal( stream, "TQValueList" ); - } else if ( type == "TQColor" ) + return demarshal( stream, TQVALUELIST_OBJECT_NAME_STRING "<" TQCSTRING_OBJECT_NAME_STRING ">" ); + } else if ( type == TQCOLOR_OBJECT_NAME_STRING ) { TQColor c; stream >> c; result = TQString(c.name()).local8Bit(); - } else if ( type == "TQSize" ) + } else if ( type == TQSIZE_OBJECT_NAME_STRING ) { TQSize s; stream >> s; result.sprintf( "%dx%d", s.width(), s.height() ); - } else if ( type == "TQPixmap" || type == "TQImage" ) + } else if ( type == TQPIXMAP_OBJECT_NAME_STRING || type == TQIMAGE_OBJECT_NAME_STRING ) { TQImage i; stream >> i; @@ -178,17 +178,17 @@ TQCString demarshal( TQDataStream &stream, const TQString &type ) buf.open( IO_WriteOnly ); i.save( &buf, "XPM" ); result = buf.buffer(); - } else if ( type == "TQPoint" ) + } else if ( type == TQPOINT_OBJECT_NAME_STRING ) { TQPoint p; stream >> p; result.sprintf( "+%d+%d", p.x(), p.y() ); - } else if ( type == "TQRect" ) + } else if ( type == TQRECT_OBJECT_NAME_STRING ) { TQRect r; stream >> r; result.sprintf( "%dx%d+%d+%d", r.width(), r.height(), r.x(), r.y() ); - } else if ( type == "TQVariant" ) + } else if ( type == TQVARIANT_OBJECT_NAME_STRING ) { TQ_INT32 type; stream >> type; @@ -203,7 +203,7 @@ TQCString demarshal( TQDataStream &stream, const TQString &type ) KURL r; stream >> r; result = r.url().local8Bit(); - } else if ( type.left( 11 ) == "TQValueList<" ) + } else if ( type.left( 11 ) == TQVALUELIST_OBJECT_NAME_STRING "<" ) { if ( (uint)type.find( '>', 11 ) != type.length() - 1 ) return result; @@ -225,7 +225,7 @@ TQCString demarshal( TQDataStream &stream, const TQString &type ) if ( i < count - 1 ) result += '\n'; } - } else if ( type.left( 5 ) == "TQMap<" ) + } else if ( type.left( 5 ) == TQMAP_OBJECT_NAME_STRING "<" ) { int commaPos = type.find( ',', 5 ); @@ -278,10 +278,10 @@ void marshall( TQDataStream &arg, QCStringList args, uint &i, TQString type ) } TQString s = TQString::fromLocal8Bit( args[ i ] ); - if (type == "TQStringList") - type = "TQValueList"; + if (type == TQSTRINGLIST_OBJECT_NAME_STRING) + type = TQVALUELIST_OBJECT_NAME_STRING "<" TQSTRING_OBJECT_NAME_STRING ">"; if (type == "QCStringList") - type = "TQValueList"; + type = TQVALUELIST_OBJECT_NAME_STRING "<" TQSTRING_OBJECT_NAME_STRING ">"; if ( type == "int" ) arg << s.toInt(); @@ -317,36 +317,36 @@ void marshall( TQDataStream &arg, QCStringList args, uint &i, TQString type ) arg << s.toDouble(); else if ( type == "bool" ) arg << mkBool( s ); - else if ( type == "TQString" ) + else if ( type == TQSTRING_OBJECT_NAME_STRING ) arg << s; - else if ( type == "TQCString" ) + else if ( type == TQCSTRING_OBJECT_NAME_STRING ) arg << TQCString( args[ i ] ); - else if ( type == "TQColor" ) + else if ( type == TQCOLOR_OBJECT_NAME_STRING ) arg << mkColor( s ); - else if ( type == "TQPoint" ) + else if ( type == TQPOINT_OBJECT_NAME_STRING ) arg << mkPoint( s ); - else if ( type == "TQSize" ) + else if ( type == TQSIZE_OBJECT_NAME_STRING ) arg << mkSize( s ); - else if ( type == "TQRect" ) + else if ( type == TQRECT_OBJECT_NAME_STRING ) arg << mkRect( s ); else if ( type == "KURL" ) arg << KURL( s ); - else if ( type == "TQVariant" ) { + else if ( type == TQVARIANT_OBJECT_NAME_STRING ) { if ( s == "true" || s == "false" ) arg << TQVariant( mkBool( s ), 42 ); else if ( s.left( 4 ) == "int(" ) arg << TQVariant( s.mid(4, s.length()-5).toInt() ); - else if ( s.left( 7 ) == "TQPoint(" ) + else if ( s.left( 7 ) == TQPOINT_OBJECT_NAME_STRING "(" ) arg << TQVariant( mkPoint( s.mid(7, s.length()-8) ) ); - else if ( s.left( 6 ) == "TQSize(" ) + else if ( s.left( 6 ) == TQSIZE_OBJECT_NAME_STRING "(" ) arg << TQVariant( mkSize( s.mid(6, s.length()-7) ) ); - else if ( s.left( 6 ) == "TQRect(" ) + else if ( s.left( 6 ) == TQRECT_OBJECT_NAME_STRING "(" ) arg << TQVariant( mkRect( s.mid(6, s.length()-7) ) ); - else if ( s.left( 7 ) == "TQColor(" ) + else if ( s.left( 7 ) == TQCOLOR_OBJECT_NAME_STRING "(" ) arg << TQVariant( mkColor( s.mid(7, s.length()-8) ) ); else arg << TQVariant( s ); - } else if ( type.startsWith("TQValueList<") || + } else if ( type.startsWith(TQVALUELIST_OBJECT_NAME_STRING "<") || type == "KURL::List" ) { if ( type == "KURL::List" ) type = "KURL"; diff --git a/dcop/dcop_deadlock_test.cpp b/dcop/dcop_deadlock_test.cpp index a5869b2a7..66bd5088a 100644 --- a/dcop/dcop_deadlock_test.cpp +++ b/dcop/dcop_deadlock_test.cpp @@ -47,7 +47,7 @@ TQCString& replyType, TQByteArray &replyData) gettimeofday(&tv, 0); tqWarning("%s: function('%s') %d:%06d", name(), m_remoteName.data(), tv.tv_sec % 100, tv.tv_usec); - replyType = "TQString"; + replyType = TQSTRING_OBJECT_NAME_STRING; TQDataStream reply( replyData, IO_WriteOnly ); reply << TQString("Hey"); m_timer.start(1000, true); diff --git a/dcop/dcopref.h b/dcop/dcopref.h index c85654e0e..6864bc4ad 100644 --- a/dcop/dcopref.h +++ b/dcop/dcopref.h @@ -238,7 +238,7 @@ inline TQDataStream & operator << (TQDataStream & str, const DCOPArg& arg ) * dcopTypeName function, for example * * \code - * inline const char* dcopTypeName( const TQString& ) { return "TQString"; } + * inline const char* dcopTypeName( const TQString& ) { return TQSTRING_OBJECT_NAME_STRING; } * \endcode * * If you use custom data types that do support TQDataStream but have diff --git a/dcop/dcoptypes.h b/dcop/dcoptypes.h index e81639baa..f72932683 100644 --- a/dcop/dcoptypes.h +++ b/dcop/dcoptypes.h @@ -37,38 +37,38 @@ inline const char* dcopTypeName( long ) { return "long int"; } inline const char* dcopTypeName( ulong ) { return "ulong"; } inline const char* dcopTypeName( double ) { return "double"; } inline const char* dcopTypeName( float ) { return "float"; } -inline const char* dcopTypeName( const char* ) { return "TQCString"; } +inline const char* dcopTypeName( const char* ) { return TQCSTRING_OBJECT_NAME_STRING; } // dcop specialities class DCOPRef; inline const char* dcopTypeName( const DCOPRef& ) { return "DCOPRef"; } // Qt variant types -class TQString; inline const char* dcopTypeName( const TQString& ) { return "TQString"; } -class TQCString; inline const char* dcopTypeName( const TQCString& ) { return "TQCString"; } -class TQFont; inline const char* dcopTypeName( const TQFont& ) { return "TQFont"; } -class TQPixmap; inline const char* dcopTypeName( const TQPixmap& ) { return "TQPixmap"; } -class TQBrush; inline const char* dcopTypeName( const TQBrush& ) { return "TQBrush"; } -class TQRect; inline const char* dcopTypeName( const TQRect& ) { return "TQRect"; } -class TQPoint; inline const char* dcopTypeName( const TQPoint& ) { return "TQPoint"; } -class TQImage; inline const char* dcopTypeName( const TQImage& ) { return "TQImage"; } -class TQSize; inline const char* dcopTypeName( const TQSize& ) { return "TQSize"; } -class TQColor; inline const char* dcopTypeName( const TQColor& ) { return "TQColor"; } -class TQPalette; inline const char* dcopTypeName( const TQPalette& ) { return "TQPalette"; } -class TQColorGroup; inline const char* dcopTypeName( const TQColorGroup& ) { return "TQColorGroup"; } -class TQIconSet; inline const char* dcopTypeName( const TQIconSet& ) { return "TQIconSet"; } -class TQDataStream; inline const char* dcopTypeName( const TQDataStream& ) { return "TQDataStream"; } -class TQPointArray; inline const char* dcopTypeName( const TQPointArray& ) { return "TQPointArray"; } -class TQRegion; inline const char* dcopTypeName( const TQRegion& ) { return "TQRegion"; } -class TQBitmap; inline const char* dcopTypeName( const TQBitmap& ) { return "TQBitmap"; } -class TQCursor; inline const char* dcopTypeName( const TQCursor& ) { return "TQCursor"; } -class TQStringList; inline const char* dcopTypeName( const TQStringList& ) { return "TQStringList"; } -class TQSizePolicy; inline const char* dcopTypeName( const TQSizePolicy& ) { return "TQSizePolicy"; } -class TQDate; inline const char* dcopTypeName( const TQDate& ) { return "TQDate"; } -class TQTime; inline const char* dcopTypeName( const TQTime& ) { return "TQTime"; } -class TQDateTime; inline const char* dcopTypeName( const TQDateTime& ) { return "TQDateTime"; } -class TQBitArray; inline const char* dcopTypeName( const TQBitArray& ) { return "TQBitArray"; } -class TQKeySequence; inline const char* dcopTypeName( const TQKeySequence& ) { return "TQKeySequence"; } -class TQVariant; inline const char* dcopTypeName( const TQVariant& ) { return "TQVariant"; } +class TQString; inline const char* dcopTypeName( const TQString& ) { return TQSTRING_OBJECT_NAME_STRING; } +class TQCString; inline const char* dcopTypeName( const TQCString& ) { return TQCSTRING_OBJECT_NAME_STRING; } +class TQFont; inline const char* dcopTypeName( const TQFont& ) { return TQFONT_OBJECT_NAME_STRING; } +class TQPixmap; inline const char* dcopTypeName( const TQPixmap& ) { return TQPIXMAP_OBJECT_NAME_STRING; } +class TQBrush; inline const char* dcopTypeName( const TQBrush& ) { return TQBRUSH_OBJECT_NAME_STRING; } +class TQRect; inline const char* dcopTypeName( const TQRect& ) { return TQRECT_OBJECT_NAME_STRING; } +class TQPoint; inline const char* dcopTypeName( const TQPoint& ) { return TQPOINT_OBJECT_NAME_STRING; } +class TQImage; inline const char* dcopTypeName( const TQImage& ) { return TQIMAGE_OBJECT_NAME_STRING; } +class TQSize; inline const char* dcopTypeName( const TQSize& ) { return TQSIZE_OBJECT_NAME_STRING; } +class TQColor; inline const char* dcopTypeName( const TQColor& ) { return TQCOLOR_OBJECT_NAME_STRING; } +class TQPalette; inline const char* dcopTypeName( const TQPalette& ) { return TQPALETTE_OBJECT_NAME_STRING; } +class TQColorGroup; inline const char* dcopTypeName( const TQColorGroup& ) { return TQCOLORGROUP_OBJECT_NAME_STRING; } +class TQIconSet; inline const char* dcopTypeName( const TQIconSet& ) { return TQICONSET_OBJECT_NAME_STRING; } +class TQDataStream; inline const char* dcopTypeName( const TQDataStream& ) { return TQDATASTREAM_OBJECT_NAME_STRING; } +class TQPointArray; inline const char* dcopTypeName( const TQPointArray& ) { return TQPOINTARRAY_OBJECT_NAME_STRING; } +class TQRegion; inline const char* dcopTypeName( const TQRegion& ) { return TQREGION_OBJECT_NAME_STRING; } +class TQBitmap; inline const char* dcopTypeName( const TQBitmap& ) { return TQBITMAP_OBJECT_NAME_STRING; } +class TQCursor; inline const char* dcopTypeName( const TQCursor& ) { return TQCURSOR_OBJECT_NAME_STRING; } +class TQStringList; inline const char* dcopTypeName( const TQStringList& ) { return TQSTRINGLIST_OBJECT_NAME_STRING; } +class TQSizePolicy; inline const char* dcopTypeName( const TQSizePolicy& ) { return TQSIZEPOLICY_OBJECT_NAME_STRING; } +class TQDate; inline const char* dcopTypeName( const TQDate& ) { return TQDATE_OBJECT_NAME_STRING; } +class TQTime; inline const char* dcopTypeName( const TQTime& ) { return TQTIME_OBJECT_NAME_STRING; } +class TQDateTime; inline const char* dcopTypeName( const TQDateTime& ) { return TQDATETIME_OBJECT_NAME_STRING; } +class TQBitArray; inline const char* dcopTypeName( const TQBitArray& ) { return TQBITARRAY_OBJECT_NAME_STRING; } +class TQKeySequence; inline const char* dcopTypeName( const TQKeySequence& ) { return TQKEYSEQUENCE_OBJECT_NAME_STRING; } +class TQVariant; inline const char* dcopTypeName( const TQVariant& ) { return TQVARIANT_OBJECT_NAME_STRING; } // And some KDE types class KURL; inline const char* dcopTypeName( const KURL& ) { return "KURL"; } diff --git a/dcop/testdcop.cpp b/dcop/testdcop.cpp index 0de10d1cd..5e4cd00c7 100644 --- a/dcop/testdcop.cpp +++ b/dcop/testdcop.cpp @@ -57,7 +57,7 @@ bool MyDCOPObject::process(const TQCString &fun, const TQByteArray &data, printf("Rect x = %d, y = %d, w = %d, h = %d\n", arg1.x(), arg1.y(), arg1.width(), arg1.height()); - replyType = "TQRect"; + replyType = TQRECT_OBJECT_NAME_STRING; TQDataStream reply( replyData, IO_WriteOnly ); TQRect r(10,20,100,200); reply << r; @@ -74,7 +74,7 @@ bool MyDCOPObject::process(const TQCString &fun, const TQByteArray &data, tqDebug("countDown() countDownAction = %p", countDownAction); if (countDownAction2) { - replyType = "TQString"; + replyType = TQSTRING_OBJECT_NAME_STRING; TQDataStream reply( replyData, IO_WriteOnly ); reply << TQString("Hey"); return true; @@ -104,7 +104,7 @@ void MyDCOPObject::slotTimeout() countDownCount--; if (countDownCount == 0) { - TQCString replyType = "TQString"; + TQCString replyType = TQSTRING_OBJECT_NAME_STRING; TQByteArray replyData; TQDataStream reply( replyData, IO_WriteOnly ); reply << TQString("Hello World"); @@ -123,7 +123,7 @@ void MyDCOPObject::slotTimeout2() countDownCount2--; if (countDownCount2 == 0) { - TQCString replyType = "TQString"; + TQCString replyType = TQSTRING_OBJECT_NAME_STRING; TQByteArray replyData; TQDataStream reply( replyData, IO_WriteOnly ); reply << TQString("Hello World"); @@ -139,7 +139,7 @@ void MyDCOPObject::slotTimeout2() QCStringList MyDCOPObject::functions() { QCStringList result = DCOPObject::functions(); - result << "TQRect canLaunchRockets(TQRect)"; + result << TQRECT_OBJECT_NAME_STRING " canLaunchRockets(" TQRECT_OBJECT_NAME_STRING ")"; return result; }