[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/marble/src/lib/geodata/scene
From:       Jens-Michael Hoffmann <jensmh () gmx ! de>
Date:       2010-04-10 14:27:22
Message-ID: 20100410142722.E0872AC892 () svn ! kde ! org
[Download RAW message or body]

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 );
 
     /**
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic