From 1827825fcb818c2cbe60e411852a0bbdf749028c Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Fri, 23 Nov 2012 21:00:20 +0100 Subject: [PATCH] Clean up namespace issues avoiding "uses..." in header files. --- src/AIModel/AIAircraft.cxx | 5 ++++- src/AIModel/AIBase.cxx | 4 ++-- src/AIModel/AIManager.cxx | 2 +- src/AIModel/submodel.cxx | 4 +++- src/ATC/trafficcontrol.cxx | 2 ++ src/Main/fg_init.cxx | 3 +++ src/Traffic/SchedFlight.hxx | 20 ++++++++------------ src/Traffic/Schedule.hxx | 20 ++++++++++---------- src/Traffic/TrafficMgr.cxx | 9 ++++----- 9 files changed, 37 insertions(+), 32 deletions(-) diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx index 4f02828fb..534cfa56d 100644 --- a/src/AIModel/AIAircraft.cxx +++ b/src/AIModel/AIAircraft.cxx @@ -40,13 +40,16 @@ # include #endif -using std::string; #include "AIAircraft.hxx" #include "performancedata.hxx" #include "performancedb.hxx" #include +using std::string; +using std::cerr; +using std::endl; + //#include FGAIAircraft::FGAIAircraft(FGAISchedule *ref) : diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index 7cfcfcb0a..be04d883b 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -149,7 +149,7 @@ FGAIBase::~FGAIBase() { if (_fx && _refID != 0 && _refID != 1) { SGSoundMgr *smgr = globals->get_soundmgr(); if (smgr) { - stringstream name; + std::stringstream name; name << "aifx:"; name << _refID; smgr->remove(name.str()); @@ -250,7 +250,7 @@ void FGAIBase::update(double dt) { props->setStringValue("sim/sound/path", fxpath.c_str()); // initialize the sound configuration - stringstream name; + std::stringstream name; name << "aifx:"; name << _refID; _fx = new FGFX(name.str(), props); diff --git a/src/AIModel/AIManager.cxx b/src/AIModel/AIManager.cxx index f7193ba81..4d92a5a46 100644 --- a/src/AIModel/AIManager.cxx +++ b/src/AIModel/AIManager.cxx @@ -91,7 +91,7 @@ FGAIManager::postinit() { enabled->setBoolValue(true); // process all scenarios - map scenarios; + std::map scenarios; for (int i = 0 ; i < root->nChildren() ; i++) { SGPropertyNode *n = root->getChild(i); if (strcmp(n->getName(), "scenario")) diff --git a/src/AIModel/submodel.cxx b/src/AIModel/submodel.cxx index e4746bfc8..88ddf60b9 100644 --- a/src/AIModel/submodel.cxx +++ b/src/AIModel/submodel.cxx @@ -23,6 +23,8 @@ #include "AIManager.hxx" #include "AIBallistic.hxx" +using std::cout; +using std::endl; const double FGSubmodelMgr::lbs_to_slugs = 0.031080950172; @@ -824,7 +826,7 @@ void FGSubmodelMgr::valueChanged(SGPropertyNode *prop) const char* _model_added = _model_added_node->getStringValue(); - basic_string ::size_type indexCh2b; + std::basic_string ::size_type indexCh2b; string str2 = _model_added; const char *cstr2b = "multiplayer"; diff --git a/src/ATC/trafficcontrol.cxx b/src/ATC/trafficcontrol.cxx index ecf4d1792..e475763f7 100644 --- a/src/ATC/trafficcontrol.cxx +++ b/src/ATC/trafficcontrol.cxx @@ -53,6 +53,8 @@ using std::sort; using std::string; +using std::cout; +using std::endl; /*************************************************************************** * ActiveRunway diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 5330ede86..23fca0508 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -113,6 +113,9 @@ #include "positioninit.hxx" using std::string; +using std::endl; +using std::cerr; +using std::cout; using namespace boost::algorithm; diff --git a/src/Traffic/SchedFlight.hxx b/src/Traffic/SchedFlight.hxx index 0567102fb..2f9f1d650 100644 --- a/src/Traffic/SchedFlight.hxx +++ b/src/Traffic/SchedFlight.hxx @@ -40,22 +40,18 @@ #ifndef _FGSCHEDFLIGHT_HXX_ #define _FGSCHEDFLIGHT_HXX_ - -using namespace std; - -using std::vector; - +class FGAirport; class FGScheduledFlight { private: - string callsign; - string fltRules; + std::string callsign; + std::string fltRules; FGAirport *departurePort; FGAirport *arrivalPort; - string depId; - string arrId; - string requiredAircraft; + std::string depId; + std::string arrId; + std::string requiredAircraft; time_t departureTime; time_t arrivalTime; time_t repeatPeriod; @@ -116,8 +112,8 @@ public: void setFlightRules(string val) { fltRules = val; }; }; -typedef vector FGScheduledFlightVec; -typedef vector::iterator FGScheduledFlightVecIterator; +typedef std::vector FGScheduledFlightVec; +typedef std::vector::iterator FGScheduledFlightVecIterator; typedef std::map < std::string, FGScheduledFlightVec > FGScheduledFlightMap; diff --git a/src/Traffic/Schedule.hxx b/src/Traffic/Schedule.hxx index bff785b68..9f5addc99 100644 --- a/src/Traffic/Schedule.hxx +++ b/src/Traffic/Schedule.hxx @@ -38,16 +38,16 @@ class FGAIAircraft; class FGAISchedule { private: - string modelPath; - string homePort; - string livery; - string registration; - string airline; - string acType; - string m_class; - string flightType; - string flightIdentifier; - string currentDestination; + std::string modelPath; + std::string homePort; + std::string livery; + std::string registration; + std::string airline; + std::string acType; + std::string m_class; + std::string flightType; + std::string flightIdentifier; + std::string currentDestination; bool heavy; FGScheduledFlightVec flights; SGGeod position; diff --git a/src/Traffic/TrafficMgr.cxx b/src/Traffic/TrafficMgr.cxx index 0abf47665..ee8e9c64f 100644 --- a/src/Traffic/TrafficMgr.cxx +++ b/src/Traffic/TrafficMgr.cxx @@ -67,12 +67,11 @@ #include #include
- - #include "TrafficMgr.hxx" using std::sort; using std::strcmp; +using std::endl; /** * Thread encapsulating parsing the traffic schedules. @@ -180,7 +179,7 @@ void FGTrafficManager::shutdown() // Save the heuristics data bool saveData = false; - ofstream cachefile; + std::ofstream cachefile; if (fgGetBool("/sim/traffic-manager/heuristics")) { SGPath cacheData(globals->get_fg_home()); cacheData.append("ai"); @@ -305,7 +304,7 @@ void FGTrafficManager::loadHeuristics() cacheData.append(airport + "-cache.txt"); string revisionStr; if (cacheData.exists()) { - ifstream data(cacheData.c_str()); + std::ifstream data(cacheData.c_str()); data >> revisionStr; if (revisionStr != "[TrafficManagerCachedata:ref:2011:09:04]") { SG_LOG(SG_GENERAL, SG_ALERT,"Traffic Manager Warning: discarding outdated cachefile " << @@ -434,7 +433,7 @@ void FGTrafficManager::readTimeTableFromFile(SGPath infileName) string buffString; vector tokens, depTime,arrTime; vector ::iterator it; - ifstream infile(infileName.str().c_str()); + std::ifstream infile(infileName.str().c_str()); while (1) { infile.getline(buffer, 256); if (infile.eof()) {