kpilot/lib

idmapperxml.h

00001 #ifndef _KPILOT_IDMAPPERXML_H
00002 #define _KPILOT_IDMAPPERXML_H
00003 /*
00004 ** Copyright (C) 2006 Bertjan Broeksema <bbroeksema@bluebottle.com>
00005 */
00006 
00007 /*
00008 ** This program is free software; you can redistribute it and/or modify
00009 ** it under the terms of the GNU Lesser General Public License as published by
00010 ** the Free Software Foundation; either version 2.1 of the License, or
00011 ** (at your option) any later version.
00012 **
00013 ** This program is distributed in the hope that it will be useful,
00014 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00016 ** GNU Lesser General Public License for more details.
00017 **
00018 ** You should have received a copy of the GNU Lesser General Public License
00019 ** along with this program in a file called COPYING; if not, write to
00020 ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00021 ** MA 02110-1301, USA.
00022 */
00023 
00024 /*
00025 ** Bug reports and questions can be sent to kde-pim@kde.org
00026 */
00027 
00028 #include "idmapping.h"
00029 
00030 #include <tqxml.h>
00031 #include <tqdom.h>
00032 #include <tqstring.h>
00033 #include <tqptrcollection.h>
00034 
00035 class IDMapperXml : public QXmlDefaultHandler
00036 {
00037 public:
00038     IDMapperXml( const TQString &file );
00039     
00040     ~IDMapperXml();
00041     
00045     bool open();
00046     
00052     void save();
00053     
00057     void addMapping( const IDMapping &mapping );
00058     
00062     TQValueList<IDMapping> &mappings();
00063      
00067     bool startElement( const TQString &namespaceURI, const TQString &localName
00068         , const TQString &qName, const TQXmlAttributes &attribs );
00069         
00073     bool endElement( const TQString &namespaceURI, const TQString &localName
00074         , const TQString &qName );
00075 
00076 private:
00077     TQFile fFile;
00078     TQDomDocument doc;
00079     TQDomElement root;
00080     IDMapping *fCurrentMapping;
00081     TQValueList<IDMapping> fMappings;
00082 };
00083 
00084 #endif