/***************************************************************************
                            DCOPRef.m -  description
                             -------------------
    begin                : Fri Mar  8 13:55:08 2002
    copyright            : (C) 2000-2002 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Fri Mar  8 13:55:08 2002, using kalyptus 0.9.
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This library is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Library General Public License as       *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

#include <qtc/qt_QString.h>
#include <qtc/qt_QCString.h>
#include <kdec/kde_DCOPRef.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/DCOPRef.h>
#include <kdeobjc/DCOPObject.h>


@implementation  DCOPRef

- (void *) qt
{
	return _qt;
}

- setQt: (void *) qt
{
	_qt = qt;
	return self;
}

- (BOOL) allocatedInObjcWorld
{
	return _allocatedInObjcWorld;
}

- setAllocatedInObjcWorld: (BOOL) yn
{
	_allocatedInObjcWorld = yn;
	return self;
}


- init
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_DCOPRef()];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- copyWithZone: (NSZone *) zone
{
	DCOPRef * aCopy;
	aCopy = [[(DCOPRef *)[[self class] allocWithZone: zone] setQt: kde_new_DCOPRef1([self qt])] init];
	[aCopy setAllocatedInObjcWorld: YES];
	[QtSupport setObject: aCopy forQtKey: [aCopy qt]];
	return aCopy;
}

- initWithText: (NSString *)app obj: (NSString *)obj
{
static qt_QCString * _qcstring_obj = 0L;
static qt_QCString * _qcstring_app = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_DCOPRef2((qt_QCString*) [app toQCString: &_qcstring_app], (qt_QCString*) [obj toQCString: &_qcstring_obj])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithDCOPObject: (DCOPObject*)object
{
	if ([self qt] == 0L) {
		[self setQt: kde_new_DCOPRef3((kde_DCOPObject*) [object qt])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- initWithText: (NSString *)app obj: (NSString *)obj type: (NSString *)type
{
static qt_QCString * _qcstring_type = 0L;
static qt_QCString * _qcstring_obj = 0L;
static qt_QCString * _qcstring_app = 0L;
	if ([self qt] == 0L) {
		[self setQt: kde_new_DCOPRef4((qt_QCString*) [app toQCString: &_qcstring_app], (qt_QCString*) [obj toQCString: &_qcstring_obj], (qt_QCString*) [type toQCString: &_qcstring_type])];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

- (BOOL) isNull
{
	return (BOOL) kde_DCOPRef_isNull((kde_DCOPRef *)[self qt]);
}

- (NSString *) app
{
static qt_QCString * _qcstring = 0L;
	_qcstring = kde_DCOPRef_app((kde_DCOPRef *)[self qt]);
	return [NSString fromQCString: _qcstring];
}

- (NSString *) object
{
static qt_QCString * _qcstring = 0L;
	_qcstring = kde_DCOPRef_object((kde_DCOPRef *)[self qt]);
	return [NSString fromQCString: _qcstring];
}

- (NSString *) type
{
static qt_QCString * _qcstring = 0L;
	_qcstring = kde_DCOPRef_type((kde_DCOPRef *)[self qt]);
	return [NSString fromQCString: _qcstring];
}

- setRef: (NSString *)app obj: (NSString *)obj
{
static qt_QCString * _qcstring_obj = 0L;
static qt_QCString * _qcstring_app = 0L;
	kde_DCOPRef_setRef((kde_DCOPRef *)[self qt], (qt_QCString*) [app toQCString: &_qcstring_app], (qt_QCString*) [obj toQCString: &_qcstring_obj]);
	return self;
}

- setRef: (NSString *)app obj: (NSString *)obj type: (NSString *)type
{
static qt_QCString * _qcstring_type = 0L;
static qt_QCString * _qcstring_obj = 0L;
static qt_QCString * _qcstring_app = 0L;
	kde_DCOPRef_setRef1((kde_DCOPRef *)[self qt], (qt_QCString*) [app toQCString: &_qcstring_app], (qt_QCString*) [obj toQCString: &_qcstring_obj], (qt_QCString*) [type toQCString: &_qcstring_type]);
	return self;
}

- clear
{
	kde_DCOPRef_clear((kde_DCOPRef *)[self qt]);
	return self;
}

@end
