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 arg >> arg0;
00060 replyType = EditDCOPInterface_ftable[1][0];
00061
QDataStream _replyStream( replyData, IO_WriteOnly );
00062 _replyStream <<
textLine(arg0 );
00063 }
break;
00064
case 2: {
00065 replyType = EditDCOPInterface_ftable[2][0];
00066
QDataStream _replyStream( replyData, IO_WriteOnly );
00067 _replyStream <<
numLines( );
00068 }
break;
00069
case 3: {
00070 replyType = EditDCOPInterface_ftable[3][0];
00071
QDataStream _replyStream( replyData, IO_WriteOnly );
00072 _replyStream <<
length( );
00073 }
break;
00074
case 4: {
00075
QString arg0;
00076
QDataStream arg( data, IO_ReadOnly );
00077 arg >> arg0;
00078 replyType = EditDCOPInterface_ftable[4][0];
00079
setText(arg0 );
00080 }
break;
00081
case 5: {
00082 uint arg0;
00083 uint arg1;
00084
QString arg2;
00085
QDataStream arg( data, IO_ReadOnly );
00086 arg >> arg0;
00087 arg >> arg1;
00088 arg >> arg2;
00089 replyType = EditDCOPInterface_ftable[5][0];
00090
QDataStream _replyStream( replyData, IO_WriteOnly );
00091 _replyStream <<
insertText(arg0, arg1, arg2 );
00092 }
break;
00093
case 6: {
00094 uint arg0;
00095 uint arg1;
00096 uint arg2;
00097 uint arg3;
00098
QDataStream arg( data, IO_ReadOnly );
00099 arg >> arg0;
00100 arg >> arg1;
00101 arg >> arg2;
00102 arg >> arg3;
00103 replyType = EditDCOPInterface_ftable[6][0];
00104
QDataStream _replyStream( replyData, IO_WriteOnly );
00105 _replyStream <<
removeText(arg0, arg1, arg2, arg3 );
00106 }
break;
00107
case 7: {
00108 uint arg0;
00109
QString arg1;
00110
QDataStream arg( data, IO_ReadOnly );
00111 arg >> arg0;
00112 arg >> arg1;
00113 replyType = EditDCOPInterface_ftable[7][0];
00114
QDataStream _replyStream( replyData, IO_WriteOnly );
00115 _replyStream <<
insertLine(arg0, arg1 );
00116 }
break;
00117
case 8: {
00118 uint arg0;
00119
QDataStream arg( data, IO_ReadOnly );
00120 arg >> arg0;
00121 replyType = EditDCOPInterface_ftable[8][0];
00122
QDataStream _replyStream( replyData, IO_WriteOnly );
00123 _replyStream <<
removeLine(arg0 );
00124 }
break;
00125
default:
00126
return DCOPObject::process( fun, data, replyType, replyData );
00127 }
00128
return true;
00129 }
00130
00131 QCStringList
EditDCOPInterface::interfaces()
00132 {
00133 QCStringList ifaces =
DCOPObject::interfaces();
00134 ifaces +=
"KTextEditor::EditDCOPInterface";
00135
return ifaces;
00136 }
00137
00138 QCStringList
EditDCOPInterface::functions()
00139 {
00140 QCStringList funcs =
DCOPObject::functions();
00141
for (
int i = 0; EditDCOPInterface_ftable[i][2]; i++ ) {
00142
if (EditDCOPInterface_ftable_hiddens[i])
00143
continue;
00144
QCString func = EditDCOPInterface_ftable[i][0];
00145 func +=
' ';
00146 func += EditDCOPInterface_ftable[i][2];
00147 funcs << func;
00148 }
00149
return funcs;
00150 }
00151
00152 }
00153