mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18:37 +00:00
48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
#include <QByteArray>
|
|
#include <QCryptographicHash>
|
|
#include <QIODevice>
|
|
#include "qcryptographichash.h"
|
|
#include "gen_qcryptographichash.h"
|
|
#include "_cgo_export.h"
|
|
|
|
QCryptographicHash* QCryptographicHash_new(uintptr_t method) {
|
|
return new QCryptographicHash(static_cast<QCryptographicHash::Algorithm>(method));
|
|
}
|
|
|
|
void QCryptographicHash_Reset(QCryptographicHash* self) {
|
|
self->reset();
|
|
}
|
|
|
|
void QCryptographicHash_AddData(QCryptographicHash* self, const char* data, int length) {
|
|
self->addData(data, static_cast<int>(length));
|
|
}
|
|
|
|
void QCryptographicHash_AddDataWithData(QCryptographicHash* self, QByteArray* data) {
|
|
self->addData(*data);
|
|
}
|
|
|
|
bool QCryptographicHash_AddDataWithDevice(QCryptographicHash* self, QIODevice* device) {
|
|
return self->addData(device);
|
|
}
|
|
|
|
QByteArray* QCryptographicHash_Result(const QCryptographicHash* self) {
|
|
QByteArray _ret = self->result();
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
return static_cast<QByteArray*>(new QByteArray(_ret));
|
|
}
|
|
|
|
QByteArray* QCryptographicHash_Hash(QByteArray* data, uintptr_t method) {
|
|
QByteArray _ret = QCryptographicHash::hash(*data, static_cast<QCryptographicHash::Algorithm>(method));
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
return static_cast<QByteArray*>(new QByteArray(_ret));
|
|
}
|
|
|
|
int QCryptographicHash_HashLength(uintptr_t method) {
|
|
return QCryptographicHash::hashLength(static_cast<QCryptographicHash::Algorithm>(method));
|
|
}
|
|
|
|
void QCryptographicHash_Delete(QCryptographicHash* self) {
|
|
delete self;
|
|
}
|
|
|