[Marble-commits] KDE/kdeedu/marble/src/lib/geodata/scene
Jens-Michael Hoffmann
jensmh at gmx.de
Sat Apr 10 17:00:07 CEST 2010
SVN commit 1113344 by jmhoffmann:
GeoSceneGroup: add const variant of method property.
M +9 -1 GeoSceneGroup.cpp
M +2 -1 GeoSceneGroup.h
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneGroup.cpp #1113343:1113344
@@ -111,7 +111,7 @@
}
}
-GeoSceneProperty* GeoSceneGroup::property( const QString& name )
+const GeoSceneProperty* GeoSceneGroup::property( const QString& name ) const
{
GeoSceneProperty* property = 0;
@@ -127,6 +127,14 @@
return property;
}
+// implement non-const method by means of const method,
+// for details, see "Effective C++" (third edition)
+GeoSceneProperty* GeoSceneGroup::property( const QString& name )
+{
+ return const_cast<GeoSceneProperty*>
+ ( static_cast<GeoSceneGroup const *>( this )->property( name ));
+}
+
QVector<GeoSceneProperty*> GeoSceneGroup::properties() const
{
return m_properties;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneGroup.h #1113343:1113344
@@ -78,7 +78,8 @@
* @param property the new property
*/
void addProperty(GeoSceneProperty*);
- GeoSceneProperty* property(const QString&);
+ const GeoSceneProperty* property( const QString& name ) const;
+ GeoSceneProperty* property( const QString& name );
QVector<GeoSceneProperty*> properties() const;
QString name() const;
More information about the Marble-commits
mailing list