/***************************************************************************
                            DCOPRef.cpp -  description
                             -------------------
    begin                : Sun Jan 27 16:22:17 2002
    copyright            : (C) 2000-2001 Lost Highway Ltd.
    email                : Richard_Dale@tipitina.demon.co.uk
    generated by         : duke@tipitina on Sun Jan 27 16:22:17 2002, 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 <dcopref.h>
#include <qstring.h>
#include <qcstring.h>

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

class DCOPRefJBridge : public DCOPRef
{
public:
	DCOPRefJBridge() : DCOPRef() {}
	DCOPRefJBridge(const DCOPRef& ref) : DCOPRef(ref) {}
	DCOPRefJBridge(const QCString& app, const QCString& obj) : DCOPRef(app, obj) {}
	DCOPRefJBridge(DCOPObject* object) : DCOPRef(object) {}
	DCOPRefJBridge(const QCString& app, const QCString& obj, const QCString& type) : DCOPRef(app, obj, type) {}
};


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

JNIEXPORT void JNICALL
Java_org_kde_koala_DCOPRef_newDCOPRef__Lorg_kde_koala_DCOPRef_2(JNIEnv *env, jobject obj, jobject ref)
{
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new DCOPRefJBridge((DCOPRef&) *(DCOPRef *) QtSupport::getQt(env, ref)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT void JNICALL
Java_org_kde_koala_DCOPRef_newDCOPRef__Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring app, jstring _obj)
{
static QCString * _qcstring_obj = 0;
static QCString * _qcstring_app = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new DCOPRefJBridge((QCString&) * (QCString *) QtSupport::toQCString(env, app, &_qcstring_app), (QCString&) * (QCString *) QtSupport::toQCString(env, _obj, &_qcstring_obj)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

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

JNIEXPORT void JNICALL
Java_org_kde_koala_DCOPRef_newDCOPRef__Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring app, jstring _obj, jstring type)
{
static QCString * _qcstring_type = 0;
static QCString * _qcstring_obj = 0;
static QCString * _qcstring_app = 0;
	if (QtSupport::getQt(env, obj) == 0) {
		QtSupport::setQt(env, obj, new DCOPRefJBridge((QCString&) * (QCString *) QtSupport::toQCString(env, app, &_qcstring_app), (QCString&) * (QCString *) QtSupport::toQCString(env, _obj, &_qcstring_obj), (QCString&) * (QCString *) QtSupport::toQCString(env, type, &_qcstring_type)));
		QtSupport::setObjectForQtKey(env, obj, QtSupport::getQt(env, obj));
	}
	return;
}

JNIEXPORT jboolean JNICALL
Java_org_kde_koala_DCOPRef_isNull(JNIEnv *env, jobject obj)
{
	return (jboolean) ((DCOPRef*) QtSupport::getQt(env, obj))->isNull();
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_DCOPRef_app(JNIEnv *env, jobject obj)
{
	QCString  _qcstring;
	_qcstring = ((DCOPRef*) QtSupport::getQt(env, obj))->app();
	return QtSupport::fromQCString(env, &_qcstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_DCOPRef_object(JNIEnv *env, jobject obj)
{
	QCString  _qcstring;
	_qcstring = ((DCOPRef*) QtSupport::getQt(env, obj))->object();
	return QtSupport::fromQCString(env, &_qcstring);
}

JNIEXPORT jstring JNICALL
Java_org_kde_koala_DCOPRef_type(JNIEnv *env, jobject obj)
{
	QCString  _qcstring;
	_qcstring = ((DCOPRef*) QtSupport::getQt(env, obj))->type();
	return QtSupport::fromQCString(env, &_qcstring);
}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_DCOPRef_setRef__Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring app, jstring obj)
//{
//static QCString * _qcstring_obj = 0;
//static QCString * _qcstring_app = 0;
//	((DCOPRef*) QtSupport::getQt(env, obj))->setRef((QCString&) * (QCString *) QtSupport::toQCString(env, app, &_qcstring_app), (QCString&) * (QCString *) QtSupport::toQCString(env, obj, &_qcstring_obj));
//	return;
//}

//JNIEXPORT void JNICALL
//Java_org_kde_koala_DCOPRef_setRef__Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_String_2(JNIEnv *env, jobject obj, jstring app, jstring obj, jstring type)
//{
//static QCString * _qcstring_type = 0;
//static QCString * _qcstring_obj = 0;
//static QCString * _qcstring_app = 0;
//	((DCOPRef*) QtSupport::getQt(env, obj))->setRef((QCString&) * (QCString *) QtSupport::toQCString(env, app, &_qcstring_app), (QCString&) * (QCString *) QtSupport::toQCString(env, obj, &_qcstring_obj), (QCString&) * (QCString *) QtSupport::toQCString(env, type, &_qcstring_type));
//	return;
//}

JNIEXPORT void JNICALL
Java_org_kde_koala_DCOPRef_clear(JNIEnv *env, jobject obj)
{
	((DCOPRef*) QtSupport::getQt(env, obj))->clear();
	return;
}

