summaryrefslogtreecommitdiff
authorsimon <simon>2002-03-20 21:08:03 (UTC)
committer simon <simon>2002-03-20 21:08:03 (UTC)
commit60b86269c6087dfb6674de6dc01d71a9a6d6d180 (patch) (side-by-side diff)
treee53c76de63500dfe52b90c3da6c354b507cb4ba0
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 (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/xmltree.cc17
-rw-r--r--libopie2/opiecore/xmltree.cc17
2 files changed, 20 insertions, 14 deletions
diff --git a/libopie/xmltree.cc b/libopie/xmltree.cc
index 3d03cc6..408e3c6 100644
--- a/libopie/xmltree.cc
+++ b/libopie/xmltree.cc
@@ -86,24 +86,26 @@ void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild )
newChild->m_prev = refChild;
newChild->m_next = next;
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 );
assert( refChild->m_parent );
assert( refChild->m_parent == this );
assert( newChild != refChild );
@@ -312,7 +314,8 @@ XMLElement *XMLElement::load( const QString &fileName )
reader.setContentHandler( &handler );
reader.parse( src );
return handler.root();;
}
-
+/* vim: et sw=4
+ */
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
@@ -86,24 +86,26 @@ void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild )
newChild->m_prev = refChild;
newChild->m_next = next;
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 );
assert( refChild->m_parent );
assert( refChild->m_parent == this );
assert( newChild != refChild );
@@ -312,7 +314,8 @@ XMLElement *XMLElement::load( const QString &fileName )
reader.setContentHandler( &handler );
reader.parse( src );
return handler.root();;
}
-
+/* vim: et sw=4
+ */