Blokkal
an Extendable KDE Blogging Client
SourceForge.net Logo

blokkalconfigbase.h

00001 /***************************************************************************
00002  *   Copyright (C) 2006 - 2008 by Martin Mueller                           *
00003  *   orvio@orvio.de                                                        *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef BLOKKALBLOKKALCONFIGBASE_H
00021 #define BLOKKALBLOKKALCONFIGBASE_H
00022 
00023 #include "blokkal_export.h"
00024 #include <QtCore/QString>
00025 
00026 class QDomElement;
00027 
00028 namespace Blokkal {
00029 
00036 class BLOKKAL_EXPORT ConfigBase
00037 {
00038 public:
00042         virtual ~ConfigBase( void );
00043 
00048         void remove( void );
00049         
00056         void writeEntry( const QString & name, const QString & value );
00057 
00063         void writeEntry( const QString & name, bool value );
00064 
00072         void writeComplex( const QString & name, const QString & value );
00073 
00079         QString readComplex( const QString & name, const QString & defaultValue = QString::null );
00080         
00088         QString readEntry( const QString & name, const QString & defaultValue = QString::null ) const;
00089 
00097         bool readBoolEntry( const QString & name, bool defaultValue = FALSE ) const;
00098 
00104         void writeEntry( const QString & name, int value );
00105 
00112         int readIntEntry( const QString & name, int defaultValue = 0 ) const;
00113 
00119         void writeEntry( const QString & name, unsigned int value );
00120 
00127         unsigned int readUIntEntry( const QString & name, unsigned int defaultValue = 0 ) const;
00128         
00134         void writeEntry( const QString & name, unsigned long value );
00135 
00142         unsigned long readULongEntry( const QString & name, unsigned long defaultValue = FALSE ) const;
00143         
00144 protected:
00149         ConfigBase( void );
00150         
00155         ConfigBase( QDomElement configNode );
00156 
00160         void setNode( QDomElement configNode );
00161         
00166         QDomElement node( void ) const;
00167 
00174         QDomElement findPropertyNode( const QString & name ) const;
00175 
00181         QDomElement createPropertyNode( const QString & name );
00182 
00189         QDomElement findComplexNode( const QString & name ) const;
00190 
00196         QDomElement createComplexNode( const QString & name );
00197 
00198 private:
00199         class Private;
00200         Private * d;
00201 };
00202 
00203 }
00204 
00205 #endif