Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsettings.cpp File Reference

(b57a9a3cd9c95ab6549ea672715245210720c8da)

#include <qdebug.h>
#include "qplatformdefs.h"
#include "qsettings.h"
#include "qsettings_p.h"
#include "qcache.h"
#include "qfile.h"
#include "qdir.h"
#include "qfileinfo.h"
#include "qmutex.h"
#include "private/qlocking_p.h"
#include "private/qtools_p.h"
#include "qlibraryinfo.h"
#include "qtemporaryfile.h"
#include "qstandardpaths.h"
#include <qdatastream.h>
#include "private/qstringconverter_p.h"
#include "qsize.h"
#include "qpoint.h"
#include "qrect.h"
#include "qcoreapplication.h"
#include "qsavefile.h"
#include "qlockfile.h"
#include <algorithm>
#include <stdlib.h>
#include "moc_qsettings.cpp"
+ Include dependency graph for qsettings.cpp:

Go to the source code of this file.

Classes

struct  QConfFileCustomFormat
 
class  QSettingsIniKey
 
struct  QSettingsIniSection
 

Namespaces

namespace  SettingsImpl
 

Macros

#define FLUSH_CURRENT_SECTION()
 

Typedefs

typedef QHash< QString, QConfFile * > ConfFileHash
 
typedef QCache< QString, QConfFileConfFileCache
 
typedef QHash< int, Path > PathHash
 
typedef QList< QConfFileCustomFormatCustomFormatVector
 
typedef QMap< QSettingsIniKey, QVariantIniKeyMap
 
typedef QMap< QString, QSettingsIniSectionIniMap
 

Enumerations

enum  { SettingsImpl::Space = 0x1 , SettingsImpl::Special = 0x2 }
 

Functions

 Q_DECLARE_TYPEINFO (QConfFileCustomFormat, Q_RELOCATABLE_TYPE)
 
static void iniChopTrailingSpaces (QString &str, qsizetype limit)
 
static int pathHashKey (QSettings::Format format, QSettings::Scope scope)
 
static QString make_user_path_without_qstandard_paths ()
 
static QString make_user_path ()
 
static std::unique_lock< QBasicMutexinitDefaultPaths (std::unique_lock< QBasicMutex > locker)
 
static Path getPath (QSettings::Format format, QSettings::Scope scope)
 
 Q_DECLARE_TYPEINFO (QSettingsIniKey, Q_RELOCATABLE_TYPE)
 
static bool operator< (const QSettingsIniKey &k1, const QSettingsIniKey &k2)
 
 Q_DECLARE_TYPEINFO (QSettingsIniSection, Q_RELOCATABLE_TYPE)
 

Variables

static Q_CONSTINIT QBasicMutex settingsGlobalMutex
 
static Q_CONSTINIT QSettings::Format globalDefaultFormat = QSettings::NativeFormat
 
static constexpr QChar sep = u'/'
 
static const char SettingsImpl::charTraits [256]
 

Macro Definition Documentation

◆ FLUSH_CURRENT_SECTION

#define FLUSH_CURRENT_SECTION ( )
Value:
{ \
QByteArray &sectionData = (*unparsedIniSections)[QSettingsKey(currentSection, \
sectionPosition)]; \
if (!sectionData.isEmpty()) \
sectionData.append('\n'); \
sectionData += data.first(lineStart).sliced(currentSectionStart); \
sectionPosition = ++position; \
}
\inmodule QtCore
Definition qbytearray.h:57
QByteArray sliced(qsizetype pos) const &
Definition qbytearray.h:200
QByteArray & append(char c)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QByteArray first(qsizetype n) const &
Definition qbytearray.h:196
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static const Qt::CaseSensitivity IniCaseSensitivity
Definition qsettings_p.h:42

Typedef Documentation

◆ ConfFileCache

Definition at line 81 of file qsettings.cpp.

◆ ConfFileHash

Definition at line 80 of file qsettings.cpp.

◆ CustomFormatVector

Definition at line 94 of file qsettings.cpp.

◆ IniKeyMap

Definition at line 1763 of file qsettings.cpp.

◆ IniMap

Definition at line 1775 of file qsettings.cpp.

◆ PathHash

typedef QHash<int, Path> PathHash

Definition at line 93 of file qsettings.cpp.

Function Documentation

◆ getPath()

static Path getPath ( QSettings::Format format,
QSettings::Scope scope )
static

Definition at line 1042 of file qsettings.cpp.

References QSettings::IniFormat, initDefaultPaths(), QSettings::NativeFormat, pathHashKey(), Q_ASSERT, QSettingsPrivate::scope, and settingsGlobalMutex.

Referenced by QConfFileSettingsPrivate::QConfFileSettingsPrivate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ iniChopTrailingSpaces()

static void iniChopTrailingSpaces ( QString & str,
qsizetype limit )
inlinestatic

Definition at line 668 of file qsettings.cpp.

References QString::at(), ch, QString::size(), str, and QString::truncate().

Referenced by QSettingsPrivate::iniUnescapedStringList().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initDefaultPaths()

static std::unique_lock< QBasicMutex > initDefaultPaths ( std::unique_lock< QBasicMutex > locker)
static

Definition at line 1000 of file qsettings.cpp.

References QSettings::IniFormat, make_user_path(), QSettings::NativeFormat, QLibraryInfo::path(), pathHashKey(), QDir::separator(), QLibraryInfo::SettingsPath, QSettings::SystemScope, and QSettings::UserScope.

Referenced by getPath(), and QSettings::setPath().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_user_path()

static QString make_user_path ( )
static

Definition at line 976 of file qsettings.cpp.

References QStandardPaths::GenericConfigLocation, make_user_path_without_qstandard_paths(), ret, sep, and QStandardPaths::writableLocation().

Referenced by initDefaultPaths().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_user_path_without_qstandard_paths()

static QString make_user_path_without_qstandard_paths ( )
static

Definition at line 963 of file qsettings.cpp.

References QFile::decodeName(), QDir::homePath(), QByteArray::isEmpty(), qgetenv(), sep, and QByteArray::startsWith().

Referenced by make_user_path().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<()

static bool operator< ( const QSettingsIniKey & k1,
const QSettingsIniKey & k2 )
static

Definition at line 1756 of file qsettings.cpp.

References k1.

Referenced by QT6_ONLY().

+ Here is the caller graph for this function:

◆ pathHashKey()

static int pathHashKey ( QSettings::Format format,
QSettings::Scope scope )
inlinestatic

Definition at line 954 of file qsettings.cpp.

References QSettingsPrivate::scope, and QSettings::SystemScope.

Referenced by getPath(), initDefaultPaths(), and QSettings::setPath().

+ Here is the caller graph for this function:

◆ Q_DECLARE_TYPEINFO() [1/3]

Q_DECLARE_TYPEINFO ( QConfFileCustomFormat ,
Q_RELOCATABLE_TYPE  )

◆ Q_DECLARE_TYPEINFO() [2/3]

Q_DECLARE_TYPEINFO ( QSettingsIniKey ,
Q_RELOCATABLE_TYPE  )

◆ Q_DECLARE_TYPEINFO() [3/3]

Q_DECLARE_TYPEINFO ( QSettingsIniSection ,
Q_RELOCATABLE_TYPE  )

Variable Documentation

◆ globalDefaultFormat

Q_CONSTINIT QSettings::Format globalDefaultFormat = QSettings::NativeFormat
static

Definition at line 103 of file qsettings.cpp.

Referenced by QSettings::defaultFormat(), and QSettings::setDefaultFormat().

◆ sep

◆ settingsGlobalMutex