/***************************************************************************
                            QNetworkOperation.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_QNetworkOperation.h>
#include <qtobjc/QNetworkOperation.h>
#include <qtobjc/QByteArray.h>

@implementation  QNetworkOperation


- initWithInt: (int)operation string: (NSString *)arg0 string: (NSString *)arg1 string: (NSString *)arg2
{
static qt_QString * _qstring_arg2 = 0L;
static qt_QString * _qstring_arg1 = 0L;
static qt_QString * _qstring_arg0 = 0L;
	if ([self qt] == 0L) {
		[self setQt: qt_new_QNetworkOperation((int)operation, (qt_QString *) [arg0 toQString: &_qstring_arg0], (qt_QString *) [arg1 toQString: &_qstring_arg1], (qt_QString *) [arg2 toQString: &_qstring_arg2])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithInt: (int)operation bytearray: (QByteArray*)arg0 bytearray: (QByteArray*)arg1 bytearray: (QByteArray*)arg2
{
	if ([self qt] == 0L) {
		[self setQt: qt_new_QNetworkOperation1((int)operation, (qt_QByteArray*) [arg0 qt], (qt_QByteArray*) [arg1 qt], (qt_QByteArray*) [arg2 qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- setState: (int)state
{
	qt_QNetworkOperation_setState((qt_QNetworkOperation *)[self qt], (int)state);
	return self;
}

- setProtocolDetail: (NSString *)detail
{
static qt_QString * _qstring_detail = 0L;
	qt_QNetworkOperation_setProtocolDetail((qt_QNetworkOperation *)[self qt], (qt_QString *) [detail toQString: &_qstring_detail]);
	return self;
}

- setErrorCode: (int)ec
{
	qt_QNetworkOperation_setErrorCode((qt_QNetworkOperation *)[self qt], (int)ec);
	return self;
}

- setArg: (int)num arg: (NSString *)arg
{
static qt_QString * _qstring_arg = 0L;
	qt_QNetworkOperation_setArg((qt_QNetworkOperation *)[self qt], (int)num, (qt_QString *) [arg toQString: &_qstring_arg]);
	return self;
}

- setRawArg: (int)num arg: (QByteArray*)arg
{
	qt_QNetworkOperation_setRawArg((qt_QNetworkOperation *)[self qt], (int)num, (qt_QByteArray*) [arg qt]);
	return self;
}

- (int) operation
{
	return (int) qt_QNetworkOperation_operation((qt_QNetworkOperation *)[self qt]);
}

- (int) state
{
	return (int) qt_QNetworkOperation_state((qt_QNetworkOperation *)[self qt]);
}

- (NSString *) arg: (int)num
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QNetworkOperation_arg((qt_QNetworkOperation *)[self qt], (int)num);
	return [NSString fromQString: _qstring];
}

- (QByteArray*) rawArg: (int)num
{
	return (QByteArray*) [QtSupport objectForQtKey: qt_QNetworkOperation_rawArg((qt_QNetworkOperation *)[self qt], (int)num) withClass: [QByteArray class] allocatedInObjcWorld: YES];
}

- (NSString *) protocolDetail
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QNetworkOperation_protocolDetail((qt_QNetworkOperation *)[self qt]);
	return [NSString fromQString: _qstring];
}

- (int) errorCode
{
	return (int) qt_QNetworkOperation_errorCode((qt_QNetworkOperation *)[self qt]);
}

- free
{
	qt_QNetworkOperation_free((qt_QNetworkOperation *)[self qt]);
	return self;
}

@end
