From 60b86269c6087dfb6674de6dc01d71a9a6d6d180 Mon Sep 17 00:00:00 2001 From: simon Date: Wed, 20 Mar 2002 21:08:03 +0000 Subject: - speed up for attribute() and setAttribute() - indentation fixlet (let's stay consistent :) --- (limited to 'libopie2') diff --git a/libopie2/opiecore/xmltree.cc b/libopie2/opiecore/xmltree.cc index 3d03cc6..408e3c6 100644 --- a/libopie2/opiecore/xmltree.cc +++ b/libopie2/opiecore/xmltree.cc @@ -89,18 +89,20 @@ void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild ) if ( next ) next->m_prev = newChild; } -QString XMLElement::attribute(const QString &attr )const + +QString XMLElement::attribute( const QString &attr ) const { - if ( !m_attributes.contains( attr ) ) - return QString::null; AttributeMap::ConstIterator it = m_attributes.find( attr ); + if ( it == m_attributes.end() ) + return QString::null; return it.data(); } -void XMLElement::setAttribute(const QString &attr, const QString &value ) + +void XMLElement::setAttribute( const QString &attr, const QString &value ) { - m_attributes.remove( attr ); - m_attributes.insert( attr, value ); + m_attributes.replace( attr, value ); } + void XMLElement::insertBefore( XMLElement *newChild, XMLElement *refChild ) { assert( refChild ); @@ -315,4 +317,5 @@ XMLElement *XMLElement::load( const QString &fileName ) return handler.root();; } - +/* vim: et sw=4 + */ -- cgit v0.9.0.2