Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QDomNamedNodeMap Class Reference

\reentrant More...

#include <qdom.h>

+ Collaboration diagram for QDomNamedNodeMap:

Public Member Functions

 QDomNamedNodeMap ()
 Constructs an empty named node map.
 
 QDomNamedNodeMap (const QDomNamedNodeMap &namedNodeMap)
 Constructs a copy of namedNodeMap.
 
QDomNamedNodeMapoperator= (const QDomNamedNodeMap &other)
 Assigns other to this named node map.
 
bool operator== (const QDomNamedNodeMap &other) const
 Returns true if other and this named node map are equal; otherwise returns false.
 
bool operator!= (const QDomNamedNodeMap &other) const
 Returns true if other and this named node map are not equal; otherwise returns false.
 
 ~QDomNamedNodeMap ()
 Destroys the object and frees its resources.
 
QDomNode namedItem (const QString &name) const
 Returns the node called name.
 
QDomNode setNamedItem (const QDomNode &newNode)
 Inserts the node newNode into the named node map.
 
QDomNode removeNamedItem (const QString &name)
 Removes the node called name from the map.
 
QDomNode item (int index) const
 Retrieves the node at position index.
 
QDomNode namedItemNS (const QString &nsURI, const QString &localName) const
 Returns the node associated with the local name localName and the namespace URI nsURI.
 
QDomNode setNamedItemNS (const QDomNode &newNode)
 Inserts the node newNode in the map.
 
QDomNode removeNamedItemNS (const QString &nsURI, const QString &localName)
 Removes the node with the local name localName and the namespace URI nsURI from the map.
 
int length () const
 Returns the number of nodes in the map.
 
int count () const
 This function is provided for Qt API consistency.
 
int size () const
 This function is provided for Qt API consistency.
 
bool isEmpty () const
 Returns true if the map is empty; otherwise returns false.
 
bool contains (const QString &name) const
 Returns true if the map contains a node called name; otherwise returns false.
 

Friends

class QDomNode
 
class QDomDocumentType
 
class QDomElement
 

Detailed Description

\reentrant

The QDomNamedNodeMap class contains a collection of nodes that can be accessed by name.

\inmodule QtXml

Note that QDomNamedNodeMap does not inherit from QDomNodeList. QDomNamedNodeMaps do not provide any specific node ordering. Although nodes in a QDomNamedNodeMap may be accessed by an ordinal index, this is simply to allow a convenient enumeration of the contents of a QDomNamedNodeMap, and does not imply that the DOM specifies an ordering of the nodes.

The QDomNamedNodeMap is used in three places: \list 1

Items in the map are identified by the name which QDomNode::name() returns. Nodes are retrieved using namedItem(), namedItemNS() or item(). New nodes are inserted with setNamedItem() or setNamedItemNS() and removed with removeNamedItem() or removeNamedItemNS(). Use contains() to see if an item with the given name is in the named node map. The number of items is returned by length().

Terminology: in this class we use "item" and "node" interchangeably.

Definition at line 356 of file qdom.h.

Constructor & Destructor Documentation

◆ QDomNamedNodeMap() [1/2]

QDomNamedNodeMap::QDomNamedNodeMap ( )

Constructs an empty named node map.

Definition at line 2693 of file qdom.cpp.

◆ QDomNamedNodeMap() [2/2]

QDomNamedNodeMap::QDomNamedNodeMap ( const QDomNamedNodeMap & namedNodeMap)

Constructs a copy of namedNodeMap.

Definition at line 2701 of file qdom.cpp.

References QBasicAtomicInteger< T >::ref(), and QDomNamedNodeMapPrivate::ref.

+ Here is the call graph for this function:

◆ ~QDomNamedNodeMap()

QDomNamedNodeMap::~QDomNamedNodeMap ( )

Destroys the object and frees its resources.

Definition at line 2749 of file qdom.cpp.

References QBasicAtomicInteger< T >::deref(), and QDomNamedNodeMapPrivate::ref.

+ Here is the call graph for this function:

Member Function Documentation

◆ contains()

bool QDomNamedNodeMap::contains ( const QString & name) const

Returns true if the map contains a node called name; otherwise returns false.

{Note:} This function does not take the presence of namespaces into account. Use namedItemNS() to test whether the map contains a node with a specific namespace URI and name.

Definition at line 2910 of file qdom.cpp.

References IMPL.

◆ count()

int QDomNamedNodeMap::count ( ) const
inline

This function is provided for Qt API consistency.

It is equivalent to length().

Definition at line 377 of file qdom.h.

◆ isEmpty()

bool QDomNamedNodeMap::isEmpty ( ) const
inline

Returns true if the map is empty; otherwise returns false.

