Update CI version
[carla.git] / source / frontend / utils / qsafesettings.hpp
blob025218289afdd6ba00560a802e045ff2a759c223
1 /*
2 * Carla plugin host
3 * Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #pragma once
20 #ifdef __clang__
21 # pragma clang diagnostic push
22 # pragma clang diagnostic ignored "-Wdeprecated-copy-with-user-provided-copy"
23 # pragma clang diagnostic ignored "-Wdeprecated-register"
24 #elif defined(__GNUC__) && __GNUC__ >= 8
25 # pragma GCC diagnostic push
26 # pragma GCC diagnostic ignored "-Wclass-memaccess"
27 # pragma GCC diagnostic ignored "-Wdeprecated-copy"
28 #endif
30 #include <QtCore/QSettings>
32 #ifdef __clang__
33 # pragma clang diagnostic pop
34 #elif defined(__GNUC__) && __GNUC__ >= 8
35 # pragma GCC diagnostic pop
36 #endif
38 #include "CarlaDefines.h"
40 //---------------------------------------------------------------------------------------------------------------------
41 // Safer QSettings class, which does not throw if type mismatches
43 class QSafeSettings : public QSettings
45 public:
46 inline QSafeSettings()
47 : QSettings() {}
49 inline QSafeSettings(const QString& organization, const QString& application)
50 : QSettings(organization, application) {}
52 bool valueBool(const QString& key, bool defaultValue) const;
53 Qt::CheckState valueCheckState(const QString& key, Qt::CheckState defaultValue) const;
54 int valueIntPositive(const QString& key, int defaultValue) const;
55 uint valueUInt(const QString& key, uint defaultValue) const;
56 double valueDouble(const QString& key, double defaultValue) const;
57 QString valueString(const QString& key, const QString& defaultValue) const;
58 QByteArray valueByteArray(const QString& key, QByteArray defaultValue = {}) const;
59 QStringList valueStringList(const QString& key, QStringList defaultValue = {}) const;
62 //---------------------------------------------------------------------------------------------------------------------