QNdefMessage Class

The QNdefMessage class provides an NFC NDEF message. 更多...

頭: #include <QNdefMessage>
CMake: find_package(Qt6 REQUIRED COMPONENTS Nfc)
target_link_libraries(mytarget PRIVATE Qt6::Nfc)
qmake: QT += nfc
Since: Qt 5.2
繼承: QList

公共函數

QNdefMessage ()
QNdefMessage (const QList<QNdefRecord> & records )
QNdefMessage (const QNdefRecord & record )
QNdefMessage (const QNdefMessage & message )
QByteArray toByteArray () const
(從 6.2 起) QNdefMessage & operator= (QNdefMessage && other )
(從 6.2 起) QNdefMessage & operator= (const QNdefMessage & other )
bool operator== (const QNdefMessage & other ) const

靜態公共成員

QNdefMessage fromByteArray (const QByteArray & message )

詳細描述

A QNdefMessage is a collection of 0 or more QNdefRecords. QNdefMessage inherits from QList < QNdefRecord > and therefore the standard QList functions can be used to manipulate the NDEF records in the message.

NDEF messages can be parsed from a byte array conforming to the NFC Data Exchange Format technical specification by using the fromByteArray () static function. Conversely QNdefMessages can be converted into a byte array with the toByteArray () 函數。

成員函數文檔編製

[constexpr noexcept] QNdefMessage:: QNdefMessage ()

Constructs a new empty NDEF message.

QNdefMessage:: QNdefMessage (const QList < QNdefRecord > & records )

Constructs a new NDEF message that contains all of the records in records .

[explicit] QNdefMessage:: QNdefMessage (const QNdefRecord & record )

Constructs a new NDEF message containing a single record record .

[noexcept] QNdefMessage:: QNdefMessage (const QNdefMessage & message )

Constructs a new NDEF message that is a copy of message .

[static] QNdefMessage QNdefMessage:: fromByteArray (const QByteArray & message )

Returns an NDEF message parsed from the contents of message .

The message parameter is interpreted as the raw message format defined in the NFC Data Exchange Format technical specification.

If a parse error occurs an empty NDEF message is returned.

QByteArray QNdefMessage:: toByteArray () const

Returns the NDEF message as a byte array.

The return value of this function conforms to the format defined in the NFC Data Exchange Format technical specification.

[noexcept, since 6.2] QNdefMessage &QNdefMessage:: operator= ( QNdefMessage && other )

Move assignment operator from QList < QNdefRecord >. Moves the other list of NDEF records to this NDEF record list.

After the operation, other will be empty.

這是重載函數。

該函數在 Qt 6.2 引入。

[noexcept, since 6.2] QNdefMessage &QNdefMessage:: operator= (const QNdefMessage & other )

Copy assignment operator from QList < QNdefRecord >. Assigns the other list of NDEF records to this NDEF record list.

After the operation, other and *this will be equal.

這是重載函數。

該函數在 Qt 6.2 引入。

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

返迴 true if this NDEF message is equivalent to other ;否則返迴 false .

An empty message (i.e. isEmpty () 返迴 true ) is equivalent to a NDEF message containing a single record of type QNdefRecord::Empty .