Qt 4.8
|
The QDomNamedNodeMap class contains a collection of nodes that can be accessed by name. More...
#include <qdom.h>
Public Functions | |
bool | contains (const QString &name) const |
Returns true if the map contains a node called name; otherwise returns false. More... | |
int | count () const |
This function is provided for Qt API consistency. More... | |
bool | isEmpty () const |
Returns true if the map is empty; otherwise returns false. More... | |
QDomNode | item (int index) const |
Retrieves the node at position index. More... | |
uint | length () const |
Returns the number of nodes in the map. More... | |
QDomNode | namedItem (const QString &name) const |
Returns the node called name. More... | |
QDomNode | namedItemNS (const QString &nsURI, const QString &localName) const |
Returns the node associated with the local name localName and the namespace URI nsURI. More... | |
bool | operator!= (const QDomNamedNodeMap &) const |
Returns true if n and this named node map are not equal; otherwise returns false. More... | |
QDomNamedNodeMap & | operator= (const QDomNamedNodeMap &) |
Assigns n to this named node map. More... | |
bool | operator== (const QDomNamedNodeMap &) const |
Returns true if n and this named node map are equal; otherwise returns false. More... | |
QDomNamedNodeMap () | |
Constructs an empty named node map. More... | |
QDomNamedNodeMap (const QDomNamedNodeMap &) | |
Constructs a copy of n. More... | |
QDomNode | removeNamedItem (const QString &name) |
Removes the node called name from the map. More... | |
QDomNode | removeNamedItemNS (const QString &nsURI, const QString &localName) |
Removes the node with the local name localName and the namespace URI nsURI from the map. More... | |
QDomNode | setNamedItem (const QDomNode &newNode) |
Inserts the node newNode into the named node map. More... | |
QDomNode | setNamedItemNS (const QDomNode &newNode) |
Inserts the node newNode in the map. More... | |
int | size () const |
This function is provided for Qt API consistency. More... | |
~QDomNamedNodeMap () | |
Destroys the object and frees its resources. More... | |
Private Functions | |
QDomNamedNodeMap (QDomNamedNodeMapPrivate *) | |
Properties | |
QDomNamedNodeMapPrivate * | impl |
Friends | |
class | QDomDocumentType |
class | QDomElement |
class | QDomNode |
The QDomNamedNodeMap class contains a collection of nodes that can be accessed by name.
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:
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.
QDomNamedNodeMap::QDomNamedNodeMap | ( | ) |
QDomNamedNodeMap::QDomNamedNodeMap | ( | const QDomNamedNodeMap & | n | ) |
QDomNamedNodeMap::~QDomNamedNodeMap | ( | ) |
|
private |
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 3521 of file qdom.cpp.
|
inline |
This function is provided for Qt API consistency.
It is equivalent to length().
Definition at line 383 of file qdom.h.
|
inline |
Returns true if the map is empty; otherwise returns false.
This function is provided for Qt API consistency.
Definition at line 385 of file qdom.h.
QDomNode QDomNamedNodeMap::item | ( | int | index | ) | const |
uint QDomNamedNodeMap::length | ( | ) | const |
Returns the node called name.
If the named node map does not contain such a node, a null node is returned. A node's name is the name returned by QDomNode::nodeName().
Definition at line 3366 of file qdom.cpp.
Returns the node associated with the local name localName and the namespace URI nsURI.
If the map does not contain such a node, a null node is returned.
Definition at line 3430 of file qdom.cpp.
bool QDomNamedNodeMap::operator!= | ( | const QDomNamedNodeMap & | n | ) | const |
QDomNamedNodeMap & QDomNamedNodeMap::operator= | ( | const QDomNamedNodeMap & | n | ) |
bool QDomNamedNodeMap::operator== | ( | const QDomNamedNodeMap & | n | ) | const |
Removes the node with the local name localName and the namespace URI nsURI from the map.
The function returns the removed node or a null node if the map did not contain a node with the local name localName and the namespace URI nsURI.
Definition at line 3463 of file qdom.cpp.
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.
Definition at line 3383 of file qdom.cpp.
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.
Definition at line 3445 of file qdom.cpp.
|
inline |
This function is provided for Qt API consistency.
It is equivalent to length().
Definition at line 384 of file qdom.h.
|
friend |
|
friend |
|
private |
Definition at line 391 of file qdom.h.
Referenced by operator!=(), operator=(), operator==(), and QDomNamedNodeMap().