]> git.mxchange.org Git - flightgear.git/commitdiff
Clean up namespace issues
authorThorstenB <brehmt@gmail.com>
Fri, 23 Nov 2012 20:00:20 +0000 (21:00 +0100)
committerThorstenB <brehmt@gmail.com>
Fri, 23 Nov 2012 20:16:08 +0000 (21:16 +0100)
avoiding "uses..." in header files.

src/AIModel/AIAircraft.cxx
src/AIModel/AIBase.cxx
src/AIModel/AIManager.cxx
src/AIModel/submodel.cxx
src/ATC/trafficcontrol.cxx
src/Main/fg_init.cxx
src/Traffic/SchedFlight.hxx
src/Traffic/Schedule.hxx
src/Traffic/TrafficMgr.cxx

index 4f02828fba4008057d0d779988b2e1fe16280f9b..534cfa56da5e0ada3ff37cc420702a03d583c098 100644 (file)
 #  include <ieeefp.h>
 #endif
 
-using std::string;
 
 #include "AIAircraft.hxx"
 #include "performancedata.hxx"
 #include "performancedb.hxx"
 #include <signal.h>
 
+using std::string;
+using std::cerr;
+using std::endl;
+
 //#include <Airports/trafficcontroller.hxx>
 
 FGAIAircraft::FGAIAircraft(FGAISchedule *ref) :
index 7cfcfcb0a33418517ff24f767da13d599e186191..be04d883b17b485d55376314f2abd49ecb88529f 100644 (file)
@@ -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);
index f7193ba8149677a9cc1b76b14b8479665d6ee2e2..4d92a5a46fcae827105db6189473fb999c777076 100644 (file)
@@ -91,7 +91,7 @@ FGAIManager::postinit() {
         enabled->setBoolValue(true);
 
     // process all scenarios
-    map<string, bool> scenarios;
+    std::map<string, bool> scenarios;
     for (int i = 0 ; i < root->nChildren() ; i++) {
         SGPropertyNode *n = root->getChild(i);
         if (strcmp(n->getName(), "scenario"))
index e4746bfc8d3cc37bd65d319b81d2b7e2595b9249..88ddf60b9f11e08dac896940147ee7ec0368b371 100644 (file)
@@ -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 <char>::size_type indexCh2b;
+    std::basic_string <char>::size_type indexCh2b;
 
     string str2 = _model_added;
     const char *cstr2b = "multiplayer";
index ecf4d1792173b8c8a48bbaa306f40498fca3db30..e475763f778f2788bb935d036cc9381350d524d1 100644 (file)
@@ -53,6 +53,8 @@
 
 using std::sort;
 using std::string;
+using std::cout;
+using std::endl;
 
 /***************************************************************************
  * ActiveRunway
index 5330ede863edc2bc542c75f82b625dfa0e1391b4..23fca0508547fc0a2865a7d99355a182a1a1502b 100644 (file)
 #include "positioninit.hxx"
 
 using std::string;
+using std::endl;
+using std::cerr;
+using std::cout;
 using namespace boost::algorithm;
 
 
index 0567102fb89930307b107ca4a2a5ccfb269f4c0d..2f9f1d650d9fbc6904d4e1b6c2428cf21e9348fb 100644 (file)
 #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<FGScheduledFlight*>           FGScheduledFlightVec;
-typedef vector<FGScheduledFlight*>::iterator FGScheduledFlightVecIterator;
+typedef std::vector<FGScheduledFlight*>           FGScheduledFlightVec;
+typedef std::vector<FGScheduledFlight*>::iterator FGScheduledFlightVecIterator;
 
 typedef std::map < std::string, FGScheduledFlightVec > FGScheduledFlightMap;
 
index bff785b685761781b932d99fe6a3d44da389d7db..9f5addc99da9789e080852053ebfcb10ddb15358 100644 (file)
@@ -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;
index 0abf476657c751fe3c51b2090767b67590b57a0c..ee8e9c64feaec3169fe0cf7c7e17e23c26511d46 100644 (file)
 #include <Airports/simple.hxx>
 #include <Main/fg_init.hxx>
 
-
-
 #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 <string> tokens, depTime,arrTime;
     vector <string>::iterator it;
-    ifstream infile(infileName.str().c_str());
+    std::ifstream infile(infileName.str().c_str());
     while (1) {
          infile.getline(buffer, 256);
          if (infile.eof()) {