Skip to content

Commit

Permalink
Fix: Don't pollute global namespace with std. (JSBSim-Team#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbirkhold authored and bcoconni committed Nov 24, 2024
1 parent 1dc9e11 commit f6ae92e
Show file tree
Hide file tree
Showing 20 changed files with 191 additions and 182 deletions.
2 changes: 1 addition & 1 deletion matlab/JSBSimInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ JSBSimInterface::~JSBSimInterface(void)
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool JSBSimInterface::OpenAircraft(const string& acName)
bool JSBSimInterface::OpenAircraft(const std::string& acName)
{

if (!fdmExec->GetAircraft()->GetAircraftName().empty()) return false;
Expand Down
2 changes: 1 addition & 1 deletion src/initialization/FGLinearization.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class JSBSIM_API FGLinearization
{
Vector2D<double> A,B,C,D;
std::vector<double> x0, u0, y0;
std::vector<string> x_names, u_names, y_names, x_units, u_units, y_units;
std::vector<std::string> x_names, u_names, y_names, x_units, u_units, y_units;
std::string aircraft_name;
public:
/**
Expand Down
2 changes: 1 addition & 1 deletion src/initialization/FGTrim.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ CLASS DOCUMENTATION
fgic->SetAltitudeFtIC(1000);
fgic->SetClimbRate(500);
if( !fgt.DoTrim() ) {
cout << "Trim Failed" << endl;
std::cout << "Trim Failed" << std::endl;
}
fgt.Report();
@endcode
Expand Down
6 changes: 3 additions & 3 deletions src/input_output/FGPropertyManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -468,15 +468,15 @@ class JSBSIM_API FGPropertyManager
{
SGPropertyNode* property = root->getNode(name.c_str(), true);
if (!property) {
cerr << "Could not get or create property " << name << endl;
std::cerr << "Could not get or create property " << name << std::endl;
return;
}

if (!property->tie(SGRawValuePointer<T>(pointer), false))
cerr << "Failed to tie property " << name << " to a pointer" << endl;
std::cerr << "Failed to tie property " << name << " to a pointer" << std::endl;
else {
tied_properties.push_back(PropertyState(property, nullptr));
if (FGJSBBase::debug_lvl & 0x20) cout << name << endl;
if (FGJSBBase::debug_lvl & 0x20) std::cout << name << std::endl;
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/math/FGParameterValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ class JSBSIM_API FGParameterValue : public FGParameter
FGParameterValue(Element* el, std::shared_ptr<FGPropertyManager> pm)
: FGParameterValue(el->GetDataLine(), pm, el)
{
string value = el->GetDataLine();
std::string value = el->GetDataLine();

if (el->GetNumDataLines() != 1 || value.empty()) {
cerr << el->ReadFrom()
<< "The element <" << el->GetName()
<< "> must either contain a value number or a property name."
<< endl;
std::cerr << el->ReadFrom()
<< "The element <" << el->GetName()
<< "> must either contain a value number or a property name."
<< std::endl;
throw BaseException("FGParameterValue: Illegal argument defining: " + el->GetName());
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/math/FGPropertyValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ INCLUDES

#include "FGPropertyValue.h"

using namespace std;

namespace JSBSim {

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
4 changes: 2 additions & 2 deletions src/models/FGAerodynamics.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ class JSBSIM_API FGAerodynamics : public FGModel
typedef double (FGAerodynamics::*PMF)(int) const;
void DetermineAxisSystem(Element* document);
void ProcessAxesNameAndFrame(FGAerodynamics::eAxisType& axisType,
const string& name, const string& frame,
Element* el, const string& validNames);
const std::string& name, const std::string& frame,
Element* el, const std::string& validNames);
void bind(void);
void BuildStabilityTransformMatrices(void);

Expand Down
2 changes: 2 additions & 0 deletions src/models/FGAtmosphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ INCLUDES
#include "FGAtmosphere.h"
#include "input_output/FGLog.h"

using namespace std;

namespace JSBSim {

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
4 changes: 2 additions & 2 deletions src/models/FGAtmosphere.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ class JSBSIM_API FGAtmosphere : public FGModel {
/// Check that the pressure is within plausible boundaries.
/// @param msg Message to display if the pressure is out of boundaries
/// @param quiet Don't display the message if set to true
double ValidatePressure(double p, const string& msg, bool quiet=false) const;
double ValidatePressure(double p, const std::string& msg, bool quiet=false) const;

/// Check that the temperature is within plausible boundaries.
/// @param msg Message to display if the pressure is out of boundaries
/// @param quiet Don't display the message if set to true
double ValidateTemperature(double t, const string& msg, bool quiet=false) const;
double ValidateTemperature(double t, const std::string& msg, bool quiet=false) const;

/// @name ISA constants
//@{
Expand Down
2 changes: 2 additions & 0 deletions src/models/atmosphere/FGStandardAtmosphere.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ INCLUDES
#include "FGStandardAtmosphere.h"
#include "input_output/FGLog.h"

using namespace std;

namespace JSBSim {

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down
4 changes: 2 additions & 2 deletions src/models/propulsion/FGTurbine.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class FGSpoolUp : public FGParameter
public:
FGSpoolUp(FGTurbine* _turb, double BPR, double factor)
: turb(_turb), delay(factor * 90.0 / (BPR + 3.0)) {}
string GetName(void) const { return string(); };
std::string GetName(void) const { return std::string(); };
double GetValue(void) const {
// adjust acceleration for N2 and atmospheric density
double n = std::min(1.0, turb->N2norm + 0.1);
Expand All @@ -345,7 +345,7 @@ class FGSimplifiedTSFC : public FGParameter
FGSimplifiedTSFC(FGTurbine* _turb, double tsfcVal)
: turb(_turb), tsfc(tsfcVal) {}

string GetName(void) const { return string(); }
std::string GetName(void) const { return std::string(); }

double GetValue(void) const {
// Correction/denormalisation for temp and thrust
Expand Down
1 change: 1 addition & 0 deletions src/simgear/props/props.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ using std::vector;
using std::stringstream;

using namespace simgear;
using namespace std;

////////////////////////////////////////////////////////////////////////
// Local classes.
Expand Down
2 changes: 0 additions & 2 deletions src/simgear/props/props.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ namespace boost {
// XXX This whole file should be in the simgear namespace, but I don't
// have the guts yet...

using namespace std;

namespace simgear
{

Expand Down
Loading

0 comments on commit f6ae92e

Please sign in to comment.