From: James Turner Date: Tue, 21 Aug 2012 16:07:47 +0000 (+0100) Subject: Fix some places relying on public 'using std::string' in SimGear X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7fabeed85d247142d7324ad70e9df706d6730e9b;p=flightgear.git Fix some places relying on public 'using std::string' in SimGear (Otherwise my next SimGear commit will break them) --- diff --git a/src/ATC/atcdialog.cxx b/src/ATC/atcdialog.cxx index 51e319d5d..f2e851e26 100644 --- a/src/ATC/atcdialog.cxx +++ b/src/ATC/atcdialog.cxx @@ -44,6 +44,7 @@ #include #include +using std::string; static SGPropertyNode *getNamedNode(SGPropertyNode *prop, const char *name) { diff --git a/src/Aircraft/flightrecorder.cxx b/src/Aircraft/flightrecorder.cxx index 73b4f9bff..a2188540b 100644 --- a/src/Aircraft/flightrecorder.cxx +++ b/src/Aircraft/flightrecorder.cxx @@ -38,6 +38,7 @@ #include "flightrecorder.hxx" using namespace FlightRecorder; +using std::string; FGFlightRecorder::FGFlightRecorder(const char* pConfigName) : m_RecorderNode(fgGetNode("/sim/flight-recorder", true)), diff --git a/src/Aircraft/flightrecorder.hxx b/src/Aircraft/flightrecorder.hxx index 2bf239088..7650db458 100644 --- a/src/Aircraft/flightrecorder.hxx +++ b/src/Aircraft/flightrecorder.hxx @@ -68,7 +68,7 @@ private: SGPropertyNode_ptr BaseNode); void processSignalList(const char* pSignalType, FlightRecorder::TSignalList& SignalList, SGPropertyNode_ptr SignalListNode, - string PropPrefix="", int Count = 1); + std::string PropPrefix="", int Count = 1); bool haveProperty(FlightRecorder::TSignalList& Capture,SGPropertyNode* pProperty); bool haveProperty(SGPropertyNode* pProperty); @@ -83,7 +83,7 @@ private: FlightRecorder::TSignalList m_CaptureBool; int m_TotalRecordSize; - string m_ConfigName; + std::string m_ConfigName; }; #endif /* FLIGHTRECORDER_HXX_ */ diff --git a/src/Autopilot/component.cxx b/src/Autopilot/component.cxx index 1da236cc9..f1c289412 100644 --- a/src/Autopilot/component.cxx +++ b/src/Autopilot/component.cxx @@ -46,7 +46,7 @@ bool Component::configure( SGPropertyNode_ptr configNode ) SGPropertyNode_ptr prop; SGPropertyNode_ptr child = configNode->getChild(i); - string cname(child->getName()); + std::string cname(child->getName()); if( configure( cname, child ) ) continue; @@ -87,7 +87,7 @@ bool Component::configure( const std::string & nodeName, SGPropertyNode_ptr conf if ( (prop = configNode->getChild( "value" )) != NULL ) { delete _enable_value; - _enable_value = new string(prop->getStringValue()); + _enable_value = new std::string(prop->getStringValue()); } if ( (prop = configNode->getChild( "honor-passive" )) != NULL ) { diff --git a/src/Autopilot/route_mgr.cxx b/src/Autopilot/route_mgr.cxx index 3be33129f..e685b8888 100644 --- a/src/Autopilot/route_mgr.cxx +++ b/src/Autopilot/route_mgr.cxx @@ -56,6 +56,7 @@ #define RM "/autopilot/route-manager/" using namespace flightgear; +using std::string; static bool commandLoadFlightPlan(const SGPropertyNode* arg) { diff --git a/src/GUI/gui.h b/src/GUI/gui.h index f25d0c961..cc523f756 100644 --- a/src/GUI/gui.h +++ b/src/GUI/gui.h @@ -42,7 +42,7 @@ class GraphicsContext; // gui.cxx extern void guiStartInit(osg::GraphicsContext*); extern bool guiFinishInit(); -extern bool openBrowser(string address); +extern bool openBrowser(const std::string& address); extern void mkDialog(const char *txt); extern void guiErrorMessage(const char *txt); extern void guiErrorMessage(const char *txt, const sg_throwable &throwable); diff --git a/src/GUI/gui_funcs.cxx b/src/GUI/gui_funcs.cxx index e8941e3d5..82a481772 100644 --- a/src/GUI/gui_funcs.cxx +++ b/src/GUI/gui_funcs.cxx @@ -165,10 +165,11 @@ void helpCb() openBrowser( "Docs/index.html" ); } -bool openBrowser(string address) +bool openBrowser(const std::string& aAddress) { bool ok = true; - + string address(aAddress); + // do not resolve addresses with given protocol, i.e. "http://...", "ftp://..." if (address.find("://")==string::npos) { diff --git a/src/Instrumentation/HUD/HUD.cxx b/src/Instrumentation/HUD/HUD.cxx index 22476c922..2b5d75aae 100644 --- a/src/Instrumentation/HUD/HUD.cxx +++ b/src/Instrumentation/HUD/HUD.cxx @@ -45,6 +45,7 @@ using std::endl; using std::ifstream; +using std::string; static float clamp(float f) { diff --git a/src/Instrumentation/HUD/HUD_ladder.cxx b/src/Instrumentation/HUD/HUD_ladder.cxx index 37a9f292c..0b7784a27 100644 --- a/src/Instrumentation/HUD/HUD_ladder.cxx +++ b/src/Instrumentation/HUD/HUD_ladder.cxx @@ -28,6 +28,8 @@ #include #include "HUD.hxx" +using std::string; + // FIXME static float get__heading() { return fgGetFloat("/orientation/heading-deg") * M_PI / 180.0; } static float get__throttleval() { return fgGetFloat("/controls/engines/engine/throttle"); } diff --git a/src/Instrumentation/KLN89/kln89_page_apt.cxx b/src/Instrumentation/KLN89/kln89_page_apt.cxx index 95b34cfe6..ae25ca723 100644 --- a/src/Instrumentation/KLN89/kln89_page_apt.cxx +++ b/src/Instrumentation/KLN89/kln89_page_apt.cxx @@ -35,6 +35,8 @@ #include #include +using std::string; + KLN89AptPage::KLN89AptPage(KLN89* parent) : KLN89Page(parent) { _nSubPages = 8; diff --git a/src/Main/bootstrap.cxx b/src/Main/bootstrap.cxx index f2c3514a0..44b547da5 100644 --- a/src/Main/bootstrap.cxx +++ b/src/Main/bootstrap.cxx @@ -64,8 +64,8 @@ using std::endl; #include "fg_os.hxx" -string homedir; -string hostname; +std::string homedir; +std::string hostname; // forward declaration. void fgExitCleanup(); @@ -259,7 +259,7 @@ int main ( int argc, char **argv ) { if (std::strlen(t.getOrigin()) != 0) cerr << " (received from " << t.getOrigin() << ')' << endl; - } catch (const string &s) { + } catch (const std::string &s) { cerr << "Fatal error: " << s << endl; } catch (const char *s) { @@ -274,8 +274,8 @@ int main ( int argc, char **argv ) { return 0; } -// do some clean up on exit. Specifically we want to call alutExit() -// which happens in the sound manager destructor. +// do some clean up on exit. Specifically we want to delete the sound-manager, +// so OpenAL device and context are released cleanly void fgExitCleanup() { if (_bootstrap_OSInit != 0) diff --git a/src/Main/main.hxx b/src/Main/main.hxx index b6c2d3442..8ddea1a9e 100644 --- a/src/Main/main.hxx +++ b/src/Main/main.hxx @@ -9,7 +9,7 @@ int fgMainInit( int argc, char **argv ); extern int idle_state; -extern string homedir; -extern string hostname; +extern std::string homedir; +extern std::string hostname; #endif