config_8h-source.html

config.h

00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qt Designer.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 
00021 #ifndef CONFIG_H
00022 #define CONFIG_H
00023 
00024 #include <qdir.h>
00025 #include <qmap.h>
00026 #include <qstringlist.h>
00027 
00070 class Config
00071 {
00072 public:
00073     typedef QMap< QString, QString > ConfigGroup;
00074     
00075     Config( const QString &fn );
00076     ~Config();
00077     
00078     void setGroup( const QString &gname );
00079     void writeEntry( const QString &key, const QString &value );
00080     void writeEntry( const QString &key, int num );
00081     void writeEntry( const QString &key, double num );
00082     void writeEntry( const QString &key, bool b );
00083     void writeEntry( const QString &key, const QStringList &lst, const QChar &sep );
00084     
00085     QString readEntry( const QString &key, const QString &deflt = QString::null );
00086     int readNumEntry( const QString &key, int deflt = -1 );
00087                 double readNumEntry( const QString &key, double deflt = 0.0 );
00088     bool readBoolEntry( const QString &key, bool deflt = FALSE );
00089     QStringList readListEntry( const QString &key, const QChar &sep ); 
00090     
00091                 void removeGroup(const QString &gp);
00092                 void removeEntry(const QString &key);
00093 
00094     void clearGroup();
00095     
00096     bool write( const QString &fn = QString::null );
00097                 bool ok();
00098     
00099 protected:
00100     bool read();
00101     void parse( const QString &line );
00102     
00103     QMap< QString, ConfigGroup > groups;
00104     QMap< QString, ConfigGroup >::Iterator git;
00105     QString filename;
00106                 bool m_bOk;
00107                 bool m_bChanged;
00108 };
00109 
00110 #endif

Generated on Thu Nov 25 15:57:05 2004 for iARS(internetAudioRenderingSystem) by  doxygen 1.3.9.1