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