Fixed usage of std::optional value_or:
value = value.value_or(...)
This commit is contained in:
parent
c799c24658
commit
f46adac56d
@ -499,7 +499,7 @@ Configuration::getDailyTicketsForAllKeys() const {
|
||||
}
|
||||
|
||||
if (tickets.size() > 0) {
|
||||
value.value_or(tickets);
|
||||
value = value.value_or(tickets);
|
||||
}
|
||||
|
||||
return value;
|
||||
@ -510,18 +510,14 @@ Configuration::getDailyTicketsForKey(int key) const {
|
||||
QVector<ATBDailyTicket> tickets;
|
||||
std::optional<QVector<ATBDailyTicket>> value;
|
||||
|
||||
std::pair<
|
||||
std::multimap<int, ATBDailyTicket>::const_iterator,
|
||||
std::multimap<int, ATBDailyTicket>::const_iterator
|
||||
> p = this->DailyTicket.equal_range(key);
|
||||
tickets.clear();
|
||||
|
||||
for (std::multimap<int, ATBDailyTicket>::const_iterator it = p.first;
|
||||
it != p.second; ++it) {
|
||||
for (auto[it, rangeEnd] = this->DailyTicket.equal_range(key); it != rangeEnd; ++it) {
|
||||
tickets.append(it->second);
|
||||
}
|
||||
|
||||
if (tickets.size() > 0) {
|
||||
value.value_or(tickets);
|
||||
value = value.value_or(tickets);
|
||||
}
|
||||
|
||||
return value;
|
||||
@ -538,7 +534,7 @@ Configuration::getPaymentRateForAllKeys() const {
|
||||
}
|
||||
|
||||
if (paymentRates.size() > 0) {
|
||||
value.value_or(paymentRates);
|
||||
value = value.value_or(paymentRates);
|
||||
}
|
||||
|
||||
return value;
|
||||
@ -550,18 +546,14 @@ Configuration::getPaymentRateForKey(int key) const {
|
||||
QVector<ATBPaymentRate> paymentRate;
|
||||
std::optional<QVector<ATBPaymentRate>> value;
|
||||
|
||||
std::pair<
|
||||
std::multimap<int, ATBPaymentRate>::const_iterator,
|
||||
std::multimap<int, ATBPaymentRate>::const_iterator
|
||||
> p = this->PaymentRate.equal_range(key);
|
||||
paymentRate.clear();
|
||||
|
||||
for (std::multimap<int, ATBPaymentRate>::const_iterator it = p.first;
|
||||
it != p.second; ++it) {
|
||||
for (auto[it, rangeEnd] = this->PaymentRate.equal_range(key); it != rangeEnd; ++it) {
|
||||
paymentRate.append(it->second);
|
||||
}
|
||||
|
||||
if (paymentRate.size() > 0) {
|
||||
value.value_or(paymentRate);
|
||||
value = value.value_or(paymentRate);
|
||||
}
|
||||
|
||||
return value;
|
||||
@ -590,7 +582,7 @@ Configuration::getWeekDayWorkTime(QTime const &time, Qt::DayOfWeek dayOfWeek) {
|
||||
ATBWeekDaysWorktime const &wt = it->second;
|
||||
if (QTime::fromString(wt.pwd_time_from.c_str(), Qt::ISODate) >= time
|
||||
&& QTime::fromString(wt.pwd_time_to.c_str(), Qt::ISODate) < time) {
|
||||
value.value_or(wt);
|
||||
value = value.value_or(wt);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user