/***************************************************************************
                            NodeFilter.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_NodeFilter.h>
#include <kdeobjc/KDESupport.h>
#include <kdeobjc/NodeFilter.h>
#include <kdeobjc/DOMNode.h>


@implementation  NodeFilter

- (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_NodeFilter()];
		[self setAllocatedInObjcWorld: YES];
		[QtSupport setObject: self forQtKey: [self qt]];
	}
	[super init];
	return self;
}

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

- (void) dealloc
{
	if ([self qt] != 0L) {
		if ([self allocatedInObjcWorld]) {
			kde_del_NodeFilter((kde_NodeFilter *)[self qt]);
		}
		[QtSupport removeQtKey: [self qt]];
		[self setQt: 0L];
	}
	[super dealloc];
}

- (short) acceptNode: (DOMNode*)n
{
	return (short) kde_NodeFilter_acceptNode((kde_NodeFilter *)[self qt], (kde_DOMNode*) [n qt]);
}

- (BOOL) isNull
{
	return (BOOL) kde_NodeFilter_isNull((kde_NodeFilter *)[self qt]);
}

//- setCustomNodeFilter: (CustomNodeFilter*)custom
//{
//	kde_NodeFilter_setCustomNodeFilter((kde_NodeFilter *)[self qt], (kde_CustomNodeFilter*) [custom qt]);
//	return self;
//}

//- (CustomNodeFilter*) customNodeFilter
//{
//	return (CustomNodeFilter*) [QtSupport objectForQtKey: kde_NodeFilter_customNodeFilter((kde_NodeFilter *)[self qt]) withClass: [CustomNodeFilter class] allocatedInObjcWorld: YES];
//}

//+ (NodeFilter*) createCustom: (CustomNodeFilter*)custom
//{
//	return (NodeFilter*) [QtSupport objectForQtKey: kde_NodeFilter_createCustom((kde_CustomNodeFilter*) [custom qt]) withClass: [NodeFilter class] allocatedInObjcWorld: YES];
//}

+ (int) FILTER_ACCEPT
{
	return (int) NODEFILTER_FILTER_ACCEPT;
}

+ (int) FILTER_REJECT
{
	return (int) NODEFILTER_FILTER_REJECT;
}

+ (int) FILTER_SKIP
{
	return (int) NODEFILTER_FILTER_SKIP;
}

+ (int) SHOW_ALL
{
	return (int) NODEFILTER_SHOW_ALL;
}

+ (int) SHOW_ELEMENT
{
	return (int) NODEFILTER_SHOW_ELEMENT;
}

+ (int) SHOW_ATTRIBUTE
{
	return (int) NODEFILTER_SHOW_ATTRIBUTE;
}

+ (int) SHOW_TEXT
{
	return (int) NODEFILTER_SHOW_TEXT;
}

+ (int) SHOW_CDATA_SECTION
{
	return (int) NODEFILTER_SHOW_CDATA_SECTION;
}

+ (int) SHOW_ENTITY_REFERENCE
{
	return (int) NODEFILTER_SHOW_ENTITY_REFERENCE;
}

+ (int) SHOW_ENTITY
{
	return (int) NODEFILTER_SHOW_ENTITY;
}

+ (int) SHOW_PROCESSING_INSTRUCTION
{
	return (int) NODEFILTER_SHOW_PROCESSING_INSTRUCTION;
}

+ (int) SHOW_COMMENT
{
	return (int) NODEFILTER_SHOW_COMMENT;
}

+ (int) SHOW_DOCUMENT
{
	return (int) NODEFILTER_SHOW_DOCUMENT;
}

+ (int) SHOW_DOCUMENT_TYPE
{
	return (int) NODEFILTER_SHOW_DOCUMENT_TYPE;
}

+ (int) SHOW_DOCUMENT_FRAGMENT
{
	return (int) NODEFILTER_SHOW_DOCUMENT_FRAGMENT;
}

+ (int) SHOW_NOTATION
{
	return (int) NODEFILTER_SHOW_NOTATION;
}

@end
