00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "./searchdcopinterface.h"
00010
00011 #include <kdatastream.h>
00012 #include <qasciidict.h>
00013
00014 namespace KTextEditor {
00015
00016 static const int SearchDCOPInterface_fhash = 17;
00017 static const char* const SearchDCOPInterface_ftable[14][3] = {
00018 { "bool", "findFirstString(QString,bool)", "findFirstString(QString text,bool caseSensitive)" },
00019 { "bool", "findNextString(QString,bool)", "findNextString(QString text,bool caseSensitive)" },
00020 { "bool", "findPreviousString(QString,bool)", "findPreviousString(QString text,bool caseSensitive)" },
00021 { "bool", "findLastString(QString,bool)", "findLastString(QString text,bool caseSensitive)" },
00022 { "bool", "findStringAt(uint,uint,QString,bool)", "findStringAt(uint row,uint col,QString text,bool caseSensitive)" },
00023 { "bool", "findFirstRegExp(QString)", "findFirstRegExp(QString regexp)" },
00024 { "bool", "findNextRegExp(QString)", "findNextRegExp(QString regexp)" },
00025 { "bool", "findPreviousRegExp(QString)", "findPreviousRegExp(QString regexp)" },
00026 { "bool", "findLastRegExp(QString)", "findLastRegExp(QString regexp)" },
00027 { "bool", "findRegExpAt(uint,uint,QString)", "findRegExpAt(uint row,uint col,QString regexp)" },
00028 { "uint", "currentMatchLine()", "currentMatchLine()" },
00029 { "uint", "currentMatchCol()", "currentMatchCol()" },
00030 { "uint", "currentMatchLength()", "currentMatchLength()" },
00031 { 0, 0, 0 }
00032 };
00033
00034 bool SearchDCOPInterface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
00035 {
00036 static QAsciiDict<int>* fdict = 0;
00037 if ( !fdict ) {
00038 fdict = new QAsciiDict<int>( SearchDCOPInterface_fhash, TRUE, FALSE );
00039 for ( int i = 0; SearchDCOPInterface_ftable[i][1]; i++ )
00040 fdict->insert( SearchDCOPInterface_ftable[i][1], new int( i ) );
00041 }
00042 int* fp = fdict->find( fun );
00043 switch ( fp?*fp:-1) {
00044 case 0: {
00045 QString arg0;
00046 bool arg1;
00047 QDataStream arg( data, IO_ReadOnly );
00048 arg >> arg0;
00049 arg >> arg1;
00050 replyType = SearchDCOPInterface_ftable[0][0];
00051 QDataStream _replyStream( replyData, IO_WriteOnly );
00052 _replyStream << findFirstString(arg0, arg1 );
00053 } break;
00054 case 1: {
00055 QString arg0;
00056 bool arg1;
00057 QDataStream arg( data, IO_ReadOnly );
00058 arg >> arg0;
00059 arg >> arg1;
00060 replyType = SearchDCOPInterface_ftable[1][0];
00061 QDataStream _replyStream( replyData, IO_WriteOnly );
00062 _replyStream << findNextString(arg0, arg1 );
00063 } break;
00064 case 2: {
00065 QString arg0;
00066 bool arg1;
00067 QDataStream arg( data, IO_ReadOnly );
00068 arg >> arg0;
00069 arg >> arg1;
00070 replyType = SearchDCOPInterface_ftable[2][0];
00071 QDataStream _replyStream( replyData, IO_WriteOnly );
00072 _replyStream << findPreviousString(arg0, arg1 );
00073 } break;
00074 case 3: {
00075 QString arg0;
00076 bool arg1;
00077 QDataStream arg( data, IO_ReadOnly );
00078 arg >> arg0;
00079 arg >> arg1;
00080 replyType = SearchDCOPInterface_ftable[3][0];
00081 QDataStream _replyStream( replyData, IO_WriteOnly );
00082 _replyStream << findLastString(arg0, arg1 );
00083 } break;
00084 case 4: {
00085 uint arg0;
00086 uint arg1;
00087 QString arg2;
00088 bool arg3;
00089 QDataStream arg( data, IO_ReadOnly );
00090 arg >> arg0;
00091 arg >> arg1;
00092 arg >> arg2;
00093 arg >> arg3;
00094 replyType = SearchDCOPInterface_ftable[4][0];
00095 QDataStream _replyStream( replyData, IO_WriteOnly );
00096 _replyStream << findStringAt(arg0, arg1, arg2, arg3 );
00097 } break;
00098 case 5: {
00099 QString arg0;
00100 QDataStream arg( data, IO_ReadOnly );
00101 arg >> arg0;
00102 replyType = SearchDCOPInterface_ftable[5][0];
00103 QDataStream _replyStream( replyData, IO_WriteOnly );
00104 _replyStream << findFirstRegExp(arg0 );
00105 } break;
00106 case 6: {
00107 QString arg0;
00108 QDataStream arg( data, IO_ReadOnly );
00109 arg >> arg0;
00110 replyType = SearchDCOPInterface_ftable[6][0];
00111 QDataStream _replyStream( replyData, IO_WriteOnly );
00112 _replyStream << findNextRegExp(arg0 );
00113 } break;
00114 case 7: {
00115 QString arg0;
00116 QDataStream arg( data, IO_ReadOnly );
00117 arg >> arg0;
00118 replyType = SearchDCOPInterface_ftable[7][0];
00119 QDataStream _replyStream( replyData, IO_WriteOnly );
00120 _replyStream << findPreviousRegExp(arg0 );
00121 } break;
00122 case 8: {
00123 QString arg0;
00124 QDataStream arg( data, IO_ReadOnly );
00125 arg >> arg0;
00126 replyType = SearchDCOPInterface_ftable[8][0];
00127 QDataStream _replyStream( replyData, IO_WriteOnly );
00128 _replyStream << findLastRegExp(arg0 );
00129 } break;
00130 case 9: {
00131 uint arg0;
00132 uint arg1;
00133 QString arg2;
00134 QDataStream arg( data, IO_ReadOnly );
00135 arg >> arg0;
00136 arg >> arg1;
00137 arg >> arg2;
00138 replyType = SearchDCOPInterface_ftable[9][0];
00139 QDataStream _replyStream( replyData, IO_WriteOnly );
00140 _replyStream << findRegExpAt(arg0, arg1, arg2 );
00141 } break;
00142 case 10: {
00143 replyType = SearchDCOPInterface_ftable[10][0];
00144 QDataStream _replyStream( replyData, IO_WriteOnly );
00145 _replyStream << currentMatchLine( );
00146 } break;
00147 case 11: {
00148 replyType = SearchDCOPInterface_ftable[11][0];
00149 QDataStream _replyStream( replyData, IO_WriteOnly );
00150 _replyStream << currentMatchCol( );
00151 } break;
00152 case 12: {
00153 replyType = SearchDCOPInterface_ftable[12][0];
00154 QDataStream _replyStream( replyData, IO_WriteOnly );
00155 _replyStream << currentMatchLength( );
00156 } break;
00157 default:
00158 return DCOPObject::process( fun, data, replyType, replyData );
00159 }
00160 return TRUE;
00161 }
00162
00163 QCStringList SearchDCOPInterface::interfaces()
00164 {
00165 QCStringList ifaces = DCOPObject::interfaces();
00166 ifaces += "KTextEditor::SearchDCOPInterface";
00167 return ifaces;
00168 }
00169
00170 QCStringList SearchDCOPInterface::functions()
00171 {
00172 QCStringList funcs = DCOPObject::functions();
00173 for ( int i = 0; SearchDCOPInterface_ftable[i][2]; i++ ) {
00174 QCString func = SearchDCOPInterface_ftable[i][0];
00175 func += ' ';
00176 func += SearchDCOPInterface_ftable[i][2];
00177 funcs << func;
00178 }
00179 return funcs;
00180 }
00181
00182 }
00183