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

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

class QXmlInputSourceJBridge : public QXmlInputSource
{
public:
	QXmlInputSourceJBridge() : QXmlInputSource() {}
	QXmlInputSourceJBridge(QIODevice* dev) : QXmlInputSource(dev) {}
	QXmlInputSourceJBridge(QFile& file) : QXmlInputSource(file) {}
	QXmlInputSourceJBridge(QTextStream& stream) : QXmlInputSource(stream) {}
	~QXmlInputSourceJBridge() {QtSupport::qtKeyDeleted(this);}
	 QString  protected_fromRawData(const QByteArray& data, bool beginning) {
		return ( QString ) QXmlInputSource::fromRawData(data, beginning);
	}
};


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

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QXmlInputSource_newQXmlInputSource__Lorg_kde_qt_QFile_2(JNIEnv *env, jobject obj, jobject file)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QXmlInputSourceJBridge((QFile&) *(QFile *) QtSupport::getQt(env, file)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QXmlInputSource_newQXmlInputSource__Lorg_kde_qt_QTextStream_2(JNIEnv *env, jobject obj, jobject stream)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QXmlInputSourceJBridge((QTextStream&) *(QTextStream *) QtSupport::getQt(env, stream)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QXmlInputSource_setData__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring dat)
{
static QString * _qstring_dat = 0;
	((QXmlInputSourceJBridge*) QtSupport::getQt(env, obj))->setData((QString&) * (QString *) QtSupport::toQString(env, dat, &_qstring_dat));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QXmlInputSource_setData___3B(JNIEnv *env, jobject obj, jbyteArray dat)
{
static QByteArray * _qbyteArray_dat = 0;
	((QXmlInputSourceJBridge*) QtSupport::getQt(env, obj))->setData((QByteArray&) * (QByteArray *) QtSupport::toQByteArray(env, dat, &_qbyteArray_dat));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QXmlInputSource_fetchData(JNIEnv *env, jobject obj)
{
	((QXmlInputSourceJBridge*) QtSupport::getQt(env, obj))->fetchData();
	return;
}

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

JNIEXPORT jchar JNICALL
Java_org_kde_qt_QXmlInputSource_next(JNIEnv *env, jobject obj)
{
	QChar  _qchar;
	_qchar = ((QXmlInputSourceJBridge*) QtSupport::getQt(env, obj))->next();
	return (jchar) QtSupport::fromQChar(env, (QChar *) &_qchar);
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QXmlInputSource_reset(JNIEnv *env, jobject obj)
{
	((QXmlInputSourceJBridge*) QtSupport::getQt(env, obj))->reset();
	return;
}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QXmlInputSource_fromRawData(JNIEnv *env, jobject obj, jbyteArray data, jboolean beginning)
{
	QString  _qstring;
static QByteArray * _qbyteArray_data = 0;
	_qstring = ((QXmlInputSourceJBridge*) QtSupport::getQt(env, obj))->protected_fromRawData((QByteArray&) * (QByteArray *) QtSupport::toQByteArray(env, data, &_qbyteArray_data), (bool) beginning);
	return QtSupport::fromQString(env, &_qstring);
}

