1
0
Fork 0

Clean up namespace issues

avoiding "uses..." in header files.
This commit is contained in:
ThorstenB 2012-11-23 21:00:20 +01:00
parent 4a53002784
commit 1827825fcb
9 changed files with 37 additions and 32 deletions

View file

@ -40,13 +40,16 @@
# include <ieeefp.h> # include <ieeefp.h>
#endif #endif
using std::string;
#include "AIAircraft.hxx" #include "AIAircraft.hxx"
#include "performancedata.hxx" #include "performancedata.hxx"
#include "performancedb.hxx" #include "performancedb.hxx"
#include <signal.h> #include <signal.h>
using std::string;
using std::cerr;
using std::endl;
//#include <Airports/trafficcontroller.hxx> //#include <Airports/trafficcontroller.hxx>
FGAIAircraft::FGAIAircraft(FGAISchedule *ref) : FGAIAircraft::FGAIAircraft(FGAISchedule *ref) :

View file

@ -149,7 +149,7 @@ FGAIBase::~FGAIBase() {
if (_fx && _refID != 0 && _refID != 1) { if (_fx && _refID != 0 && _refID != 1) {
SGSoundMgr *smgr = globals->get_soundmgr(); SGSoundMgr *smgr = globals->get_soundmgr();
if (smgr) { if (smgr) {
stringstream name; std::stringstream name;
name << "aifx:"; name << "aifx:";
name << _refID; name << _refID;
smgr->remove(name.str()); smgr->remove(name.str());
@ -250,7 +250,7 @@ void FGAIBase::update(double dt) {
props->setStringValue("sim/sound/path", fxpath.c_str()); props->setStringValue("sim/sound/path", fxpath.c_str());
// initialize the sound configuration // initialize the sound configuration
stringstream name; std::stringstream name;
name << "aifx:"; name << "aifx:";
name << _refID; name << _refID;
_fx = new FGFX(name.str(), props); _fx = new FGFX(name.str(), props);

View file

@ -91,7 +91,7 @@ FGAIManager::postinit() {
enabled->setBoolValue(true); enabled->setBoolValue(true);
// process all scenarios // process all scenarios
map<string, bool> scenarios; std::map<string, bool> scenarios;
for (int i = 0 ; i < root->nChildren() ; i++) { for (int i = 0 ; i < root->nChildren() ; i++) {
SGPropertyNode *n = root->getChild(i); SGPropertyNode *n = root->getChild(i);
if (strcmp(n->getName(), "scenario")) if (strcmp(n->getName(), "scenario"))

View file

@ -23,6 +23,8 @@
#include "AIManager.hxx" #include "AIManager.hxx"
#include "AIBallistic.hxx" #include "AIBallistic.hxx"
using std::cout;
using std::endl;
const double FGSubmodelMgr::lbs_to_slugs = 0.031080950172; 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(); 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; string str2 = _model_added;
const char *cstr2b = "multiplayer"; const char *cstr2b = "multiplayer";

View file

@ -53,6 +53,8 @@
using std::sort; using std::sort;
using std::string; using std::string;
using std::cout;
using std::endl;
/*************************************************************************** /***************************************************************************
* ActiveRunway * ActiveRunway

View file

@ -113,6 +113,9 @@
#include "positioninit.hxx" #include "positioninit.hxx"
using std::string; using std::string;
using std::endl;
using std::cerr;
using std::cout;
using namespace boost::algorithm; using namespace boost::algorithm;

View file

@ -40,22 +40,18 @@
#ifndef _FGSCHEDFLIGHT_HXX_ #ifndef _FGSCHEDFLIGHT_HXX_
#define _FGSCHEDFLIGHT_HXX_ #define _FGSCHEDFLIGHT_HXX_
class FGAirport;
using namespace std;
using std::vector;
class FGScheduledFlight class FGScheduledFlight
{ {
private: private:
string callsign; std::string callsign;
string fltRules; std::string fltRules;
FGAirport *departurePort; FGAirport *departurePort;
FGAirport *arrivalPort; FGAirport *arrivalPort;
string depId; std::string depId;
string arrId; std::string arrId;
string requiredAircraft; std::string requiredAircraft;
time_t departureTime; time_t departureTime;
time_t arrivalTime; time_t arrivalTime;
time_t repeatPeriod; time_t repeatPeriod;
@ -116,8 +112,8 @@ public:
void setFlightRules(string val) { fltRules = val; }; void setFlightRules(string val) { fltRules = val; };
}; };
typedef vector<FGScheduledFlight*> FGScheduledFlightVec; typedef std::vector<FGScheduledFlight*> FGScheduledFlightVec;
typedef vector<FGScheduledFlight*>::iterator FGScheduledFlightVecIterator; typedef std::vector<FGScheduledFlight*>::iterator FGScheduledFlightVecIterator;
typedef std::map < std::string, FGScheduledFlightVec > FGScheduledFlightMap; typedef std::map < std::string, FGScheduledFlightVec > FGScheduledFlightMap;

View file

@ -38,16 +38,16 @@ class FGAIAircraft;
class FGAISchedule class FGAISchedule
{ {
private: private:
string modelPath; std::string modelPath;
string homePort; std::string homePort;
string livery; std::string livery;
string registration; std::string registration;
string airline; std::string airline;
string acType; std::string acType;
string m_class; std::string m_class;
string flightType; std::string flightType;
string flightIdentifier; std::string flightIdentifier;
string currentDestination; std::string currentDestination;
bool heavy; bool heavy;
FGScheduledFlightVec flights; FGScheduledFlightVec flights;
SGGeod position; SGGeod position;

View file

@ -67,12 +67,11 @@
#include <Airports/simple.hxx> #include <Airports/simple.hxx>
#include <Main/fg_init.hxx> #include <Main/fg_init.hxx>
#include "TrafficMgr.hxx" #include "TrafficMgr.hxx"
using std::sort; using std::sort;
using std::strcmp; using std::strcmp;
using std::endl;
/** /**
* Thread encapsulating parsing the traffic schedules. * Thread encapsulating parsing the traffic schedules.
@ -180,7 +179,7 @@ void FGTrafficManager::shutdown()
// Save the heuristics data // Save the heuristics data
bool saveData = false; bool saveData = false;
ofstream cachefile; std::ofstream cachefile;
if (fgGetBool("/sim/traffic-manager/heuristics")) { if (fgGetBool("/sim/traffic-manager/heuristics")) {
SGPath cacheData(globals->get_fg_home()); SGPath cacheData(globals->get_fg_home());
cacheData.append("ai"); cacheData.append("ai");
@ -305,7 +304,7 @@ void FGTrafficManager::loadHeuristics()
cacheData.append(airport + "-cache.txt"); cacheData.append(airport + "-cache.txt");
string revisionStr; string revisionStr;
if (cacheData.exists()) { if (cacheData.exists()) {
ifstream data(cacheData.c_str()); std::ifstream data(cacheData.c_str());
data >> revisionStr; data >> revisionStr;
if (revisionStr != "[TrafficManagerCachedata:ref:2011:09:04]") { if (revisionStr != "[TrafficManagerCachedata:ref:2011:09:04]") {
SG_LOG(SG_GENERAL, SG_ALERT,"Traffic Manager Warning: discarding outdated cachefile " << SG_LOG(SG_GENERAL, SG_ALERT,"Traffic Manager Warning: discarding outdated cachefile " <<
@ -434,7 +433,7 @@ void FGTrafficManager::readTimeTableFromFile(SGPath infileName)
string buffString; string buffString;
vector <string> tokens, depTime,arrTime; vector <string> tokens, depTime,arrTime;
vector <string>::iterator it; vector <string>::iterator it;
ifstream infile(infileName.str().c_str()); std::ifstream infile(infileName.str().c_str());
while (1) { while (1) {
infile.getline(buffer, 256); infile.getline(buffer, 256);
if (infile.eof()) { if (infile.eof()) {