/****************************************************************************
**
** DCOP Skeleton generated by dcopidl2cpp from dcopinterface.kidl
**
** WARNING! All changes made in this file will be lost!
**
*****************************************************************************/

#include "./dcopinterface.h"

#include <kdatastream.h>
#include <tqasciidict.h>

namespace Tellico {

static const int ApplicationInterface_fhash = 17;
static const char* const ApplicationInterface_ftable[16][3] = {
    { "bool", "importTellico(TQString,TQString)", "importTellico(TQString file,TQString action)" },
    { "bool", "importBibtex(TQString,TQString)", "importBibtex(TQString file,TQString action)" },
    { "bool", "importMODS(TQString,TQString)", "importMODS(TQString file,TQString action)" },
    { "bool", "importRIS(TQString,TQString)", "importRIS(TQString file,TQString action)" },
    { "bool", "exportXML(TQString)", "exportXML(TQString file)" },
    { "bool", "exportZip(TQString)", "exportZip(TQString file)" },
    { "bool", "exportBibtex(TQString)", "exportBibtex(TQString file)" },
    { "bool", "exportHTML(TQString)", "exportHTML(TQString file)" },
    { "bool", "exportCSV(TQString)", "exportCSV(TQString file)" },
    { "bool", "exportPilotDB(TQString)", "exportPilotDB(TQString file)" },
    { "TQValueList<long int>", "selectedEntries()", "selectedEntries()" },
    { "TQValueList<long int>", "filteredEntries()", "filteredEntries()" },
    { "void", "openFile(TQString)", "openFile(TQString file)" },
    { "void", "setFilter(TQString)", "setFilter(TQString text)" },
    { "bool", "showEntry(long int)", "showEntry(long int id)" },
    { 0, 0, 0 }
};
static const int ApplicationInterface_ftable_hiddens[15] = {
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
};

bool ApplicationInterface::process(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData)
{
    static TQAsciiDict<int>* fdict = 0;
    if ( !fdict ) {
	fdict = new TQAsciiDict<int>( ApplicationInterface_fhash, true, false );
	for ( int i = 0; ApplicationInterface_ftable[i][1]; i++ )
	    fdict->insert( ApplicationInterface_ftable[i][1],  new int( i ) );
    }
    int* fp = fdict->find( fun );
    switch ( fp?*fp:-1) {
    case 0: { // bool importTellico(TQString,TQString)
	TQString arg0;
	TQString arg1;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	if (arg.atEnd()) return false;
	arg >> arg1;
	replyType = ApplicationInterface_ftable[0][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << importTellico(arg0, arg1 );
    } break;
    case 1: { // bool importBibtex(TQString,TQString)
	TQString arg0;
	TQString arg1;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	if (arg.atEnd()) return false;
	arg >> arg1;
	replyType = ApplicationInterface_ftable[1][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << importBibtex(arg0, arg1 );
    } break;
    case 2: { // bool importMODS(TQString,TQString)
	TQString arg0;
	TQString arg1;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	if (arg.atEnd()) return false;
	arg >> arg1;
	replyType = ApplicationInterface_ftable[2][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << importMODS(arg0, arg1 );
    } break;
    case 3: { // bool importRIS(TQString,TQString)
	TQString arg0;
	TQString arg1;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	if (arg.atEnd()) return false;
	arg >> arg1;
	replyType = ApplicationInterface_ftable[3][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << importRIS(arg0, arg1 );
    } break;
    case 4: { // bool exportXML(TQString)
	TQString arg0;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	replyType = ApplicationInterface_ftable[4][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << exportXML(arg0 );
    } break;
    case 5: { // bool exportZip(TQString)
	TQString arg0;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	replyType = ApplicationInterface_ftable[5][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << exportZip(arg0 );
    } break;
    case 6: { // bool exportBibtex(TQString)
	TQString arg0;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	replyType = ApplicationInterface_ftable[6][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << exportBibtex(arg0 );
    } break;
    case 7: { // bool exportHTML(TQString)
	TQString arg0;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	replyType = ApplicationInterface_ftable[7][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << exportHTML(arg0 );
    } break;
    case 8: { // bool exportCSV(TQString)
	TQString arg0;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	replyType = ApplicationInterface_ftable[8][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << exportCSV(arg0 );
    } break;
    case 9: { // bool exportPilotDB(TQString)
	TQString arg0;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	replyType = ApplicationInterface_ftable[9][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << exportPilotDB(arg0 );
    } break;
    case 10: { // TQValueList<long int> selectedEntries()
	replyType = ApplicationInterface_ftable[10][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << selectedEntries( );
    } break;
    case 11: { // TQValueList<long int> filteredEntries()
	replyType = ApplicationInterface_ftable[11][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << filteredEntries( );
    } break;
    case 12: { // void openFile(TQString)
	TQString arg0;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	replyType = ApplicationInterface_ftable[12][0]; 
	openFile(arg0 );
    } break;
    case 13: { // void setFilter(TQString)
	TQString arg0;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	replyType = ApplicationInterface_ftable[13][0]; 
	setFilter(arg0 );
    } break;
    case 14: { // bool showEntry(long int)
	long int arg0;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	replyType = ApplicationInterface_ftable[14][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << showEntry(arg0 );
    } break;
    default: 
	return DCOPObject::process( fun, data, replyType, replyData );
    }
    return true;
}

QCStringList ApplicationInterface::interfaces()
{
    QCStringList ifaces = DCOPObject::interfaces();
    ifaces += "Tellico::ApplicationInterface";
    return ifaces;
}

QCStringList ApplicationInterface::functions()
{
    QCStringList funcs = DCOPObject::functions();
    for ( int i = 0; ApplicationInterface_ftable[i][2]; i++ ) {
	if (ApplicationInterface_ftable_hiddens[i])
	    continue;
	TQCString func = ApplicationInterface_ftable[i][0];
	func += ' ';
	func += ApplicationInterface_ftable[i][2];
	funcs << func;
    }
    return funcs;
}

} // namespace

#include <kdatastream.h>
#include <tqasciidict.h>

namespace Tellico {

static const int CollectionInterface_fhash = 11;
static const char* const CollectionInterface_ftable[9][3] = {
    { "long int", "addEntry()", "addEntry()" },
    { "bool", "removeEntry(long int)", "removeEntry(long int entryID)" },
    { TQSTRINGLIST_OBJECT_NAME_STRING, "values(TQString)", "values(TQString fieldName)" },
    { TQSTRINGLIST_OBJECT_NAME_STRING, "values(long int,TQString)", "values(long int entryID,TQString fieldName)" },
    { TQSTRINGLIST_OBJECT_NAME_STRING, "bibtexKeys()", "bibtexKeys()" },
    { TQSTRING_OBJECT_NAME_STRING, "bibtexKey(long int)", "bibtexKey(long int entryID)" },
    { "bool", "setFieldValue(long int,TQString,TQString)", "setFieldValue(long int entryID,TQString fieldName,TQString value)" },
    { "bool", "addFieldValue(long int,TQString,TQString)", "addFieldValue(long int entryID,TQString fieldName,TQString value)" },
    { 0, 0, 0 }
};
static const int CollectionInterface_ftable_hiddens[8] = {
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
};

bool CollectionInterface::process(const TQCString &fun, const TQByteArray &data, TQCString& replyType, TQByteArray &replyData)
{
    static TQAsciiDict<int>* fdict = 0;
    if ( !fdict ) {
	fdict = new TQAsciiDict<int>( CollectionInterface_fhash, true, false );
	for ( int i = 0; CollectionInterface_ftable[i][1]; i++ )
	    fdict->insert( CollectionInterface_ftable[i][1],  new int( i ) );
    }
    int* fp = fdict->find( fun );
    switch ( fp?*fp:-1) {
    case 0: { // long int addEntry()
	replyType = CollectionInterface_ftable[0][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << addEntry( );
    } break;
    case 1: { // bool removeEntry(long int)
	long int arg0;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	replyType = CollectionInterface_ftable[1][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << removeEntry(arg0 );
    } break;
    case 2: { // TQStringList values(TQString)
	TQString arg0;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	replyType = CollectionInterface_ftable[2][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << values(arg0 );
    } break;
    case 3: { // TQStringList values(long int,TQString)
	long int arg0;
	TQString arg1;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	if (arg.atEnd()) return false;
	arg >> arg1;
	replyType = CollectionInterface_ftable[3][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << values(arg0, arg1 );
    } break;
    case 4: { // TQStringList bibtexKeys()
	replyType = CollectionInterface_ftable[4][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << bibtexKeys( );
    } break;
    case 5: { // TQString bibtexKey(long int)
	long int arg0;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	replyType = CollectionInterface_ftable[5][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << bibtexKey(arg0 );
    } break;
    case 6: { // bool setFieldValue(long int,TQString,TQString)
	long int arg0;
	TQString arg1;
	TQString arg2;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	if (arg.atEnd()) return false;
	arg >> arg1;
	if (arg.atEnd()) return false;
	arg >> arg2;
	replyType = CollectionInterface_ftable[6][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << setFieldValue(arg0, arg1, arg2 );
    } break;
    case 7: { // bool addFieldValue(long int,TQString,TQString)
	long int arg0;
	TQString arg1;
	TQString arg2;
	TQDataStream arg( data, IO_ReadOnly );
	if (arg.atEnd()) return false;
	arg >> arg0;
	if (arg.atEnd()) return false;
	arg >> arg1;
	if (arg.atEnd()) return false;
	arg >> arg2;
	replyType = CollectionInterface_ftable[7][0]; 
	TQDataStream _replyStream( replyData, IO_WriteOnly );
	_replyStream << addFieldValue(arg0, arg1, arg2 );
    } break;
    default: 
	return DCOPObject::process( fun, data, replyType, replyData );
    }
    return true;
}

QCStringList CollectionInterface::interfaces()
{
    QCStringList ifaces = DCOPObject::interfaces();
    ifaces += "Tellico::CollectionInterface";
    return ifaces;
}

QCStringList CollectionInterface::functions()
{
    QCStringList funcs = DCOPObject::functions();
    for ( int i = 0; CollectionInterface_ftable[i][2]; i++ ) {
	if (CollectionInterface_ftable_hiddens[i])
	    continue;
	TQCString func = CollectionInterface_ftable[i][0];
	func += ' ';
	func += CollectionInterface_ftable[i][2];
	funcs << func;
    }
    return funcs;
}

} // namespace

