1 | // Copyright (C) 2017 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QHSTSSTORE_P_H |
5 | #define QHSTSSTORE_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of the Network Access API. This header file may change from |
13 | // version to version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtNetwork/private/qtnetworkglobal_p.h> |
19 | |
20 | QT_REQUIRE_CONFIG(settings); |
21 | |
22 | #include <QtCore/qlist.h> |
23 | #include <QtCore/qsettings.h> |
24 | |
25 | QT_BEGIN_NAMESPACE |
26 | |
27 | class QHstsPolicy; |
28 | class QByteArray; |
29 | class QString; |
30 | |
31 | class Q_AUTOTEST_EXPORT QHstsStore |
32 | { |
33 | public: |
34 | explicit QHstsStore(const QString &dirName); |
35 | ~QHstsStore(); |
36 | |
37 | QList<QHstsPolicy> readPolicies(); |
38 | void addToObserved(const QHstsPolicy &policy); |
39 | void synchronize(); |
40 | |
41 | bool isWritable() const; |
42 | |
43 | static QString absoluteFilePath(const QString &dirName); |
44 | private: |
45 | void beginHstsGroups(); |
46 | bool serializePolicy(const QString &key, const QHstsPolicy &policy); |
47 | bool deserializePolicy(const QString &key, QHstsPolicy &policy); |
48 | void evictPolicy(const QString &key); |
49 | void endHstsGroups(); |
50 | |
51 | QList<QHstsPolicy> observedPolicies; |
52 | QSettings store; |
53 | |
54 | Q_DISABLE_COPY_MOVE(QHstsStore) |
55 | }; |
56 | |
57 | QT_END_NAMESPACE |
58 | |
59 | #endif // QHSTSSTORE_P_H |
60 | |