Use std::array over QVector/QList for static const arrays

parent 6e893f6c
......@@ -247,7 +247,7 @@ void ProjectChangesModel::reloadAll()
void ProjectChangesModel::jobUnregistered(KJob* job)
{
static const QList<VcsJob::JobType> readOnly = QList<VcsJob::JobType>{
static const std::array<VcsJob::JobType, 7> readOnly = {
KDevelop::VcsJob::Add,
KDevelop::VcsJob::Remove,
KDevelop::VcsJob::Pull,
......@@ -258,7 +258,7 @@ void ProjectChangesModel::jobUnregistered(KJob* job)
};
auto* vcsjob = qobject_cast<VcsJob*>(job);
if(vcsjob && readOnly.contains(vcsjob->type())) {
if (vcsjob && std::find(readOnly.begin(), readOnly.end(), vcsjob->type()) != readOnly.end()) {
reloadAll();
}
}
......
......@@ -29,11 +29,22 @@
#include <QProcess>
#include <KLocalizedString>
static const QVector<QString> args = {
QLatin1String("--help-command"), QLatin1String("--help-variable"), QLatin1String("--help-module"), QLatin1String("--help-property"), QLatin1String("--help-policy"), QString()
#include <array>
static const std::array<QString, 6> args = {
QStringLiteral("--help-command"),
QStringLiteral("--help-variable"),
QStringLiteral("--help-module"),
QStringLiteral("--help-property"),
QStringLiteral("--help-policy"),
QString(),
};
static QString modules [] = {
i18n("Commands"), i18n("Variables"), i18n("Modules"), i18n("Properties"), i18n("Policies")
static const std::array<QString, 5> modules = {
i18n("Commands"),
i18n("Variables"),
i18n("Modules"),
i18n("Properties"),
i18n("Policies"),
};
CMakeCommandsContents::CMakeCommandsContents(QObject* parent)
......
......@@ -1271,8 +1271,8 @@ void GitPlugin::parseGitVersionOutput(DVcsJob* job)
{
const auto output = job->output().trimmed();
auto versionString = output.midRef(output.lastIndexOf(QLatin1Char(' '))).split(QLatin1Char('.'));
static const QList<int> minimumVersion = QList<int>{1, 7};
qCDebug(PLUGIN_GIT) << "checking git version" << versionString << "against" << minimumVersion;
static const std::array<int, 2> minimumVersion = {1, 7};
qCDebug(PLUGIN_GIT) << "checking git version" << versionString << "against" << minimumVersion[0] << minimumVersion[1];
m_oldVersion = false;
if (versionString.size() < minimumVersion.size()) {
m_oldVersion = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment