1 | /****************************************************************************
|
---|
2 | ** $Id: qsettings_p.h 8 2005-11-16 19:36:46Z dmik $
|
---|
3 | **
|
---|
4 | ** Definition of QSettings related classes
|
---|
5 | **
|
---|
6 | ** Created : 990124
|
---|
7 | **
|
---|
8 | ** Copyright (C) 1999-2002 Trolltech AS. All rights reserved.
|
---|
9 | **
|
---|
10 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
11 | **
|
---|
12 | ** This file may be distributed under the terms of the Q Public License
|
---|
13 | ** as defined by Trolltech AS of Norway and appearing in the file
|
---|
14 | ** LICENSE.QPL included in the packaging of this file.
|
---|
15 | **
|
---|
16 | ** This file may be distributed and/or modified under the terms of the
|
---|
17 | ** GNU General Public License version 2 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
19 | ** packaging of this file.
|
---|
20 | **
|
---|
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
22 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
23 | ** Agreement provided with the Software.
|
---|
24 | **
|
---|
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
27 | **
|
---|
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
29 | ** information about Qt Commercial License Agreements.
|
---|
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
32 | **
|
---|
33 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
34 | ** not clear to you.
|
---|
35 | **
|
---|
36 | **********************************************************************/
|
---|
37 |
|
---|
38 | #ifndef QSETTINGS_P_H
|
---|
39 | #define QSETTINGS_P_H
|
---|
40 |
|
---|
41 | //
|
---|
42 | // W A R N I N G
|
---|
43 | // -------------
|
---|
44 | //
|
---|
45 | // This file is not part of the Qt API. It exists for the convenience
|
---|
46 | // of QSettings. This header file may change from version to
|
---|
47 | // version without notice, or even be removed.
|
---|
48 | //
|
---|
49 | // We mean it.
|
---|
50 | //
|
---|
51 | //
|
---|
52 |
|
---|
53 | #ifndef QT_H
|
---|
54 | #include "qstringlist.h"
|
---|
55 | #include "qmap.h"
|
---|
56 | #include "qvaluestack.h"
|
---|
57 | #endif // QT_H
|
---|
58 |
|
---|
59 | #ifndef QT_NO_SETTINGS
|
---|
60 | class QSettingsSysPrivate;
|
---|
61 |
|
---|
62 | // QSettingsGroup is a map of key/value pairs
|
---|
63 | class QSettingsGroup : public QMap<QString,QString>
|
---|
64 | {
|
---|
65 | public:
|
---|
66 | QSettingsGroup();
|
---|
67 |
|
---|
68 | bool modified;
|
---|
69 | };
|
---|
70 |
|
---|
71 | // QSettingsHeading is a map of heading/group pairs
|
---|
72 | class QSettingsHeading : public QMap<QString,QSettingsGroup>
|
---|
73 | {
|
---|
74 | public:
|
---|
75 | QSettingsHeading::Iterator git;
|
---|
76 | void read(const QString &);
|
---|
77 | void parseLine(QTextStream &);
|
---|
78 | };
|
---|
79 |
|
---|
80 |
|
---|
81 | class QSettingsPrivate
|
---|
82 | {
|
---|
83 | public:
|
---|
84 | QSettingsPrivate( QSettings::Format format );
|
---|
85 | ~QSettingsPrivate();
|
---|
86 |
|
---|
87 | QSettingsGroup readGroup();
|
---|
88 | void removeGroup(const QString &);
|
---|
89 | void writeGroup(const QString &, const QString &);
|
---|
90 | QDateTime modificationTime();
|
---|
91 |
|
---|
92 | QStringList searchPaths;
|
---|
93 | QMap<QString,QSettingsHeading> headings;
|
---|
94 | QString group;
|
---|
95 | QString heading;
|
---|
96 |
|
---|
97 | /*### static data brings threading trouble
|
---|
98 | static QString *defProduct;
|
---|
99 | static QString *defDomain;
|
---|
100 | */
|
---|
101 | QValueStack<QString> groupStack;
|
---|
102 | QString groupPrefix;
|
---|
103 |
|
---|
104 | bool groupDirty :1;
|
---|
105 | bool modified :1;
|
---|
106 | bool globalScope :1;
|
---|
107 |
|
---|
108 | #if !defined(QWS) && (defined(Q_WS_WIN) || defined(Q_WS_PM) || defined(Q_OS_MAC))
|
---|
109 | // system dependent implementations to use the
|
---|
110 | // system specific setting database (ie. registry on Windows)
|
---|
111 |
|
---|
112 | QSettingsSysPrivate *sysd;
|
---|
113 | void sysInit();
|
---|
114 | void sysClear();
|
---|
115 |
|
---|
116 | #if !defined(Q_NO_BOOL_TYPE)
|
---|
117 | bool sysWriteEntry( const QString &, bool );
|
---|
118 | #endif
|
---|
119 | bool sysWriteEntry( const QString &, double );
|
---|
120 | bool sysWriteEntry( const QString &, int );
|
---|
121 | bool sysWriteEntry( const QString &, const QString & );
|
---|
122 | bool sysWriteEntry( const QString &, const QStringList & );
|
---|
123 | bool sysWriteEntry( const QString &, const QStringList &, const QChar& sep );
|
---|
124 |
|
---|
125 | QStringList sysEntryList(const QString &) const;
|
---|
126 | QStringList sysSubkeyList(const QString &) const;
|
---|
127 |
|
---|
128 | QStringList sysReadListEntry( const QString &, bool * = 0 ) const;
|
---|
129 | QStringList sysReadListEntry( const QString &, const QChar& sep, bool * = 0 ) const;
|
---|
130 | QString sysReadEntry( const QString &, const QString &def = QString::null, bool * = 0 ) const;
|
---|
131 | int sysReadNumEntry( const QString &, int def = 0, bool * = 0 ) const;
|
---|
132 | double sysReadDoubleEntry( const QString &, double def = 0, bool * = 0 ) const;
|
---|
133 | bool sysReadBoolEntry( const QString &, bool def = 0, bool * = 0 ) const;
|
---|
134 |
|
---|
135 | bool sysRemoveEntry( const QString & );
|
---|
136 |
|
---|
137 | bool sysSync();
|
---|
138 |
|
---|
139 | void sysInsertSearchPath( QSettings::System, const QString & );
|
---|
140 | void sysRemoveSearchPath( QSettings::System, const QString & );
|
---|
141 | #endif
|
---|
142 |
|
---|
143 | };
|
---|
144 | #endif //QT_NO_SETTINGS
|
---|
145 | #endif // QSETTINGS_P_H
|
---|