[Marble-commits] KDE/kdeedu/marble/src/lib/geodata/scene
Jens-Michael Hoffmann
jensmh at gmx.de
Wed Feb 3 19:49:38 CET 2010
SVN commit 1084771 by jmhoffmann:
Fix constness of getters which return pointers to members.
Const getters should return pointers to const member objects and
non-const getters should return pointers to non-const member objects.
M +24 -4 GeoSceneDocument.cpp
M +11 -4 GeoSceneDocument.h
M +26 -15 GeoSceneHead.cpp
M +10 -7 GeoSceneHead.h
M +6 -1 GeoSceneItem.cpp
M +2 -1 GeoSceneItem.h
M +28 -4 GeoSceneLayer.cpp
M +5 -1 GeoSceneLayer.h
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneDocument.cpp #1084770:1084771
@@ -72,26 +72,46 @@
delete d;
}
-GeoSceneHead* GeoSceneDocument::head() const
+const GeoSceneHead* GeoSceneDocument::head() const
{
return d->m_head;
}
-GeoSceneMap* GeoSceneDocument::map() const
+GeoSceneHead* GeoSceneDocument::head()
{
+ return d->m_head;
+}
+
+const GeoSceneMap* GeoSceneDocument::map() const
+{
return d->m_map;
}
-GeoSceneSettings* GeoSceneDocument::settings() const
+GeoSceneMap* GeoSceneDocument::map()
{
+ return d->m_map;
+}
+
+const GeoSceneSettings* GeoSceneDocument::settings() const
+{
return d->m_settings;
}
-GeoSceneLegend* GeoSceneDocument::legend() const
+GeoSceneSettings* GeoSceneDocument::settings()
{
+ return d->m_settings;
+}
+
+const GeoSceneLegend* GeoSceneDocument::legend() const
+{
return d->m_legend;
}
+GeoSceneLegend* GeoSceneDocument::legend()
+{
+ return d->m_legend;
}
+}
+
#include "GeoSceneDocument.moc"
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneDocument.h #1084770:1084771
@@ -53,11 +53,18 @@
virtual bool isGeoSceneDocument() const { return true; }
- GeoSceneHead* head() const;
- GeoSceneMap* map() const;
- GeoSceneSettings* settings() const;
- GeoSceneLegend* legend() const;
+ const GeoSceneHead* head() const;
+ GeoSceneHead* head();
+ const GeoSceneMap* map() const;
+ GeoSceneMap* map();
+
+ const GeoSceneSettings* settings() const;
+ GeoSceneSettings* settings();
+
+ const GeoSceneLegend* legend() const;
+ GeoSceneLegend* legend();
+
Q_SIGNALS:
void valueChanged( QString, bool );
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneHead.cpp #1084770:1084771
@@ -71,18 +71,8 @@
delete d;
}
-GeoSceneIcon* GeoSceneHead::icon() const
+QString GeoSceneHead::name() const
{
- return d->m_icon;
-}
-
-GeoSceneZoom* GeoSceneHead::zoom() const
-{
- return d->m_zoom;
-}
-
-const QString GeoSceneHead::name() const
-{
return d->m_name;
}
@@ -91,7 +81,7 @@
d->m_name = name;
}
-const QString GeoSceneHead::target() const
+QString GeoSceneHead::target() const
{
return d->m_target;
}
@@ -101,12 +91,12 @@
d->m_target = target;
}
-const QString GeoSceneHead::theme() const
+QString GeoSceneHead::theme() const
{
return d->m_theme;
}
-const QString GeoSceneHead::mapThemeId() const
+QString GeoSceneHead::mapThemeId() const
{
return d->m_target + '/' + d->m_theme + '/' + d->m_theme + ".dgml";
}
@@ -116,7 +106,7 @@
d->m_theme = theme;
}
-const QString GeoSceneHead::description() const
+QString GeoSceneHead::description() const
{
return d->m_description;
}
@@ -136,4 +126,25 @@
d->m_visible = visible;
}
+const GeoSceneIcon* GeoSceneHead::icon() const
+{
+ return d->m_icon;
}
+
+GeoSceneIcon* GeoSceneHead::icon()
+{
+ return d->m_icon;
+}
+
+const GeoSceneZoom* GeoSceneHead::zoom() const
+{
+ return d->m_zoom;
+}
+
+GeoSceneZoom* GeoSceneHead::zoom()
+{
+ return d->m_zoom;
+}
+
+
+}
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneHead.h #1084770:1084771
@@ -45,24 +45,27 @@
~GeoSceneHead();
- const QString name() const;
+ QString name() const;
void setName( const QString& name );
- const QString target() const;
+ QString target() const;
void setTarget( const QString& target );
- const QString theme() const;
+ QString theme() const;
void setTheme( const QString& theme );
- const QString mapThemeId() const;
+ QString mapThemeId() const;
- const QString description() const;
+ QString description() const;
void setDescription( const QString& );
bool visible() const;
void setVisible( bool visible );
- GeoSceneZoom* zoom() const;
- GeoSceneIcon* icon() const;
+ const GeoSceneZoom* zoom() const;
+ GeoSceneZoom* zoom();
+ const GeoSceneIcon* icon() const;
+ GeoSceneIcon* icon();
+
private:
Q_DISABLE_COPY( GeoSceneHead )
GeoSceneHeadPrivate * const d;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneItem.cpp #1084770:1084771
@@ -41,11 +41,16 @@
delete m_icon;
}
-GeoSceneIcon* GeoSceneItem::icon() const
+const GeoSceneIcon* GeoSceneItem::icon() const
{
return m_icon;
}
+GeoSceneIcon* GeoSceneItem::icon()
+{
+ return m_icon;
+}
+
QString GeoSceneItem::name() const
{
return m_name;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneItem.h #1084770:1084771
@@ -55,7 +55,8 @@
int spacing() const;
void setSpacing( int spacing );
- GeoSceneIcon* icon() const;
+ const GeoSceneIcon* icon() const;
+ GeoSceneIcon* icon();
private:
Q_DISABLE_COPY( GeoSceneItem )
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneLayer.cpp #1084770:1084771
@@ -96,7 +96,7 @@
}
}
-GeoSceneAbstractDataset* GeoSceneLayer::dataset( const QString& name )
+const GeoSceneAbstractDataset* GeoSceneLayer::dataset( const QString& name ) const
{
GeoSceneAbstractDataset* dataset = 0;
@@ -108,14 +108,25 @@
break;
}
}
+ return dataset;
+}
-// dataset = new GeoSceneAbstractDataset( name );
-// addDataset( dataset );
+GeoSceneAbstractDataset* GeoSceneLayer::dataset( const QString& name )
+{
+ GeoSceneAbstractDataset* dataset = 0;
+ QVector<GeoSceneAbstractDataset*>::const_iterator it = m_datasets.constBegin();
+ QVector<GeoSceneAbstractDataset*>::const_iterator end = m_datasets.constEnd();
+ for (; it != end; ++it) {
+ if ( (*it)->name() == name ) {
+ dataset = *it;
+ break;
+ }
+ }
return dataset;
}
-GeoSceneAbstractDataset * GeoSceneLayer::groundDataset() const
+const GeoSceneAbstractDataset * GeoSceneLayer::groundDataset() const
{
if ( m_datasets.isEmpty() )
return 0;
@@ -123,6 +134,14 @@
return m_datasets.first();
}
+GeoSceneAbstractDataset * GeoSceneLayer::groundDataset()
+{
+ if ( m_datasets.isEmpty() )
+ return 0;
+
+ return m_datasets.first();
+}
+
QVector<GeoSceneAbstractDataset *> GeoSceneLayer::datasets() const
{
return m_datasets;
@@ -163,6 +182,11 @@
m_role = role;
}
+const GeoSceneFilter* GeoSceneLayer::filter() const
+{
+ return m_filter;
+}
+
GeoSceneFilter* GeoSceneLayer::filter()
{
return m_filter;
--- trunk/KDE/kdeedu/marble/src/lib/geodata/scene/GeoSceneLayer.h #1084770:1084771
@@ -77,9 +77,12 @@
*/
void addDataset( GeoSceneAbstractDataset* );
+ const GeoSceneAbstractDataset * dataset( const QString& ) const;
GeoSceneAbstractDataset * dataset( const QString& );
- GeoSceneAbstractDataset * groundDataset() const;
+ const GeoSceneAbstractDataset * groundDataset() const;
+ GeoSceneAbstractDataset * groundDataset();
+
QVector<GeoSceneAbstractDataset*> datasets() const;
QString name() const;
@@ -96,6 +99,7 @@
QString role() const;
void setRole( const QString& type );
+ const GeoSceneFilter * filter() const;
GeoSceneFilter * filter();
void addFilter( GeoSceneFilter * filter );
void removeFilter( GeoSceneFilter * filter );
More information about the Marble-commits
mailing list