QXmpp Version: 1.10.0
Public Member Functions | Static Public Member Functions | List of all members
QXmppBitsOfBinaryContentId Class Reference

Public Member Functions

 QXmppBitsOfBinaryContentId ()
 
 QXmppBitsOfBinaryContentId (const QXmppBitsOfBinaryContentId &cid)
 Default copy-constructor.
 
 QXmppBitsOfBinaryContentId (QXmppBitsOfBinaryContentId &&)
 Default move-constructor.
 
 ~QXmppBitsOfBinaryContentId ()
 Default destructor.
 
QXmppBitsOfBinaryContentIdoperator= (const QXmppBitsOfBinaryContentId &other)
 Default assignment operator.
 
QXmppBitsOfBinaryContentIdoperator= (QXmppBitsOfBinaryContentId &&)
 Default move-assignment operator.
 
QString toContentId () const
 
QString toCidUrl () const
 
QByteArray hash () const
 
void setHash (const QByteArray &hash)
 
QCryptographicHash::Algorithm algorithm () const
 
void setAlgorithm (QCryptographicHash::Algorithm algo)
 
bool isValid () const
 
bool operator== (const QXmppBitsOfBinaryContentId &other) const
 

Static Public Member Functions

static QXmppBitsOfBinaryContentId fromCidUrl (const QString &input)
 
static QXmppBitsOfBinaryContentId fromContentId (const QString &input)
 
static bool isBitsOfBinaryContentId (const QString &uri, bool checkIsCidUrl=false)
 

Detailed Description

QXmppBitsOfBinaryContentId represents a link to or an identifier of XEP-0231: Bits of Binary data.

Currently supported hash algorithms:

Note
Security notice: When using the content IDs to cache data between multiple entities it is important to avoid hash collisions. SHA-1 cannot fulfill this requirement. You SHOULD use another more secure hash algorithm if you do this.
Since
QXmpp 1.2

Constructor & Destructor Documentation

◆ QXmppBitsOfBinaryContentId()

QXmppBitsOfBinaryContentId::QXmppBitsOfBinaryContentId ( )

Default contructor

Member Function Documentation

◆ algorithm()

QCryptographicHash::Algorithm QXmppBitsOfBinaryContentId::algorithm ( ) const

Returns the hash algorithm used to calculate the hash value

The default value is QCryptographicHash::Sha1.

◆ fromCidUrl()

QXmppBitsOfBinaryContentId QXmppBitsOfBinaryContentId::fromCidUrl ( const QString &  input)
static

Parses a QXmppBitsOfBinaryContentId from a XEP-0231: Bits of Binary cid: URL

In case parsing failed, the returned QXmppBitsOfBinaryContentId is empty.

See also
QXmppBitsOfBinaryContentId::fromContentId

◆ fromContentId()

QXmppBitsOfBinaryContentId QXmppBitsOfBinaryContentId::fromContentId ( const QString &  input)
static

Parses a QXmppBitsOfBinaryContentId from a XEP-0231: Bits of Binary content id

In case parsing failed, the returned QXmppBitsOfBinaryContentId is empty.

Note
This does not allow cid: URLs to be passed. Use QXmppBitsOfBinaryContentId::fromCidUrl for that purpose.
See also
QXmppBitsOfBinaryContentId::fromCidUrl

◆ hash()

QByteArray QXmppBitsOfBinaryContentId::hash ( ) const

Returns the hash value in binary form

◆ isBitsOfBinaryContentId()

bool QXmppBitsOfBinaryContentId::isBitsOfBinaryContentId ( const QString &  input,
bool  checkIsCidUrl = false 
)
static

Checks whether input is a Bits of Binary content id or cid: URL

Parameters
inputThe string to be checked.
checkIsCidUrlIf true, it only accepts cid: URLs.
Returns
True, if input is valid.

◆ isValid()

bool QXmppBitsOfBinaryContentId::isValid ( ) const

Checks whether the content id is valid and can be serialized into a string.

Also checks the length of the hash.

Returns
True, if the set hashing algorithm is supported, a hash value is set and its length is correct, false otherwise.

◆ operator==()

bool QXmppBitsOfBinaryContentId::operator== ( const QXmppBitsOfBinaryContentId other) const

Returns true, if two QXmppBitsOfBinaryContentId equal

◆ setAlgorithm()

void QXmppBitsOfBinaryContentId::setAlgorithm ( QCryptographicHash::Algorithm  algo)

Sets the hash algorithm used to calculate the hash value

The default value is QCryptographicHash::Sha1.

Note
Only change this, if you know what you do. The XEP allows other hashing algorithms than SHA-1 to be used, but not all clients support this.

◆ setHash()

void QXmppBitsOfBinaryContentId::setHash ( const QByteArray &  hash)

Sets the hash value in binary form

◆ toCidUrl()

QString QXmppBitsOfBinaryContentId::toCidUrl ( ) const

Returns a XEP-0231: Bits of Binary cid: URL

◆ toContentId()

QString QXmppBitsOfBinaryContentId::toContentId ( ) const

Returns a XEP-0231: Bits of Binary content id


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