/***************************************************************************
                            BookmarkTokenizer.cpp -  description
                             -------------------
    begin                : Sun Aug 26 09:45:02 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Aug 26 09:45:02 2001, using kdoc parser/custom Java conversion backend.
 ***************************************************************************/

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

#include <qtjava/QtSupport.h>
#include <kdejava/BookmarkTokenizer.h>

class BookmarkTokenizerJBridge : public BookmarkTokenizer
{
public:
	BookmarkTokenizerJBridge() : BookmarkTokenizer() {}
	~BookmarkTokenizerJBridge() {QtSupport::qtKeyDeleted(this);}
	void protected_reset() {
		BookmarkTokenizer::reset();
		return;
	}
	void protected_appendToken(const char* t, int len) {
		BookmarkTokenizer::appendToken(t, len);
		return;
	}
};


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

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

JNIEXPORT void JNICALL
Java_org_kde_koala_BookmarkTokenizer_begin(JNIEnv *env, jobject obj)
{
	((BookmarkTokenizerJBridge*) QtSupport::getQt(env, obj))->begin();
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_BookmarkTokenizer_write(JNIEnv *env, jobject obj, jstring arg1)
{
static QString * _qstring_arg1 = 0;
	((BookmarkTokenizerJBridge*) QtSupport::getQt(env, obj))->write((QString&) * (QString *) QtSupport::toQString(env, arg1, &_qstring_arg1));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_BookmarkTokenizer_end(JNIEnv *env, jobject obj)
{
	((BookmarkTokenizerJBridge*) QtSupport::getQt(env, obj))->end();
	return;
}

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

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_BookmarkTokenizer_hasMoreTokens(JNIEnv *env, jobject obj)
{
	return (jboolean) ((BookmarkTokenizerJBridge*) QtSupport::getQt(env, obj))->hasMoreTokens();
}

JNIEXPORT void JNICALL
Java_org_kde_koala_BookmarkTokenizer_first(JNIEnv *env, jobject obj)
{
	((BookmarkTokenizerJBridge*) QtSupport::getQt(env, obj))->first();
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_BookmarkTokenizer_appendToken(JNIEnv *env, jobject obj, jstring t, jint len)
{
static QCString * _qstring_t = 0;
	((BookmarkTokenizerJBridge*) QtSupport::getQt(env, obj))->protected_appendToken((char*) QtSupport::toCharString(env, t, &_qstring_t), (int) len);
	return;
}

