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 static const int SearchDCOPInterface_ftable_hiddens[13] = {
00034 0,
00035 0,
00036 0,
00037 0,
00038 0,
00039 0,
00040 0,
00041 0,
00042 0,
00043 0,
00044 0,
00045 0,
00046 0,
00047 };
00048
00049 bool SearchDCOPInterface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
00050 {
00051 static QAsciiDict<int>* fdict = 0;
00052 if ( !fdict ) {
00053 fdict = new QAsciiDict<int>( SearchDCOPInterface_fhash, true, false );
00054 for ( int i = 0; SearchDCOPInterface_ftable[i][1]; i++ )
00055 fdict->insert( SearchDCOPInterface_ftable[i][1], new int( i ) );
00056 }
00057 int* fp = fdict->find( fun );
00058 switch ( fp?*fp:-1) {
00059 case 0: {
00060 QString arg0;
00061 bool arg1;
00062 QDataStream arg( data, IO_ReadOnly );
00063 arg >> arg0;
00064 arg >> arg1;
00065 replyType = SearchDCOPInterface_ftable[0][0];
00066 QDataStream _replyStream( replyData, IO_WriteOnly );
00067 _replyStream << findFirstString(arg0, arg1 );
00068 } break;
00069 case 1: {
00070 QString arg0;
00071 bool arg1;
00072 QDataStream arg( data, IO_ReadOnly );
00073 arg >> arg0;
00074 arg >> arg1;
00075 replyType = SearchDCOPInterface_ftable[1][0];
00076 QDataStream _replyStream( replyData, IO_WriteOnly );
00077 _replyStream << findNextString(arg0, arg1 );
00078 } break;
00079 case 2: {
00080 QString arg0;
00081 bool arg1;
00082 QDataStream arg( data, IO_ReadOnly );
00083 arg >> arg0;
00084 arg >> arg1;
00085 replyType = SearchDCOPInterface_ftable[2][0];
00086 QDataStream _replyStream( replyData, IO_WriteOnly );
00087 _replyStream << findPreviousString(arg0, arg1 );
00088 } break;
00089 case 3: {
00090 QString arg0;
00091 bool arg1;
00092 QDataStream arg( data, IO_ReadOnly );
00093 arg >> arg0;
00094 arg >> arg1;
00095 replyType = SearchDCOPInterface_ftable[3][0];
00096 QDataStream _replyStream( replyData, IO_WriteOnly );
00097 _replyStream << findLastString(arg0, arg1 );
00098 } break;
00099 case 4: {
00100 uint arg0;
00101 uint arg1;
00102 QString arg2;
00103 bool arg3;
00104 QDataStream arg( data, IO_ReadOnly );
00105 arg >> arg0;
00106 arg >> arg1;
00107 arg >> arg2;
00108 arg >> arg3;
00109 replyType = SearchDCOPInterface_ftable[4][0];
00110 QDataStream _replyStream( replyData, IO_WriteOnly );
00111 _replyStream << findStringAt(arg0, arg1, arg2, arg3 );
00112 } break;
00113 case 5: {
00114 QString arg0;
00115 QDataStream arg( data, IO_ReadOnly );
00116 arg >> arg0;
00117 replyType = SearchDCOPInterface_ftable[5][0];
00118 QDataStream _replyStream( replyData, IO_WriteOnly );
00119 _replyStream << findFirstRegExp(arg0 );
00120 } break;
00121 case 6: {
00122 QString arg0;
00123 QDataStream arg( data, IO_ReadOnly );
00124 arg >> arg0;
00125 replyType = SearchDCOPInterface_ftable[6][0];
00126 QDataStream _replyStream( replyData, IO_WriteOnly );
00127 _replyStream << findNextRegExp(arg0 );
00128 } break;
00129 case 7: {
00130 QString arg0;
00131 QDataStream arg( data, IO_ReadOnly );
00132 arg >> arg0;
00133 replyType = SearchDCOPInterface_ftable[7][0];
00134 QDataStream _replyStream( replyData, IO_WriteOnly );
00135 _replyStream << findPreviousRegExp(arg0 );
00136 } break;
00137 case 8: {
00138 QString arg0;
00139 QDataStream arg( data, IO_ReadOnly );
00140 arg >> arg0;
00141 replyType = SearchDCOPInterface_ftable[8][0];
00142 QDataStream _replyStream( replyData, IO_WriteOnly );
00143 _replyStream << findLastRegExp(arg0 );
00144 } break;
00145 case 9: {
00146 uint arg0;
00147 uint arg1;
00148 QString arg2;
00149 QDataStream arg( data, IO_ReadOnly );
00150 arg >> arg0;
00151 arg >> arg1;
00152 arg >> arg2;
00153 replyType = SearchDCOPInterface_ftable[9][0];
00154 QDataStream _replyStream( replyData, IO_WriteOnly );
00155 _replyStream << findRegExpAt(arg0, arg1, arg2 );
00156 } break;
00157 case 10: {
00158 replyType = SearchDCOPInterface_ftable[10][0];
00159 QDataStream _replyStream( replyData, IO_WriteOnly );
00160 _replyStream << currentMatchLine( );
00161 } break;
00162 case 11: {
00163 replyType = SearchDCOPInterface_ftable[11][0];
00164 QDataStream _replyStream( replyData, IO_WriteOnly );
00165 _replyStream << currentMatchCol( );
00166 } break;
00167 case 12: {
00168 replyType = SearchDCOPInterface_ftable[12][0];
00169 QDataStream _replyStream( replyData, IO_WriteOnly );
00170 _replyStream << currentMatchLength( );
00171 } break;
00172 default:
00173 return DCOPObject::process( fun, data, replyType, replyData );
00174 }
00175 return true;
00176 }
00177
00178 QCStringList SearchDCOPInterface::interfaces()
00179 {
00180 QCStringList ifaces = DCOPObject::interfaces();
00181 ifaces += "KTextEditor::SearchDCOPInterface";
00182 return ifaces;
00183 }
00184
00185 QCStringList SearchDCOPInterface::functions()
00186 {
00187 QCStringList funcs = DCOPObject::functions();
00188 for ( int i = 0; SearchDCOPInterface_ftable[i][2]; i++ ) {
00189 if (SearchDCOPInterface_ftable_hiddens[i])
00190 continue;
00191 QCString func = SearchDCOPInterface_ftable[i][0];
00192 func += ' ';
00193 func += SearchDCOPInterface_ftable[i][2];
00194 funcs << func;
00195 }
00196 return funcs;
00197 }
00198
00199 }
00200