From: Thomas Geymayer Date: Thu, 9 Aug 2012 11:14:19 +0000 (+0200) Subject: Clean up X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=350d508324380f2c080201dc5359de5954d0f77a;p=flightgear.git Clean up - Replace deprecated boost::shared_static_cast with boost::static_pointer_cast - Use boost::ends_with in favor of own implementation. --- diff --git a/src/Canvas/canvas.cxx b/src/Canvas/canvas.cxx index d379b644d..086ace05c 100644 --- a/src/Canvas/canvas.cxx +++ b/src/Canvas/canvas.cxx @@ -194,7 +194,7 @@ void Canvas::update(double delta_time_sec) placement_factory->second ( node, - boost::shared_static_cast(_self.lock()) + boost::static_pointer_cast(_self.lock()) ); node->setStringValue ( diff --git a/src/Canvas/elements/map.cxx b/src/Canvas/elements/map.cxx index 59a7d9bac..97bb6e5d6 100644 --- a/src/Canvas/elements/map.cxx +++ b/src/Canvas/elements/map.cxx @@ -24,6 +24,8 @@ #include
#include +#include + #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 diff --git a/src/Canvas/elements/map.hxx b/src/Canvas/elements/map.hxx index 944f8b671..c875eec1f 100644 --- a/src/Canvas/elements/map.hxx +++ b/src/Canvas/elements/map.hxx @@ -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 diff --git a/src/Canvas/gui_mgr.cxx b/src/Canvas/gui_mgr.cxx index 6ff2c577b..34b356f0a 100644 --- a/src/Canvas/gui_mgr.cxx +++ b/src/Canvas/gui_mgr.cxx @@ -177,7 +177,7 @@ bool GUIMgr::handleEvent(const osgGA::GUIEventAdapter& ea) //------------------------------------------------------------------------------ canvas::WindowPtr GUIMgr::getWindow(size_t i) { - return boost::shared_static_cast(_elements[i]); + return boost::static_pointer_cast(_elements[i]); } //------------------------------------------------------------------------------