SGPath in easyXML API

This commit is contained in:
James Turner 2016-07-03 23:41:07 +01:00
parent ca84d2046a
commit a636da6959
3 changed files with 18 additions and 14 deletions

View File

@ -438,7 +438,7 @@ readProperties (const SGPath &file, SGPropertyNode * start_node,
int default_mode, bool extended) int default_mode, bool extended)
{ {
PropsVisitor visitor(start_node, file.utf8Str(), default_mode, extended); PropsVisitor visitor(start_node, file.utf8Str(), default_mode, extended);
readXML(file.local8BitStr(), visitor); readXML(file, visitor);
if (visitor.hasException()) if (visitor.hasException())
throw visitor.getException(); throw visitor.getException();
} }

View File

@ -23,6 +23,9 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <simgear/misc/sgstream.hxx>
#include <simgear/misc/sg_path.hxx>
using std::ifstream; using std::ifstream;
using std::istream; using std::istream;
using std::string; using std::string;
@ -283,12 +286,12 @@ readXML (istream &input, XMLVisitor &visitor, const string &path)
} }
void void
readXML (const string &path, XMLVisitor &visitor) readXML (const SGPath &path, XMLVisitor &visitor)
{ {
ifstream input(path.c_str()); sg_ifstream input(path);
if (input.good()) { if (input.good()) {
try { try {
readXML(input, visitor, path); readXML(input, visitor, path.utf8Str());
} catch (sg_io_exception &) { } catch (sg_io_exception &) {
input.close(); input.close();
throw; throw;

View File

@ -11,10 +11,12 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/structure/exception.hxx> #include <simgear/structure/exception.hxx>
#include <iostream> #include <iosfwd>
#include <string> #include <string>
#include <vector> #include <vector>
class SGPath;
typedef struct XML_ParserStruct* XML_Parser; typedef struct XML_ParserStruct* XML_Parser;
/** /**
@ -490,7 +492,7 @@ extern void readXML (std::istream &input, XMLVisitor &visitor,
* is a problem reading the file. * is a problem reading the file.
* @see XMLVisitor * @see XMLVisitor
*/ */
extern void readXML (const std::string &path, XMLVisitor &visitor); extern void readXML (const SGPath &path, XMLVisitor &visitor);
/** /**
@ -516,4 +518,3 @@ extern void readXML (const char *buf, const int size, XMLVisitor &visitor);
#endif // __EASYXML_HXX #endif // __EASYXML_HXX