File indexing completed on 2024-04-28 09:36:45

0001 /*
0002     This file is part of KCachegrind.
0003 
0004     SPDX-FileCopyrightText: 2008-2016 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
0005 
0006     SPDX-License-Identifier: GPL-2.0-only
0007 */
0008 
0009 #include "config.h"
0010 
0011 #include <QStringList>
0012 #include <QList>
0013 
0014 // helper functions
0015 
0016 QList<int> toIntList(QStringList l)
0017 {
0018     QList<int> iList;
0019 
0020     foreach(const QString& s, l)
0021         iList << s.toInt();
0022 
0023     return iList;
0024 }
0025 
0026 QStringList toStringList(QList<int> l)
0027 {
0028     QStringList sList;
0029 
0030     foreach(int i, l)
0031         sList << QString::number(i);
0032 
0033     return sList;
0034 }
0035 
0036 
0037 //
0038 // ConfigGroup
0039 //
0040 
0041 ConfigGroup::ConfigGroup()
0042 {}
0043 
0044 ConfigGroup::~ConfigGroup()
0045 {}
0046 
0047 void ConfigGroup::setValue(const QString&, const QVariant&, const QVariant&)
0048 {}
0049 
0050 QVariant ConfigGroup::value(const QString&, const QVariant& def) const
0051 {
0052     return def;
0053 }
0054 
0055 
0056 //
0057 // ConfigStorage
0058 //
0059 
0060 ConfigStorage* ConfigStorage::_storage = nullptr;
0061 
0062 ConfigStorage::ConfigStorage()
0063 {
0064     _storage = nullptr;
0065 }
0066 
0067 ConfigStorage::~ConfigStorage()
0068 {}
0069 
0070 ConfigGroup* ConfigStorage::group(const QString& group,
0071                                   const QString& optSuffix)
0072 {
0073     Q_ASSERT(_storage != nullptr);
0074 
0075     return _storage->getGroup(group, optSuffix);
0076 }
0077 
0078 void ConfigStorage::setStorage(ConfigStorage* storage)
0079 {
0080     _storage = storage;
0081 }
0082 
0083 void ConfigStorage::cleanup()
0084 {
0085     delete _storage;
0086 }
0087 
0088 ConfigGroup* ConfigStorage::getGroup(const QString&, const QString&)
0089 {
0090     return new ConfigGroup();
0091 }