52 lines
1.8 KiB
C
52 lines
1.8 KiB
C
|
#pragma once
|
|||
|
|
|||
|
#include <QStringList>
|
|||
|
#include <json.hpp>
|
|||
|
|
|||
|
#define TRY try
|
|||
|
|
|||
|
#define CATCH(x) catch (json::exception& e){\
|
|||
|
CommonHelper::handleError(x, e.what());\
|
|||
|
return true;}\
|
|||
|
catch (std::exception& e) {\
|
|||
|
CommonHelper::handleError(x, e.what());\
|
|||
|
return true;}\
|
|||
|
catch (...) {CommonHelper::handleError(x, CommonHelper::utf8ToString("ϵͳδ֪<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));\
|
|||
|
return true;}
|
|||
|
|
|||
|
class CommonHelper
|
|||
|
{
|
|||
|
public:
|
|||
|
CommonHelper();
|
|||
|
~CommonHelper();
|
|||
|
|
|||
|
static bool compareQStringlist(QStringList& a, QStringList& b);
|
|||
|
static bool convertExcelboolValue(const QString& src, int& dst);
|
|||
|
static QString convertPropertyValue(const int src);
|
|||
|
|
|||
|
static std::string stringToUtf8(const std::string& str);
|
|||
|
static QString stringToQstring(const std::string& str);
|
|||
|
static std::string utf8ToStdString(const char* str);
|
|||
|
static std::string utf8ToStdString(const std::string& str);
|
|||
|
static const char* utf8ToString(const char* str);
|
|||
|
static QString utf8ToQString(const char* str);
|
|||
|
static QString utf8ToQString(std::string&& str);
|
|||
|
static QString jsonToQString(nlohmann::json& j);
|
|||
|
static const char* jsonToString(nlohmann::json& j);
|
|||
|
static std::string qstringToUtf8(const QString& str);
|
|||
|
static std::string qstringToStdString(const QString& str);
|
|||
|
static const char* qstringToString(const QString& str);
|
|||
|
|
|||
|
static bool intTobool(int b);
|
|||
|
static void convertExcelInt(const QString& src, int& dst);
|
|||
|
static QString convertFolderTypeToString(const int type);
|
|||
|
static QString convertAttributeTypeTpString(const int type);
|
|||
|
static QString convertInterfaceTypeToStr(const int type);
|
|||
|
|
|||
|
static void handleError(nlohmann::json& parameter, const char* error);
|
|||
|
static void message(const QString& message, int type);
|
|||
|
|
|||
|
static bool checkDir(QString fullPath); //<2F><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵĻ<DAB5><C4BB><EFBFBD><EFBFBD>½<EFBFBD><C2BD>ļ<EFBFBD><C4BC><EFBFBD>
|
|||
|
static void deleteFilesInFolder(const QString& folderPath);
|
|||
|
};
|