summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-09-04 13:53:09 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-09-04 13:53:09 (GMT)
commita6b115517b23943b2b5868d7e3473c051b7d2394 (patch)
treee5d087a08fd5fe5bfe8caffa597954781830fcb5
parent36319184f908f4dc436643571cef5327383d98ef (diff)
Favor nodeType and static_cast over dynamic_cast (faster)
-rw-r--r--src/lib/marble/geodata/data/GeoDataContainer.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/lib/marble/geodata/data/GeoDataContainer.cpp b/src/lib/marble/geodata/data/GeoDataContainer.cpp
index ea2eaca..6aa231d 100644
--- a/src/lib/marble/geodata/data/GeoDataContainer.cpp
+++ b/src/lib/marble/geodata/data/GeoDataContainer.cpp
@@ -212,17 +212,11 @@ QVector<GeoDataFolder*> GeoDataContainer::folderList() const
QVector<GeoDataPlacemark*> GeoDataContainer::placemarkList() const
{
QVector<GeoDataPlacemark*> results;
-
- QVector<GeoDataFeature*>::const_iterator it = p()->m_vector.constBegin();
- QVector<GeoDataFeature*>::const_iterator end = p()->m_vector.constEnd();
-
- for (; it != end; ++it) {
- GeoDataPlacemark *placemark = dynamic_cast<GeoDataPlacemark*>( *it );
- if ( placemark ) {
- results.append( placemark );
+ for (auto it=p()->m_vector.constBegin(), end = p()->m_vector.constEnd(); it != end; ++it) {
+ if ((*it)->nodeType() == GeoDataTypes::GeoDataPlacemarkType) {
+ results.append(static_cast<GeoDataPlacemark*>(*it));
}
}
-
return results;
}