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

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

class QUrlJBridge : public QUrl
{
public:
	QUrlJBridge() : QUrl() {}
	QUrlJBridge(const QString& url) : QUrl(url) {}
	QUrlJBridge(const QUrl& url) : QUrl(url) {}
	QUrlJBridge(const QUrl& url, const QString& relUrl, bool checkSlash) : QUrl(url, relUrl, checkSlash) {}
	~QUrlJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_reset() {
		QUrl::reset();
		return;
	}
	 bool  protected_parse(const QString& url) {
		return ( bool ) QUrl::parse(url);
	}
};


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

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_newQUrl__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring url)
{
static QString * _qstring_url = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QUrlJBridge((QString&) * (QString *) QtSupport::toQString(env, url, &_qstring_url)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_newQUrl__Lorg_kde_qt_QUrlInterface_2(JNIEnv *env, jobject obj, jobject url)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QUrlJBridge((QUrl&) *(QUrl *) QtSupport::getQt(env, url)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_newQUrl__Lorg_kde_qt_QUrlInterface_2Ljava_lang_String_2Z(JNIEnv *env, jobject obj, jobject url, jstring relUrl, jboolean checkSlash)
{
static QString * _qstring_relUrl = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QUrlJBridge((QUrl&) *(QUrl *) QtSupport::getQt(env, url), (QString&) * (QString *) QtSupport::toQString(env, relUrl, &_qstring_relUrl), (bool) checkSlash));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_newQUrl__Lorg_kde_qt_QUrlInterface_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jobject url, jstring relUrl)
{
static QString * _qstring_relUrl = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QUrlJBridge((QUrl&) *(QUrl *) QtSupport::getQt(env, url), (QString&) * (QString *) QtSupport::toQString(env, relUrl, &_qstring_relUrl), FALSE));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_setProtocol(JNIEnv *env, jobject obj, jstring protocol)
{
static QString * _qstring_protocol = 0;
	((QUrlJBridge*) QtSupport::getQt(env, obj))->setProtocol((QString&) * (QString *) QtSupport::toQString(env, protocol, &_qstring_protocol));
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_setUser(JNIEnv *env, jobject obj, jstring user)
{
static QString * _qstring_user = 0;
	((QUrlJBridge*) QtSupport::getQt(env, obj))->setUser((QString&) * (QString *) QtSupport::toQString(env, user, &_qstring_user));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QUrl_hasUser(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QUrlJBridge*) QtSupport::getQt(env, obj))->hasUser();
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_setPassword(JNIEnv *env, jobject obj, jstring pass)
{
static QString * _qstring_pass = 0;
	((QUrlJBridge*) QtSupport::getQt(env, obj))->setPassword((QString&) * (QString *) QtSupport::toQString(env, pass, &_qstring_pass));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QUrl_hasPassword(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QUrlJBridge*) QtSupport::getQt(env, obj))->hasPassword();
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_setHost(JNIEnv *env, jobject obj, jstring user)
{
static QString * _qstring_user = 0;
	((QUrlJBridge*) QtSupport::getQt(env, obj))->setHost((QString&) * (QString *) QtSupport::toQString(env, user, &_qstring_user));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QUrl_hasHost(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QUrlJBridge*) QtSupport::getQt(env, obj))->hasHost();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QUrl_port(JNIEnv *env, jobject obj)
{
	return (jint) ((QUrlJBridge*) QtSupport::getQt(env, obj))->port();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_setPort(JNIEnv *env, jobject obj, jint port)
{
	((QUrlJBridge*) QtSupport::getQt(env, obj))->setPort((int) port);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QUrl_hasPort(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QUrlJBridge*) QtSupport::getQt(env, obj))->hasPort();
}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QUrl_path(JNIEnv *env, jobject obj, jboolean correct)
{
	QString  _qstring;
	_qstring = ((QUrlJBridge*) QtSupport::getQt(env, obj))->path((bool) correct);
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_setPath(JNIEnv *env, jobject obj, jstring path)
{
static QString * _qstring_path = 0;
	((QUrlJBridge*) QtSupport::getQt(env, obj))->setPath((QString&) * (QString *) QtSupport::toQString(env, path, &_qstring_path));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QUrl_hasPath(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QUrlJBridge*) QtSupport::getQt(env, obj))->hasPath();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_setEncodedPathAndQuery(JNIEnv *env, jobject obj, jstring enc)
{
static QString * _qstring_enc = 0;
	((QUrlJBridge*) QtSupport::getQt(env, obj))->setEncodedPathAndQuery((QString&) * (QString *) QtSupport::toQString(env, enc, &_qstring_enc));
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_setQuery(JNIEnv *env, jobject obj, jstring txt)
{
static QString * _qstring_txt = 0;
	((QUrlJBridge*) QtSupport::getQt(env, obj))->setQuery((QString&) * (QString *) QtSupport::toQString(env, txt, &_qstring_txt));
	return;
}

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

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_setRef(JNIEnv *env, jobject obj, jstring txt)
{
static QString * _qstring_txt = 0;
	((QUrlJBridge*) QtSupport::getQt(env, obj))->setRef((QString&) * (QString *) QtSupport::toQString(env, txt, &_qstring_txt));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QUrl_hasRef(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QUrlJBridge*) QtSupport::getQt(env, obj))->hasRef();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QUrl_isValid(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QUrlJBridge*) QtSupport::getQt(env, obj))->isValid();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QUrl_isLocalFile(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QUrlJBridge*) QtSupport::getQt(env, obj))->isLocalFile();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_addPath(JNIEnv *env, jobject obj, jstring path)
{
static QString * _qstring_path = 0;
	((QUrlJBridge*) QtSupport::getQt(env, obj))->addPath((QString&) * (QString *) QtSupport::toQString(env, path, &_qstring_path));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_setFileName(JNIEnv *env, jobject obj, jstring txt)
{
static QString * _qstring_txt = 0;
	((QUrlJBridge*) QtSupport::getQt(env, obj))->setFileName((QString&) * (QString *) QtSupport::toQString(env, txt, &_qstring_txt));
	return;
}

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

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

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QUrl_toString(JNIEnv *env, jobject obj, jboolean encodedPath, jboolean forcePrependProtocol)
{
	QString  _qstring;
	_qstring = ((QUrlJBridge*) QtSupport::getQt(env, obj))->toString((bool) encodedPath, (bool) forcePrependProtocol);
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QUrl_cdUp(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QUrlJBridge*) QtSupport::getQt(env, obj))->cdUp();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_decode(JNIEnv *env, jclass obj, jstring url)
{
static QString * _qstring_url = 0;
	QUrlJBridge::decode((QString&) * (QString *) QtSupport::toQString(env, url, &_qstring_url));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_encode(JNIEnv *env, jclass obj, jstring url)
{
static QString * _qstring_url = 0;
	QUrlJBridge::encode((QString&) * (QString *) QtSupport::toQString(env, url, &_qstring_url));
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QUrl_isRelativeUrl(JNIEnv *env, jclass obj, jstring url)
{
static QString * _qstring_url = 0;
	return (jboolean) QUrlJBridge::isRelativeUrl((QString&) * (QString *) QtSupport::toQString(env, url, &_qstring_url));
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QUrl_reset(JNIEnv *env, jobject obj)
{
	((QUrlJBridge*) QtSupport::getQt(env, obj))->protected_reset();
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QUrl_parse(JNIEnv *env, jobject obj, jstring url)
{
static QString * _qstring_url = 0;
	return (jboolean) ((QUrlJBridge*) QtSupport::getQt(env, obj))->protected_parse((QString&) * (QString *) QtSupport::toQString(env, url, &_qstring_url));
}

