12#include "multivalidator_p.h"
19MultiValidator::MultiValidator(
const std::vector<std::shared_ptr<QValidator>> &validators)
21 , m_validators{validators}
26std::shared_ptr<QValidator> Kleo::MultiValidator::create(
const std::vector<std::shared_ptr<QValidator>> &validators)
28 Q_ASSERT(std::all_of(std::begin(validators), std::end(validators), [](
const auto &v) {
29 return v && !v->parent();
32 return std::shared_ptr<MultiValidator>{
new MultiValidator{validators}};
35MultiValidator::~MultiValidator() =
default;
37void MultiValidator::fixup(
QString &str)
const
39 std::for_each(std::cbegin(m_validators), std::cend(m_validators), [&str](
const auto &val) {
46 std::vector<State> states;
47 states.reserve(m_validators.size());
48 std::transform(std::cbegin(m_validators), std::cend(m_validators), std::back_inserter(states), [&str, &pos](
const auto &val) {
49 return val->validate(str, pos);
52 if (std::any_of(std::cbegin(states), std::cend(states), [](
State state) {
53 return state == Invalid;
58 if (std::all_of(std::cbegin(states), std::cend(states), [](
State state) {
59 return state == Acceptable;
67#include "moc_multivalidator_p.cpp"
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:00:53 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.