This function is provided for Qt API consistency.

Definition at line 379 of file qdom.h.

◆ item()

QDomNode QDomNamedNodeMap::item ( int index) const

Retrieves the node at position index.

This can be used to iterate over the map. Note that the nodes in the map are ordered arbitrarily.

See also
length()

Definition at line 2812 of file qdom.cpp.

References IMPL, and QDomNode.

◆ length()

int QDomNamedNodeMap::length ( ) const

Returns the number of nodes in the map.

See also
item()

Definition at line 2876 of file qdom.cpp.

References IMPL.

◆ namedItem()

QDomNode QDomNamedNodeMap::namedItem ( const QString & name) const

Returns the node called name.

If the named node map does not contain such a node, a \l{QDomNode::isNull()}{null node} is returned. A node's name is the name returned by QDomNode::nodeName().

See also
setNamedItem(), namedItemNS()

Definition at line 2764 of file qdom.cpp.

References IMPL, and QDomNode.

◆ namedItemNS()

QDomNode QDomNamedNodeMap::namedItemNS ( const QString & nsURI,
const QString & localName ) const

Returns the node associated with the local name localName and the namespace URI nsURI.

If the map does not contain such a node, a \l{QDomNode::isNull()}{null node} is returned.

See also
setNamedItemNS(), namedItem()

Definition at line 2828 of file qdom.cpp.

References IMPL, and QDomNode.

◆ operator!=()

bool QDomNamedNodeMap::operator!= ( const QDomNamedNodeMap & other) const

Returns true if other and this named node map are not equal; otherwise returns false.

Definition at line 2741 of file qdom.cpp.

References operator==(), and other().

+ Here is the call graph for this function:

◆ operator=()

QDomNamedNodeMap & QDomNamedNodeMap::operator= ( const QDomNamedNodeMap & other)

Assigns other to this named node map.

Definition at line 2718 of file qdom.cpp.

References QBasicAtomicInteger< T >::deref(), other(), and QDomNamedNodeMapPrivate::ref.

+ Here is the call graph for this function:

◆ operator==()

bool QDomNamedNodeMap::operator== ( const QDomNamedNodeMap & other) const

Returns true if other and this named node map are equal; otherwise returns false.

Definition at line 2732 of file qdom.cpp.

References other().

Referenced by operator!=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeNamedItem()

QDomNode QDomNamedNodeMap::removeNamedItem ( const QString & name)

Removes the node called name from the map.

The function returns the removed node or a \l{QDomNode::isNull()}{null node} if the map did not contain a node called name.

See also
setNamedItem(), namedItem(), removeNamedItemNS()

Definition at line 2797 of file qdom.cpp.

References IMPL, and QDomNode.

◆ removeNamedItemNS()

QDomNode QDomNamedNodeMap::removeNamedItemNS ( const QString & nsURI,
const QString & localName )

Removes the node with the local name localName and the namespace URI nsURI from the map.

The function returns the removed node or a \l{QDomNode::isNull()}{null node} if the map did not contain a node with the local name localName and the namespace URI nsURI.

See also
setNamedItemNS(), namedItemNS(), removeNamedItem()

Definition at line 2861 of file qdom.cpp.

References IMPL, and QDomNode.

◆ setNamedItem()

QDomNode QDomNamedNodeMap::setNamedItem ( const QDomNode & newNode)

Inserts the node newNode into the named node map.

The name used by the map is the node name of newNode as returned by QDomNode::nodeName().

If the new node replaces an existing node, i.e. the map contains a node with the same name, the replaced node is returned.

See also
namedItem(), removeNamedItem(), setNamedItemNS()

Definition at line 2781 of file qdom.cpp.

References IMPL, QDomNode::impl, and QDomNode.

◆ setNamedItemNS()

QDomNode QDomNamedNodeMap::setNamedItemNS ( const QDomNode & newNode)

Inserts the node newNode in the map.

If a node with the same namespace URI and the same local name already exists in the map, it is replaced by newNode. If the new node replaces an existing node, the replaced node is returned.

See also
namedItemNS(), removeNamedItemNS(), setNamedItem()

Definition at line 2843 of file qdom.cpp.

References IMPL, QDomNode::impl, and QDomNode.

◆ size()

int QDomNamedNodeMap::size ( ) const
inline

This function is provided for Qt API consistency.

It is equivalent to length().

Definition at line 378 of file qdom.h.

Friends And Related Symbol Documentation

◆ QDomDocumentType

friend class QDomDocumentType
friend

Definition at line 389 of file qdom.h.

◆ QDomElement

friend class QDomElement
friend

Definition at line 390 of file qdom.h.

◆ QDomNode

friend class QDomNode
friend

The documentation for this class was generated from the following files: