From: James Turner Date: Sun, 3 Jul 2016 22:43:39 +0000 (+0100) Subject: Update for path-aware easyXML API X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c00bc0163f5f0c9067ae38c73695f90b383b53f5;p=flightgear.git Update for path-aware easyXML API --- diff --git a/src/Airports/xmlloader.cxx b/src/Airports/xmlloader.cxx index d5b90ad2f..1ad823919 100644 --- a/src/Airports/xmlloader.cxx +++ b/src/Airports/xmlloader.cxx @@ -54,7 +54,7 @@ void XMLLoader::load(FGGroundNetwork* net) t.stamp(); try { FGGroundNetXMLLoader visitor(net); - readXML(path.local8BitStr(), visitor); + readXML(path, visitor); } catch (sg_exception& e) { SG_LOG(SG_NAVAID, SG_INFO, "parsing groundnet XML failed:" << e.getFormattedMessage()); } @@ -106,7 +106,7 @@ bool XMLLoader::loadAirportXMLDataIntoVisitor(const string& aICAO, } SG_LOG(SG_GENERAL, SG_DEBUG, "loadAirportXMLDataIntoVisitor: loading from " << path); - readXML(path.local8BitStr(), aVisitor); + readXML(path, aVisitor); return true; } diff --git a/src/FDM/YASim/YASim.cxx b/src/FDM/YASim/YASim.cxx index 22073380a..868f65f88 100644 --- a/src/FDM/YASim/YASim.cxx +++ b/src/FDM/YASim/YASim.cxx @@ -170,7 +170,7 @@ void YASim::init() f.append(fgGetString("/sim/aero")); f.concat(".xml"); try { - readXML(f.local8BitStr(), *_fdm); + readXML(f, *_fdm); } catch (const sg_exception &e) { SG_LOG(SG_FLIGHT, SG_ALERT, "Error reading YASim FDM: '" << f << "'" << std::endl diff --git a/src/FDM/YASim/proptest.cpp b/src/FDM/YASim/proptest.cpp index cc4ffc421..49abc1916 100644 --- a/src/FDM/YASim/proptest.cpp +++ b/src/FDM/YASim/proptest.cpp @@ -52,7 +52,7 @@ int main(int argc, char** argv) // Read try { - readXML(argv[1], fdm); + readXML(SGPath::fromLocal8Bit(argv[1]), fdm); } catch (const sg_exception &e) { printf("XML parse error: %s (%s)\n", e.getFormattedMessage().c_str(), e.getOrigin()); diff --git a/src/FDM/YASim/yasim-test.cpp b/src/FDM/YASim/yasim-test.cpp index 87b834e53..dbd860887 100644 --- a/src/FDM/YASim/yasim-test.cpp +++ b/src/FDM/YASim/yasim-test.cpp @@ -83,7 +83,7 @@ int main(int argc, char** argv) // Read try { string file = argv[1]; - readXML(file, *fdm); + readXML(SGPath(file), *fdm); } catch (const sg_exception &e) { printf("XML parse error: %s (%s)\n", e.getFormattedMessage().c_str(), e.getOrigin()); diff --git a/src/Navaids/FlightPlan.cxx b/src/Navaids/FlightPlan.cxx index d5f91323d..6e2658da2 100644 --- a/src/Navaids/FlightPlan.cxx +++ b/src/Navaids/FlightPlan.cxx @@ -727,7 +727,7 @@ bool FlightPlan::loadGpxFormat(const SGPath& path) GpxXmlVisitor gpxVistor(this); try { - readXML(path.local8BitStr(), gpxVistor); + readXML(path, gpxVistor); } catch (sg_exception& e) { // XML parsing fails => not a GPX XML file diff --git a/src/Navaids/route.cxx b/src/Navaids/route.cxx index 43109b85a..780489eba 100644 --- a/src/Navaids/route.cxx +++ b/src/Navaids/route.cxx @@ -379,7 +379,7 @@ void RouteBase::loadAirportProcedures(const SGPath& aPath, FGAirport* aApt) assert(aApt); try { NavdataVisitor visitor(aApt, aPath); - readXML(aPath.local8BitStr(), visitor); + readXML(aPath, visitor); } catch (sg_io_exception& ex) { SG_LOG(SG_NAVAID, SG_WARN, "failure parsing procedures: " << aPath << "\n\t" << ex.getMessage() << "\n\tat:" << ex.getLocation().asString()); diff --git a/src/Traffic/TrafficMgr.cxx b/src/Traffic/TrafficMgr.cxx index e4596a5d5..c9908cb7d 100644 --- a/src/Traffic/TrafficMgr.cxx +++ b/src/Traffic/TrafficMgr.cxx @@ -167,7 +167,7 @@ public: SGPath path = globals->get_fg_root(); path.append("/Traffic/"); path.append(attval); - readXML(path.local8BitStr(), *this); + readXML(path, *this); } elementValueStack.push_back(""); // cout << " " << atts.getName(i) << '=' << atts.getValue(i) << endl; @@ -385,7 +385,7 @@ private: SG_LOG(SG_AI, SG_INFO, "parsing traffic in:" << p); simgear::PathList trafficFiles = d2.children(simgear::Dir::TYPE_FILE, ".xml"); BOOST_FOREACH(SGPath xml, trafficFiles) { - readXML(xml.local8BitStr(), *this); + readXML(xml, *this); if (_cancelThread) { return; } @@ -564,7 +564,7 @@ void FGTrafficManager::init() // use a SchedulerParser to parse, but run it in this thread, // i.e don't start it ScheduleParseThread parser(this); - readXML(path.local8BitStr(), parser); + readXML(path, parser); } } else if (path.extension() == "conf") { if (path.exists()) {