SimpleWeatherService: Add forecast operator overrides (#2011)
Any screen that relies on DirtyValue to display up-to-date forecast data would require the struct to provide an operator override for comparison.
This commit is contained in:
@@ -158,3 +158,16 @@ bool SimpleWeatherService::CurrentWeather::operator==(const SimpleWeatherService
|
||||
this->maxTemperature == other.maxTemperature && this->minTemperature == other.maxTemperature &&
|
||||
std::strcmp(this->location.data(), other.location.data()) == 0;
|
||||
}
|
||||
|
||||
bool SimpleWeatherService::Forecast::Day::operator==(const SimpleWeatherService::Forecast::Day& other) const {
|
||||
return this->iconId == other.iconId && this->maxTemperature == other.maxTemperature && this->minTemperature == other.maxTemperature;
|
||||
}
|
||||
|
||||
bool SimpleWeatherService::Forecast::operator==(const SimpleWeatherService::Forecast& other) const {
|
||||
for (int i = 0; i < this->nbDays; i++) {
|
||||
if (this->days[i] != other.days[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return this->timestamp == other.timestamp && this->nbDays == other.nbDays;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user