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

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

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

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QTextCodec_name(JNIEnv *env, jobject obj)
{
	 const char*  _qcstring;
	_qcstring = (const char *)((QTextCodec*) QtSupport::getQt(env, obj))->name();
	return QtSupport::fromCharString(env, (char *) _qcstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QTextCodec_mimeName(JNIEnv *env, jobject obj)
{
	 const char*  _qcstring;
	_qcstring = (const char *)((QTextCodec*) QtSupport::getQt(env, obj))->mimeName();
	return QtSupport::fromCharString(env, (char *) _qcstring);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextCodec_mibEnum(JNIEnv *env, jobject obj)
{
	return (jint) ((QTextCodec*) QtSupport::getQt(env, obj))->mibEnum();
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextCodec_makeDecoder(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((QTextCodec*) QtSupport::getQt(env, obj))->makeDecoder(), "org.kde.qt.QTextDecoder");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextCodec_makeEncoder(JNIEnv *env, jobject obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)((QTextCodec*) QtSupport::getQt(env, obj))->makeEncoder(), "org.kde.qt.QTextEncoder");
}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QTextCodec_toUnicode__Ljava_lang_String_2I(JNIEnv *env, jobject obj, jstring chars, jint len)
{
	QString  _qstring;
static QCString * _qstring_chars = 0;
	_qstring = ((QTextCodec*) QtSupport::getQt(env, obj))->toUnicode((char*) QtSupport::toCharString(env, chars, &_qstring_chars), (int) len);
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QTextCodec_fromUnicode__Ljava_lang_String_2I(JNIEnv *env, jobject obj, jstring uc, jint lenInOut)
{
	QCString  _qcstring;
static QString * _qstring_uc = 0;
	_qcstring = ((QTextCodec*) QtSupport::getQt(env, obj))->fromUnicode((QString&) * (QString *) QtSupport::toQString(env, uc, &_qstring_uc), (int&) * (int *) lenInOut);
	return QtSupport::fromQCString(env, &_qcstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QTextCodec_fromUnicode__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring uc)
{
	QCString  _qcstring;
static QString * _qstring_uc = 0;
	_qcstring = ((QTextCodec*) QtSupport::getQt(env, obj))->fromUnicode((QString&) * (QString *) QtSupport::toQString(env, uc, &_qstring_uc));
	return QtSupport::fromQCString(env, &_qcstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QTextCodec_toUnicode___3BI(JNIEnv *env, jobject obj, jbyteArray arg1, jint len)
{
	QString  _qstring;
static QByteArray * _qbyteArray_arg1 = 0;
	_qstring = ((QTextCodec*) QtSupport::getQt(env, obj))->toUnicode((QByteArray&) * (QByteArray *) QtSupport::toQByteArray(env, arg1, &_qbyteArray_arg1), (int) len);
	return QtSupport::fromQString(env, &_qstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QTextCodec_toUnicode___3B(JNIEnv *env, jobject obj, jbyteArray arg1)
{
	QString  _qstring;
static QByteArray * _qbyteArray_arg1 = 0;
	_qstring = ((QTextCodec*) QtSupport::getQt(env, obj))->toUnicode((QByteArray&) * (QByteArray *) QtSupport::toQByteArray(env, arg1, &_qbyteArray_arg1));
	return QtSupport::fromQString(env, &_qstring);
}

//JNIEXPORT jstring JNICALL
//Java_org_kde_qt_QTextCodec_toUnicode__Ljava_lang_String_2I(JNIEnv *env, jobject obj, jstring arg1, jint len)
//{
//	QString  _qstring;
//static QCString * _qcstring_arg1 = 0;
//	_qstring = ((QTextCodec*) QtSupport::getQt(env, obj))->toUnicode((QCString&) * (QCString *) QtSupport::toQCString(env, arg1, &_qcstring_arg1), (int) len);
//	return QtSupport::fromQString(env, &_qstring);
//}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QTextCodec_toUnicode__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring arg1)
{
	QString  _qstring;
static QCString * _qcstring_arg1 = 0;
	_qstring = ((QTextCodec*) QtSupport::getQt(env, obj))->toUnicode((QCString&) * (QCString *) QtSupport::toQCString(env, arg1, &_qcstring_arg1));
	return QtSupport::fromQString(env, &_qstring);
}

//JNIEXPORT jstring JNICALL
//Java_org_kde_qt_QTextCodec_toUnicode__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring chars)
//{
//	QString  _qstring;
//static QCString * _qstring_chars = 0;
//	_qstring = ((QTextCodec*) QtSupport::getQt(env, obj))->toUnicode((char*) QtSupport::toCharString(env, chars, &_qstring_chars));
//	return QtSupport::fromQString(env, &_qstring);
//}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QTextCodec_canEncode__C(JNIEnv *env, jobject obj, jchar arg1)
{
static QChar * _qchar_arg1 = 0;
	return (jboolean) ((QTextCodec*) QtSupport::getQt(env, obj))->canEncode((QChar) * (QChar *) QtSupport::toQChar(env, arg1, &_qchar_arg1));
}

JNIEXPORT jboolean JNICALL
Java_org_kde_qt_QTextCodec_canEncode__Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring arg1)
{
static QString * _qstring_arg1 = 0;
	return (jboolean) ((QTextCodec*) QtSupport::getQt(env, obj))->canEncode((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextCodec_heuristicContentMatch(JNIEnv *env, jobject obj, jstring chars, jint len)
{
static QCString * _qstring_chars = 0;
	return (jint) ((QTextCodec*) QtSupport::getQt(env, obj))->heuristicContentMatch((char*) QtSupport::toCharString(env, chars, &_qstring_chars), (int) len);
}

JNIEXPORT jint JNICALL
Java_org_kde_qt_QTextCodec_heuristicNameMatch(JNIEnv *env, jobject obj, jstring hint)
{
static QCString * _qstring_hint = 0;
	return (jint) ((QTextCodec*) QtSupport::getQt(env, obj))->heuristicNameMatch((char*) QtSupport::toCharString(env, hint, &_qstring_hint));
}

JNIEXPORT jbyteArray JNICALL
Java_org_kde_qt_QTextCodec_fromUnicode__Ljava_lang_String_2II(JNIEnv *env, jobject obj, jstring uc, jint from, jint len)
{
	QByteArray  _qbyteArray;
static QString * _qstring_uc = 0;
	_qbyteArray = ((QTextCodec*) QtSupport::getQt(env, obj))->fromUnicode((QString&) * (QString *) QtSupport::toQString(env, uc, &_qstring_uc), (int) from, (int) len);
	return QtSupport::fromQByteArray(env, &_qbyteArray);
}

JNIEXPORT jshort JNICALL
Java_org_kde_qt_QTextCodec_characterFromUnicode(JNIEnv *env, jobject obj, jstring str, jint pos)
{
static QString * _qstring_str = 0;
	return (jshort) ((QTextCodec*) QtSupport::getQt(env, obj))->characterFromUnicode((QString&) * (QString *) QtSupport::toQString(env, str, &_qstring_str), (int) pos);
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextCodec_loadCharmap(JNIEnv *env, jclass obj, jobject arg1)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)QTextCodec::loadCharmap((QIODevice*) QtSupport::getQt(env, arg1)), "org.kde.qt.QTextCodec");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextCodec_loadCharmapFile(JNIEnv *env, jclass obj, jstring filename)
{
static QString * _qstring_filename = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)QTextCodec::loadCharmapFile((QString) * (QString *) QtSupport::toQString(env, filename, &_qstring_filename)), "org.kde.qt.QTextCodec");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextCodec_codecForMib(JNIEnv *env, jclass obj, jint mib)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)QTextCodec::codecForMib((int) mib), "org.kde.qt.QTextCodec");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextCodec_codecForName__Ljava_lang_String_2I(JNIEnv *env, jclass obj, jstring hint, jint accuracy)
{
static QCString * _qstring_hint = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)QTextCodec::codecForName((char*) QtSupport::toCharString(env, hint, &_qstring_hint), (int) accuracy), "org.kde.qt.QTextCodec");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextCodec_codecForName__Ljava_lang_String_2(JNIEnv *env, jclass obj, jstring hint)
{
static QCString * _qstring_hint = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)QTextCodec::codecForName((char*) QtSupport::toCharString(env, hint, &_qstring_hint), 0), "org.kde.qt.QTextCodec");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextCodec_codecForContent(JNIEnv *env, jclass obj, jstring chars, jint len)
{
static QCString * _qstring_chars = 0;
	return (jobject) QtSupport::objectForQtKey(env, (void *)QTextCodec::codecForContent((char*) QtSupport::toCharString(env, chars, &_qstring_chars), (int) len), "org.kde.qt.QTextCodec");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextCodec_codecForIndex(JNIEnv *env, jclass obj, jint i)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)QTextCodec::codecForIndex((int) i), "org.kde.qt.QTextCodec");
}

JNIEXPORT jobject JNICALL
Java_org_kde_qt_QTextCodec_codecForLocale(JNIEnv *env, jclass obj)
{
	return (jobject) QtSupport::objectForQtKey(env, (void *)QTextCodec::codecForLocale(), "org.kde.qt.QTextCodec");
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTextCodec_setCodecForLocale(JNIEnv *env, jclass obj, jobject c)
{
	QTextCodec::setCodecForLocale((QTextCodec*) QtSupport::getQt(env, c));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_qt_QTextCodec_deleteAllCodecs(JNIEnv *env, jclass obj)
{
	QTextCodec::deleteAllCodecs();
	return;
}

JNIEXPORT jstring JNICALL
Java_org_kde_qt_QTextCodec_locale(JNIEnv *env, jclass obj)
{
	 const char*  _qcstring;
	_qcstring = (const char *)QTextCodec::locale();
	return QtSupport::fromCharString(env, (char *) _qcstring);
}

