diff --git a/src/ATC/ATISEncoder.cxx b/src/ATC/ATISEncoder.cxx index 6cc060877..2983cfac1 100644 --- a/src/ATC/ATISEncoder.cxx +++ b/src/ATC/ATISEncoder.cxx @@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include
#include #include -#include #include #include @@ -38,7 +37,7 @@ static string EMPTY(""); std::string ATCSpeech::getSpokenDigit( int i ) { - string key = "n" + boost::lexical_cast( i ); + string key = "n" + std::to_string(i); return globals->get_locale()->getLocalizedString(key.c_str(), "atc", "" ); } diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx index ad56c3bab..2ac7cc29c 100644 --- a/src/Autopilot/route_mgr.cxx +++ b/src/Autopilot/route_mgr.cxx @@ -23,20 +23,13 @@ // $Id$ -#ifdef HAVE_CONFIG_H -# include -#endif +#include #include #include - #include "route_mgr.hxx" -#include -#include -#include - #include #include #include @@ -945,7 +938,7 @@ flightgear::SID* createDefaultSID(FGRunway* aRunway, double enrouteCourse) wpts.push_back(w); } - BOOST_FOREACH(Waypt* w, wpts) { + for (Waypt* w : wpts) { w->setFlag(WPT_DEPARTURE); w->setFlag(WPT_GENERATED); } @@ -1103,7 +1096,7 @@ flightgear::Approach* createDefaultApproach(FGRunway* aRunway, double aEnrouteCo w->setAltitude(thresholdElevFt + approachHeightFt, RESTRICT_AT); wpts.push_back(w); - BOOST_FOREACH(Waypt* w, wpts) { + for (Waypt* w : wpts) { w->setFlag(WPT_APPROACH); w->setFlag(WPT_GENERATED); } diff --git a/src/Canvas/gui_mgr.cxx b/src/Canvas/gui_mgr.cxx index ede50d9b6..7f64e0eb1 100644 --- a/src/Canvas/gui_mgr.cxx +++ b/src/Canvas/gui_mgr.cxx @@ -34,8 +34,6 @@ #include #include -#include - class DesktopGroup; typedef SGSharedPtr DesktopPtr; typedef SGWeakPtr DesktopWeakPtr; @@ -682,7 +680,7 @@ void GUIMgr::init() sc::Canvas::addPlacementFactory ( "window", - boost::bind(&GUIMgr::addWindowPlacement, this, _1, _2) + std::bind(&GUIMgr::addWindowPlacement, this, std::placeholders::_1, std::placeholders::_2) ); _desktop->getProps()->fireCreatedRecursive(); diff --git a/src/Cockpit/NavDisplay.cxx b/src/Cockpit/NavDisplay.cxx index 47f51ac0c..d3a114d5e 100644 --- a/src/Cockpit/NavDisplay.cxx +++ b/src/Cockpit/NavDisplay.cxx @@ -19,15 +19,11 @@ // // -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "config.h" #include "NavDisplay.hxx" #include -#include -#include #include #include @@ -196,8 +192,7 @@ public: return false; } - type = node->getStringValue("type"); - boost::to_lower(type); + type = simgear::strutils::lowercase(node->getStringValue("type")); SGPropertyNode* enableNode = node->getChild("enable"); if (enableNode) { enable.reset(sgReadCondition(fgGetNode("/"), enableNode)); @@ -227,13 +222,13 @@ public: bool matches(const string_set& states) const { - BOOST_FOREACH(const string& s, required_states) { + for (auto s : required_states) { if (states.count(s) == 0) { return false; } } - BOOST_FOREACH(const string& s, excluded_states) { + for (auto s : excluded_states) { if (states.count(s) != 0) { return false; } @@ -479,7 +474,7 @@ NavDisplay::NavDisplay(SGPropertyNode *node) : _definitions.push_back(def); } // of symbol definition parsing - BOOST_FOREACH(SGPropertyNode* rule, symbolsNode->getChildren("rule")) { + for (SGPropertyNode* rule : symbolsNode->getChildren("rule")) { SymbolRule* r = new SymbolRule; if (!r->initFromNode(rule, this)) { delete r; @@ -719,18 +714,18 @@ NavDisplay::update (double delta_time_sec) _texCoords->clear(); _textGeode->removeDrawables(0, _textGeode->getNumDrawables()); - BOOST_FOREACH(SymbolInstance* si, _symbols) { + for (SymbolInstance* si : _symbols) { delete si; } _symbols.clear(); - BOOST_FOREACH(SymbolDef* d, _definitions) { + for (SymbolDef* d : _definitions) { d->instanceCount = 0; d->textEnabled = d->textEnable.get() ? d->textEnable->test() : true; } bool enableChanged = false; - BOOST_FOREACH(SymbolRule* r, _rules) { + for (SymbolRule* r : _rules) { enableChanged |= r->checkEnabled(); } @@ -928,7 +923,7 @@ public: void NavDisplay::addSymbolsToScene() { std::sort(_symbols.begin(), _symbols.end(), OrderByZ()); - BOOST_FOREACH(SymbolInstance* sym, _symbols) { + for (SymbolInstance* sym : _symbols) { addSymbolToScene(sym); } } @@ -1015,8 +1010,7 @@ void NavDisplay::findItems() // sort by distance from pos, so symbol limits are accurate FGPositioned::sortByRange(_itemsInRange, _pos); - - BOOST_FOREACH(FGPositioned* pos, _itemsInRange) { + for (FGPositioned* pos : _itemsInRange) { foundPositionedItem(pos); } } @@ -1068,7 +1062,7 @@ void NavDisplay::processRoute() computeWayptPropsAndHeading(wpt, g, vars, heading); osg::Vec2 projected = projectGeod(g); - BOOST_FOREACH(SymbolRule* r, rules) { + for (SymbolRule* r : rules) { addSymbolInstance(projected, heading, r->getDefinition(), vars); if (r->getDefinition()->drawRouteLeg) { @@ -1120,7 +1114,7 @@ FGNavRecord* NavDisplay::processNavRadio(const SGPropertyNode_ptr& radio) bool NavDisplay::anyRuleForType(const string& type) const { - BOOST_FOREACH(SymbolRule* r, _rules) { + for (SymbolRule* r : _rules) { if (!r->enabled) { continue; } @@ -1135,7 +1129,7 @@ bool NavDisplay::anyRuleForType(const string& type) const void NavDisplay::findRules(const string& type, const string_set& states, SymbolRuleVector& rules) { - BOOST_FOREACH(SymbolRule* candidate, _rules) { + for (SymbolRule* candidate : _rules) { if (!candidate->enabled || (candidate->type != type)) { continue; } @@ -1155,8 +1149,7 @@ bool NavDisplay::isPositionedShown(FGPositioned* pos) void NavDisplay::isPositionedShownInner(FGPositioned* pos, SymbolRuleVector& rules) { - string type = FGPositioned::nameForType(pos->type()); - boost::to_lower(type); + string type = simgear::strutils::lowercase(FGPositioned::nameForType(pos->type())); if (!anyRuleForType(type)) { return; // not diplayed at all, we're done } @@ -1189,7 +1182,7 @@ void NavDisplay::foundPositionedItem(FGPositioned* pos) projected = projectGeod(rwy->threshold()); } - BOOST_FOREACH(SymbolRule* r, rules) { + for (SymbolRule* r : rules) { SymbolInstance* ins = addSymbolInstance(projected, heading, r->getDefinition(), vars); if ((ins)&&(pos->type() == FGPositioned::RUNWAY)) { FGRunway* rwy = (FGRunway*) pos; @@ -1345,7 +1338,7 @@ void NavDisplay::processAI() model->setIntValue("flight-level", fl * 10); osg::Vec2 projected = projectGeod(aiModelPos); - BOOST_FOREACH(SymbolRule* r, rules) { + for (SymbolRule* r : rules) { addSymbolInstance(projected, heading, r->getDefinition(), (SGPropertyNode*) model); } } // of ai models iteration @@ -1399,7 +1392,7 @@ bool NavDisplay::isProjectedClipped(const osg::Vec2& projected) const void NavDisplay::addTestSymbol(const std::string& type, const std::string& states, const SGGeod& pos, double heading, SGPropertyNode* vars) { string_set stateSet; - BOOST_FOREACH(std::string s, simgear::strutils::split(states, ",")) { + for (auto s : simgear::strutils::split(states, ",")) { stateSet.insert(s); } @@ -1410,7 +1403,7 @@ void NavDisplay::addTestSymbol(const std::string& type, const std::string& state } osg::Vec2 projected = projectGeod(pos); - BOOST_FOREACH(SymbolRule* r, rules) { + for (SymbolRule* r : rules) { addSymbolInstance(projected, heading, r->getDefinition(), vars); } } @@ -1454,7 +1447,7 @@ void NavDisplay::addRule(SymbolRule* r) void NavDisplay::computeCustomSymbolStates(const SGPropertyNode* sym, string_set& states) { - BOOST_FOREACH(SGPropertyNode* st, sym->getChildren("state")) { + for (SGPropertyNode* st : sym->getChildren("state")) { states.insert(st->getStringValue()); } } @@ -1481,7 +1474,7 @@ void NavDisplay::processCustomSymbols() osg::Vec2 projected = projectGeod(pos); - BOOST_FOREACH(SymbolRule* r, rules) { + for (SymbolRule* r : rules) { addSymbolInstance(projected, heading, r->getDefinition(), symNode); } } // of custom symbols iteration diff --git a/src/GUI/new_gui.cxx b/src/GUI/new_gui.cxx index 5565ad8a4..8ed36427e 100644 --- a/src/GUI/new_gui.cxx +++ b/src/GUI/new_gui.cxx @@ -18,9 +18,6 @@ #include #include -#include -#include - #include #include
@@ -155,7 +152,7 @@ NewGUI::reset (bool reload) for (iter = _active_dialogs.begin(); iter != _active_dialogs.end(); ++iter) openDialogs.push_back(iter->first); - BOOST_FOREACH(string d, openDialogs) + for (auto d : openDialogs) closeDialog(d); setStyle(); @@ -174,7 +171,7 @@ NewGUI::reset (bool reload) bind(); // open dialogs again - BOOST_FOREACH(string d, openDialogs) + for (auto d : openDialogs) showDialog(d); } diff --git a/src/Main/metar_main.cxx b/src/Main/metar_main.cxx index fbde73ccb..35720f1d9 100644 --- a/src/Main/metar_main.cxx +++ b/src/Main/metar_main.cxx @@ -28,8 +28,6 @@ #include #include -#include - #include #include @@ -542,8 +540,7 @@ int main(int argc, char *argv[]) "http://tgftp.nws.noaa.gov/data/observations/metar/stations/"; HTTP::MemoryRequest* mr = new HTTP::MemoryRequest ( - NOAA_BASE_URL - + boost::to_upper_copy(argv[i]) + ".TXT" + NOAA_BASE_URL + strutils::uppercase(argv[i]) + ".TXT" ); HTTP::Request_ptr own(mr); http.makeRequest(mr); diff --git a/src/Navaids/FlightPlan.cxx b/src/Navaids/FlightPlan.cxx index 843e9bf3a..40781c63d 100644 --- a/src/Navaids/FlightPlan.cxx +++ b/src/Navaids/FlightPlan.cxx @@ -27,10 +27,6 @@ #include #include -// Boost -#include -#include - // SimGear #include #include @@ -1325,7 +1321,7 @@ WayptRef viaFromString(const SGGeod& basePosition, const std::string& target) WayptRef FlightPlan::waypointFromString(const string& tgt ) { - string target(boost::to_upper_copy(tgt)); + string target = simgear::strutils::uppercase(tgt); // extract altitude double altFt = 0.0; RouteRestriction altSetting = RESTRICT_NONE; diff --git a/src/Navaids/LevelDXML.cxx b/src/Navaids/LevelDXML.cxx index ccaba4411..26e8c5c95 100644 --- a/src/Navaids/LevelDXML.cxx +++ b/src/Navaids/LevelDXML.cxx @@ -4,10 +4,9 @@ #include "LevelDXML.hxx" -#include - #include #include +#include #include #include @@ -111,9 +110,8 @@ void NavdataVisitor::processRunways(ArrivalDeparture* aProc, const XMLAttributes return; } - vector rwys; - boost::split(rwys, v, boost::is_any_of(" ,")); - for (auto rwy : rwys) { + auto rwys = simgear::strutils::split_on_any_of(v, " ,"); + for (auto rwy : rwys) { if (!_airport->hasRunwayWithIdent(rwy)) { SG_LOG(SG_NAVAID, SG_DEV_WARN, "Procedure file " << _path << " references unknown airport runway:" << rwy); continue; diff --git a/src/Navaids/positioned.cxx b/src/Navaids/positioned.cxx index da8a21e15..74e1f724f 100644 --- a/src/Navaids/positioned.cxx +++ b/src/Navaids/positioned.cxx @@ -18,9 +18,7 @@ // // $Id$ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "config.h" #include "positioned.hxx" @@ -30,9 +28,6 @@ #include #include -#include -#include -#include #include #include @@ -216,7 +211,7 @@ FGPositioned::Type FGPositioned::typeFromName(const std::string& aName) {NULL, INVALID} }; - std::string lowerName(boost::to_lower_copy(aName)); + std::string lowerName = simgear::strutils::lowercase(aName); for (const NameTypeEntry* n = names; (n->_name != NULL); ++n) { if (::strcmp(n->_name, lowerName.c_str()) == 0) { @@ -464,7 +459,7 @@ FGPositioned::TypeFilter::fromString(const std::string& aFilterSpec) string_list parts = simgear::strutils::split(aFilterSpec, ","); TypeFilter f; - BOOST_FOREACH(std::string token, parts) { + for (std::string token : parts) { f.addType(typeFromName(token)); } diff --git a/src/Navaids/route.cxx b/src/Navaids/route.cxx index d084b1a64..a61f9a7f2 100644 --- a/src/Navaids/route.cxx +++ b/src/Navaids/route.cxx @@ -26,10 +26,6 @@ #include #include -// Boost -#include -#include -#include // SimGear #include @@ -166,7 +162,7 @@ std::string Waypt::icaoDescription() const static RouteRestriction restrictionFromString(const char* aStr) { - std::string l = boost::to_lower_copy(std::string(aStr)); + std::string l = simgear::strutils::lowercase(aStr); if (l == "at") return RESTRICT_AT; if (l == "above") return RESTRICT_ABOVE; diff --git a/src/Network/http/FlightHistoryUriHandler.cxx b/src/Network/http/FlightHistoryUriHandler.cxx index 615b04996..329cd425b 100644 --- a/src/Network/http/FlightHistoryUriHandler.cxx +++ b/src/Network/http/FlightHistoryUriHandler.cxx @@ -25,7 +25,6 @@ #include #include
#include -#include using std::string; using std::stringstream; @@ -287,13 +286,13 @@ bool FlightHistoryUriHandler::handleRequest(const HTTPRequest & request, } else if (requestPath == "track.json") { size_t count = -1; try { - count = boost::lexical_cast(request.RequestVariables.get("count")); + count = std::stoul(request.RequestVariables.get("count")); } catch( ... ) { } size_t last = 0; try { - last = boost::lexical_cast(request.RequestVariables.get("last")); + last = std::stoul(request.RequestVariables.get("last")); } catch( ... ) { }