/***************************************************************************
                            QXmlDefaultHandler.m -  description
                             -------------------
    begin                : Wed Nov 21 12:08:37 2001
    copyright            : (C) 2000-2001 Lost Highway Ltd. All rights reserved.
    email                : Lost_Highway@tipitina.demon.co.uk
    generated by         : duke@tipitina on Wed Nov 21 12:08:37 2001, 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 <qtc/qt_QXmlContentHandler.h>
#include <qtc/qt_QXmlDTDHandler.h>
#include <qtc/qt_QXmlDeclHandler.h>
#include <qtc/qt_QXmlDefaultHandler.h>
#include <qtc/qt_QXmlEntityResolver.h>
#include <qtc/qt_QXmlErrorHandler.h>
#include <qtc/qt_QXmlLexicalHandler.h>
#include <qtc/qt_QXmlDeclHandler.h>

#include <qtobjc/QXmlContentHandler.h>
#include <qtobjc/QXmlDTDHandler.h>
#include <qtobjc/QXmlDeclHandler.h>
#include <qtobjc/QXmlDefaultHandler.h>
#include <qtobjc/QXmlEntityResolver.h>
#include <qtobjc/QXmlErrorHandler.h>
#include <qtobjc/QXmlLexicalHandler.h>
#include <qtobjc/QXmlLocator.h>
#include <qtobjc/QXmlAttributes.h>
#include <qtobjc/QXmlParseException.h>
#include <qtobjc/QXmlInputSource.h>

@implementation  QXmlDefaultHandler


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

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

- setDocumentLocator: (QXmlLocator*)locator
{
	qt_QXmlDefaultHandler_setDocumentLocator((qt_QXmlDefaultHandler *)[self qt], (qt_QXmlLocator*) [locator qt]);
	return self;
}

- (BOOL) startDocument
{
	return (BOOL) qt_QXmlDefaultHandler_startDocument((qt_QXmlDefaultHandler *)[self qt]);
}

- (BOOL) endDocument
{
	return (BOOL) qt_QXmlDefaultHandler_endDocument((qt_QXmlDefaultHandler *)[self qt]);
}

- (BOOL) startPrefixMapping: (NSString *)prefix uri: (NSString *)uri
{
static qt_QString * _qstring_uri = 0L;
static qt_QString * _qstring_prefix = 0L;
	return (BOOL) qt_QXmlDefaultHandler_startPrefixMapping((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [prefix toQString: &_qstring_prefix], (qt_QString *) [uri toQString: &_qstring_uri]);
}

- (BOOL) endPrefixMapping: (NSString *)prefix
{
static qt_QString * _qstring_prefix = 0L;
	return (BOOL) qt_QXmlDefaultHandler_endPrefixMapping((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [prefix toQString: &_qstring_prefix]);
}

- (BOOL) startElement: (NSString *)namespaceURI localName: (NSString *)localName qName: (NSString *)qName atts: (QXmlAttributes*)atts
{
static qt_QString * _qstring_qName = 0L;
static qt_QString * _qstring_localName = 0L;
static qt_QString * _qstring_namespaceURI = 0L;
	return (BOOL) qt_QXmlDefaultHandler_startElement((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [namespaceURI toQString: &_qstring_namespaceURI], (qt_QString *) [localName toQString: &_qstring_localName], (qt_QString *) [qName toQString: &_qstring_qName], (qt_QXmlAttributes*) [atts qt]);
}

- (BOOL) endElement: (NSString *)namespaceURI localName: (NSString *)localName qName: (NSString *)qName
{
static qt_QString * _qstring_qName = 0L;
static qt_QString * _qstring_localName = 0L;
static qt_QString * _qstring_namespaceURI = 0L;
	return (BOOL) qt_QXmlDefaultHandler_endElement((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [namespaceURI toQString: &_qstring_namespaceURI], (qt_QString *) [localName toQString: &_qstring_localName], (qt_QString *) [qName toQString: &_qstring_qName]);
}

- (BOOL) characters: (NSString *)ch
{
static qt_QString * _qstring_ch = 0L;
	return (BOOL) qt_QXmlDefaultHandler_characters((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [ch toQString: &_qstring_ch]);
}

- (BOOL) ignorableWhitespace: (NSString *)ch
{
static qt_QString * _qstring_ch = 0L;
	return (BOOL) qt_QXmlDefaultHandler_ignorableWhitespace((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [ch toQString: &_qstring_ch]);
}

- (BOOL) processingInstruction: (NSString *)target data: (NSString *)data
{
static qt_QString * _qstring_data = 0L;
static qt_QString * _qstring_target = 0L;
	return (BOOL) qt_QXmlDefaultHandler_processingInstruction((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [target toQString: &_qstring_target], (qt_QString *) [data toQString: &_qstring_data]);
}

- (BOOL) skippedEntity: (NSString *)name
{
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlDefaultHandler_skippedEntity((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [name toQString: &_qstring_name]);
}

- (BOOL) warning: (QXmlParseException*)exception
{
	return (BOOL) qt_QXmlDefaultHandler_warning((qt_QXmlDefaultHandler *)[self qt], (qt_QXmlParseException*) [exception qt]);
}

- (BOOL) error: (QXmlParseException*)exception
{
	return (BOOL) qt_QXmlDefaultHandler_error((qt_QXmlDefaultHandler *)[self qt], (qt_QXmlParseException*) [exception qt]);
}

- (BOOL) fatalError: (QXmlParseException*)exception
{
	return (BOOL) qt_QXmlDefaultHandler_fatalError((qt_QXmlDefaultHandler *)[self qt], (qt_QXmlParseException*) [exception qt]);
}

- (BOOL) notationDecl: (NSString *)name publicId: (NSString *)publicId systemId: (NSString *)systemId
{
static qt_QString * _qstring_systemId = 0L;
static qt_QString * _qstring_publicId = 0L;
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlDefaultHandler_notationDecl((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [publicId toQString: &_qstring_publicId], (qt_QString *) [systemId toQString: &_qstring_systemId]);
}

- (BOOL) unparsedEntityDecl: (NSString *)name publicId: (NSString *)publicId systemId: (NSString *)systemId notationName: (NSString *)notationName
{
static qt_QString * _qstring_notationName = 0L;
static qt_QString * _qstring_systemId = 0L;
static qt_QString * _qstring_publicId = 0L;
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlDefaultHandler_unparsedEntityDecl((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [publicId toQString: &_qstring_publicId], (qt_QString *) [systemId toQString: &_qstring_systemId], (qt_QString *) [notationName toQString: &_qstring_notationName]);
}

- (BOOL) resolveEntity: (NSString *)publicId systemId: (NSString *)systemId ret: (QXmlInputSource*)ret
{
static qt_QString * _qstring_systemId = 0L;
static qt_QString * _qstring_publicId = 0L;
	return (BOOL) qt_QXmlDefaultHandler_resolveEntity((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [publicId toQString: &_qstring_publicId], (qt_QString *) [systemId toQString: &_qstring_systemId], (qt_QXmlInputSource*) [ret qt]);
}

- (BOOL) startDTD: (NSString *)name publicId: (NSString *)publicId systemId: (NSString *)systemId
{
static qt_QString * _qstring_systemId = 0L;
static qt_QString * _qstring_publicId = 0L;
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlDefaultHandler_startDTD((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [publicId toQString: &_qstring_publicId], (qt_QString *) [systemId toQString: &_qstring_systemId]);
}

- (BOOL) endDTD
{
	return (BOOL) qt_QXmlDefaultHandler_endDTD((qt_QXmlDefaultHandler *)[self qt]);
}

- (BOOL) startCDATA
{
	return (BOOL) qt_QXmlDefaultHandler_startCDATA((qt_QXmlDefaultHandler *)[self qt]);
}

- (BOOL) endCDATA
{
	return (BOOL) qt_QXmlDefaultHandler_endCDATA((qt_QXmlDefaultHandler *)[self qt]);
}

- (BOOL) comment: (NSString *)ch
{
static qt_QString * _qstring_ch = 0L;
	return (BOOL) qt_QXmlDefaultHandler_comment((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [ch toQString: &_qstring_ch]);
}

- (BOOL) attributeDecl: (NSString *)eName aName: (NSString *)aName type: (NSString *)type valueDefault: (NSString *)valueDefault value: (NSString *)value
{
static qt_QString * _qstring_value = 0L;
static qt_QString * _qstring_valueDefault = 0L;
static qt_QString * _qstring_type = 0L;
static qt_QString * _qstring_aName = 0L;
static qt_QString * _qstring_eName = 0L;
	return (BOOL) qt_QXmlDefaultHandler_attributeDecl((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [eName toQString: &_qstring_eName], (qt_QString *) [aName toQString: &_qstring_aName], (qt_QString *) [type toQString: &_qstring_type], (qt_QString *) [valueDefault toQString: &_qstring_valueDefault], (qt_QString *) [value toQString: &_qstring_value]);
}

- (BOOL) internalEntityDecl: (NSString *)name value: (NSString *)value
{
static qt_QString * _qstring_value = 0L;
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlDefaultHandler_internalEntityDecl((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [value toQString: &_qstring_value]);
}

- (BOOL) externalEntityDecl: (NSString *)name publicId: (NSString *)publicId systemId: (NSString *)systemId
{
static qt_QString * _qstring_systemId = 0L;
static qt_QString * _qstring_publicId = 0L;
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlDefaultHandler_externalEntityDecl((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [publicId toQString: &_qstring_publicId], (qt_QString *) [systemId toQString: &_qstring_systemId]);
}

- (NSString *) errorString
{
static qt_QString * _qstring = 0L;
	_qstring = qt_QXmlDefaultHandler_errorString((qt_QXmlDefaultHandler *)[self qt]);
	return [NSString fromQString: _qstring];
}

@end

@implementation QXmlDefaultHandler (QXmlContentHandlerImplementation)
- setDocumentLocator: (QXmlLocator*)locator
{
	qt_QXmlContentHandler_setDocumentLocator(qt_QXmlDefaultHandler_QXmlContentHandler([self qt]), (qt_QXmlLocator*) [locator qt]);
	return self;
}

- (BOOL) startDocument
{
	return (BOOL) qt_QXmlContentHandler_startDocument(qt_QXmlDefaultHandler_QXmlContentHandler([self qt]));
}

- (BOOL) endDocument
{
	return (BOOL) qt_QXmlContentHandler_endDocument(qt_QXmlDefaultHandler_QXmlContentHandler([self qt]));
}

- (BOOL) startPrefixMapping: (NSString *)prefix uri: (NSString *)uri
{
static qt_QString * _qstring_uri = 0L;
static qt_QString * _qstring_prefix = 0L;
	return (BOOL) qt_QXmlContentHandler_startPrefixMapping(qt_QXmlDefaultHandler_QXmlContentHandler([self qt]), (qt_QString *) [prefix toQString: &_qstring_prefix], (qt_QString *) [uri toQString: &_qstring_uri]);
}

- (BOOL) endPrefixMapping: (NSString *)prefix
{
static qt_QString * _qstring_prefix = 0L;
	return (BOOL) qt_QXmlContentHandler_endPrefixMapping(qt_QXmlDefaultHandler_QXmlContentHandler([self qt]), (qt_QString *) [prefix toQString: &_qstring_prefix]);
}

- (BOOL) startElement: (NSString *)namespaceURI localName: (NSString *)localName qName: (NSString *)qName atts: (QXmlAttributes*)atts
{
static qt_QString * _qstring_qName = 0L;
static qt_QString * _qstring_localName = 0L;
static qt_QString * _qstring_namespaceURI = 0L;
	return (BOOL) qt_QXmlContentHandler_startElement(qt_QXmlDefaultHandler_QXmlContentHandler([self qt]), (qt_QString *) [namespaceURI toQString: &_qstring_namespaceURI], (qt_QString *) [localName toQString: &_qstring_localName], (qt_QString *) [qName toQString: &_qstring_qName], (qt_QXmlAttributes*) [atts qt]);
}

- (BOOL) endElement: (NSString *)namespaceURI localName: (NSString *)localName qName: (NSString *)qName
{
static qt_QString * _qstring_qName = 0L;
static qt_QString * _qstring_localName = 0L;
static qt_QString * _qstring_namespaceURI = 0L;
	return (BOOL) qt_QXmlContentHandler_endElement(qt_QXmlDefaultHandler_QXmlContentHandler([self qt]), (qt_QString *) [namespaceURI toQString: &_qstring_namespaceURI], (qt_QString *) [localName toQString: &_qstring_localName], (qt_QString *) [qName toQString: &_qstring_qName]);
}

- (BOOL) characters: (NSString *)ch
{
static qt_QString * _qstring_ch = 0L;
	return (BOOL) qt_QXmlContentHandler_characters(qt_QXmlDefaultHandler_QXmlContentHandler([self qt]), (qt_QString *) [ch toQString: &_qstring_ch]);
}

- (BOOL) ignorableWhitespace: (NSString *)ch
{
static qt_QString * _qstring_ch = 0L;
	return (BOOL) qt_QXmlContentHandler_ignorableWhitespace(qt_QXmlDefaultHandler_QXmlContentHandler([self qt]), (qt_QString *) [ch toQString: &_qstring_ch]);
}

- (BOOL) processingInstruction: (NSString *)target data: (NSString *)data
{
static qt_QString * _qstring_data = 0L;
static qt_QString * _qstring_target = 0L;
	return (BOOL) qt_QXmlContentHandler_processingInstruction(qt_QXmlDefaultHandler_QXmlContentHandler([self qt]), (qt_QString *) [target toQString: &_qstring_target], (qt_QString *) [data toQString: &_qstring_data]);
}

- (BOOL) skippedEntity: (NSString *)name
{
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlContentHandler_skippedEntity(qt_QXmlDefaultHandler_QXmlContentHandler([self qt]), (qt_QString *) [name toQString: &_qstring_name]);
}

@end

@implementation QXmlDefaultHandler (QXmlDTDHandlerImplementation)

- (BOOL) notationDecl: (NSString *)name publicId: (NSString *)publicId systemId: (NSString *)systemId
{
static qt_QString * _qstring_systemId = 0L;
static qt_QString * _qstring_publicId = 0L;
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlDTDHandler_notationDecl(qt_QXmlDefaultHandler_QXmlDTDHandler([self qt]), (qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [publicId toQString: &_qstring_publicId], (qt_QString *) [systemId toQString: &_qstring_systemId]);
}

- (BOOL) unparsedEntityDecl: (NSString *)name publicId: (NSString *)publicId systemId: (NSString *)systemId notationName: (NSString *)notationName
{
static qt_QString * _qstring_notationName = 0L;
static qt_QString * _qstring_systemId = 0L;
static qt_QString * _qstring_publicId = 0L;
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlDTDHandler_unparsedEntityDecl(qt_QXmlDefaultHandler_QXmlDTDHandler([self qt]), (qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [publicId toQString: &_qstring_publicId], (qt_QString *) [systemId toQString: &_qstring_systemId], (qt_QString *) [notationName toQString: &_qstring_notationName]);
}

@end

@implementation QXmlDefaultHandler (QXmlDeclHandlerImplementation)

- (BOOL) attributeDecl: (NSString *)eName aName: (NSString *)aName type: (NSString *)type valueDefault: (NSString *)valueDefault value: (NSString *)value
{
static qt_QString * _qstring_value = 0L;
static qt_QString * _qstring_valueDefault = 0L;
static qt_QString * _qstring_type = 0L;
static qt_QString * _qstring_aName = 0L;
static qt_QString * _qstring_eName = 0L;
	return (BOOL) qt_QXmlDeclHandler_attributeDecl(qt_QXmlDefaultHandler_QXmlDeclHandler([self qt]), (qt_QString *) [eName toQString: &_qstring_eName], (qt_QString *) [aName toQString: &_qstring_aName], (qt_QString *) [type toQString: &_qstring_type], (qt_QString *) [valueDefault toQString: &_qstring_valueDefault], (qt_QString *) [value toQString: &_qstring_value]);
}

- (BOOL) internalEntityDecl: (NSString *)name value: (NSString *)value
{
static qt_QString * _qstring_value = 0L;
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlDeclHandler_internalEntityDecl(qt_QXmlDefaultHandler_QXmlDeclHandler([self qt]), (qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [value toQString: &_qstring_value]);
}

- (BOOL) externalEntityDecl: (NSString *)name publicId: (NSString *)publicId systemId: (NSString *)systemId
{
static qt_QString * _qstring_systemId = 0L;
static qt_QString * _qstring_publicId = 0L;
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlDeclHandler_externalEntityDecl(qt_QXmlDefaultHandler_QXmlDeclHandler([self qt]), (qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [publicId toQString: &_qstring_publicId], (qt_QString *) [systemId toQString: &_qstring_systemId]);
}

@end

@implementation QXmlDefaultHandler (QXmlEntityResolverImplementation)

- (BOOL) resolveEntity: (NSString *)publicId systemId: (NSString *)systemId ret: (QXmlInputSource*)ret
{
static qt_QString * _qstring_systemId = 0L;
static qt_QString * _qstring_publicId = 0L;
	return (BOOL) qt_QXmlEntityResolver_resolveEntity(qt_QXmlDefaultHandler_QXmlEntityResolver([self qt]), (qt_QString *) [publicId toQString: &_qstring_publicId], (qt_QString *) [systemId toQString: &_qstring_systemId], (qt_QXmlInputSource*) [ret qt]);
}

@end

@implementation QXmlDefaultHandler (QXmlErrorHandlerImplementation)

- (BOOL) warning: (QXmlParseException*)exception
{
	return (BOOL) qt_QXmlErrorHandler_warning(qt_QXmlDefaultHandler_QXmlErrorHandler([self qt]), (qt_QXmlParseException*) [exception qt]);
}

- (BOOL) error: (QXmlParseException*)exception
{
	return (BOOL) qt_QXmlErrorHandler_error(qt_QXmlDefaultHandler_QXmlErrorHandler([self qt]), (qt_QXmlParseException*) [exception qt]);
}

- (BOOL) fatalError: (QXmlParseException*)exception
{
	return (BOOL) qt_QXmlErrorHandler_fatalError(qt_QXmlDefaultHandler_QXmlErrorHandler([self qt]), (qt_QXmlParseException*) [exception qt]);
}

@end

@implementation QXmlDefaultHandler (QXmlLexicalHandlerImplementation)

- (BOOL) startDTD: (NSString *)name publicId: (NSString *)publicId systemId: (NSString *)systemId
{
static qt_QString * _qstring_systemId = 0L;
static qt_QString * _qstring_publicId = 0L;
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlLexicalHandler_startDTD(qt_QXmlDefaultHandler_QXmlLexicalHandler([self qt]), (qt_QString *) [name toQString: &_qstring_name], (qt_QString *) [publicId toQString: &_qstring_publicId], (qt_QString *) [systemId toQString: &_qstring_systemId]);
}

- (BOOL) endDTD
{
	return (BOOL) qt_QXmlLexicalHandler_endDTD(qt_QXmlDefaultHandler_QXmlLexicalHandler([self qt]));
}

- (BOOL) startEntity: (NSString *)name
{
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlDefaultHandler_startEntity((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [name toQString: &_qstring_name]);
}

- (BOOL) endEntity: (NSString *)name
{
static qt_QString * _qstring_name = 0L;
	return (BOOL) qt_QXmlDefaultHandler_endEntity((qt_QXmlDefaultHandler *)[self qt], (qt_QString *) [name toQString: &_qstring_name]);
}

- (BOOL) startCDATA
{
	return (BOOL) qt_QXmlLexicalHandler_startCDATA(qt_QXmlDefaultHandler_QXmlLexicalHandler([self qt]));
}

- (BOOL) endCDATA
{
	return (BOOL) qt_QXmlLexicalHandler_endCDATA(qt_QXmlDefaultHandler_QXmlLexicalHandler([self qt]));
}

- (BOOL) comment: (NSString *)ch
{
static qt_QString * _qstring_ch = 0L;
	return (BOOL) qt_QXmlLexicalHandler_comment(qt_QXmlDefaultHandler_QXmlLexicalHandler([self qt]), (qt_QString *) [ch toQString: &_qstring_ch]);
}

@end
