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

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

class QDnsJBridge : public QDns
{
public:
	QDnsJBridge() : QDns() {}
	QDnsJBridge(const QString& label, RecordType rr) : QDns(label, rr) {}
	QDnsJBridge(const QHostAddress& address, RecordType rr) : QDns(address, rr) {}
	~QDnsJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_connectNotify(const char* signal) {
		QDns::connectNotify(signal);
		return;
	}
	void childEvent(QChildEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "childEvent", arg1, "org.kde.qt.QChildEvent")) {
			QObject::childEvent(arg1);
		}
		return;
	}
	void customEvent(QCustomEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "customEvent", arg1, "org.kde.qt.QCustomEvent")) {
			QObject::customEvent(arg1);
		}
		return;
	}
	void timerEvent(QTimerEvent* arg1) {
		if (! QtSupport::eventDelegate(this, "timerEvent", arg1, "org.kde.qt.QTimerEvent")) {
			QObject::timerEvent(arg1);
		}
		return;
	}
};


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

JNIEXPORT void JNICALL
Java_org_kde_qt_QDns_newQDns__Ljava_lang_String_2I(JNIEnv *env, jobject obj, jstring label, jint rr)
{
static QString * _qstring_label = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QDnsJBridge((QString&) * (QString *) QtSupport::toQString(env, label, &_qstring_label), (QDns::RecordType) rr));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDns_newQDns__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring label)
{
static QString * _qstring_label = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QDnsJBridge((QString&) * (QString *) QtSupport::toQString(env, label, &_qstring_label), QDns::A));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDns_newQDns__Lorg_kde_qt_QHostAddress_2I(JNIEnv *env, jobject obj, jobject address, jint rr)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QDnsJBridge((QHostAddress&) *(QHostAddress *) QtSupport::getQt(env, address), (QDns::RecordType) rr));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDns_newQDns__Lorg_kde_qt_QHostAddress_2(JNIEnv *env, jobject obj, jobject address)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QDnsJBridge((QHostAddress&) *(QHostAddress *) QtSupport::getQt(env, address), QDns::Ptr));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDns_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj) && ((QDns*)QtSupport::getQt(env, obj))->parent() == (QObject *) 0) {
		delete (QDns*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDns_setLabel__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring label)
{
static QString * _qstring_label = 0;
	((QDnsJBridge*) QtSupport::getQt(env, obj))->setLabel((QString&) * (QString *) QtSupport::toQString(env, label, &_qstring_label));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDns_setLabel__Lorg_kde_qt_QHostAddress_2(JNIEnv *env, jobject obj, jobject address)
{
	((QDnsJBridge*) QtSupport::getQt(env, obj))->setLabel((QHostAddress&) *(QHostAddress *) QtSupport::getQt(env, address));
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QDns_setRecordType__I(JNIEnv *env, jobject obj, jint rr)
{
	((QDnsJBridge*) QtSupport::getQt(env, obj))->setRecordType((QDns::RecordType) rr);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDns_setRecordType__(JNIEnv *env, jobject obj)
{
	((QDnsJBridge*) QtSupport::getQt(env, obj))->setRecordType(QDns::A);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QDns_recordType(JNIEnv *env, jobject obj)
{
	return (jint) ((QDnsJBridge*) QtSupport::getQt(env, obj))->recordType();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QDns_isWorking(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QDnsJBridge*) QtSupport::getQt(env, obj))->isWorking();
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QDns_hostNames(JNIEnv *env, jobject obj)
{
	QStringList  _qlist;
	_qlist = ((QDnsJBridge*) QtSupport::getQt(env, obj))->hostNames();
	return (jobject) QtSupport::arrayWithQStringList(env, (QStringList *) &_qlist);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QDns_texts(JNIEnv *env, jobject obj)
{
	QStringList  _qlist;
	_qlist = ((QDnsJBridge*) QtSupport::getQt(env, obj))->texts();
	return (jobject) QtSupport::arrayWithQStringList(env, (QStringList *) &_qlist);
}

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

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QDns_qualifiedNames(JNIEnv *env, jobject obj)
{
	QStringList  _qlist;
	_qlist = ((QDnsJBridge*) QtSupport::getQt(env, obj))->qualifiedNames();
	return (jobject) QtSupport::arrayWithQStringList(env, (QStringList *) &_qlist);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDns_connectNotify(JNIEnv *env, jobject obj, jstring signal)
{
static QCString * _qstring_signal = 0;
	((QDnsJBridge*) QtSupport::getQt(env, obj))->protected_connectNotify((char*) QtSupport::toCharString(env, signal, &_qstring_signal));
	return;
}

