/***************************************************************************
                            QMimeSourceFactory.m -  description
                             -------------------
    begin                : Wed Nov 21 12:08:37 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Nov 21 12:08:37 2001, 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 <qtc/qt_QStringList.h>
#include <qtc/qt_QMimeSourceFactory.h>
#include <qtobjc/QMimeSourceFactory.h>
#include <qtobjc/QImage.h>
#include <qtobjc/QPixmap.h>
#include <qtobjc/QMimeSource.h>

@implementation  QMimeSourceFactory

- (void *) qt
{
	return _qt;
}

- setQt: (void *) qt
{
	_qt = qt;
	return self;
}

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

- setAllocatedInObjcWorld: (BOOL) yn
{
	_allocatedInObjcWorld = yn;
	return self;
}


- init
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QMimeSourceFactory()];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld]) {
			qt_del_QMimeSourceFactory((qt_QMimeSourceFactory *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (QMimeSource*) data: (NSString *)abs_name
{
static qt_QString * _qstring_abs_name = 0L;
	return (QMimeSource*) [QtSupport objectForQtKey: qt_QMimeSourceFactory_data((qt_QMimeSourceFactory *)[self qt], (qt_QString *) [abs_name toQString: &_qstring_abs_name]) withClass: [QMimeSource class] allocatedInObjcWorld: YES];
}

- (NSString *) makeAbsolute: (NSString *)abs_or_rel_name context: (NSString *)context
{
static qt_QString * _qstring = 0L;
static qt_QString * _qstring_context = 0L;
static qt_QString * _qstring_abs_or_rel_name = 0L;
	_qstring = qt_QMimeSourceFactory_makeAbsolute((qt_QMimeSourceFactory *)[self qt], (qt_QString *) [abs_or_rel_name toQString: &_qstring_abs_or_rel_name], (qt_QString *) [context toQString: &_qstring_context]);
	return [NSString fromQString: _qstring];
}

- (QMimeSource*) data: (NSString *)abs_or_rel_name context: (NSString *)context
{
static qt_QString * _qstring_context = 0L;
static qt_QString * _qstring_abs_or_rel_name = 0L;
	return (QMimeSource*) [QtSupport objectForQtKey: qt_QMimeSourceFactory_data1((qt_QMimeSourceFactory *)[self qt], (qt_QString *) [abs_or_rel_name toQString: &_qstring_abs_or_rel_name], (qt_QString *) [context toQString: &_qstring_context]) withClass: [QMimeSource class] allocatedInObjcWorld: YES];
}

- setText: (NSString *)abs_name text: (NSString *)text
{
static qt_QString * _qstring_text = 0L;
static qt_QString * _qstring_abs_name = 0L;
	qt_QMimeSourceFactory_setText((qt_QMimeSourceFactory *)[self qt], (qt_QString *) [abs_name toQString: &_qstring_abs_name], (qt_QString *) [text toQString: &_qstring_text]);
	return self;
}

- setImage: (NSString *)abs_name im: (QImage *)im
{
static qt_QString * _qstring_abs_name = 0L;
	qt_QMimeSourceFactory_setImage((qt_QMimeSourceFactory *)[self qt], (qt_QString *) [abs_name toQString: &_qstring_abs_name], (qt_QImage *) [im qt]);
	return self;
}

- setPixmap: (NSString *)abs_name pm: (QPixmap *)pm
{
static qt_QString * _qstring_abs_name = 0L;
	qt_QMimeSourceFactory_setPixmap((qt_QMimeSourceFactory *)[self qt], (qt_QString *) [abs_name toQString: &_qstring_abs_name], (qt_QPixmap *) [pm qt]);
	return self;
}

- setData: (NSString *)abs_name data: (QMimeSource*)data
{
static qt_QString * _qstring_abs_name = 0L;
	qt_QMimeSourceFactory_setData((qt_QMimeSourceFactory *)[self qt], (qt_QString *) [abs_name toQString: &_qstring_abs_name], (qt_QMimeSource*) [data qt]);
	return self;
}

- setFilePath: (NSArray *)arg1
{
static qt_QStringList * _qlist_arg1 = 0L;
	qt_QMimeSourceFactory_setFilePath((qt_QMimeSourceFactory *)[self qt], (qt_QStringList*) [arg1 toQStringList: (void *)&_qlist_arg1]);
	return self;
}

- (NSArray *) filePath
{
static qt_QStringList * _qlist = 0L;
	_qlist = qt_QMimeSourceFactory_filePath((qt_QMimeSourceFactory *)[self qt]);
	return (NSArray *) [NSMutableArray arrayWithQStringList: _qlist];
}

- addFilePath: (NSString *)arg1
{
static qt_QString * _qstring_arg1 = 0L;
	qt_QMimeSourceFactory_addFilePath((qt_QMimeSourceFactory *)[self qt], (qt_QString *) [arg1 toQString: &_qstring_arg1]);
	return self;
}

- setExtensionType: (NSString *)ext mimetype: (NSString *)mimetype
{
static qt_QString * _qstring_ext = 0L;
	qt_QMimeSourceFactory_setExtensionType((qt_QMimeSourceFactory *)[self qt], (qt_QString *) [ext toQString: &_qstring_ext], (char*) [mimetype cString]);
	return self;
}

+ (QMimeSourceFactory*) defaultFactory
{
	return (QMimeSourceFactory*) [QtSupport objectForQtKey: qt_QMimeSourceFactory_defaultFactory() withClass: [QMimeSourceFactory class] allocatedInObjcWorld: YES];
}

+ setDefaultFactory: (QMimeSourceFactory*)arg1
{
	qt_QMimeSourceFactory_setDefaultFactory((qt_QMimeSourceFactory*) [arg1 qt]);
	return self;
}

+ (QMimeSourceFactory*) takeDefaultFactory
{
	return (QMimeSourceFactory*) [QtSupport objectForQtKey: qt_QMimeSourceFactory_takeDefaultFactory() withClass: [QMimeSourceFactory class] allocatedInObjcWorld: YES];
}

+ addFactory: (QMimeSourceFactory*)f
{
	qt_QMimeSourceFactory_addFactory((qt_QMimeSourceFactory*) [f qt]);
	return self;
}

+ removeFactory: (QMimeSourceFactory*)f
{
	qt_QMimeSourceFactory_removeFactory((qt_QMimeSourceFactory*) [f qt]);
	return self;
}

@end
