From: James Turner Date: Sun, 9 Jun 2013 18:18:02 +0000 (+0100) Subject: EasyXML: expose attributes easier. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=848965e7f07c0da4bb5f15674c9501fcfa37cd18;p=simgear.git EasyXML: expose attributes easier. --- diff --git a/simgear/xml/easyxml.cxx b/simgear/xml/easyxml.cxx index 5cccdc48..c2fc1213 100644 --- a/simgear/xml/easyxml.cxx +++ b/simgear/xml/easyxml.cxx @@ -141,19 +141,6 @@ XMLAttributesDefault::setValue (const char * name, const char * value) // Attribute list wrapper for Expat. //////////////////////////////////////////////////////////////////////// -class ExpatAtts : public XMLAttributes -{ -public: - ExpatAtts (const char ** atts) : _atts(atts) {} - - virtual int size () const; - virtual const char * getName (int i) const; - virtual const char * getValue (int i) const; - -private: - const char ** _atts; -}; - int ExpatAtts::size () const { @@ -175,6 +162,11 @@ ExpatAtts::getValue (int i) const return _atts[i*2+1]; } +const char * +ExpatAtts::getValue (const char * name) const +{ + return XMLAttributes::getValue(name); +} //////////////////////////////////////////////////////////////////////// diff --git a/simgear/xml/easyxml.hxx b/simgear/xml/easyxml.hxx index f5ff575d..6356901b 100644 --- a/simgear/xml/easyxml.hxx +++ b/simgear/xml/easyxml.hxx @@ -223,6 +223,24 @@ private: vector _atts; }; +//////////////////////////////////////////////////////////////////////// +// Attribute list wrapper for Expat. +//////////////////////////////////////////////////////////////////////// + +class ExpatAtts : public XMLAttributes +{ +public: + ExpatAtts (const char ** atts) : _atts(atts) {} + + virtual int size () const; + virtual const char * getName (int i) const; + virtual const char * getValue (int i) const; + + virtual const char * getValue (const char * name) const; +private: + const char ** _atts; +}; + /** * Visitor class for an XML document.