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