/***************************************************************************
                            QXmlAttributes.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_QXmlAttributes.h>
#include <qtobjc/QXmlAttributes.h>

@implementation  QXmlAttributes

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

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

- (int) index: (NSString *)qName
{
static qt_QString * _qstring_qName = 0L;
	return (int) qt_QXmlAttributes_index((qt_QXmlAttributes *)[self qt], (qt_QString *) [qName toQString: &_qstring_qName]);
}

- (int) index: (NSString *)uri localPart: (NSString *)localPart
{
static qt_QString * _qstring_localPart = 0L;
static qt_QString * _qstring_uri = 0L;
	return (int) qt_QXmlAttributes_index1((qt_QXmlAttributes *)[self qt], (qt_QString *) [uri toQString: &_qstring_uri], (qt_QString *) [localPart toQString: &_qstring_localPart]);
}

- (int) length
{
	return (int) qt_QXmlAttributes_length((qt_QXmlAttributes *)[self qt]);
}

- (int) count
{
	return (int) qt_QXmlAttributes_count((qt_QXmlAttributes *)[self qt]);
}

- (NSString *) localName: (int)index
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QXmlAttributes_localName((qt_QXmlAttributes *)[self qt], (int)index);
	return [NSString fromQString: _qstring];
}

- (NSString *) qName: (int)index
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QXmlAttributes_qName((qt_QXmlAttributes *)[self qt], (int)index);
	return [NSString fromQString: _qstring];
}

- (NSString *) uri: (int)index
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QXmlAttributes_uri((qt_QXmlAttributes *)[self qt], (int)index);
	return [NSString fromQString: _qstring];
}

- (NSString *) typeAt: (int)index
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QXmlAttributes_type((qt_QXmlAttributes *)[self qt], (int)index);
	return [NSString fromQString: _qstring];
}

- (NSString *) type: (NSString *)qName
{
static qt_QString * _qstring = 0L;
static qt_QString * _qstring_qName = 0L;
	_qstring = qt_QXmlAttributes_type1((qt_QXmlAttributes *)[self qt], (qt_QString *) [qName toQString: &_qstring_qName]);
	return [NSString fromQString: _qstring];
}

- (NSString *) type: (NSString *)uri localName: (NSString *)localName
{
static qt_QString * _qstring = 0L;
static qt_QString * _qstring_localName = 0L;
static qt_QString * _qstring_uri = 0L;
	_qstring = qt_QXmlAttributes_type2((qt_QXmlAttributes *)[self qt], (qt_QString *) [uri toQString: &_qstring_uri], (qt_QString *) [localName toQString: &_qstring_localName]);
	return [NSString fromQString: _qstring];
}

- (NSString *) valueAt: (int)index
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QXmlAttributes_value((qt_QXmlAttributes *)[self qt], (int)index);
	return [NSString fromQString: _qstring];
}

- (NSString *) value: (NSString *)qName
{
static qt_QString * _qstring = 0L;
static qt_QString * _qstring_qName = 0L;
	_qstring = qt_QXmlAttributes_value1((qt_QXmlAttributes *)[self qt], (qt_QString *) [qName toQString: &_qstring_qName]);
	return [NSString fromQString: _qstring];
}

- (NSString *) value: (NSString *)uri localName: (NSString *)localName
{
static qt_QString * _qstring = 0L;
static qt_QString * _qstring_localName = 0L;
static qt_QString * _qstring_uri = 0L;
	_qstring = qt_QXmlAttributes_value2((qt_QXmlAttributes *)[self qt], (qt_QString *) [uri toQString: &_qstring_uri], (qt_QString *) [localName toQString: &_qstring_localName]);
	return [NSString fromQString: _qstring];
}

- clear
{
	qt_QXmlAttributes_clear((qt_QXmlAttributes *)[self qt]);
	return self;
}

- append: (NSString *)qName uri: (NSString *)uri localPart: (NSString *)localPart value: (NSString *)value
{
static qt_QString * _qstring_value = 0L;
static qt_QString * _qstring_localPart = 0L;
static qt_QString * _qstring_uri = 0L;
static qt_QString * _qstring_qName = 0L;
	qt_QXmlAttributes_append((qt_QXmlAttributes *)[self qt], (qt_QString *) [qName toQString: &_qstring_qName], (qt_QString *) [uri toQString: &_qstring_uri], (qt_QString *) [localPart toQString: &_qstring_localPart], (qt_QString *) [value toQString: &_qstring_value]);
	return self;
}

@end
