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

List:       kde-commits
Subject:    [marble] src/lib: remove friend declarations
From:       Bernhard Beschow <bbeschow () cs ! tu-berlin ! de>
Date:       2012-07-02 13:37:22
Message-ID: 20120702133722.72D12A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit bf356e32789a3771dc36da44f94b3a97a4d2cf3f by Bernhard Beschow.
Committed on 02/07/2012 at 15:03.
Pushed by beschow into branch 'master'.

remove friend declarations

M  +24   -25   src/lib/TileId.h

http://commits.kde.org/marble/bf356e32789a3771dc36da44f94b3a97a4d2cf3f

diff --git a/src/lib/TileId.h b/src/lib/TileId.h
index 33674e6..28587da 100644
--- a/src/lib/TileId.h
+++ b/src/lib/TileId.h
@@ -6,6 +6,7 @@
 // the source code.
 //
 // Copyright 2008, 2010 Jens-Michael Hoffmann <jensmh@gmx.de>
+// Copyright 2012       Bernhard Beschow <bbeschow@cs.tu-berlin.de>
 //
 
 #ifndef MARBLE_TILEID_H
@@ -19,10 +20,6 @@ namespace Marble
 
 class TileId
 {
-    friend bool operator==( TileId const& lhs, TileId const& rhs );
-    friend bool operator<( TileId const& lhs, TileId const& rhs );
-    friend uint qHash( TileId const& );
-
  public:
     TileId( QString const & mapThemeId, int zoomLevel, int tileX, int tileY );
     TileId( uint mapThemeIdHash, int zoomLevel, int tileX, int tileY );
@@ -33,6 +30,9 @@ class TileId
     int y() const;
     uint mapThemeIdHash() const;
 
+    bool operator==( TileId const& rhs ) const;
+    bool operator<( TileId const& rhs ) const;
+
     QString toString() const;
     static TileId fromString( QString const& );
 
@@ -43,7 +43,6 @@ class TileId
     int m_tileY;
 };
 
-bool operator==( TileId const& lhs, TileId const& rhs );
 uint qHash( TileId const& );
 
 
@@ -74,39 +73,39 @@ inline QString TileId::toString() const
     return QString( "%1:%2:%3:%4" ).arg( m_mapThemeIdHash ).arg( m_zoomLevel ).arg( \
m_tileX ).arg( m_tileY );  }
 
-inline bool operator==( TileId const& lhs, TileId const& rhs )
+inline bool TileId::operator==( TileId const& rhs ) const
 {
-    return lhs.m_zoomLevel == rhs.m_zoomLevel
-        && lhs.m_tileX == rhs.m_tileX
-        && lhs.m_tileY == rhs.m_tileY
-        && lhs.m_mapThemeIdHash == rhs.m_mapThemeIdHash;
+    return m_zoomLevel == rhs.m_zoomLevel
+        && m_tileX == rhs.m_tileX
+        && m_tileY == rhs.m_tileY
+        && m_mapThemeIdHash == rhs.m_mapThemeIdHash;
 }
 
-inline bool operator<( TileId const& lhs, TileId const& rhs )
+inline bool TileId::operator<( TileId const& rhs ) const
 {
-    if (lhs.m_zoomLevel < rhs.m_zoomLevel)
+    if (m_zoomLevel < rhs.m_zoomLevel)
         return true;
-    else if (lhs.m_zoomLevel == rhs.m_zoomLevel
-             && lhs.m_tileX < rhs.m_tileX)
+    else if (m_zoomLevel == rhs.m_zoomLevel
+             && m_tileX < rhs.m_tileX)
         return true;
-    else if (lhs.m_zoomLevel == rhs.m_zoomLevel
-             && lhs.m_tileX == rhs.m_tileX
-             && lhs.m_tileY < rhs.m_tileY)
+    else if (m_zoomLevel == rhs.m_zoomLevel
+             && m_tileX == rhs.m_tileX
+             && m_tileY < rhs.m_tileY)
         return true;
-    else if (lhs.m_zoomLevel == rhs.m_zoomLevel
-             && lhs.m_tileX == rhs.m_tileX
-             && lhs.m_tileY == rhs.m_tileY
-             && lhs.m_mapThemeIdHash < rhs.m_mapThemeIdHash)
+    else if (m_zoomLevel == rhs.m_zoomLevel
+             && m_tileX == rhs.m_tileX
+             && m_tileY == rhs.m_tileY
+             && m_mapThemeIdHash < rhs.m_mapThemeIdHash)
         return true;
     return false;
 }
 
 inline uint qHash( TileId const& tid )
 {
-    const quint64 tmp = (( quint64 )( tid.m_zoomLevel ) << 36 )
-        + (( quint64 )( tid.m_tileX ) << 18 )
-        + ( quint64 )( tid.m_tileY );
-    return ::qHash( tmp ) ^ tid.m_mapThemeIdHash;
+    const quint64 tmp = (( quint64 )( tid.zoomLevel() ) << 36 )
+        + (( quint64 )( tid.x() ) << 18 )
+        + ( quint64 )( tid.y() );
+    return ::qHash( tmp ) ^ tid.mapThemeIdHash();
 }
 
 }


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

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