/***************************************************************************
                            KLibrary.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 <klibloader.h>
#include <qstring.h>
#include <qcstring.h>

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

JNIEXPORT void JNICALL
Java_org_kde_koala_KLibrary_newKLibrary(JNIEnv *env, jobject obj, jstring libname, jstring filename, jint handle)
{
static QString * _qstring_filename = 0;
static QString * _qstring_libname = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new KLibrary((QString&) * (QString *) QtSupport::toQString(env, libname, &_qstring_libname), (QString&) * (QString *) QtSupport::toQString(env, filename, &_qstring_filename), (void*) handle));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KLibrary_name(JNIEnv *env, jobject obj)
{
	QString  _qstring;
	_qstring = ((KLibrary*) QtSupport::getQt(env, obj))->name();
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_KLibrary_fileName(JNIEnv *env, jobject obj)
{
	QString  _qstring;
	_qstring = ((KLibrary*) QtSupport::getQt(env, obj))->fileName();
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jobject JNICALL
Java_org_kde_koala_KLibrary_factory(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((KLibrary*) QtSupport::getQt(env, obj))->factory(), "org.kde.koala.KLibFactory");
}

JNIEXPORT jint JNICALL
Java_org_kde_koala_KLibrary_symbol(JNIEnv *env, jobject obj, jstring name)
{
static QCString * _qstring_name = 0;
	return (jint) ((KLibrary*) QtSupport::getQt(env, obj))->symbol((char*) QtSupport::toCharString(env, name, &_qstring_name));
}

JNIEXPORT void JNICALL
Java_org_kde_koala_KLibrary_unload(JNIEnv *env, jobject obj)
{
	((KLibrary*) QtSupport::getQt(env, obj))->unload();
	return;
}

