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

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

class QDataStreamJBridge : public QDataStream
{
public:
	QDataStreamJBridge() : QDataStream() {}
	QDataStreamJBridge(QIODevice* arg1) : QDataStream(arg1) {}
	QDataStreamJBridge(QByteArray arg1, int mode) : QDataStream(arg1, mode) {}
	~QDataStreamJBridge() {QtSupport::qtKeyDeleted(this);}
};


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

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

JNIEXPORT void JNICALL
Java_org_kde_qt_QDataStream_newQDataStream___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 QDataStreamJBridge((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_QDataStream_finalize(JNIEnv *env, jobject obj)
{
	if (QtSupport::allocatedInJavaWorld(env, obj)) {
		delete (QDataStream*)QtSupport::getQt(env, obj);
		QtSupport::setQt(env, obj, 0);
	}
	return;
}

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

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

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

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

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

JNIEXPORT jint JNICALL
Java_org_kde_qt_QDataStream_byteOrder(JNIEnv *env, jobject obj)
{
	return (jint) ((QDataStreamJBridge*) QtSupport::getQt(env, obj))->byteOrder();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDataStream_setByteOrder(JNIEnv *env, jobject obj, jint arg1)
{
	((QDataStreamJBridge*) QtSupport::getQt(env, obj))->setByteOrder((int) arg1);
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QDataStream_isPrintableData(JNIEnv *env, jobject obj)
{
	return (jboolean) ((QDataStreamJBridge*) QtSupport::getQt(env, obj))->isPrintableData();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDataStream_setPrintableData(JNIEnv *env, jobject obj, jboolean arg1)
{
	((QDataStreamJBridge*) QtSupport::getQt(env, obj))->setPrintableData((bool) arg1);
	return;
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QDataStream_version(JNIEnv *env, jobject obj)
{
	return (jint) ((QDataStreamJBridge*) QtSupport::getQt(env, obj))->version();
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QDataStream_setVersion(JNIEnv *env, jobject obj, jint arg1)
{
	((QDataStreamJBridge*) QtSupport::getQt(env, obj))->setVersion((int) arg1);
	return;
}

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

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

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

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

