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

#include <qtjava/QtSupport.h>
#include <kdejava/KDESupport.h>
#include <kdejava/CharacterData.h>

class CharacterDataJBridge : public DOM::CharacterData
{
public:
	CharacterDataJBridge() : CharacterData() {}
	CharacterDataJBridge(const CharacterData& other) : CharacterData(other) {}
	CharacterDataJBridge(const Node& other) : CharacterData(other) {}
	~CharacterDataJBridge() {QtSupport::qtKeyDeleted(this);}
//	CharacterDataJBridge(CharacterDataImpl* i) : CharacterData(i) {}
};


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

JNIEXPORT void JNICALL
Java_org_kde_koala_CharacterData_newCharacterData__Lorg_kde_koala_CharacterData_2(JNIEnv *env, jobject obj, jobject other)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new CharacterDataJBridge((DOM::CharacterData&) *(DOM::CharacterData *) QtSupport::getQt(env, other)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_CharacterData_newCharacterData__Lorg_kde_koala_DOMNode_2(JNIEnv *env, jobject obj, jobject other)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new CharacterDataJBridge((DOM::Node&) *(DOM::Node *) QtSupport::getQt(env, other)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT jstring JNICALL
Java_org_kde_koala_CharacterData_data(JNIEnv *env, jobject obj)
{
	DOM::DOMString  _domstring;
	_domstring = ((CharacterDataJBridge*) QtSupport::getQt(env, obj))->data();
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_CharacterData_setData(JNIEnv *env, jobject obj, jstring arg1)
{
static DOM::DOMString * _domstring_arg1 = 0;
	((CharacterDataJBridge*) QtSupport::getQt(env, obj))->setData((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, arg1, &_domstring_arg1));
	return;
}

JNIEXPORT jlong JNICALL
Java_org_kde_koala_CharacterData_length(JNIEnv *env, jobject obj)
{
	return (jlong) ((CharacterDataJBridge*) QtSupport::getQt(env, obj))->length();
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_CharacterData_substringData(JNIEnv *env, jobject obj, jlong offset, jlong count)
{
	DOM::DOMString  _domstring;
	_domstring = ((CharacterDataJBridge*) QtSupport::getQt(env, obj))->substringData((unsigned long) offset, (unsigned long) count);
	return KDESupport::fromDOMString(env, &_domstring);
}

JNIEXPORT void JNICALL
Java_org_kde_koala_CharacterData_appendData(JNIEnv *env, jobject obj, jstring arg)
{
static DOM::DOMString * _domstring_arg = 0;
	((CharacterDataJBridge*) QtSupport::getQt(env, obj))->appendData((DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, arg, &_domstring_arg));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_CharacterData_insertData(JNIEnv *env, jobject obj, jlong offset, jstring arg)
{
static DOM::DOMString * _domstring_arg = 0;
	((CharacterDataJBridge*) QtSupport::getQt(env, obj))->insertData((unsigned long) offset, (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, arg, &_domstring_arg));
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_CharacterData_deleteData(JNIEnv *env, jobject obj, jlong offset, jlong count)
{
	((CharacterDataJBridge*) QtSupport::getQt(env, obj))->deleteData((unsigned long) offset, (unsigned long) count);
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_CharacterData_replaceData(JNIEnv *env, jobject obj, jlong offset, jlong count, jstring arg)
{
static DOM::DOMString * _domstring_arg = 0;
	((CharacterDataJBridge*) QtSupport::getQt(env, obj))->replaceData((unsigned long) offset, (unsigned long) count, (DOM::DOMString) * (DOM::DOMString *) KDESupport::toDOMString(env, arg, &_domstring_arg));
	return;
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_CharacterData_newCharacterData__Lorg_kde_koala_CharacterDataImpl_2(JNIEnv *env, jobject obj, jobject i)
//{
//	if (QtSupport::getQt(env, obj) == 0) {
//		QtSupport::setQt(env, obj, new CharacterDataJBridge((CharacterDataImpl*) QtSupport::getQt(env, i)));
//		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
//	}
//	return;
//}

