summaryrefslogtreecommitdiffhomepage
path: root/options
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-06-26 22:25:22 +0200
committerStanislaw Halik <sthalik@misaki.pl>2018-06-26 23:05:21 +0200
commitd65936200a2756e6619a109fa6fa673b91df802e (patch)
tree80b6b6fc7ba9023cbe47290b8ae1bc5468a19bb1 /options
parent4046773c41ee3c0f65840828ab983cfd13451c85 (diff)
modernize C++ syntax
No visible changes (hopefully).
Diffstat (limited to 'options')
-rw-r--r--options/connector.cpp28
-rw-r--r--options/group.cpp3
-rw-r--r--options/group.hpp1
3 files changed, 13 insertions, 19 deletions
diff --git a/options/connector.cpp b/options/connector.cpp
index 6031d9ed..2d039ccf 100644
--- a/options/connector.cpp
+++ b/options/connector.cpp
@@ -27,7 +27,7 @@ bool connector::is_equal(const QString& name, const QVariant& val1, const QVaria
auto it = connected_values.find(name);
- if (it != connected_values.cend() && std::get<0>((*it).second).size() != 0)
+ if (it != connected_values.cend() && !std::get<0>((*it).second).empty())
return std::get<1>((*it).second)(val1, val2);
else
return generic_is_equal(val1, val2);
@@ -37,29 +37,23 @@ bool connector::on_value_destructed_impl(const QString& name, value_type val)
{
QMutexLocker l(get_mtx());
- const bool ok = progn(
- auto it = connected_values.find(name);
+ auto it = connected_values.find(name);
- if (it != connected_values.end())
+ if (it != connected_values.end())
+ {
+ std::vector<value_type>& values = std::get<0>((*it).second);
+ for (auto it = values.begin(); it != values.end(); it++)
{
- std::vector<value_type>& values = std::get<0>((*it).second);
- for (auto it = values.begin(); it != values.end(); it++)
+ if (*it == val)
{
- if (*it == val)
- {
- values.erase(it);
- return true;
- }
+ values.erase(it);
+ return true;
}
}
- return false;
- );
-
- return ok;
+ }
+ return false;
}
-
-
void connector::on_value_destructed(const QString& name, value_type val)
{
if (!name.size())
diff --git a/options/group.cpp b/options/group.cpp
index 77773744..788dd5de 100644
--- a/options/group.cpp
+++ b/options/group.cpp
@@ -69,8 +69,7 @@ bool group::contains(const QString &s) const
bool group::is_portable_installation()
{
#if defined _WIN32
- if (QFile::exists(OPENTRACK_BASE_PATH + "/portable.txt"))
- return true;
+ return QFile::exists(OPENTRACK_BASE_PATH + "/portable.txt");
#endif
return false;
}
diff --git a/options/group.hpp b/options/group.hpp
index c3fce892..0717e2c9 100644
--- a/options/group.hpp
+++ b/options/group.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include "compat/macros.hpp"
#include "export.hpp"
// included here to propagate into callers of options::group