00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "./undodcopinterface.h"
00010
00011 #include <kdatastream.h>
00012 #include <qasciidict.h>
00013
00014 namespace KTextEditor {
00015
00016 static const int UndoDCOPInterface_fhash = 11;
00017 static const char* const UndoDCOPInterface_ftable[11][3] = {
00018 { "uint", "undoInterfaceNumber()", "undoInterfaceNumber()" },
00019 { "void", "undo()", "undo()" },
00020 { "void", "redo()", "redo()" },
00021 { "void", "clearUndo()", "clearUndo()" },
00022 { "void", "clearRedo()", "clearRedo()" },
00023 { "uint", "undoCount()", "undoCount()" },
00024 { "uint", "redoCount()", "redoCount()" },
00025 { "uint", "undoSteps()", "undoSteps()" },
00026 { "void", "setUndoSteps(uint)", "setUndoSteps(uint steps)" },
00027 { "void", "undoChanged()", "undoChanged()" },
00028 { 0, 0, 0 }
00029 };
00030
00031 bool UndoDCOPInterface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
00032 {
00033 static QAsciiDict<int>* fdict = 0;
00034 if ( !fdict ) {
00035 fdict = new QAsciiDict<int>( UndoDCOPInterface_fhash, TRUE, FALSE );
00036 for ( int i = 0; UndoDCOPInterface_ftable[i][1]; i++ )
00037 fdict->insert( UndoDCOPInterface_ftable[i][1], new int( i ) );
00038 }
00039 int* fp = fdict->find( fun );
00040 switch ( fp?*fp:-1) {
00041 case 0: {
00042 replyType = UndoDCOPInterface_ftable[0][0];
00043 QDataStream _replyStream( replyData, IO_WriteOnly );
00044 _replyStream << undoInterfaceNumber( );
00045 } break;
00046 case 1: {
00047 replyType = UndoDCOPInterface_ftable[1][0];
00048 undo( );
00049 } break;
00050 case 2: {
00051 replyType = UndoDCOPInterface_ftable[2][0];
00052 redo( );
00053 } break;
00054 case 3: {
00055 replyType = UndoDCOPInterface_ftable[3][0];
00056 clearUndo( );
00057 } break;
00058 case 4: {
00059 replyType = UndoDCOPInterface_ftable[4][0];
00060 clearRedo( );
00061 } break;
00062 case 5: {
00063 replyType = UndoDCOPInterface_ftable[5][0];
00064 QDataStream _replyStream( replyData, IO_WriteOnly );
00065 _replyStream << undoCount( );
00066 } break;
00067 case 6: {
00068 replyType = UndoDCOPInterface_ftable[6][0];
00069 QDataStream _replyStream( replyData, IO_WriteOnly );
00070 _replyStream << redoCount( );
00071 } break;
00072 case 7: {
00073 replyType = UndoDCOPInterface_ftable[7][0];
00074 QDataStream _replyStream( replyData, IO_WriteOnly );
00075 _replyStream << undoSteps( );
00076 } break;
00077 case 8: {
00078 uint arg0;
00079 QDataStream arg( data, IO_ReadOnly );
00080 arg >> arg0;
00081 replyType = UndoDCOPInterface_ftable[8][0];
00082 setUndoSteps(arg0 );
00083 } break;
00084 case 9: {
00085 replyType = UndoDCOPInterface_ftable[9][0];
00086 undoChanged( );
00087 } break;
00088 default:
00089 return DCOPObject::process( fun, data, replyType, replyData );
00090 }
00091 return TRUE;
00092 }
00093
00094 QCStringList UndoDCOPInterface::interfaces()
00095 {
00096 QCStringList ifaces = DCOPObject::interfaces();
00097 ifaces += "KTextEditor::UndoDCOPInterface";
00098 return ifaces;
00099 }
00100
00101 QCStringList UndoDCOPInterface::functions()
00102 {
00103 QCStringList funcs = DCOPObject::functions();
00104 for ( int i = 0; UndoDCOPInterface_ftable[i][2]; i++ ) {
00105 QCString func = UndoDCOPInterface_ftable[i][0];
00106 func += ' ';
00107 func += UndoDCOPInterface_ftable[i][2];
00108 funcs << func;
00109 }
00110 return funcs;
00111 }
00112
00113 }
00114