00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef QSETTINGS_H
00039 #define QSETTINGS_H
00040
00041 #ifndef QT_H
00042 #include "qdatetime.h"
00043 #include "qstringlist.h"
00044 #endif // QT_H
00045
00046 #ifndef QT_NO_SETTINGS
00047
00048 class QSettingsPrivate;
00049
00050
00051 class Q_EXPORT QSettings
00052 {
00053 public:
00054 enum Format {
00055 Native = 0,
00056 Ini
00057 };
00058 enum System {
00059 Unix = 0,
00060 Windows,
00061 Mac
00062 };
00063 enum Scope {
00064 User,
00065 Global
00066 };
00067
00068 QSettings();
00069 QSettings( Format format );
00070
00071 ~QSettings();
00072
00073 #if !defined(Q_NO_BOOL_TYPE)
00074 bool writeEntry( const QString &, bool );
00075 #endif
00076 bool writeEntry( const QString &, double );
00077 bool writeEntry( const QString &, int );
00078 bool writeEntry( const QString &, const char * );
00079 bool writeEntry( const QString &, const QString & );
00080 bool writeEntry( const QString &, const QStringList & );
00081 bool writeEntry( const QString &, const QStringList &, const QChar& sep );
00082
00083 QStringList entryList(const QString &) const;
00084 QStringList subkeyList(const QString &) const;
00085
00086
00087 QStringList readListEntry( const QString &, bool * = 0 );
00088 QStringList readListEntry( const QString &, const QChar& sep, bool * = 0 );
00089 QString readEntry( const QString &, const QString &def = QString::null, bool * = 0 );
00090 int readNumEntry( const QString &, int def = 0, bool * = 0 );
00091 double readDoubleEntry( const QString &, double def = 0, bool * = 0 );
00092 bool readBoolEntry( const QString &, bool def = FALSE, bool * = 0 );
00093
00094
00095 QStringList readListEntry( const QString &key, bool *ok = 0 ) const
00096 {
00097 QSettings *that = (QSettings*)this;
00098 return that->readListEntry( key, ok );
00099 }
00100 QStringList readListEntry( const QString &key, const QChar& sep, bool *ok = 0 ) const
00101 {
00102 QSettings *that = (QSettings*)this;
00103 return that->readListEntry( key, sep, ok );
00104 }
00105 QString readEntry( const QString &key, const QString &def = QString::null,
00106 bool *ok = 0 ) const
00107 {
00108 QSettings *that = (QSettings*)this;
00109 return that->readEntry( key, def, ok );
00110 }
00111 int readNumEntry( const QString &key, int def = 0, bool *ok = 0 ) const
00112 {
00113 QSettings *that = (QSettings*)this;
00114 return that->readNumEntry( key, def, ok );
00115 }
00116
00117 double readDoubleEntry( const QString &key, double def = 0, bool *ok = 0 ) const
00118 {
00119 QSettings *that = (QSettings*)this;
00120 return that->readDoubleEntry( key, def, ok );
00121 }
00122 bool readBoolEntry( const QString &key, bool def = FALSE, bool *ok = 0 ) const
00123 {
00124 QSettings *that = (QSettings*)this;
00125 return that->readBoolEntry( key, def, ok );
00126 }
00127
00128 bool removeEntry( const QString & );
00129
00130 void insertSearchPath( System, const QString & );
00131 void removeSearchPath( System, const QString & );
00132
00133 void setPath( const QString &domain, const QString &product, Scope = Global );
00134
00135 void beginGroup( const QString &group );
00136 void endGroup();
00137 void resetGroup();
00138 QString group() const;
00139
00140 bool sync();
00141
00142 private:
00143 QSettingsPrivate *d;
00144
00145 #if defined(Q_DISABLE_COPY)
00146 QSettings(const QSettings &);
00147 QSettings &operator=(const QSettings &);
00148 #endif
00149
00150 QDateTime lastModificationTime( const QString & );
00151
00152 friend class QApplication;
00153 };
00154
00155 #endif // QT_NO_SETTINGS
00156 #endif // QSETTINGS_H