/***************************************************************************
                            KJavaProcess.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_KJavaProcess.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/KJavaProcess.h>
#include <qtobjc/QByteArray.h>


@implementation  KJavaProcess


- init
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_KJavaProcess()];
		[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) {
			kde_del_KJavaProcess((kde_KJavaProcess *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (BOOL) startJava
{
	return (BOOL) kde_KJavaProcess_startJava((kde_KJavaProcess *)[self qt]);
}

- stopJava
{
	kde_KJavaProcess_stopJava((kde_KJavaProcess *)[self qt]);
	return self;
}

- (BOOL) isRunning
{
	return (BOOL) kde_KJavaProcess_isRunning((kde_KJavaProcess *)[self qt]);
}

- setJVMPath: (NSString *)path
{
static qt_QString * _qstring_path = 0L;
	kde_KJavaProcess_setJVMPath((kde_KJavaProcess *)[self qt], (qt_QString *) [path toQString: &_qstring_path]);
	return self;
}

- setClasspath: (NSString *)classpath
{
static qt_QString * _qstring_classpath = 0L;
	kde_KJavaProcess_setClasspath((kde_KJavaProcess *)[self qt], (qt_QString *) [classpath toQString: &_qstring_classpath]);
	return self;
}

- setSystemProperty: (NSString *)name value: (NSString *)value
{
static qt_QString * _qstring_value = 0L;
static qt_QString * _qstring_name = 0L;
	kde_KJavaProcess_setSystemProperty((kde_KJavaProcess *)[self qt], (qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [value toQString: &_qstring_value]);
	return self;
}

- setMainClass: (NSString *)clazzName
{
static qt_QString * _qstring_clazzName = 0L;
	kde_KJavaProcess_setMainClass((kde_KJavaProcess *)[self qt], (qt_QString *) [clazzName toQString: &_qstring_clazzName]);
	return self;
}

- setExtraArgs: (NSString *)args
{
static qt_QString * _qstring_args = 0L;
	kde_KJavaProcess_setExtraArgs((kde_KJavaProcess *)[self qt], (qt_QString *) [args toQString: &_qstring_args]);
	return self;
}

- setClassArgs: (NSString *)classArgs
{
static qt_QString * _qstring_classArgs = 0L;
	kde_KJavaProcess_setClassArgs((kde_KJavaProcess *)[self qt], (qt_QString *) [classArgs toQString: &_qstring_classArgs]);
	return self;
}

- send: (char)cmd_code args: (NSArray *)args
{
static qt_QStringList * _qlist_args = 0L;
	kde_KJavaProcess_send((kde_KJavaProcess *)[self qt], (char)cmd_code, (qt_QStringList*) [args toQStringList: (void *)&_qlist_args]);
	return self;
}

- send: (char)cmd_code args: (NSArray *)args data: (QByteArray*)data
{
static qt_QStringList * _qlist_args = 0L;
	kde_KJavaProcess_send1((kde_KJavaProcess *)[self qt], (char)cmd_code, (qt_QStringList*) [args toQStringList: (void *)&_qlist_args], (qt_QByteArray*) [data qt]);
	return self;
}

- (BOOL) invokeJVM
{
	return (BOOL) kde_KJavaProcess_invokeJVM((kde_KJavaProcess *)[self qt]);
}

- killJVM
{
	kde_KJavaProcess_killJVM((kde_KJavaProcess *)[self qt]);
	return self;
}

- (QByteArray*) addArgs: (char)cmd_code args: (NSArray *)args
{
static qt_QStringList * _qlist_args = 0L;
	return (QByteArray*) [QtSupport objectForQtKey: kde_KJavaProcess_addArgs((kde_KJavaProcess *)[self qt], (char)cmd_code, (qt_QStringList*) [args toQStringList: (void *)&_qlist_args]) withClass: [QByteArray class] allocatedInObjcWorld: YES];
}

- popBuffer
{
	kde_KJavaProcess_popBuffer((kde_KJavaProcess *)[self qt]);
	return self;
}

- sendBuffer: (QByteArray*)buff
{
	kde_KJavaProcess_sendBuffer((kde_KJavaProcess *)[self qt], (qt_QByteArray*) [buff qt]);
	return self;
}

- storeSize: (QByteArray*)buff
{
	kde_KJavaProcess_storeSize((kde_KJavaProcess *)[self qt], (qt_QByteArray*) [buff qt]);
	return self;
}

- slotWroteData
{
	kde_KJavaProcess_slotWroteData((kde_KJavaProcess *)[self qt]);
	return self;
}

- slotReceivedData: (int)arg1 int: (int)arg2
{
	kde_KJavaProcess_slotReceivedData((kde_KJavaProcess *)[self qt], (int)arg1, (int)arg2);
	return self;
}

@end
