/***************************************************************************
                            QUuid.cpp -  description
                             -------------------
    begin                : Wed Nov 21 17:05:56 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 17:05:56 2001, 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 <quuid.h>
#include <qstring.h>
#include <qcstring.h>

#include <qtjava/QtSupport.h>
#include <qtjava/QUuid.h>

class QUuidJBridge : public QUuid
{
public:
	QUuidJBridge() : QUuid() {}
	QUuidJBridge(ulong l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8) : QUuid(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) {}
	QUuidJBridge(const QUuid& uuid) : QUuid(uuid) {}
	QUuidJBridge(const QString& arg1) : QUuid(arg1) {}
//	QUuidJBridge(const GUID& guid) : QUuid(guid) {}
};


JNIEXPORT void JNICALL
Java_org_kde_qt_QUuid_newQUuid__(JNIEnv *env, jobject obj)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QUuidJBridge());
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUuid_newQUuid__JSSLjava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jlong l, jshort w1, jshort w2, jstring b1, jstring b2, jstring b3, jstring b4, jstring b5, jstring b6, jstring b7, jstring b8)
{
static QCString * _qstring_b8 = 0;
static QCString * _qstring_b7 = 0;
static QCString * _qstring_b6 = 0;
static QCString * _qstring_b5 = 0;
static QCString * _qstring_b4 = 0;
static QCString * _qstring_b3 = 0;
static QCString * _qstring_b2 = 0;
static QCString * _qstring_b1 = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QUuidJBridge((ulong) l, (ushort) w1, (ushort) w2, (uchar) QtSupport::toCharString(env, b1, &_qstring_b1), (uchar) QtSupport::toCharString(env, b2, &_qstring_b2), (uchar) QtSupport::toCharString(env, b3, &_qstring_b3), (uchar) QtSupport::toCharString(env, b4, &_qstring_b4), (uchar) QtSupport::toCharString(env, b5, &_qstring_b5), (uchar) QtSupport::toCharString(env, b6, &_qstring_b6), (uchar) QtSupport::toCharString(env, b7, &_qstring_b7), (uchar) QtSupport::toCharString(env, b8, &_qstring_b8)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUuid_newQUuid__Lorg_kde_qt_QUuid_2(JNIEnv *env, jobject obj, jobject uuid)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QUuidJBridge((QUuid&) *(QUuid *) QtSupport::getQt(env, uuid)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUuid_newQUuid__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring arg1)
{
static QString * _qstring_arg1 = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QUuidJBridge((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QUuid_isNull(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QUuidJBridge*) QtSupport::getQt(env, obj))->isNull();
}

//JNIEXPORT void JNICALL
//Java_org_kde_qt_QUuid_newQUuid__(JNIEnv *env, jobject obj, j guid)
//{
//	if (QtSupport::getQt(env, obj) == 0) {
//		QtSupport::setQt(env, obj, new QUuidJBridge((GUID) guid));
//		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
//	}
//	return;
//}

