Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QNdefNfcSmartPosterRecord Class Reference

The QNdefNfcSmartPosterRecord class provides an NFC RTD-SmartPoster. More...

#include <qndefnfcsmartposterrecord.h>

+ Inheritance diagram for QNdefNfcSmartPosterRecord:
+ Collaboration diagram for QNdefNfcSmartPosterRecord:

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...
 
- Public Types inherited from QNdefRecord
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.
 
QNdefNfcSmartPosterRecordoperator= (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< QNdefNfcTextRecordtitleRecords () 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< QNdefNfcIconRecordiconRecords () 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.
 
- Public Member Functions inherited from QNdefRecord
 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.
 
QNdefRecordoperator= (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

- Protected Member Functions inherited from QNdefRecord
 QNdefRecord (const QNdefRecord &other, TypeNameFormat typeNameFormat, const QByteArray &type)
 
 QNdefRecord (const QNdefRecord &other, TypeNameFormat typeNameFormat)
 
 QNdefRecord (TypeNameFormat typeNameFormat, const QByteArray &type)
 

Detailed Description

The QNdefNfcSmartPosterRecord class provides an NFC RTD-SmartPoster.

\inmodule QtNfc

Since
Qt 5.2

RTD-SmartPoster encapsulates a Smart Poster.

Definition at line 41 of file qndefnfcsmartposterrecord.h.

Member Enumeration Documentation

◆ Action

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.

Constructor & Destructor Documentation

◆ QNdefNfcSmartPosterRecord() [1/3]

QNdefNfcSmartPosterRecord::QNdefNfcSmartPosterRecord ( )

Constructs a new empty smart poster.

Definition at line 65 of file qndefnfcsmartposterrecord.cpp.

◆ QNdefNfcSmartPosterRecord() [2/3]

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().

+ Here is the call graph for this function:

◆ QNdefNfcSmartPosterRecord() [3/3]

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::~QNdefNfcSmartPosterRecord ( )

Destroys the smart poster.

Definition at line 105 of file qndefnfcsmartposterrecord.cpp.

Member Function Documentation

◆ action()

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.

+ Here is the call graph for this function:

◆ addIcon() [1/2]

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().

+ Here is the call graph for this function:

◆ addIcon() [2/2]

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().

+ Here is the caller graph for this function:

◆ addTitle() [1/2]

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().

+ Here is the caller graph for this function:

◆ addTitle() [2/2]

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.

+ Here is the call graph for this function:

◆ hasAction()

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.

◆ hasIcon()

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().

+ Here is the call graph for this function:

◆ hasSize()

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.

◆ hasTitle()

bool QNdefNfcSmartPosterRecord::hasTitle ( const QString & locale = QString()) const

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.

+ Here is the call graph for this function:

◆ hasTypeInfo()

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.

◆ icon()

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, QByteArray(), and QList< T >::size().

+ Here is the call graph for this function:

◆ iconCount()

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().

+ Here is the call graph for this function:

◆ iconRecord()

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.

◆ iconRecords()

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.

◆ operator=()

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().

+ Here is the call graph for this function:

◆ removeIcon() [1/2]

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().

+ Here is the call graph for this function:

◆ removeIcon() [2/2]

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().

+ Here is the call graph for this function:

◆ removeTitle() [1/2]

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().

+ Here is the call graph for this function:

◆ removeTitle() [2/2]

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().

+ Here is the call graph for this function:

◆ setAction()

void QNdefNfcSmartPosterRecord::setAction ( Action act)

Sets the action record to act.

Definition at line 483 of file qndefnfcsmartposterrecord.cpp.

References QNdefNfcSmartPosterRecordPrivate::m_action.

◆ setIcons()

void QNdefNfcSmartPosterRecord::setIcons ( const QList< QNdefNfcIconRecord > & icons)

Adds the icon record list icons to the smart poster.

Any existing records are overwritten.

See also
hasIcon(), icon()

Definition at line 634 of file qndefnfcsmartposterrecord.cpp.

References QList< T >::append(), QList< T >::clear(), i, and QNdefNfcSmartPosterRecordPrivate::m_iconList.

+ Here is the call graph for this function:

◆ setPayload()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSize()

void QNdefNfcSmartPosterRecord::setSize ( quint32 size)

Sets the record size.

The value contains the size in bytes of the object that the URI refers to.

See also
size(), hasSize()

Definition at line 669 of file qndefnfcsmartposterrecord.cpp.

References QNdefNfcSmartPosterRecordPrivate::m_size.

◆ setTitles()

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, and QNdefNfcSmartPosterRecordPrivate::m_titleList.

+ Here is the call graph for this function:

◆ setTypeInfo()

void QNdefNfcSmartPosterRecord::setTypeInfo ( const QString & type)

Sets the type record to type.

type describes the type of the object referenced by uri().

See also
typeInfo()

Definition at line 702 of file qndefnfcsmartposterrecord.cpp.

References QNdefNfcSmartPosterRecordPrivate::m_type.

◆ setUri() [1/2]

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().

+ Here is the caller graph for this function:

◆ setUri() [2/2]

void QNdefNfcSmartPosterRecord::setUri ( const QUrl & url)

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.

+ Here is the call graph for this function:

◆ size()

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.

See also
setSize()

Definition at line 655 of file qndefnfcsmartposterrecord.cpp.

References QNdefNfcSmartPosterRecordPrivate::m_size, and QNdefNfcSizeRecord::size().

+ Here is the call graph for this function:

◆ title()

QString QNdefNfcSmartPosterRecord::title ( const QString & locale = QString()) const

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.

+ Here is the call graph for this function:

◆ titleCount()

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().

+ Here is the call graph for this function:

◆ titleRecord()

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.

◆ titleRecords()

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.

◆ typeInfo()

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.

See also
setTypeInfo(), hasTypeInfo()

Definition at line 688 of file qndefnfcsmartposterrecord.cpp.

References QNdefNfcSmartPosterRecordPrivate::m_type, and QNdefNfcTypeRecord::typeInfo().

+ Here is the call graph for this function:

◆ uri()

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.

◆ uriRecord()

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.


The documentation for this class was generated from the following files: