summaryrefslogtreecommitdiff
path: root/libopie2
authorsimon <simon>2002-03-20 21:08:03 (UTC)
committer simon <simon>2002-03-20 21:08:03 (UTC)
commit60b86269c6087dfb6674de6dc01d71a9a6d6d180 (patch) (unidiff)
treee53c76de63500dfe52b90c3da6c354b507cb4ba0 /libopie2
parent79d96ab3393af185b0f0d705e1b7ae74ee801241 (diff)
downloadopie-60b86269c6087dfb6674de6dc01d71a9a6d6d180.zip
opie-60b86269c6087dfb6674de6dc01d71a9a6d6d180.tar.gz
opie-60b86269c6087dfb6674de6dc01d71a9a6d6d180.tar.bz2
- speed up for attribute() and setAttribute()
- indentation fixlet (let's stay consistent :)
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/xmltree.cc17
1 files changed, 10 insertions, 7 deletions
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 )
89 if ( next ) 89 if ( next )
90 next->m_prev = newChild; 90 next->m_prev = newChild;
91} 91}
92QString XMLElement::attribute(const QString &attr )const 92
93QString XMLElement::attribute( const QString &attr ) const
93{ 94{
94 if ( !m_attributes.contains( attr ) )
95 return QString::null;
96 AttributeMap::ConstIterator it = m_attributes.find( attr ); 95 AttributeMap::ConstIterator it = m_attributes.find( attr );
96 if ( it == m_attributes.end() )
97 return QString::null;
97 return it.data(); 98 return it.data();
98} 99}
99void XMLElement::setAttribute(const QString &attr, const QString &value ) 100
101void XMLElement::setAttribute( const QString &attr, const QString &value )
100{ 102{
101 m_attributes.remove( attr ); 103 m_attributes.replace( attr, value );
102 m_attributes.insert( attr, value );
103} 104}
105
104void XMLElement::insertBefore( XMLElement *newChild, XMLElement *refChild ) 106void XMLElement::insertBefore( XMLElement *newChild, XMLElement *refChild )
105{ 107{
106 assert( refChild ); 108 assert( refChild );
@@ -315,4 +317,5 @@ XMLElement *XMLElement::load( const QString &fileName )
315 return handler.root();; 317 return handler.root();;
316} 318}
317 319
318 320/* vim: et sw=4
321 */