Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QDomNamedNodeMap Class

TheQDomNamedNodeMap class contains a collection of nodes that can be accessed by name.More...

Header:#include <QDomNamedNodeMap>

Note: All functions in this class arereentrant.

Public Functions

QDomNamedNodeMap()
QDomNamedNodeMap(const QDomNamedNodeMap & n)
~QDomNamedNodeMap()
boolcontains(const QString & name) const
intcount() const
boolisEmpty() const
QDomNodeitem(int index) const
uintlength() const
QDomNodenamedItem(const QString & name) const
QDomNodenamedItemNS(const QString & nsURI, const QString & localName) const
QDomNoderemoveNamedItem(const QString & name)
QDomNoderemoveNamedItemNS(const QString & nsURI, const QString & localName)
QDomNodesetNamedItem(const QDomNode & newNode)
QDomNodesetNamedItemNS(const QDomNode & newNode)
intsize() const
booloperator!=(const QDomNamedNodeMap & n) const
QDomNamedNodeMap &operator=(const QDomNamedNodeMap & n)
booloperator==(const QDomNamedNodeMap & n) const

Detailed Description

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

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

TheQDomNamedNodeMap is used in three places:

  1. QDomDocumentType::entities() returns a map of all entities described in the DTD.
  2. QDomDocumentType::notations() returns a map of all notations described in the DTD.
  3. QDomNode::attributes() returns a map of all attributes of an element.

Items in the map are identified by the name which QDomNode::name() returns. Nodes are retrieved usingnamedItem(),namedItemNS() oritem(). New nodes are inserted withsetNamedItem() orsetNamedItemNS() and removed withremoveNamedItem() orremoveNamedItemNS(). Usecontains() to see if an item with the given name is in the named node map. The number of items is returned bylength().

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

Member Function Documentation

QDomNamedNodeMap::QDomNamedNodeMap()

Constructs an empty named node map.

QDomNamedNodeMap::QDomNamedNodeMap(constQDomNamedNodeMap & n)

Constructs a copy ofn.

QDomNamedNodeMap::~QDomNamedNodeMap()

Destroys the object and frees its resources.

bool QDomNamedNodeMap::contains(constQString & name) const

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

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

int QDomNamedNodeMap::count() const

This function is provided for Qt API consistency. It is equivalent tolength().

bool QDomNamedNodeMap::isEmpty() const

Returns true if the map is empty; otherwise returns false. This function is provided for Qt API consistency.

QDomNode QDomNamedNodeMap::item(int index) const

Retrieves the node at positionindex.

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

See alsolength().

uint QDomNamedNodeMap::length() const

Returns the number of nodes in the map.

See alsoitem().

QDomNode QDomNamedNodeMap::namedItem(constQString & name) const

Returns the node calledname.

If the named node map does not contain such a node, anull node is returned. A node's name is the name returned byQDomNode::nodeName().

See alsosetNamedItem() andnamedItemNS().

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

Returns the node associated with the local namelocalName and the namespace URInsURI.

If the map does not contain such a node, anull node is returned.

See alsosetNamedItemNS() andnamedItem().

QDomNode QDomNamedNodeMap::removeNamedItem(constQString & name)

Removes the node calledname from the map.

The function returns the removed node or anull node if the map did not contain a node calledname.

See alsosetNamedItem(),namedItem(), andremoveNamedItemNS().

QDomNode QDomNamedNodeMap::removeNamedItemNS(constQString & nsURI, constQString & localName)

Removes the node with the local namelocalName and the namespace URInsURI from the map.

The function returns the removed node or anull node if the map did not contain a node with the local namelocalName and the namespace URInsURI.

See alsosetNamedItemNS(),namedItemNS(), andremoveNamedItem().

QDomNode QDomNamedNodeMap::setNamedItem(constQDomNode & newNode)

Inserts the nodenewNode into the named node map. The name used by the map is the node name ofnewNode as returned byQDomNode::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 alsonamedItem(),removeNamedItem(), andsetNamedItemNS().

QDomNode QDomNamedNodeMap::setNamedItemNS(constQDomNode & newNode)

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

See alsonamedItemNS(),removeNamedItemNS(), andsetNamedItem().

int QDomNamedNodeMap::size() const

This function is provided for Qt API consistency. It is equivalent tolength().

bool QDomNamedNodeMap::operator!=(constQDomNamedNodeMap & n) const

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

QDomNamedNodeMap & QDomNamedNodeMap::operator=(constQDomNamedNodeMap & n)

Assignsn to this named node map.

bool QDomNamedNodeMap::operator==(constQDomNamedNodeMap & n) const

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

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp