// Find all methods on this hierarchy that match this // method's erased (name, signature) bool visit() { PseudoScope* scope = PseudoScope::cast(current_data()); InstanceKlass* iklass = current_class(); Method* m = iklass->find_method(_method_name, _method_signature); // private interface methods are not candidates for default methods // invokespecial to private interface methods doesn't use default method logic // The overpasses are your supertypes' errors, we do not include them // future: take access controls into account for superclass methods if (m != NULL && !m->is_static() && !m->is_overpass() && (!iklass->is_interface() || m->is_public())) { if (_family == NULL) { _family = new StatefulMethodFamily(); } if (iklass->is_interface()) { StateRestorer* restorer = _family->record_method_and_dq_further(m); scope->add_mark(restorer); } else { // This is the rule that methods in classes "win" (bad word) over // methods in interfaces. This works because of single inheritance _family->set_target_if_empty(m); } } return true; }
int main (int argc, char *argv[]) { time_t current_day; struct tm *tm = NULL; int year, current_month; Core::Data *temp_data = NULL; Core::DataParser* dp = NULL; int success = 0; uint i = 0; QString temp; QString temp_high; QString temp_low; QCoreApplication a(argc, argv); textdomain("omweather"); bindtextdomain("omweather", "/opt/com.meecast.omweather/share/locale"); config = create_and_fill_config(); /* Check time for previous updating */ dp = current_data(config->stationsList().at(config->current_station_id())->fileName()); /* 25*60 = 25 minutes - minimal time between updates */ if ((!dp) || (dp && (abs(time(NULL) - dp->LastUpdate()) > 25*60))){ /*update weather forecast*/ for (i=0; i < config->stationsList().size();i++){ if (config->stationsList().at(i)->updateData(true)){ success ++; } } } dp = current_data(config->stationsList().at(config->current_station_id())->fileName()); /* set current day */ current_day = time(NULL); //tm = localtime(¤t_day); tm = gmtime(¤t_day); year = 1900 + tm->tm_year; current_month = tm->tm_mon; tm->tm_sec = 0; tm->tm_min = 0; tm->tm_hour = 0; tm->tm_isdst = 1; if (dp) temp_data = dp->data().GetDataForTime(time(NULL)); // if (temp_data) // current_day = current_day + 3600*dp->timezone(); current_day = mktime(tm); /* fill current date */ if (dp != NULL && (temp_data = dp->data().GetDataForTime(time(NULL)))) { QString icon_string = config->iconspath().c_str(); QString icon_number; icon_string.append("/") ; icon_string.append(config->iconSet().c_str()); icon_string.append("/") ; icon_number = icon_number.number((temp_data->Icon()), 'i', 0) + ".png"; icon_string.append(icon_number) ; temp_data->temperature_low().units(config->TemperatureUnit()); temp_data->temperature_hi().units(config->TemperatureUnit()); temp_data->temperature().units(config->TemperatureUnit()); temp_data->Text(_(temp_data->Text().c_str())); if (temp_data->temperature().value(TRUE) == INT_MAX){ temp = "N/A"; }else temp = temp.number((temp_data->temperature().value()),'f',0); if (temp_data->temperature_hi().value(TRUE) == INT_MAX){ temp_high = "N/A"; }else temp_high = temp.number((temp_data->temperature_hi().value()),'f',0); if (temp_data->temperature_low().value(TRUE) == INT_MAX){ temp_low = "N/A"; }else temp_low = temp.number((temp_data->temperature_low().value()),'f',0); /* Call DBUS */ MeecastIf* dbusclient = new MeecastIf("com.meecast.applet", "/com/meecast/applet", QDBusConnection::sessionBus(), 0); /* Preparing time for updateing */ uint result_time = 0; if (config->UpdatePeriod() != INT_MAX || config->UpdatePeriod() != 0){ if ((time(NULL) - dp->LastUpdate()) > config->UpdatePeriod()) result_time = time(NULL) + 10; else if (dp->LastUpdate() + config->UpdatePeriod() < temp_data->EndTime()) result_time = dp->LastUpdate() + config->UpdatePeriod(); else result_time = temp_data->EndTime(); }else result_time = temp_data->EndTime(); QString stationname = ""; QDateTime t; t.setTime_t(dp->LastUpdate()); QString description =""; dbusclient->SetCurrentData(stationname.fromUtf8(config->stationname().c_str()), temp, temp_high, temp_low, icon_string, description.fromUtf8(temp_data->Text().c_str()), result_time, temp_data->Current(), config->Lockscreen(), config->Standbyscreen(), t.toString("dd MMM h:mm")); } if (dp){ dp->DeleteInstance(); dp = NULL; } return 0; }