Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

qlabinifile.h

00001 /*
00002 * Linux Advanced Business Enterprise Management System
00003 *
00004 *
00005 * File name....... : qlabinifile.h
00006 * File version.... : 1.2.8
00007 * Revision Date... : Mon Feb 09 2004
00008 *
00009 * File Description : Generic INI file manager
00010 *
00011 * Author.......... : DJ Anubis
00012 * Copyright....... : (C) 2001-2004 by DJ Anubis
00013 * Email .......... : labproject@free.fr
00014 *
00015 * License :
00016 *   Please read the license file in doc directory.
00017 *   1. Lab Public License.
00018 *      You should have received a copy of the Lab Public License with this package.
00019 *      If this is not the case, you can read it or download it at:
00020 *      http://labproject.free.fr
00021 *   2. Q Public License.
00022 *      Conformant to Trolltech QPL license.
00023 *   3. GNU General Public License.
00024 *      Reserved for free projects.
00025 *   4. Commercial license.
00026 *      Recommanded if your code is not distributed under one of the 3 models above.
00027 *
00028 *   Read the license FAQ in doc directory.
00029 *
00030 * Comments:
00031 * Documentation has been revamped.
00032 */
00033 
00034 #ifndef QLABINIFILE_H
00035 #define QLABINIFILE_H
00036 
00037 
00038 #include <qobject.h>
00039 #include <qmap.h>
00040 
00041 class QVariant ;
00042 class QStringList ;
00043 
00044 
00045 class Q_EXPORT QlabIniFile : public QObject
00046 {
00047         Q_OBJECT
00048 
00049         Q_ENUMS( FileScope )
00050         Q_ENUMS( AccessModes )
00051 
00052         Q_PROPERTY( FileScope scope READ scope WRITE setScope
00053                                 DESIGNABLE true SCRIPTABLE true STORED true )
00054         Q_PROPERTY( AccessModes accessMode READ accessMode WRITE setAccessMode
00055                                 DESIGNABLE true SCRIPTABLE true STORED true )
00056 
00057 public :
00058         enum FileScope { System, Global, Module, Local, Private } ;
00059         enum AccessModes { Create, ReadOnly, ReadWrite, Append, Override } ;
00060 
00061         QlabIniFile( QObject * parent = 0, char * name = 0 ) ;
00062         ~QlabIniFile() ;
00063 
00064         uint groupCount() ;
00065         QStringList groups() ;
00066         bool groupExists( const QString & groupName ) ;
00067 
00068 public slots :
00069         FileScope scope() const ;
00070         void setScope( const FileScope scope ) ;
00071 
00072         AccessModes accessMode() const ;
00073         void setAccessMode( const AccessModes mode ) ;
00074 
00075         QVariant readVar( const QString & section, const QString & varName ) ;
00076         void setVar( const QString & section, const QString & varName, const QVariant & varValue ) ;
00077         QMap<QString, QVariant> readGroup( const QString & groupName ) ;
00078         bool removeGroup( const QString & groupName ) ;
00079         bool varExists( const QString & groupName, const QString & varName ) ;
00080         QStringList readList( const QString & groupName, const QString & varName, const QString & separator = ";" ) ;
00081 
00082 private :
00083         QSqlCursor * iniFile ;
00084         QString newFilter ;
00085         FileScope iniScope ;
00086         AccessModes iniMode ;
00087 
00088 } ;
00089 
00090 
00091 #endif // QLABINIFILE_H

 

L.A.B. Project © 2001-2004 LAB Project & DJ Anubis