本文整理汇总了C++中Station::bikes方法的典型用法代码示例。如果您正苦于以下问题:C++ Station::bikes方法的具体用法?C++ Station::bikes怎么用?C++ Station::bikes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Station
的用法示例。
在下文中一共展示了Station::bikes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: re_stations
void
StationsPluginLondon::handleInfos(const QByteArray & data)
{
QRegExp re_stations("station\\=\\{(.*)\\}\\;");
QRegExp re_items("\\s*(\\w+)\\s*:(.*),");
int ofs = 0;
re_stations.setMinimal(true);
re_items.setMinimal(true);
while ((ofs = re_stations.indexIn(data, ofs)) >= 0) {
bool ok;
int id;
QPointF pos;
Station *station;
QMap<QString, QString> values;
ofs += re_stations.matchedLength();
int station_ofs = 0;
QString station_data = re_stations.capturedTexts().at(1);
while ((station_ofs = re_items.indexIn(station_data, station_ofs)) >= 0) {
QStringList capt = re_items.capturedTexts();
if (capt.size() < 3)
continue ;
station_ofs += re_items.matchedLength();
values[capt.at(1)] = capt.at(2);
values[capt.at(1)].replace("\"", "");
}
id = values["id"].toInt(&ok);
pos = QPointF(values["lat"].toDouble(),
values["long"].toDouble());
if (!ok)
continue ;
station = getOrCreateStation(id);
if (station->name().isEmpty())
station->setName(values["name"]);
if (station->pos().isNull())
station->setPos(pos);
station->setBikes(values["nbBikes"].toInt());
station->setFreeSlots(values["nbEmptyDocks"].toInt());
station->setTotalSlots(station->bikes() + station->freeSlots());
storeOrDropStation(station);
}
emit stationsCreated(stations.values());
emit stationsUpdated(stations.values());
}