/***************************************************************************
                            KCmdLineArgs.cpp -  description
                             -------------------
    begin                : Sun Jan 27 16:22:17 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Jan 27 16:22:17 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
***************************************************************************/

#define _BOOL_H_
#include <kcmdlineargs.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <kdejava/KDESupport.h>
#include <kdejava/KCmdLineArgs.h>

class KCmdLineArgsJBridge : public KCmdLineArgs
{
public:
	KCmdLineArgsJBridge(const KCmdLineOptions* _options, const char* _id, const char* _name) : KCmdLineArgs(_options, _id, _name) {}
	~KCmdLineArgsJBridge() {QtSupport::qtKeyDeleted(this);}
};


JNIEXPORT jstring JNICALL
Java_org_kde_koala_KCmdLineArgs_getOption(JNIEnv *env, jobject obj, jstring option)
{
	QCString  _qcstring;
static QCString * _qstring_option = 0;
	_qcstring = ((KCmdLineArgs*) QtSupport::getQt(env, obj))->getOption((char*) QtSupport::toCharString(env, option, &_qstring_option));
	return QtSupport::fromQCString(env, &_qcstring);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KCmdLineArgs_getOptionList(JNIEnv *env, jobject obj, jstring option)
{
	QCStringList  _qlist;
static QCString * _qstring_option = 0;
	_qlist = ((KCmdLineArgs*) QtSupport::getQt(env, obj))->getOptionList((char*) QtSupport::toCharString(env, option, &_qstring_option));
	return (jobject) KDESupport::arrayWithQCStringList(env, (QCStringList *) &_qlist);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_KCmdLineArgs_isSet(JNIEnv *env, jobject obj, jstring option)
{
static QCString * _qstring_option = 0;
	return (jboolean) ((KCmdLineArgs*) QtSupport::getQt(env, obj))->isSet((char*) QtSupport::toCharString(env, option, &_qstring_option));
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KCmdLineArgs_count(JNIEnv *env, jobject obj)
{
	return (jint) ((KCmdLineArgs*) QtSupport::getQt(env, obj))->count();
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KCmdLineArgs_arg(JNIEnv *env, jobject obj, jint n)
{
	const char * _qcstring;
	_qcstring = (const char *)((KCmdLineArgs*) QtSupport::getQt(env, obj))->arg((int) n);
	return QtSupport::fromCharString(env, (char *) _qcstring);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KCmdLineArgs_url(JNIEnv *env, jobject obj, jint n)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)new KURL (((KCmdLineArgs*) QtSupport::getQt(env, obj))->url((int) n)), "org.kde.koala.KURL", TRUE);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_clear(JNIEnv *env, jobject obj)
{
	((KCmdLineArgs*) QtSupport::getQt(env, obj))->clear();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_init___3Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Z(JNIEnv *env, jclass obj, jobjectArray args, jstring _appname, jstring _description, jstring _version, jboolean noKApp)
{
static QCString * _qstring__version = 0;
static QCString * _qstring__description = 0;
static QCString * _qstring__appname = 0;
	int argc = (int) env->GetArrayLength(args);
	KCmdLineArgsJBridge::init((int) argc + 1, QtSupport::toArgv(env, args), (char*) QtSupport::toCharString(env, _appname, &_qstring__appname), (char*) QtSupport::toCharString(env, _description, &_qstring__description), (char*) QtSupport::toCharString(env, _version, &_qstring__version), (bool) noKApp);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_init___3Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jclass obj, jobjectArray args, jstring _appname, jstring _description, jstring _version)
{
static QCString * _qstring__version = 0;
static QCString * _qstring__description = 0;
static QCString * _qstring__appname = 0;
	int argc = (int) env->GetArrayLength(args);
	KCmdLineArgsJBridge::init((int) argc + 1, QtSupport::toArgv(env, args), (char*) QtSupport::toCharString(env, _appname, &_qstring__appname), (char*) QtSupport::toCharString(env, _description, &_qstring__description), (char*) QtSupport::toCharString(env, _version, &_qstring__version));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_init___3Ljava_lang_String_2Lorg_kde_koala_KAboutData_2Z(JNIEnv *env, jclass obj, jobjectArray args, jobject about, jboolean noKApp)
{
	int argc = (int) env->GetArrayLength(args);
	KCmdLineArgsJBridge::init((int) argc + 1, QtSupport::toArgv(env, args), (KAboutData*) QtSupport::getQt(env, about), (bool) noKApp);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_init___3Ljava_lang_String_2Lorg_kde_koala_KAboutData_2(JNIEnv *env, jclass obj, jobjectArray args, jobject about)
{
	int argc = (int) env->GetArrayLength(args);
	KCmdLineArgsJBridge::init((int) argc + 1, QtSupport::toArgv(env, args), (KAboutData*) QtSupport::getQt(env, about), false);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_init__Lorg_kde_koala_KAboutData_2(JNIEnv *env, jclass obj, jobject about)
{
	KCmdLineArgsJBridge::init((KAboutData*) QtSupport::getQt(env, about));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_addCmdLineOptions___3_3Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jclass obj, jobjectArray options, jstring name, jstring identifier, jstring afterId)
{
static QCString * _qstring_afterId = 0;
static QCString * _qstring_identifier = 0;
static QCString * _qstring_name = 0;
	KCmdLineArgsJBridge::addCmdLineOptions((KCmdLineOptions*) KDESupport::toKCmdLineOptions(env, options), (char*) QtSupport::toCharString(env, name, &_qstring_name), (char*) QtSupport::toCharString(env, identifier, &_qstring_identifier), (char*) QtSupport::toCharString(env, afterId, &_qstring_afterId));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_addCmdLineOptions___3_3Ljava_lang_String_2(JNIEnv *env, jclass obj, jobjectArray options)
{
	KCmdLineArgsJBridge::addCmdLineOptions((KCmdLineOptions*) KDESupport::toKCmdLineOptions(env, options), 0, 0, 0);
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KCmdLineArgs_parsedArgs__Ljava_lang_String_2(JNIEnv *env, jclass obj, jstring identifier)
{
static QCString * _qstring_identifier = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)KCmdLineArgsJBridge::parsedArgs((char*) QtSupport::toCharString(env, identifier, &_qstring_identifier)), "org.kde.koala.KCmdLineArgs");
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KCmdLineArgs_parsedArgs__(JNIEnv *env, jclass obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)KCmdLineArgsJBridge::parsedArgs(0), "org.kde.koala.KCmdLineArgs");
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KCmdLineArgs_cwd(JNIEnv *env, jclass obj)
{
	QString  _qstring;
	_qstring = KCmdLineArgsJBridge::cwd();
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KCmdLineArgs_appName(JNIEnv *env, jclass obj)
{
	 const char * _qcstring;
	_qcstring = (const char *)KCmdLineArgsJBridge::appName();
	return QtSupport::fromCharString(env, (char *) _qcstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_usage__Ljava_lang_String_2(JNIEnv *env, jclass obj, jstring identifier)
{
static QCString * _qstring_identifier = 0;
	KCmdLineArgsJBridge::usage((char*) QtSupport::toCharString(env, identifier, &_qstring_identifier));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_usage__(JNIEnv *env, jclass obj)
{
	KCmdLineArgsJBridge::usage(0);
	return;
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KCmdLineArgs_usage__Ljava_lang_String_2(JNIEnv *env, jclass obj, jstring error)
//{
//static QString * _qstring_error = 0;
//	KCmdLineArgsJBridge::usage((QString&) * (QString *) QtSupport::toQString(env, error, &_qstring_error));
//	return;
//}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_enable_1i18n(JNIEnv *env, jclass obj)
{
	KCmdLineArgsJBridge::enable_i18n();
	return;
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KCmdLineArgs_makeURL(JNIEnv *env, jclass obj, jstring urlArg)
{
static QCString * _qstring_urlArg = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)new  KURL (KCmdLineArgsJBridge::makeURL((char*) QtSupport::toCharString(env, urlArg, &_qstring_urlArg))), "org.kde.koala.KURL", TRUE);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_setCwd(JNIEnv *env, jclass obj, jstring cwd)
{
static QCString * _qstring_cwd = 0;
	KCmdLineArgsJBridge::setCwd((char*) QtSupport::toCharString(env, cwd, &_qstring_cwd));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KCmdLineArgs_newKCmdLineArgs__Lorg_kde_koala_KCmdLineOptions_2Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobject _options, jstring _id, jstring _name)
{
static QCString * _qstring__name = 0;
static QCString * _qstring__id = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KCmdLineArgsJBridge((KCmdLineOptions*) QtSupport::getQt(env, _options), (char*) QtSupport::toCharString(env, _id, &_qstring__id), (char*) QtSupport::toCharString(env, _name, &_qstring__name)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KCmdLineArgs_finalize(JNIEnv *env, jobject obj)
//{
//	if (QtSupport::allocatedInJavaWorld(env, obj)) {
//		delete (KCmdLineArgs*)QtSupport::getQt(env, obj);
//		QtSupport::setQt(env, obj, 0);
//	}
//	return;
//}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_KCmdLineArgs_dispose(JNIEnv *env, jobject obj)
//{
//	Java_org_kde_koala_KCmdLineArgs_finalize(env, obj);
//	return;
//}

//JNIEXPORT jboolean JNICALL
//Java_org_kde_koala_KCmdLineArgs_isDisposed(JNIEnv *env, jobject obj)
//{
//	return (QtSupport::getQt(env, obj) == 0);
//}

