/***************************************************************************
                            QSqlPropertyMap.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_QSqlPropertyMap.h>
#include <qtobjc/QSqlPropertyMap.h>
#include <qtobjc/QVariant.h>
#include <qtobjc/QWidget.h>


@implementation  QSqlPropertyMap

- (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_QSqlPropertyMap()];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- (QVariant*) property: (QWidget *)widget
{
	return (QVariant*) [QtSupport objectForQtKey: qt_QSqlPropertyMap_property((qt_QSqlPropertyMap *)[self qt], (qt_QWidget *) [widget qt]) withClass: [QVariant class] allocatedInObjcWorld: YES];
}

- setProperty: (QWidget *)widget value: (QVariant *)value
{
	qt_QSqlPropertyMap_setProperty((qt_QSqlPropertyMap *)[self qt], (qt_QWidget *) [widget qt], (qt_QVariant *) [value qt]);
	return self;
}

- insert: (NSString *)classname property: (NSString *)property
{
static qt_QString * _qstring_property = 0L;
static qt_QString * _qstring_classname = 0L;
	qt_QSqlPropertyMap_insert((qt_QSqlPropertyMap *)[self qt], (qt_QString *) [classname toQString: &_qstring_classname], (qt_QString *) [property toQString: &_qstring_property]);
	return self;
}

- remove: (NSString *)classname
{
static qt_QString * _qstring_classname = 0L;
	qt_QSqlPropertyMap_remove((qt_QSqlPropertyMap *)[self qt], (qt_QString *) [classname toQString: &_qstring_classname]);
	return self;
}

+ (QSqlPropertyMap*) defaultMap
{
	return (QSqlPropertyMap*) [QtSupport objectForQtKey: qt_QSqlPropertyMap_defaultMap() withClass: [QSqlPropertyMap class] allocatedInObjcWorld: YES];
}

+ installDefaultMap: (QSqlPropertyMap*)map
{
	qt_QSqlPropertyMap_installDefaultMap((qt_QSqlPropertyMap*) [map qt]);
	return self;
}

@end
