From f034c452c5aad4f8a38045530486a6afd27aa215 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Fri, 25 Nov 2011 13:16:04 +0100 Subject: simplify attribute retrieval syntax a bit --- oox/inc/oox/mathml/importutils.hxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'oox') diff --git a/oox/inc/oox/mathml/importutils.hxx b/oox/inc/oox/mathml/importutils.hxx index 3a59320317aa..ca212aad8029 100644 --- a/oox/inc/oox/mathml/importutils.hxx +++ b/oox/inc/oox/mathml/importutils.hxx @@ -90,6 +90,15 @@ public: int token; ///< tag type, or XML_TOKEN_INVALID AttributeList attributes; rtl::OUString text; + /** + This function returns value of the given attribute, or the passed default value if not found. + The type of the default value selects the return type (OUString here). + */ + rtl::OUString attribute( int token, const rtl::OUString& def = rtl::OUString()) const; + /** + @overload + */ + bool attribute( int token, bool def ) const; /** Converts to true if the tag has a valid token, false otherwise. Allows simple usage in if(), for example 'if( XmlStream::Tag foo = stream.checkOpeningTag( footoken ))'. @@ -169,6 +178,18 @@ public: void appendCharacters( const rtl::OUString& characters ); }; +inline +rtl::OUString XmlStream::Tag::attribute( int t, const rtl::OUString& def ) const +{ + return attributes.attribute( t, def ); +} + +inline +bool XmlStream::Tag::attribute( int t, bool def ) const +{ + return attributes.attribute( t, def ); +} + } // namespace } // namespace -- cgit