summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -91,14 +91,16 @@ void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild )
}
-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 )
@@ -317,2 +319,3 @@ XMLElement *XMLElement::load( const QString &fileName )
-
+/* 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
@@ -91,14 +91,16 @@ void XMLElement::insertAfter( XMLElement *newChild, XMLElement *refChild )
}
-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 )
@@ -317,2 +319,3 @@ XMLElement *XMLElement::load( const QString &fileName )
-
+/* vim: et sw=4
+ */