]> git.mxchange.org Git - flightgear.git/commitdiff
Clean up
authorThomas Geymayer <thomas.geymayer@student.tugraz.at>
Thu, 9 Aug 2012 11:14:19 +0000 (13:14 +0200)
committerThomas Geymayer <thomas.geymayer@student.tugraz.at>
Thu, 9 Aug 2012 11:22:48 +0000 (13:22 +0200)
 - Replace deprecated boost::shared_static_cast with
   boost::static_pointer_cast
 - Use boost::ends_with in favor of own implementation.

src/Canvas/canvas.cxx
src/Canvas/elements/map.cxx
src/Canvas/elements/map.hxx
src/Canvas/gui_mgr.cxx

index d379b644d4128691b2935d426b41143bd3ce236a..086ace05c4cf48418fa0ecd93577c612215c21b4 100644 (file)
@@ -194,7 +194,7 @@ void Canvas::update(double delta_time_sec)
           placement_factory->second
           (
             node,
-            boost::shared_static_cast<Canvas>(_self.lock())
+            boost::static_pointer_cast<Canvas>(_self.lock())
           );
       node->setStringValue
       (
index 59a7d9bacfb55f8a1775cf2b6d0129a49ec1604d..97bb6e5d69042f5d9d6fe62df3de77658531d3b7 100644 (file)
@@ -24,6 +24,8 @@
 #include <Main/fg_props.hxx>
 #include <cmath>
 
+#include <boost/algorithm/string/predicate.hpp>
+
 #define LOG_GEO_RET(msg) \
   {\
     SG_LOG\
@@ -93,7 +95,7 @@ namespace canvas
   //----------------------------------------------------------------------------
   void Map::childAdded(SGPropertyNode* parent, SGPropertyNode* child)
   {
-    if( !hasSuffix(child->getNameString(), GEO) )
+    if( !boost::ends_with(child->getNameString(), GEO) )
       return Element::childAdded(parent, child);
 
     _geo_nodes[child].reset(new GeoNodePair());
@@ -102,7 +104,7 @@ namespace canvas
   //----------------------------------------------------------------------------
   void Map::childRemoved(SGPropertyNode* parent, SGPropertyNode* child)
   {
-    if( !hasSuffix(child->getNameString(), GEO) )
+    if( !boost::ends_with(child->getNameString(), GEO) )
       return Element::childRemoved(parent, child);
 
     // TODO remove from other node
@@ -114,7 +116,7 @@ namespace canvas
   {
     const std::string& name = child->getNameString();
 
-    if( !hasSuffix(name, GEO) )
+    if( !boost::ends_with(name, GEO) )
       return Group::valueChanged(child);
 
     GeoNodes::iterator it_geo_node = _geo_nodes.find(child);
@@ -218,15 +220,4 @@ namespace canvas
     return coord;
   }
 
-  //----------------------------------------------------------------------------
-  bool Map::hasSuffix(const std::string& str, const std::string& suffix) const
-  {
-    if( suffix.length() > str.length() )
-      return false;
-
-    return ( str.compare( str.length() - suffix.length(),
-                          suffix.length(),
-                          suffix ) == 0 );
-  }
-
 } // namespace canvas
index 944f8b6714025c8c76b024695d9713a9d55897d8..c875eec1fa4e269eb55ea2189c84f44e7757e480 100644 (file)
@@ -68,8 +68,6 @@ namespace canvas
       };
 
       GeoCoord parseGeoCoord(const std::string& val) const;
-
-      bool hasSuffix(const std::string& str, const std::string& suffix) const;
   };
 
 } // namespace canvas
index 6ff2c577b6f50b984ba420e592883722737a52de..34b356f0a22c2759608791d2b9e681ec1c2350b6 100644 (file)
@@ -177,7 +177,7 @@ bool GUIMgr::handleEvent(const osgGA::GUIEventAdapter& ea)
 //------------------------------------------------------------------------------
 canvas::WindowPtr GUIMgr::getWindow(size_t i)
 {
-  return boost::shared_static_cast<canvas::Window>(_elements[i]);
+  return boost::static_pointer_cast<canvas::Window>(_elements[i]);
 }
 
 //------------------------------------------------------------------------------