QXmlAttributes Class
QXmlAttributes クラスは、XML 属性を提供します。詳細...
| ヘッダー: | #include <QXmlAttributes> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core5Compat) target_link_libraries(mytarget PRIVATE Qt6::Core5Compat) |
| qmake: | QT += core5compat |
注:このクラスのすべての関数は再入可能である。
パブリック関数
| QXmlAttributes() | |
| QXmlAttributes(const QXmlAttributes &) | |
| QXmlAttributes(QXmlAttributes &&) | |
| virtual | ~QXmlAttributes() |
| void | append(const QString &qName, const QString &uri, const QString &localPart, const QString &value) |
| void | clear() |
| int | count() const |
| int | index(const QString &qName) const |
| int | index(QLatin1String qName) const |
| int | index(const QString &uri, const QString &localPart) const |
| int | length() const |
| QString | localName(int index) const |
| QString | qName(int index) const |
| void | swap(QXmlAttributes &other) |
| QString | type(int index) const |
| QString | type(const QString &qName) const |
| QString | type(const QString &uri, const QString &localName) const |
| QString | uri(int index) const |
| QString | value(int index) const |
| QString | value(QLatin1String qName) const |
| QString | value(const QString &qName) const |
| QString | value(const QString &uri, const QString &localName) const |
| QXmlAttributes & | operator=(QXmlAttributes &&) |
| QXmlAttributes & | operator=(const QXmlAttributes &) |
詳細な説明
QXmlContentHandler::startElement() によって属性が報告される場合、このクラスは属性値を渡すために使用されます。
index() を使用してリスト内の属性の位置を特定し、count() を使用して属性の数を取得し、clear() を使用して属性を削除します。 新しい属性は、append() を使用して追加できます。属性の型を取得するにはtype() を、その値を取得するにはvalue() を使用します。属性名はlocalName() またはqName() で取得でき、その名前空間 URI はuri() で取得できます。
メンバ関数のドキュメント
QXmlAttributes::QXmlAttributes()
空の属性リストを作成します。
[noexcept default] QXmlAttributes::QXmlAttributes(const QXmlAttributes &)
QXmlAttributes のインスタンスをコピーして生成します。
[noexcept default] QXmlAttributes::QXmlAttributes(QXmlAttributes &&)
QXmlAttributes のインスタンスをMoveコンストラクタで生成します。
[virtual noexcept] QXmlAttributes::~QXmlAttributes()
attributes オブジェクトを破棄します。
void QXmlAttributes::append(const QString &qName, const QString &uri, const QString &localPart, const QString &value)
属性リストに新しい属性エントリを追加します。この属性の修飾名はqName 、名前空間URIはuri 、ローカル名はlocalPart です。属性の値はvalue です。
qName()、uri()、localName()、およびvalue()も参照してください 。
void QXmlAttributes::clear()
属性のリストをクリアします。
append()も参照してください 。
int QXmlAttributes::count() const
リストに含まれる属性の数を返します。この関数は、length() と同等です。
int QXmlAttributes::index(const QString &qName) const
修飾名 `qName` に基づいて、属性のインデックスを検索します。
属性のインデックスを返します。見つからない場合は -1 を返します。
int QXmlAttributes::index(QLatin1String qName) const
これはオーバーロードされた関数です。
int QXmlAttributes::index(const QString &uri, const QString &localPart) const
名前空間名に基づいて属性のインデックスを検索します。
uri 名前空間 URI を指定します。名前に名前空間 URI がない場合は、空の文字列を指定します。localPart は、属性のローカル名を指定します。
属性のインデックスを返します。見つからなかった場合は -1 を返します。
これはオーバーロードされた関数です。
int QXmlAttributes::length() const
リストに含まれる属性の数を返します。
count()も参照してください 。
QString QXmlAttributes::localName(int index) const
位置index にある属性のローカル名を検索します。名前空間の処理が行われていない場合、ローカル名は空の文字列になります。
QString QXmlAttributes::qName(int index) const
位置index にある属性のXML 1.0修飾名を検索します。
[noexcept] void QXmlAttributes::swap(QXmlAttributes &other)
this をother に置き換えます。
QString QXmlAttributes::type(int index) const
位置index にある属性の型を検索します。
現在、返される値は「CDATA」のみです。
QString QXmlAttributes::type(const QString &qName) const
修飾名「qName 」の属性の型を検索します。
現在、「CDATA」のみが返されます。
これはオーバーロードされた関数です。
QString QXmlAttributes::type(const QString &uri, const QString &localName) const
名前空間名に基づいて属性の型を検索します。
uri namespaceURIは名前空間URIを指定し、localName はローカル名を指定します。名前に名前空間URIがない場合は、uri に空文字列を指定してください。
現在、返される値は「CDATA」のみです。
これはオーバーロードされた関数です。
QString QXmlAttributes::uri(int index) const
位置index にある属性の名前空間URIを検索します。名前空間の処理が行われていない場合、またはその属性に名前空間がない場合は、名前空間URIは空文字列となります。
QString QXmlAttributes::value(int index) const
位置index にある属性の値を返します。インデックスは有効な位置である必要があります(つまり、0 <=index <count()))。
QString QXmlAttributes::value(QLatin1String qName) const
修飾名 `qName` に対応する属性の値を返します。指定された名前に該当する属性が存在しない場合は、空の文字列を返します。
これはオーバーロードされた関数です。
QString QXmlAttributes::value(const QString &qName) const
修飾名 `qName` に対応する属性の値を返します。指定された名前に属性が存在しない場合は、空の文字列を返します。
これはオーバーロードされた関数です。
QString QXmlAttributes::value(const QString &uri, const QString &localName) const
名前空間名に基づいて属性の値を返します。
uri 名前空間 URI を指定します。名前に名前空間 URI がない場合は、空の文字列を指定します。localName は、属性のローカル名を指定します。
これはオーバーロードされた関数です。
[noexcept default] QXmlAttributes &QXmlAttributes::operator=(QXmlAttributes &&)
other をこのQXmlAttributes インスタンスに割り当てます。
[noexcept default] QXmlAttributes &QXmlAttributes::operator=(const QXmlAttributes &)
other をこのQXmlAttributes インスタンスにコピーして割り当てます。
© 2026 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 the GNU 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.