QXmpp  Version:1.2.0
QXmppBitsOfBinaryContentId.h
1 /*
2  * Copyright (C) 2008-2020 The QXmpp developers
3  *
4  * Author:
5  * Linus Jahn
6  *
7  * Source:
8  * https://github.com/qxmpp-project/qxmpp
9  *
10  * This file is a part of QXmpp library.
11  *
12  * This library is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20  * Lesser General Public License for more details.
21  *
22  */
23 
24 #ifndef QXMPPBITSOFBINARYCONTENTID_H
25 #define QXMPPBITSOFBINARYCONTENTID_H
26 
27 #include "QXmppGlobal.h"
28 
29 #include <QCryptographicHash>
30 #include <QSharedDataPointer>
31 
32 class QXmppBitsOfBinaryContentIdPrivate;
33 
38 
39 class QXMPP_EXPORT QXmppBitsOfBinaryContentId
40 {
41 public:
42  static QXmppBitsOfBinaryContentId fromCidUrl(const QString &input);
43  static QXmppBitsOfBinaryContentId fromContentId(const QString &input);
44 
48 
50 
51  QString toContentId() const;
52  QString toCidUrl() const;
53 
54  QByteArray hash() const;
55  void setHash(const QByteArray &hash);
56 
57  QCryptographicHash::Algorithm algorithm() const;
58  void setAlgorithm(QCryptographicHash::Algorithm algo);
59 
60  bool isValid() const;
61 
62  static bool isBitsOfBinaryContentId(const QString &uri, bool checkIsCidUrl = false);
63 
64  bool operator==(const QXmppBitsOfBinaryContentId &other) const;
65 
66 private:
67  QSharedDataPointer<QXmppBitsOfBinaryContentIdPrivate> d;
68 };
69 
70 #endif // QXMPPBITSOFBINARYCONTENTID_H
QXmppBitsOfBinaryContentId
Definition: QXmppBitsOfBinaryContentId.h:39