/***************************************************************************
                            KFilterBase.m -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#include <qtc/qt_QString.h>
#include <qtc/qt_QCString.h>
#include <kdec/kde_KFilterBase.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KFilterBase.h>
#include <qtobjc/QIODevice.h>


@implementation  KFilterBase


- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld] && [self parent] == nil) {
			kde_del_KFilterBase((kde_KFilterBase *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- setDevice: (QIODevice *)dev autodelete: (BOOL)autodelete
{
	kde_KFilterBase_setDevice((kde_KFilterBase *)[self qt], (qt_QIODevice *) [dev qt], (int)autodelete);
	return self;
}

- setDevice: (QIODevice *)dev 
{
	kde_KFilterBase_setDevice((kde_KFilterBase *)[self qt], (qt_QIODevice *) [dev qt], 0);
	return self;
}

- (QIODevice*) device
{
	return (QIODevice*) [QtSupport objectForQtKey: kde_KFilterBase_device((kde_KFilterBase *)[self qt]) withClass: [QIODevice class] allocatedInObjcWorld: YES];
}

- init: (int)mode
{
	kde_KFilterBase_init((kde_KFilterBase *)[self qt], (int)mode);
	return self;
}

- (int) mode
{
	return (int) kde_KFilterBase_mode((kde_KFilterBase *)[self qt]);
}

- terminate
{
	kde_KFilterBase_terminate((kde_KFilterBase *)[self qt]);
	return self;
}

- reset
{
	kde_KFilterBase_reset((kde_KFilterBase *)[self qt]);
	return self;
}

- (BOOL) readHeader
{
	return (BOOL) kde_KFilterBase_readHeader((kde_KFilterBase *)[self qt]);
}

- (BOOL) writeHeader: (NSString *)filename
{
static qt_QCString * _qcstring_filename = 0L;
	return (BOOL) kde_KFilterBase_writeHeader((kde_KFilterBase *)[self qt], (qt_QCString*) [filename toQCString: &_qcstring_filename]);
}

- setOutBuffer: (NSString *)data maxlen: (unsigned int)maxlen
{
	kde_KFilterBase_setOutBuffer((kde_KFilterBase *)[self qt], (char*) [data cString], (unsigned int)maxlen);
	return self;
}

- setInBuffer: (NSString *)data size: (unsigned int)size
{
	kde_KFilterBase_setInBuffer((kde_KFilterBase *)[self qt], (char*) [data cString], (unsigned int)size);
	return self;
}

- (BOOL) inBufferEmpty
{
	return (BOOL) kde_KFilterBase_inBufferEmpty((kde_KFilterBase *)[self qt]);
}

- (int) inBufferAvailable
{
	return (int) kde_KFilterBase_inBufferAvailable((kde_KFilterBase *)[self qt]);
}

- (BOOL) outBufferFull
{
	return (BOOL) kde_KFilterBase_outBufferFull((kde_KFilterBase *)[self qt]);
}

- (int) outBufferAvailable
{
	return (int) kde_KFilterBase_outBufferAvailable((kde_KFilterBase *)[self qt]);
}

- (int) uncompress
{
	return (int) kde_KFilterBase_uncompress((kde_KFilterBase *)[self qt]);
}

- (int) compress: (BOOL)finish
{
	return (int) kde_KFilterBase_compress((kde_KFilterBase *)[self qt], (int)finish);
}

+ (KFilterBase*) findFilterByFileName: (NSString *)fileName
{
static qt_QString * _qstring_fileName = 0L;
	return (KFilterBase*) [QtSupport objectForQtKey: kde_KFilterBase_findFilterByFileName((qt_QString *) [fileName toQString: &_qstring_fileName]) withClass: [KFilterBase class] allocatedInObjcWorld: YES];
}

+ (KFilterBase*) findFilterByMimeType: (NSString *)mimeType
{
static qt_QString * _qstring_mimeType = 0L;
	return (KFilterBase*) [QtSupport objectForQtKey: kde_KFilterBase_findFilterByMimeType((qt_QString *) [mimeType toQString: &_qstring_mimeType]) withClass: [KFilterBase class] allocatedInObjcWorld: YES];
}

+ (int) OK
{
	return (int) KFILTERBASE_OK;
}

+ (int) END
{
	return (int) KFILTERBASE_END;
}

+ (int) ERROR
{
	return (int) KFILTERBASE_ERROR;
}

@end
