[Marble-commits] KDE/kdeedu/marble/src/lib/geodata/scene
Jens-Michael Hoffmann
jensmh at gmx.de
Sat Apr 10 16:27:22 CEST 2010
SVN commit 1113337 by jmhoffmann:
GeoSceneSettings: add const variant of method property.
M +9 -1 GeoSceneSettings.cpp
M +1 -0 GeoSceneSettings.h
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneSettings.cpp #1113336:1113337
@@ -220,7 +220,7 @@
}
}
-GeoSceneProperty* GeoSceneSettings::property( const QString& name )
+const GeoSceneProperty* GeoSceneSettings::property( const QString& name ) const
{
GeoSceneProperty* property = 0;
@@ -236,6 +236,14 @@
return property;
}
+// implement non-const method by means of const method,
+// for details, see "Effective C++" (third edition)
+GeoSceneProperty* GeoSceneSettings::property( const QString& name )
+{
+ return const_cast<GeoSceneProperty*>
+ ( static_cast<GeoSceneSettings const *>( this )->property( name ));
+}
+
QVector<GeoSceneProperty*> GeoSceneSettings::rootProperties() const
{
return d->m_properties;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneSettings.h #1113336:1113337
@@ -105,6 +105,7 @@
* @brief Get a property from the settings
* @param name the name of the property
*/
+ const GeoSceneProperty* property( const QString& name ) const;
GeoSceneProperty* property( const QString& name );
/**
More information about the Marble-commits
mailing list