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

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

class QTextStreamJBridge : public QTextStream
{
public:
	QTextStreamJBridge() : QTextStream() {}
	QTextStreamJBridge(QIODevice* arg1) : QTextStream(arg1) {}
	QTextStreamJBridge(QString* arg1, int mode) : QTextStream(arg1, mode) {}
	QTextStreamJBridge(QString& arg1, int mode) : QTextStream(arg1, mode) {}
	QTextStreamJBridge(QByteArray arg1, int mode) : QTextStream(arg1, mode) {}
	QTextStreamJBridge(FILE* arg1, int mode) : QTextStream(arg1, mode) {}
	~QTextStreamJBridge() {QtSupport::qtKeyDeleted(this);}
};


JNIEXPORT void JNICALL
Java_org_kde_qt_QTextStream_setEncoding(JNIEnv *env, jobject obj, jint arg1)
{
	((QTextStreamJBridge*) QtSupport::getQt(env, obj))->setEncoding((QTextStream::Encoding) arg1);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTextStream_setCodec(JNIEnv *env, jobject obj, jobject arg1)
{
	((QTextStreamJBridge*) QtSupport::getQt(env, obj))->setCodec((QTextCodec*) QtSupport::getQt(env, arg1));
	return;
}

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

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

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

//JNIEXPORT void JNICALL
//Java_org_kde_qt_QTextStream_newQTextStream__Ljava_lang_String_2I(JNIEnv *env, jobject obj, jstring arg1, jint mode)
//{
//static QString * _qstring_arg1 = 0;
//	if (QtSupport::getQt(env, obj) == 0) {
//		QtSupport::setQt(env, obj, new QTextStreamJBridge((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1), (int) mode));
//		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
//	}
//	return;
//}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTextStream_newQTextStream___3BI(JNIEnv *env, jobject obj, jbyteArray arg1, jint mode)
{
static QByteArray * _qbyteArray_arg1 = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new QTextStreamJBridge((QByteArray) * (QByteArray *) QtSupport::toQByteArray(env, arg1, &_qbyteArray_arg1), (int) mode));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

//JNIEXPORT void JNICALL
//Java_org_kde_qt_QTextStream_newQTextStream__I(JNIEnv *env, jobject obj, jFILE* arg1, jint mode)
//{
//	if (QtSupport::getQt(env, obj) == 0) {
//		QtSupport::setQt(env, obj, new QTextStreamJBridge((FILE*) arg1, (int) mode));
//		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
//	}
//	return;
//}

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

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextStream_device(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((QTextStreamJBridge*) QtSupport::getQt(env, obj))->device(), "org.kde.qt.QIODeviceInterface");
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTextStream_setDevice(JNIEnv *env, jobject obj, jobject arg1)
{
	((QTextStreamJBridge*) QtSupport::getQt(env, obj))->setDevice((QIODevice*) QtSupport::getQt(env, arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTextStream_unsetDevice(JNIEnv *env, jobject obj)
{
	((QTextStreamJBridge*) QtSupport::getQt(env, obj))->unsetDevice();
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QTextStream_atEnd(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->atEnd();
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QTextStream_eof(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->eof();
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextStream_readRawBytes(JNIEnv *env, jobject obj, jstring arg1, jint len)
{
static QCString * _qstring_arg1 = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)(QTextStream *) &((QTextStreamJBridge*) QtSupport::getQt(env, obj))->readRawBytes((char*) QtSupport::toCharString(env, arg1, &_qstring_arg1), (uint) len), "org.kde.qt.QTextStream");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextStream_writeRawBytes(JNIEnv *env, jobject obj, jstring arg1, jint len)
{
static QCString * _qstring_arg1 = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)(QTextStream *) &((QTextStreamJBridge*) QtSupport::getQt(env, obj))->writeRawBytes((char*) QtSupport::toCharString(env, arg1, &_qstring_arg1), (uint) len), "org.kde.qt.QTextStream");
}

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

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QTextStream_skipWhiteSpace(JNIEnv *env, jobject obj)
{
	((QTextStreamJBridge*) QtSupport::getQt(env, obj))->skipWhiteSpace();
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextStream_flags__(JNIEnv *env, jobject obj)
{
	return (jint) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->flags();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextStream_flags__I(JNIEnv *env, jobject obj, jint f)
{
	return (jint) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->flags((int) f);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextStream_setf__I(JNIEnv *env, jobject obj, jint bits)
{
	return (jint) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->setf((int) bits);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextStream_setf__II(JNIEnv *env, jobject obj, jint bits, jint mask)
{
	return (jint) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->setf((int) bits, (int) mask);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextStream_unsetf(JNIEnv *env, jobject obj, jint bits)
{
	return (jint) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->unsetf((int) bits);
}

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

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextStream_width__(JNIEnv *env, jobject obj)
{
	return (jint) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->width();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextStream_width__I(JNIEnv *env, jobject obj, jint arg1)
{
	return (jint) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->width((int) arg1);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextStream_fill__(JNIEnv *env, jobject obj)
{
	return (jint) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->fill();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextStream_fill__I(JNIEnv *env, jobject obj, jint arg1)
{
	return (jint) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->fill((int) arg1);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextStream_precision__(JNIEnv *env, jobject obj)
{
	return (jint) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->precision();
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextStream_precision__I(JNIEnv *env, jobject obj, jint arg1)
{
	return (jint) ((QTextStreamJBridge*) QtSupport::getQt(env, obj))->precision((int) arg1);
}

