添加项目文件。

This commit is contained in:
ldh
2026-11-06 14:45:09 +08:00
parent fb76f2ed7d
commit 24cbecc2cc
3437 changed files with 895900 additions and 0 deletions
+56
View File
@@ -0,0 +1,56 @@
#ifndef UTIL_H
#define UTIL_H
#include <string>
#include <QString>
#include <vector>
#include <QImage>
#define ARM_RUN true /* shi fou zai ARM shang yun xing*/
#if (ARM_RUN)
#include <assert.h>
#define ASSERT(x) assert(x)
#else
#define ASSERT(x) _ASSERT(x)
#endif
#define EPSLON 1E-6
#define COUNT_ARRAY(Array) (sizeof(Array)/sizeof(Array[0])) /*计算数组长度*/
#define DEL_PTR_S(pData) { try { if (pData) { delete (pData); (pData) = NULL; } } catch (...) { ASSERT(false); } ASSERT(NULL ==(pData)); } /* 安全删除指针 */
#define DEL_ARRAY_S(pData) { try { if (pData) { delete[] (pData); (pData) = NULL;} } catch (...) { ASSERT(false); } ASSERT(NULL ==(pData)); } /* 安全删除数组[] */
#define STR2SZ(str) ((LPSTR)(LPCTSTR)(str)) /* CStringתΪchar* */
typedef bool (*OnReceiveDataCallBackFunc)(int nDeviceIndex, double* pSpectrum, int nLen);
using namespace std;
class QWidget;
class Util
{
public:
Util();
static void Assert(bool bExprState) { ASSERT(bExprState); } //Assert断言
static void WriteLog(std::string logInfo); //写入日志
static void MessageBox(QWidget *parentWnd, std::string msg, std::string title = "信息"); //弹出模态消息框
static QString ToQstr(std::string str); //std::string 转 QString
static std::string ToStdStr(QString str = "默认的参数:你好2 helloworld *&……%¥#@!"); //QString 转 std::string
static bool IsEqual(double a, double b); //比较两个浮点数使否相等
static void delay(int ms); //延迟指定的ms毫秒数
static QString GetId();
static std::string Dec2Hex(int num, int width);
static std::string Byte2Hex(unsigned char* bytes, int byteLength);
static QString Img2base64(QImage& image);
static qint64 generate11DigitRandomNumber();
};
#endif // UTIL_H