From 8852bf55a3928a940ff1305f95426695095efacc Mon Sep 17 00:00:00 2001 From: Bertrand Coconnier Date: Tue, 1 Feb 2022 21:55:03 +0100 Subject: [PATCH] `SGPropertyNode::getName()` has been removed from official SimGear. The SimGear project advises to use `SGPropertyNode::getNameString()` instead. JSBSim uses a simplified version of `SGPropertyNode` so the method `getName` has been removed to mimick the new official SimGear API. --- src/FGFDMExec.cpp | 2 +- src/input_output/FGPropertyManager.cpp | 11 ++--------- src/input_output/FGPropertyManager.h | 2 +- src/models/flight_control/FGDeadBand.cpp | 2 +- src/models/flight_control/FGFCSFunction.cpp | 2 +- src/models/flight_control/FGFilter.cpp | 2 +- src/models/flight_control/FGGain.cpp | 2 +- src/models/flight_control/FGKinemat.cpp | 2 +- src/models/flight_control/FGPID.cpp | 2 +- src/models/flight_control/FGSensor.cpp | 2 +- src/models/flight_control/FGSwitch.cpp | 2 +- src/simgear/props/props.cxx | 8 ++++---- src/simgear/props/props.hxx | 6 ------ 13 files changed, 16 insertions(+), 29 deletions(-) diff --git a/src/FGFDMExec.cpp b/src/FGFDMExec.cpp index 8a5a33a0a2..796e68d742 100644 --- a/src/FGFDMExec.cpp +++ b/src/FGFDMExec.cpp @@ -998,7 +998,7 @@ void FGFDMExec::BuildPropertyCatalog(struct PropertyCatalogStructure* pcs) for (int i=0; inode->nChildren(); i++) { string access=""; - pcsNew->base_string = pcs->base_string + "/" + pcs->node->getChild(i)->getName(); + pcsNew->base_string = pcs->base_string + "/" + pcs->node->getChild(i)->getNameString(); int node_idx = pcs->node->getChild(i)->getIndex(); if (node_idx != 0) { pcsNew->base_string = CreateIndexedPropertyName(pcsNew->base_string, node_idx); diff --git a/src/input_output/FGPropertyManager.cpp b/src/input_output/FGPropertyManager.cpp index 6f2f3801ec..9ec56b539f 100644 --- a/src/input_output/FGPropertyManager.cpp +++ b/src/input_output/FGPropertyManager.cpp @@ -111,16 +111,9 @@ bool FGPropertyNode::HasNode (const string &path) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -string FGPropertyNode::GetName( void ) const -{ - return string( getName() ); -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - string FGPropertyNode::GetPrintableName( void ) const { - string temp_string(getName()); + string temp_string(getNameString()); size_t initial_location=0; size_t found_location; @@ -317,7 +310,7 @@ void FGPropertyManager::Untie(const string &name) void FGPropertyManager::Untie(SGPropertyNode *property) { - const char *name = property->getName(); + const string& name = property->getNameString(); assert(property->isTied()); diff --git a/src/input_output/FGPropertyManager.h b/src/input_output/FGPropertyManager.h index 81c9a049ef..0e2d3a1a21 100644 --- a/src/input_output/FGPropertyManager.h +++ b/src/input_output/FGPropertyManager.h @@ -97,7 +97,7 @@ class FGPropertyNode : public SGPropertyNode /** * Get the name of a node */ - std::string GetName( void ) const; + const std::string& GetName( void ) const { return getNameString(); } /** * Get the name of a node without underscores, etc. diff --git a/src/models/flight_control/FGDeadBand.cpp b/src/models/flight_control/FGDeadBand.cpp index 51374a482b..a9c7dc6b2b 100644 --- a/src/models/flight_control/FGDeadBand.cpp +++ b/src/models/flight_control/FGDeadBand.cpp @@ -132,7 +132,7 @@ void FGDeadBand::Debug(int from) cout << " GAIN: " << gain << endl; for (auto node: OutputNodes) - cout << " OUTPUT: " << node->getName() << endl; + cout << " OUTPUT: " << node->getNameString() << endl; } } if (debug_lvl & 2 ) { // Instantiation/Destruction notification diff --git a/src/models/flight_control/FGFCSFunction.cpp b/src/models/flight_control/FGFCSFunction.cpp index d1b9be310b..64d516e88c 100644 --- a/src/models/flight_control/FGFCSFunction.cpp +++ b/src/models/flight_control/FGFCSFunction.cpp @@ -121,7 +121,7 @@ void FGFCSFunction::Debug(int from) if (!InputNodes.empty()) cout << " INPUT: " << InputNodes[0]->GetName() << endl; for (auto node: OutputNodes) - cout << " OUTPUT: " << node->getName() << endl; + cout << " OUTPUT: " << node->getNameString() << endl; } } if (debug_lvl & 2 ) { // Instantiation/Destruction notification diff --git a/src/models/flight_control/FGFilter.cpp b/src/models/flight_control/FGFilter.cpp index eb33e70fcd..a1a5fd6a68 100644 --- a/src/models/flight_control/FGFilter.cpp +++ b/src/models/flight_control/FGFilter.cpp @@ -227,7 +227,7 @@ void FGFilter::Debug(int from) } for (auto node: OutputNodes) - cout << " OUTPUT: " << node->getName() << endl; + cout << " OUTPUT: " << node->getNameString() << endl; } } if (debug_lvl & 2 ) { // Instantiation/Destruction notification diff --git a/src/models/flight_control/FGGain.cpp b/src/models/flight_control/FGGain.cpp index fcf002b00a..cb8eb117a6 100644 --- a/src/models/flight_control/FGGain.cpp +++ b/src/models/flight_control/FGGain.cpp @@ -200,7 +200,7 @@ void FGGain::Debug(int from) cout << " GAIN: " << Gain->GetName() << endl; for (auto node: OutputNodes) - cout << " OUTPUT: " << node->getName() << endl; + cout << " OUTPUT: " << node->getNameString() << endl; if (Type == "AEROSURFACE_SCALE") { cout << " In/Out Mapping:" << endl; diff --git a/src/models/flight_control/FGKinemat.cpp b/src/models/flight_control/FGKinemat.cpp index 791224732b..c15dc661ef 100644 --- a/src/models/flight_control/FGKinemat.cpp +++ b/src/models/flight_control/FGKinemat.cpp @@ -185,7 +185,7 @@ void FGKinemat::Debug(int from) cout << " " << Detents[i] << " " << TransitionTimes[i] << endl; } for (auto node: OutputNodes) - cout << " OUTPUT: " << node->getName() << endl; + cout << " OUTPUT: " << node->getNameString() << endl; if (!DoScale) cout << " NOSCALE" << endl; } } diff --git a/src/models/flight_control/FGPID.cpp b/src/models/flight_control/FGPID.cpp index 2b4b7ee4fe..330b2a95ca 100644 --- a/src/models/flight_control/FGPID.cpp +++ b/src/models/flight_control/FGPID.cpp @@ -239,7 +239,7 @@ void FGPID::Debug(int from) cout << " INPUT: " << InputNodes[0]->GetNameWithSign() << endl; for (auto node: OutputNodes) - cout << " OUTPUT: " << node->getName() << endl; + cout << " OUTPUT: " << node->getNameString() << endl; } } if (debug_lvl & 2 ) { // Instantiation/Destruction notification diff --git a/src/models/flight_control/FGSensor.cpp b/src/models/flight_control/FGSensor.cpp index ed255a54f7..1ff17820d3 100644 --- a/src/models/flight_control/FGSensor.cpp +++ b/src/models/flight_control/FGSensor.cpp @@ -335,7 +335,7 @@ void FGSensor::Debug(int from) } } for (auto node: OutputNodes) - cout << " OUTPUT: " << node->getName() << endl; + cout << " OUTPUT: " << node->getNameString() << endl; } } if (debug_lvl & 2 ) { // Instantiation/Destruction notification diff --git a/src/models/flight_control/FGSwitch.cpp b/src/models/flight_control/FGSwitch.cpp index 3040fad82a..7925811e1f 100644 --- a/src/models/flight_control/FGSwitch.cpp +++ b/src/models/flight_control/FGSwitch.cpp @@ -206,7 +206,7 @@ void FGSwitch::Debug(int from) ++i; } for (auto node: OutputNodes) - cout << " OUTPUT: " << node->getName() << endl; + cout << " OUTPUT: " << node->getNameString() << endl; } } if (debug_lvl & 2 ) { // Instantiation/Destruction notification diff --git a/src/simgear/props/props.cxx b/src/simgear/props/props.cxx index eb80de91cd..1082f713fe 100644 --- a/src/simgear/props/props.cxx +++ b/src/simgear/props/props.cxx @@ -328,7 +328,7 @@ find_child (Itr begin, Itr end, int index, const PropertyList& nodes) #if PROPS_STANDALONE for (size_t i = 0; i < nNodes; i++) { SGPropertyNode * node = nodes[i]; - if (node->getIndex() == index && compare_strings(node->getName(), begin)) + if (node->getIndex() == index && compare_strings(node->getNameString().c_str(), begin)) return i; } #else @@ -356,7 +356,7 @@ find_last_child (const char * name, const PropertyList& nodes) for (size_t i = 0; i < nNodes; i++) { SGPropertyNode * node = nodes[i]; - if (compare_strings(node->getName(), name)) + if (compare_strings(node->getNameString().c_str(), name)) { int idx = node->getIndex(); if (idx > index) index = idx; @@ -1186,7 +1186,7 @@ SGPropertyNode::getChildren (const char * name) const size_t max = _children.size(); for (size_t i = 0; i < max; i++) - if (compare_strings(_children[i]->getName(), name)) + if (compare_strings(_children[i]->getNameString().c_str(), name)) children.push_back(_children[i]); sort(children.begin(), children.end(), CompareIndices()); @@ -1241,7 +1241,7 @@ SGPropertyNode::removeChildren(const char * name) PropertyList children; for (int pos = static_cast(_children.size() - 1); pos >= 0; pos--) - if (compare_strings(_children[pos]->getName(), name)) + if (compare_strings(_children[pos]->getNameString().c_str(), name)) children.push_back(removeChild(pos)); sort(children.begin(), children.end(), CompareIndices()); diff --git a/src/simgear/props/props.hxx b/src/simgear/props/props.hxx index 76adf9d1c8..ee19d1e55b 100644 --- a/src/simgear/props/props.hxx +++ b/src/simgear/props/props.hxx @@ -817,12 +817,6 @@ public: */ bool hasValue () const { return (_type != simgear::props::NONE); } - - /** - * Get the node's simple (XML) name. - */ - const char * getName () const { return _name.c_str(); } - /** * Get the node's simple name as a string. */