From c64776029ebfe688390f1563be11f387cae91994 Mon Sep 17 00:00:00 2001 From: bcoconni Date: Mon, 11 Nov 2013 19:06:44 +0100 Subject: [PATCH] Removed the 'using::std' instructions from the headers as per James Turner request. Also took this opportunity to add a check in XMLVisitor::savePosition() against a null pointer. --- simgear/xml/easyxml.cxx | 9 ++++++--- simgear/xml/easyxml.hxx | 18 +++++++----------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/simgear/xml/easyxml.cxx b/simgear/xml/easyxml.cxx index bdb1358b..2a695359 100644 --- a/simgear/xml/easyxml.cxx +++ b/simgear/xml/easyxml.cxx @@ -24,7 +24,8 @@ #include using std::ifstream; - +using std::istream; +using std::string; //////////////////////////////////////////////////////////////////////// @@ -140,8 +141,10 @@ XMLAttributesDefault::setValue (const char * name, const char * value) void XMLVisitor::savePosition(void) { - column = XML_GetCurrentColumnNumber(parser); - line = XML_GetCurrentLineNumber(parser); + if (parser) { + column = XML_GetCurrentColumnNumber(parser); + line = XML_GetCurrentLineNumber(parser); + } } //////////////////////////////////////////////////////////////////////// diff --git a/simgear/xml/easyxml.hxx b/simgear/xml/easyxml.hxx index 92a5c95b..7f0c916e 100644 --- a/simgear/xml/easyxml.hxx +++ b/simgear/xml/easyxml.hxx @@ -15,10 +15,6 @@ #include #include -using std::istream; -using std::string; -using std::vector; - typedef struct XML_ParserStruct* XML_Parser; /** @@ -221,7 +217,7 @@ public: virtual void setValue (const char * name, const char * value); private: - vector _atts; + std::vector _atts; }; //////////////////////////////////////////////////////////////////////// @@ -385,7 +381,7 @@ public: * @param _path The path to the parsed file. * @see #getPath */ - void setPath(const string& _path) { path = _path; } + void setPath(const std::string& _path) { path = _path; } /** Get the path to the parsed file. * @@ -397,7 +393,7 @@ public: * @return the path to the parsed file. * @see #setPath */ - const string& getPath(void) const { return path; } + const std::string& getPath(void) const { return path; } /** Save the current position in the parsed file. * @@ -448,7 +444,7 @@ public: void setParser(XML_Parser _parser) { parser = _parser; } private: XML_Parser parser; - string path; + std::string path; int line, column; }; @@ -472,8 +468,8 @@ private: * is a problem reading the file. * @see XMLVisitor */ -extern void readXML (istream &input, XMLVisitor &visitor, - const string &path=""); +extern void readXML (std::istream &input, XMLVisitor &visitor, + const std::string &path=""); /** @@ -494,7 +490,7 @@ extern void readXML (istream &input, XMLVisitor &visitor, * is a problem reading the file. * @see XMLVisitor */ -extern void readXML (const string &path, XMLVisitor &visitor); +extern void readXML (const std::string &path, XMLVisitor &visitor); /** -- 2.39.5