refactoring: rename mtx::includes to mtx::included_in

This commit is contained in:
Moritz Bunkus 2015-06-01 22:01:52 +02:00
parent c826183ed5
commit b9f783d127
3 changed files with 15 additions and 15 deletions

View File

@ -18,7 +18,7 @@ namespace mtx {
template<typename T>
bool
includes(T const &needle,
included_in(T const &needle,
T const &val) {
return needle == val;
}
@ -26,10 +26,10 @@ includes(T const &needle,
template<typename T,
typename... Trest>
bool
includes(T const &needle,
T const &val,
Trest... rest) {
return (needle == val) || includes(needle, rest...);
included_in(T const &needle,
T const &val,
Trest... rest) {
return (needle == val) || included_in(needle, rest...);
}
template<typename T>

View File

@ -113,7 +113,7 @@ Tab::setInitialDisplay(Jobs::Job const &job) {
m_fullOutput = job.m_fullOutput;
ui->abortButton->setEnabled(Jobs::Job::Running == job.m_status);
ui->saveOutputButton->setEnabled(!mtx::includes(job.m_status, Jobs::Job::PendingManual, Jobs::Job::PendingAuto, Jobs::Job::Disabled));
ui->saveOutputButton->setEnabled(!mtx::included_in(job.m_status, Jobs::Job::PendingManual, Jobs::Job::PendingAuto, Jobs::Job::Disabled));
ui->acknowledgeWarningsAndErrorsButton->setEnabled(job.numUnacknowledgedWarnings() || job.numUnacknowledgedErrors());
}

View File

@ -6,16 +6,16 @@
namespace {
TEST(ListUtils, includes) {
EXPECT_TRUE(mtx::includes(42, 42));
EXPECT_TRUE(mtx::includes(42, 54, 42, 48));
EXPECT_TRUE(mtx::includes(42, 42, 54, 48));
EXPECT_TRUE(mtx::includes(42, 54, 48, 42));
TEST(ListUtils, included_in) {
EXPECT_TRUE(mtx::included_in(42, 42));
EXPECT_TRUE(mtx::included_in(42, 54, 42, 48));
EXPECT_TRUE(mtx::included_in(42, 42, 54, 48));
EXPECT_TRUE(mtx::included_in(42, 54, 48, 42));
EXPECT_FALSE(mtx::includes(23, 42));
EXPECT_FALSE(mtx::includes(23, 54, 42, 48));
EXPECT_FALSE(mtx::includes(23, 42, 54, 48));
EXPECT_FALSE(mtx::includes(23, 54, 48, 42));
EXPECT_FALSE(mtx::included_in(23, 42));
EXPECT_FALSE(mtx::included_in(23, 54, 42, 48));
EXPECT_FALSE(mtx::included_in(23, 42, 54, 48));
EXPECT_FALSE(mtx::included_in(23, 54, 48, 42));
}
TEST(ListUtils, any_of) {