重写base64编码转换demo
This commit is contained in:
37
base64/base64.h
Normal file
37
base64/base64.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef BASE64_H
|
||||
#define BASE64_H
|
||||
|
||||
/**
|
||||
* base64编码转换类 作者:feiyangqingyun(QQ:517216493) 2016-12-16
|
||||
* 1. 图片转base64字符串
|
||||
* 2. base64字符串转图片
|
||||
* 3. 字符转base64字符串
|
||||
* 4. base64字符串转字符
|
||||
* 5. 后期增加数据压缩
|
||||
* 6. Qt6对base64编码转换进行了重写效率提升至少200%
|
||||
*/
|
||||
|
||||
#include <QImage>
|
||||
|
||||
#ifdef quc
|
||||
class Q_DECL_EXPORT Base64
|
||||
#else
|
||||
class Base64
|
||||
#endif
|
||||
|
||||
{
|
||||
public:
|
||||
//图片转base64字符串
|
||||
static QString imageToBase64(const QImage &image);
|
||||
static QByteArray imageToBase64x(const QImage &image);
|
||||
|
||||
//base64字符串转图片
|
||||
static QImage base64ToImage(const QString &data);
|
||||
static QImage base64ToImagex(const QByteArray &data);
|
||||
|
||||
//字符串与base64互转
|
||||
static QString textToBase64(const QString &text);
|
||||
static QString base64ToText(const QString &text);
|
||||
};
|
||||
|
||||
#endif // BASE64_H
|
||||
Reference in New Issue
Block a user