Sophie

Sophie

distrib > Mandriva > 2011.0 > i586 > media > contrib-release-debug > by-pkgid > 0b102c0e3d0c39a3855aaf976204ce5c > files > 59

associationsubscribersmanager-debug-3.2.0-2mdv2011.0.i586.rpm


//  Copyright (C) 2009 by Arnaud Dupuis
//  a.dupuis@infinityperl.org
//  http://www.infinityperl.org
// 
//  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 3 of the License, or
//  (at your option) any later version.
// 
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the
//  Free Software Foundation, Inc.,
//  59 Temple Place - Suite 330, Boston, MA  02111-1307, USA

#ifndef CUSTOMFIELDSXMLHANDLER_H
#define CUSTOMFIELDSXMLHANDLER_H

#include <QXmlDefaultHandler>
#include <QString>
#include <QStringList>
#include <QMap>
#include "customfielditem.h"

/*! \class CustomFieldsXmlHandler
* \brief the XML handler for the custom fields description files.
*
* This class is the XML handler for the Association Subscribers Manager's custom fields description files.
* 
*/
class CustomFieldsXmlHandler : public QXmlDefaultHandler
{
	public:
		/*!
		Constructs a new handler.
		*/
		CustomFieldsXmlHandler();
		/*!
		The reader calls this function when it has parsed a start element tag.

		There is a corresponding endElement() call when the corresponding end element tag is read. The startElement() and endElement() calls are always nested correctly. Empty element tags (e.g. <x/>) cause a startElement() call to be immediately followed by an endElement() call.

		The attribute list provided only contains attributes with explicit values. The attribute list contains attributes used for namespace declaration (i.e. attributes starting with xmlns) only if the namespace-prefix property of the reader is true.

		The argument namespaceURI is the namespace URI, or an empty string if the element has no namespace URI or if no namespace processing is done. localName is the local name (without prefix), or an empty string if no namespace processing is done, qName is the qualified name (with prefix) and atts are the attributes attached to the element. If there are no attributes, atts is an empty attributes object.

		If this function returns false the reader stops parsing and reports an error. The reader uses the function errorString() to get the error message.
		*/
		bool startElement( const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &attributes );
		/*!
		A reader must use this function to report a non-recoverable error. Details of the error are stored in exception.

		If this function returns true the reader might try to go on parsing and reporting further errors, but no regular parsing events are reported.
		*/
		bool fatalError(const QXmlParseException &exception);
		/*!
		Returns a QMap filled with data parsed from the XML file.
		*/
		QList<CustomFieldItem *> getData();
	private:
		QString currentText;
		QList<CustomFieldItem *> m_itemList;
};

#endif