Unboosting files
Use simgear::strutils replacements in places, C++11 features in others
This commit is contained in:
parent
f6046836c0
commit
a9a49bc2e6
11 changed files with 38 additions and 77 deletions
|
@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
#include <Main/locale.hxx>
|
||||
#include <simgear/structure/exception.hxx>
|
||||
#include <simgear/props/props_io.hxx>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
@ -38,7 +37,7 @@ static string EMPTY("");
|
|||
|
||||
std::string ATCSpeech::getSpokenDigit( int i )
|
||||
{
|
||||
string key = "n" + boost::lexical_cast<std::string>( i );
|
||||
string key = "n" + std::to_string(i);
|
||||
return globals->get_locale()->getLocalizedString(key.c_str(), "atc", "" );
|
||||
}
|
||||
|
||||
|
|
|
@ -23,20 +23,13 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include <config.h>
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#include <simgear/compiler.h>
|
||||
|
||||
#include "route_mgr.hxx"
|
||||
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <simgear/misc/strutils.hxx>
|
||||
#include <simgear/structure/exception.hxx>
|
||||
#include <simgear/structure/commands.hxx>
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
#include <osgViewer/Viewer>
|
||||
#include <osgGA/GUIEventHandler>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
class DesktopGroup;
|
||||
typedef SGSharedPtr<DesktopGroup> DesktopPtr;
|
||||
typedef SGWeakPtr<DesktopGroup> 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();
|
||||
|
|
|
@ -19,15 +19,11 @@
|
|||
//
|
||||
//
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#include "config.h"
|
||||
|
||||
#include "NavDisplay.hxx"
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
#include <osg/Array>
|
||||
|
@ -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
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
#include <simgear/props/props_io.hxx>
|
||||
#include <simgear/misc/sg_dir.hxx>
|
||||
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <Add-ons/AddonManager.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <simgear/environment/metar.hxx>
|
||||
#include <simgear/structure/exception.hxx>
|
||||
|
||||
|
@ -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<std::string>(argv[i]) + ".TXT"
|
||||
NOAA_BASE_URL + strutils::uppercase(argv[i]) + ".TXT"
|
||||
);
|
||||
HTTP::Request_ptr own(mr);
|
||||
http.makeRequest(mr);
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
#include <fstream>
|
||||
#include <cassert>
|
||||
|
||||
// Boost
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
// SimGear
|
||||
#include <simgear/structure/exception.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
@ -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;
|
||||
|
|
|
@ -4,10 +4,9 @@
|
|||
|
||||
#include "LevelDXML.hxx"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <simgear/structure/exception.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include <simgear/misc/strutils.hxx>
|
||||
|
||||
#include <Navaids/waypoint.hxx>
|
||||
#include <Airports/airport.hxx>
|
||||
|
@ -111,9 +110,8 @@ void NavdataVisitor::processRunways(ArrivalDeparture* aProc, const XMLAttributes
|
|||
return;
|
||||
}
|
||||
|
||||
vector<string> 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;
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
//
|
||||
// $Id$
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#include "config.h"
|
||||
|
||||
#include "positioned.hxx"
|
||||
|
||||
|
@ -30,9 +28,6 @@
|
|||
#include <queue>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
#include <simgear/timing/timestamp.hxx>
|
||||
#include <simgear/debug/logstream.hxx>
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -26,10 +26,6 @@
|
|||
#include <map>
|
||||
#include <fstream>
|
||||
|
||||
// Boost
|
||||
#include <boost/algorithm/string/case_conv.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
// SimGear
|
||||
#include <simgear/structure/exception.hxx>
|
||||
|
@ -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;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <Aircraft/FlightHistory.hxx>
|
||||
#include <Main/fg_props.hxx>
|
||||
#include <sstream>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
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<size_t>(request.RequestVariables.get("count"));
|
||||
count = std::stoul(request.RequestVariables.get("count"));
|
||||
}
|
||||
catch( ... ) {
|
||||
}
|
||||
size_t last = 0;
|
||||
try {
|
||||
last = boost::lexical_cast<size_t>(request.RequestVariables.get("last"));
|
||||
last = std::stoul(request.RequestVariables.get("last"));
|
||||
}
|
||||
catch( ... ) {
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue