QXmppBitsOfBinaryContentId Class Reference

## Public Member Functions

| QXmppBitsOfBinaryContentId ()
| Default contructor.
| QXmppBitsOfBinaryContentId (const QXmppBitsOfBinaryContentId &cid)
QXmppBitsOfBinaryContentId & | operator= (const QXmppBitsOfBinaryContentId &other)
QString | toContentId () const
| Returns a XEP-0231: Bits of Binary content id.
QString | toCidUrl () const
| Returns a XEP-0231: Bits of Binary `cid:` URL.
QByteArray | hash () const
| Returns the hash value in binary form.
void | setHash (const QByteArray &hash)
| Sets the hash value in binary form.
QCryptographicHash::Algorithm | algorithm () const
void | setAlgorithm (QCryptographicHash::Algorithm algo)
bool | isValid () const
bool | operator== (const QXmppBitsOfBinaryContentId &other) const
| Returns true, if two `QXmppBitsOfBinaryContentId` equal.

## 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

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

Since
  QXmpp 1.2

## 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`.

This currently supports MD4, MD5, SHA-1, SHA-2 (SHA224 - SHA512) and SHA-3 (SHA3-224 - SHA3-512).

## 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

## 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

  checkIsCidUrl | If 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.

Note
  Checking the hash length requires QXmpp to be built with Qt 5.12.0 or later.

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

## setAlgorithm()

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

Sets the hash algorithm used to calculate the `hash` value

The default value is `QCryptographicHash::Sha1`.

This currently supports MD4, MD5, SHA-1, SHA-2 (SHA224 - SHA512) and SHA-3 (SHA3-224 - SHA3-512).

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. Since in most cases the content id is not security relevant it is not a problem to continue using SHA-1.

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

- QXmppBitsOfBinaryContentId.h
- QXmppBitsOfBinaryContentId.cpp