From 848965e7f07c0da4bb5f15674c9501fcfa37cd18 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sun, 9 Jun 2013 19:18:02 +0100 Subject: [PATCH] EasyXML: expose attributes easier. --- simgear/xml/easyxml.cxx | 18 +++++------------- simgear/xml/easyxml.hxx | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 13 deletions(-) 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. -- 2.39.5