00001
00002
00003
00004
00005
00006
00007
00008
00009
#include "./editdcopinterface.h"
00010
00011
#include <kdatastream.h>
00012
#include <qasciidict.h>
00013
00014
namespace KTextEditor {
00015
00016
static const int EditDCOPInterface_fhash = 11;
00017
static const char*
const EditDCOPInterface_ftable[10][3] = {
00018 {
"QString",
"text()",
"text()" },
00019 {
"QString",
"textLine(uint)",
"textLine(uint line)" },
00020 {
"int",
"numLines()",
"numLines()" },
00021 {
"int",
"length()",
"length()" },
00022 {
"void",
"setText(QString)",
"setText(QString text)" },
00023 {
"bool",
"insertText(uint,uint,QString)",
"insertText(uint line,uint col,QString text)" },
00024 {
"bool",
"removeText(uint,uint,uint,uint)",
"removeText(uint startLine,uint startCol,uint endLine,uint endCol)" },
00025 {
"bool",
"insertLine(uint,QString)",
"insertLine(uint line,QString text)" },
00026 {
"bool",
"removeLine(uint)",
"removeLine(uint line)" },
00027 { 0, 0, 0 }
00028 };
00029
static const int EditDCOPInterface_ftable_hiddens[9] = {
00030 0,
00031 0,
00032 0,
00033 0,
00034 0,
00035 0,
00036 0,
00037 0,
00038 0,
00039 };
00040
00041
bool EditDCOPInterface::process(
const QCString &fun,
const QByteArray &data,
QCString& replyType,
QByteArray &replyData)
00042 {
00043
static QAsciiDict<int>* fdict = 0;
00044
if ( !fdict ) {
00045 fdict =
new QAsciiDict<int>( EditDCOPInterface_fhash,
true,
false );
00046
for (
int i = 0; EditDCOPInterface_ftable[i][1]; i++ )
00047 fdict->insert( EditDCOPInterface_ftable[i][1],
new int( i ) );
00048 }
00049
int* fp = fdict->find( fun );
00050
switch ( fp?*fp:-1) {
00051
case 0: {
00052 replyType = EditDCOPInterface_ftable[0][0];
00053
QDataStream _replyStream( replyData, IO_WriteOnly );
00054 _replyStream <<
text( );
00055 }
break;
00056
case 1: {
00057 uint arg0;
00058
QDataStream arg( data, IO_ReadOnly );
00059
if (arg.atEnd())
return false;
00060 arg >> arg0;
00061 replyType = EditDCOPInterface_ftable[1][0];
00062
QDataStream _replyStream( replyData, IO_WriteOnly );
00063 _replyStream <<
textLine(arg0 );
00064 }
break;
00065
case 2: {
00066 replyType = EditDCOPInterface_ftable[2][0];
00067
QDataStream _replyStream( replyData, IO_WriteOnly );
00068 _replyStream <<
numLines( );
00069 }
break;
00070
case 3: {
00071 replyType = EditDCOPInterface_ftable[3][0];
00072
QDataStream _replyStream( replyData, IO_WriteOnly );
00073 _replyStream <<
length( );
00074 }
break;
00075
case 4: {
00076
QString arg0;
00077
QDataStream arg( data, IO_ReadOnly );
00078
if (arg.atEnd())
return false;
00079 arg >> arg0;
00080 replyType = EditDCOPInterface_ftable[4][0];
00081
setText(arg0 );
00082 }
break;
00083
case 5: {
00084 uint arg0;
00085 uint arg1;
00086
QString arg2;
00087
QDataStream arg( data, IO_ReadOnly );
00088
if (arg.atEnd())
return false;
00089 arg >> arg0;
00090
if (arg.atEnd())
return false;
00091 arg >> arg1;
00092
if (arg.atEnd())
return false;
00093 arg >> arg2;
00094 replyType = EditDCOPInterface_ftable[5][0];
00095
QDataStream _replyStream( replyData, IO_WriteOnly );
00096 _replyStream <<
insertText(arg0, arg1, arg2 );
00097 }
break;
00098
case 6: {
00099 uint arg0;
00100 uint arg1;
00101 uint arg2;
00102 uint arg3;
00103
QDataStream arg( data, IO_ReadOnly );
00104
if (arg.atEnd())
return false;
00105 arg >> arg0;
00106
if (arg.atEnd())
return false;
00107 arg >> arg1;
00108
if (arg.atEnd())
return false;
00109 arg >> arg2;
00110
if (arg.atEnd())
return false;
00111 arg >> arg3;
00112 replyType = EditDCOPInterface_ftable[6][0];
00113
QDataStream _replyStream( replyData, IO_WriteOnly );
00114 _replyStream <<
removeText(arg0, arg1, arg2, arg3 );
00115 }
break;
00116
case 7: {
00117 uint arg0;
00118
QString arg1;
00119
QDataStream arg( data, IO_ReadOnly );
00120
if (arg.atEnd())
return false;
00121 arg >> arg0;
00122
if (arg.atEnd())
return false;
00123 arg >> arg1;
00124 replyType = EditDCOPInterface_ftable[7][0];
00125
QDataStream _replyStream( replyData, IO_WriteOnly );
00126 _replyStream <<
insertLine(arg0, arg1 );
00127 }
break;
00128
case 8: {
00129 uint arg0;
00130
QDataStream arg( data, IO_ReadOnly );
00131
if (arg.atEnd())
return false;
00132 arg >> arg0;
00133 replyType = EditDCOPInterface_ftable[8][0];
00134
QDataStream _replyStream( replyData, IO_WriteOnly );
00135 _replyStream <<
removeLine(arg0 );
00136 }
break;
00137
default:
00138
return DCOPObject::process( fun, data, replyType, replyData );
00139 }
00140
return true;
00141 }
00142
00143 QCStringList
EditDCOPInterface::interfaces()
00144 {
00145 QCStringList ifaces =
DCOPObject::interfaces();
00146 ifaces +=
"KTextEditor::EditDCOPInterface";
00147
return ifaces;
00148 }
00149
00150 QCStringList
EditDCOPInterface::functions()
00151 {
00152 QCStringList funcs =
DCOPObject::functions();
00153
for (
int i = 0; EditDCOPInterface_ftable[i][2]; i++ ) {
00154
if (EditDCOPInterface_ftable_hiddens[i])
00155
continue;
00156
QCString func = EditDCOPInterface_ftable[i][0];
00157 func +=
' ';
00158 func += EditDCOPInterface_ftable[i][2];
00159 funcs << func;
00160 }
00161
return funcs;
00162 }
00163
00164 }
00165