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)
{
PropsVisitor visitor(start_node, file.utf8Str(), default_mode, extended);
readXML(file.local8BitStr(), visitor);
readXML(file, visitor);
if (visitor.hasException())
throw visitor.getException();
}

View File

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

View File

@ -11,10 +11,12 @@
#include <simgear/compiler.h>
#include <simgear/structure/exception.hxx>
#include <iostream>
#include <iosfwd>
#include <string>
#include <vector>
class SGPath;
typedef struct XML_ParserStruct* XML_Parser;
/**
@ -490,7 +492,7 @@ extern void readXML (std::istream &input, XMLVisitor &visitor,
* is a problem reading the file.
* @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