![]() |
Qt 6.x
The Qt SDK
|
The QNdefNfcSmartPosterRecord class provides an NFC RTD-SmartPoster. More...
#include <qndefnfcsmartposterrecord.h>
Public Types | |
enum | Action { UnspecifiedAction = -1 , DoAction = 0 , SaveAction = 1 , EditAction = 2 } |
This enum describes the course of action that a device should take with the content. More... | |
![]() | |
enum | TypeNameFormat { Empty = 0x00 , NfcRtd = 0x01 , Mime = 0x02 , Uri = 0x03 , ExternalRtd = 0x04 , Unknown = 0x05 } |
This enum describes the type name format of an NDEF record. More... | |
Public Member Functions | |
QNdefNfcSmartPosterRecord () | |
Constructs a new empty smart poster. | |
QNdefNfcSmartPosterRecord (const QNdefRecord &other) | |
Constructs a new smart poster that is a copy of other. | |
QNdefNfcSmartPosterRecord (const QNdefNfcSmartPosterRecord &other) | |
Constructs a new smart poster that is a copy of other. | |
QNdefNfcSmartPosterRecord & | operator= (const QNdefNfcSmartPosterRecord &other) |
Assigns the other smart poster record to this record and returns a reference to this record. | |
~QNdefNfcSmartPosterRecord () | |
Destroys the smart poster. | |
void | setPayload (const QByteArray &payload) |
bool | hasTitle (const QString &locale=QString()) const |
Returns true if the smart poster contains a title record using the locale locale. | |
bool | hasAction () const |
Returns true if the smart poster contains an action record, otherwise returns false . | |
bool | hasIcon (const QByteArray &mimetype=QByteArray()) const |
Returns true if the smart poster contains an icon record using the type mimetype. | |
bool | hasSize () const |
Returns true if the smart poster contains a size record, otherwise returns false . | |
bool | hasTypeInfo () const |
Returns true if the smart poster contains a type record, otherwise returns false . | |
qsizetype | titleCount () const |
Returns the number of title records contained inside the smart poster. | |
QNdefNfcTextRecord | titleRecord (qsizetype index) const |
Returns the title record corresponding to the index index inside the smart poster, where index is a value between 0 and titleCount() - 1. | |
QString | title (const QString &locale=QString()) const |
Returns the title record text associated with locale locale if available. | |
QList< QNdefNfcTextRecord > | titleRecords () const |
Returns a copy of all title records inside the smart poster. | |
bool | addTitle (const QNdefNfcTextRecord &text) |
Attempts to add a title record text to the smart poster. | |
bool | addTitle (const QString &text, const QString &locale, QNdefNfcTextRecord::Encoding encoding) |
Attempts to add a new title record with title text, locale locale and encoding encoding. | |
bool | removeTitle (const QNdefNfcTextRecord &text) |
Attempts to remove the title record text from the smart poster. | |
bool | removeTitle (const QString &locale) |
Attempts to remove a title record with the locale locale from the smart poster. | |
void | setTitles (const QList< QNdefNfcTextRecord > &titles) |
Adds the title record list titles to the smart poster. | |
QUrl | uri () const |
Returns the URI from the smart poster's URI record if set. | |
QNdefNfcUriRecord | uriRecord () const |
Returns the smart poster's URI record if set. | |
void | setUri (const QNdefNfcUriRecord &url) |
Sets the URI record to url. | |
void | setUri (const QUrl &url) |
Constructs a URI record and sets its content inside the smart poster to url. | |
Action | action () const |
Returns the action from the action record if available. | |
void | setAction (Action act) |
Sets the action record to act. | |
qsizetype | iconCount () const |
Returns the number of icon records contained inside the smart poster. | |
QNdefNfcIconRecord | iconRecord (qsizetype index) const |
Returns the icon record corresponding to the index index inside the smart poster, where index is a value between 0 and \l iconCount() - 1. | |
QByteArray | icon (const QByteArray &mimetype=QByteArray()) const |
Returns the associated icon record data if the smart poster contains an icon record with MIME type mimetype. | |
QList< QNdefNfcIconRecord > | iconRecords () const |
Returns a copy of all icon records inside the smart poster. | |
void | addIcon (const QNdefNfcIconRecord &icon) |
Adds an icon record icon to the smart poster. | |
void | addIcon (const QByteArray &type, const QByteArray &data) |
Adds an icon record with type type and data data to the smart poster. | |
bool | removeIcon (const QNdefNfcIconRecord &icon) |
Attempts to remove the icon record icon from the smart poster. | |
bool | removeIcon (const QByteArray &type) |
Attempts to remove the icon record with the type type from the smart poster. | |
void | setIcons (const QList< QNdefNfcIconRecord > &icons) |
Adds the icon record list icons to the smart poster. | |
quint32 | size () const |
Returns the size from the size record if available; otherwise returns 0. | |
void | setSize (quint32 size) |
Sets the record size. | |
QString | typeInfo () const |
Returns the MIME type that describes the type of the objects that can be reached via uri(). | |
void | setTypeInfo (const QString &type) |
Sets the type record to type. | |
![]() | |
QNdefRecord () | |
Constructs a new empty NDEF record. | |
~QNdefRecord () | |
Destroys the NDEF record. | |
QNdefRecord (const QNdefRecord &other) | |
Constructs a new NDEF record that is a copy of other. | |
QNdefRecord & | operator= (const QNdefRecord &other) |
Assigns this NDEF record to other. | |
void | setTypeNameFormat (TypeNameFormat typeNameFormat) |
Sets the type name format of the NDEF record to typeNameFormat. | |
TypeNameFormat | typeNameFormat () const |
Returns the type name format of the NDEF record. | |
void | setType (const QByteArray &type) |
Sets the type of the NDEF record to type. | |
QByteArray | type () const |
Returns the type of the NDEF record. | |
void | setId (const QByteArray &id) |
Sets the id of the NDEF record to id. | |
QByteArray | id () const |
Returns the id of the NDEF record. | |
void | setPayload (const QByteArray &payload) |
Sets the payload of the NDEF record to payload. | |
QByteArray | payload () const |
Returns the payload of the NDEF record. | |
bool | isEmpty () const |
Returns true if the NDEF record contains an empty payload; otherwise returns false . | |
template<typename T > | |
bool | isRecordType () const |
Returns true if the NDEF record is of the specified record type; otherwise returns false . | |
bool | operator== (const QNdefRecord &other) const |
Returns true if other and this NDEF record are the same. | |
bool | operator!= (const QNdefRecord &other) const |
Returns true if this NDEF record does not equal other; otherwise return false . | |
void | clear () |
Additional Inherited Members | |
![]() | |
QNdefRecord (const QNdefRecord &other, TypeNameFormat typeNameFormat, const QByteArray &type) | |
QNdefRecord (const QNdefRecord &other, TypeNameFormat typeNameFormat) | |
QNdefRecord (TypeNameFormat typeNameFormat, const QByteArray &type) | |
![]() | |
size_t | qHash (const QNdefRecord &key) |
\macro Q_DECLARE_NDEF_RECORD(className, typeNameFormat, type, initialPayload) | |
The QNdefNfcSmartPosterRecord class provides an NFC RTD-SmartPoster.
\inmodule QtNfc
RTD-SmartPoster encapsulates a Smart Poster.
Definition at line 41 of file qndefnfcsmartposterrecord.h.
This enum describes the course of action that a device should take with the content.
\value UnspecifiedAction The action is not defined. \value DoAction Do the action (send the SMS, launch the browser, make the telephone call). \value SaveAction Save for later (store the SMS in INBOX, put the URI in a bookmark, save the telephone number in contacts). \value EditAction Open for editing (open an SMS in the SMS editor, open the URI in a URI editor, open the telephone number for editing).
Enumerator | |
---|---|
UnspecifiedAction | |
DoAction | |
SaveAction | |
EditAction |
Definition at line 44 of file qndefnfcsmartposterrecord.h.
QNdefNfcSmartPosterRecord::QNdefNfcSmartPosterRecord | ( | ) |
Constructs a new empty smart poster.
Definition at line 65 of file qndefnfcsmartposterrecord.cpp.
QNdefNfcSmartPosterRecord::QNdefNfcSmartPosterRecord | ( | const QNdefRecord & | other | ) |
Constructs a new smart poster that is a copy of other.
Definition at line 74 of file qndefnfcsmartposterrecord.cpp.
References other(), and setPayload().
QNdefNfcSmartPosterRecord::QNdefNfcSmartPosterRecord | ( | const QNdefNfcSmartPosterRecord & | other | ) |
Constructs a new smart poster that is a copy of other.
Definition at line 85 of file qndefnfcsmartposterrecord.cpp.
QNdefNfcSmartPosterRecord::~QNdefNfcSmartPosterRecord | ( | ) |
Destroys the smart poster.
Definition at line 105 of file qndefnfcsmartposterrecord.cpp.
QNdefNfcSmartPosterRecord::Action QNdefNfcSmartPosterRecord::action | ( | ) | const |
Returns the action from the action record if available.
Otherwise \l UnspecifiedAction is returned.
Definition at line 472 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcActRecord::action(), QNdefNfcSmartPosterRecordPrivate::m_action, and UnspecifiedAction.
void QNdefNfcSmartPosterRecord::addIcon | ( | const QByteArray & | type, |
const QByteArray & | data | ||
) |
Adds an icon record with type type and data data to the smart poster.
If the smart poster already contains an icon record with the same type then the existing icon record is replaced.
Definition at line 567 of file qndefnfcsmartposterrecord.cpp.
References addIcon(), and QNdefRecord::setType().
void QNdefNfcSmartPosterRecord::addIcon | ( | const QNdefNfcIconRecord & | icon | ) |
Adds an icon record icon to the smart poster.
If the smart poster already contains an icon record with the same type then the existing icon record is replaced.
Definition at line 543 of file qndefnfcsmartposterrecord.cpp.
References icon.
Referenced by addIcon().
bool QNdefNfcSmartPosterRecord::addTitle | ( | const QNdefNfcTextRecord & | text | ) |
Attempts to add a title record text to the smart poster.
If the smart poster does not already contain a title record with the same locale as title record text, then the title record is added and the function returns true
. Otherwise false
is returned.
Definition at line 316 of file qndefnfcsmartposterrecord.cpp.
References text.
Referenced by addTitle().
bool QNdefNfcSmartPosterRecord::addTitle | ( | const QString & | text, |
const QString & | locale, | ||
QNdefNfcTextRecord::Encoding | encoding | ||
) |
Attempts to add a new title record with title text, locale locale and encoding encoding.
If the smart poster does not already contain a title record with locale locale, then the title record is added and the function returns true
. Otherwise false
is returned.
Definition at line 345 of file qndefnfcsmartposterrecord.cpp.
References addTitle(), QNdefNfcTextRecord::setEncoding(), QNdefNfcTextRecord::setLocale(), QNdefNfcTextRecord::setText(), and text.
bool QNdefNfcSmartPosterRecord::hasAction | ( | ) | const |
Returns true
if the smart poster contains an action record, otherwise returns false
.
Definition at line 224 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_action.
bool QNdefNfcSmartPosterRecord::hasIcon | ( | const QByteArray & | mimetype = QByteArray() | ) | const |
Returns true
if the smart poster contains an icon record using the type mimetype.
If mimetype is empty, then true
is returned if the smart poster contains at least one icon record. In all other cases, false
is returned.
Definition at line 235 of file qndefnfcsmartposterrecord.cpp.
References i, icon, QByteArray::isEmpty(), QNdefNfcSmartPosterRecordPrivate::m_iconList, and QList< T >::size().
bool QNdefNfcSmartPosterRecord::hasSize | ( | ) | const |
Returns true
if the smart poster contains a size record, otherwise returns false
.
Definition at line 251 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_size.
Returns true
if the smart poster contains a title record using the locale locale.
If locale is empty, then true
is returned if the smart poster contains at least one title record. In all other cases, false
is returned.
Definition at line 208 of file qndefnfcsmartposterrecord.cpp.
References i, QNdefNfcSmartPosterRecordPrivate::m_titleList, QList< T >::size(), and text.
bool QNdefNfcSmartPosterRecord::hasTypeInfo | ( | ) | const |
Returns true
if the smart poster contains a type record, otherwise returns false
.
Definition at line 260 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_type.
QByteArray QNdefNfcSmartPosterRecord::icon | ( | const QByteArray & | mimetype = QByteArray() | ) | const |
Returns the associated icon record data if the smart poster contains an icon record with MIME type mimetype.
If mimetype is omitted or empty then the first icon's record data is returned. In all other cases, an empty array is returned.
Definition at line 519 of file qndefnfcsmartposterrecord.cpp.
References i, icon, QByteArray::isEmpty(), QNdefNfcSmartPosterRecordPrivate::m_iconList, and QList< T >::size().
qsizetype QNdefNfcSmartPosterRecord::iconCount | ( | ) | const |
Returns the number of icon records contained inside the smart poster.
Definition at line 497 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_iconList, and QList< T >::size().
QNdefNfcIconRecord QNdefNfcSmartPosterRecord::iconRecord | ( | qsizetype | index | ) | const |
Returns the icon record corresponding to the index index inside the smart poster, where index is a value between 0 and \l iconCount() - 1.
Values outside of this range return an empty record.
Definition at line 507 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_iconList.
QList< QNdefNfcIconRecord > QNdefNfcSmartPosterRecord::iconRecords | ( | ) | const |
Returns a copy of all icon records inside the smart poster.
Definition at line 534 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_iconList.
QNdefNfcSmartPosterRecord & QNdefNfcSmartPosterRecord::operator= | ( | const QNdefNfcSmartPosterRecord & | other | ) |
Assigns the other smart poster record to this record and returns a reference to this record.
Definition at line 94 of file qndefnfcsmartposterrecord.cpp.
References other().
bool QNdefNfcSmartPosterRecord::removeIcon | ( | const QByteArray & | type | ) |
Attempts to remove the icon record with the type type from the smart poster.
Removes the record and returns true
if the smart poster contains a matching record, otherwise false
is returned.
Definition at line 607 of file qndefnfcsmartposterrecord.cpp.
References i, QNdefNfcSmartPosterRecordPrivate::m_iconList, QList< T >::removeAt(), QList< T >::size(), and QNdefRecord::type().
bool QNdefNfcSmartPosterRecord::removeIcon | ( | const QNdefNfcIconRecord & | icon | ) |
Attempts to remove the icon record icon from the smart poster.
Removes the record and returns true
if the smart poster contains a matching record, otherwise false
is returned.
Definition at line 581 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcIconRecord::data(), i, icon, QNdefNfcSmartPosterRecordPrivate::m_iconList, QList< T >::removeAt(), QList< T >::size(), and QNdefRecord::type().
bool QNdefNfcSmartPosterRecord::removeTitle | ( | const QNdefNfcTextRecord & | text | ) |
Attempts to remove the title record text from the smart poster.
Removes the record and returns true
if the smart poster contains a matching record, otherwise false
is returned.
Definition at line 360 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcTextRecord::encoding(), i, QNdefNfcSmartPosterRecordPrivate::m_titleList, QList< T >::removeAt(), QList< T >::size(), text, and QNdefNfcTextRecord::text().
bool QNdefNfcSmartPosterRecord::removeTitle | ( | const QString & | locale | ) |
Attempts to remove a title record with the locale locale from the smart poster.
Removes the record and returns true
if the smart poster contains a matching record, otherwise false
is returned.
Definition at line 386 of file qndefnfcsmartposterrecord.cpp.
References i, QNdefNfcSmartPosterRecordPrivate::m_titleList, QList< T >::removeAt(), and QList< T >::size().
Sets the action record to act.
Definition at line 483 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_action.
void QNdefNfcSmartPosterRecord::setIcons | ( | const QList< QNdefNfcIconRecord > & | icons | ) |
Adds the icon record list icons to the smart poster.
Any existing records are overwritten.
Definition at line 634 of file qndefnfcsmartposterrecord.cpp.
References QList< T >::append(), QList< T >::clear(), i, QNdefNfcSmartPosterRecordPrivate::m_iconList, and QList< T >::size().
void QNdefNfcSmartPosterRecord::setPayload | ( | const QByteArray & | payload | ) |
Sets the payload of the NDEF record to payload
Definition at line 126 of file qndefnfcsmartposterrecord.cpp.
References QNdefMessage::fromByteArray(), QByteArray::isEmpty(), QNdefNfcSmartPosterRecordPrivate::m_action, QNdefNfcSmartPosterRecordPrivate::m_size, QNdefNfcSmartPosterRecordPrivate::m_type, QNdefNfcSmartPosterRecordPrivate::m_uri, QNdefRecord::payload(), record(), and QNdefRecord::setPayload().
Referenced by QNdefNfcSmartPosterRecord().
Sets the record size.
The value contains the size in bytes of the object that the URI refers to.
Definition at line 669 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_size.
void QNdefNfcSmartPosterRecord::setTitles | ( | const QList< QNdefNfcTextRecord > & | titles | ) |
Adds the title record list titles to the smart poster.
Any existing records are overwritten.
Definition at line 410 of file qndefnfcsmartposterrecord.cpp.
References QList< T >::append(), QList< T >::clear(), i, QNdefNfcSmartPosterRecordPrivate::m_titleList, and QList< T >::size().
Sets the type record to type.
type describes the type of the object referenced by uri().
Definition at line 702 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_type.
void QNdefNfcSmartPosterRecord::setUri | ( | const QNdefNfcUriRecord & | url | ) |
Sets the URI record to url.
Definition at line 447 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_uri, and url.
Referenced by setUri().
Constructs a URI record and sets its content inside the smart poster to url.
Definition at line 461 of file qndefnfcsmartposterrecord.cpp.
References setUri(), QNdefNfcUriRecord::setUri(), and url.
quint32 QNdefNfcSmartPosterRecord::size | ( | ) | const |
Returns the size from the size record if available; otherwise returns 0.
The value is optional and contains the size in bytes of the object that the URI refers to. It may be used by the device to determine whether it can accommodate the object.
Definition at line 655 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_size, and QNdefNfcSizeRecord::size().
Returns the title record text associated with locale locale if available.
If locale is empty then the title text of the first available record is returned. In all other cases an empty string is returned.
Definition at line 291 of file qndefnfcsmartposterrecord.cpp.
References i, QNdefNfcSmartPosterRecordPrivate::m_titleList, QList< T >::size(), and text.
qsizetype QNdefNfcSmartPosterRecord::titleCount | ( | ) | const |
Returns the number of title records contained inside the smart poster.
Definition at line 268 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_titleList, and QList< T >::size().
QNdefNfcTextRecord QNdefNfcSmartPosterRecord::titleRecord | ( | qsizetype | index | ) | const |
Returns the title record corresponding to the index index inside the smart poster, where index is a value between 0 and titleCount() - 1.
Values outside of this range return an empty record.
Definition at line 278 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_titleList.
QList< QNdefNfcTextRecord > QNdefNfcSmartPosterRecord::titleRecords | ( | ) | const |
Returns a copy of all title records inside the smart poster.
Definition at line 306 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_titleList.
QString QNdefNfcSmartPosterRecord::typeInfo | ( | ) | const |
Returns the MIME type that describes the type of the objects that can be reached via uri().
If the type is not known, the returned QString is empty.
Definition at line 688 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_type, and QNdefNfcTypeRecord::typeInfo().
QUrl QNdefNfcSmartPosterRecord::uri | ( | ) | const |
Returns the URI from the smart poster's URI record if set.
Otherwise an empty URI is returned.
Definition at line 425 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_uri.
QNdefNfcUriRecord QNdefNfcSmartPosterRecord::uriRecord | ( | ) | const |
Returns the smart poster's URI record if set.
Otherwise an empty URI is returned.
Definition at line 436 of file qndefnfcsmartposterrecord.cpp.
References QNdefNfcSmartPosterRecordPrivate::m_uri.