1.5K Star 15.5K Fork 2K

GVP爬山虎/ndd

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CmpareMode.h 2.77 KB
一键复制 编辑 原始数据 按行查看 历史
#pragma once
#include <qobject.h>
#include<QVector>
#include<QMap>
#include <QFuture>
#include <functional>
#include "rcglobal.h"
#include "Encode.h"
class BlockUserData;
class QFile;
const int LEFT = 0;
const int RIGHT = 1;
//对比bin二进制文件。
const int MAX_BIN_SIZE = 1024 * 1024 * 10; //最大10M
typedef void(* CALL_FUNC)(void *, uchar *, int);
typedef struct lineFileInfo_ {
qint32 lineNums; //行号码
bool isLcsExist;//是否属于lcsline的一部分
bool isEmptyLine; //是否是空白行,只包含换行符的行
int code; //该行的字符编码
int lineEndFormat; //行尾:见RC_LINE_FORM
QByteArray md4;
QString unicodeStr; //这个是包含行尾的换行符的
lineFileInfo_()
{
isLcsExist = false;
isEmptyLine = false;
code = UNKOWN;
lineEndFormat = UNKNOWN_LINE;
}
}LineFileInfo;
const int EMPTY_FILE = 0;
const int SCAN_SUCCESS = 1;
class CmpareMode;
typedef struct ThreadFileCmpParameter_ {
QString leftPath;
QString rightPath;
CmpareMode *resultCmpObj;
ThreadFileCmpParameter_(QString leftPath_, QString rightPath_)
{
leftPath = leftPath_;
rightPath = rightPath_;
resultCmpObj = nullptr;
}
}ThreadFileCmpParameter;
class CmpareMode :public QObject
{
Q_OBJECT
public:
CmpareMode();
virtual ~CmpareMode();
static CODE_ID readLineFromFile(uchar * m_fileFpr, const int fileLength, const CODE_ID fileCode, QList<LineFileInfo>& lineInfoVec, QList<LineFileInfo>& blankLineInfoVec, int mode, int& maxLineSize);
static CODE_ID judgeFinalTextCode(CODE_ID code, bool isExistUnKownCode, bool isExistGbk, bool isExistUtf8);
static CODE_ID readLineFromFile(uchar * m_fileFpr, const int fileLength, const CODE_ID fileCode, QList<LineFileInfo>& lineInfoVec,int& maxLineSize, int& charsNums, bool &isMaybeHexFile);
static CODE_ID scanFileRealCode(QString filePath,int scanLineNum=200);
static CODE_ID scanFileOutPut(CODE_ID code, QString filePath, QList<LineFileInfo>& outputLineInfoVec, int & maxLineSize, int & charsNums, bool &isHexFile);
static CODE_ID scanFileOutPut(QFile& pFile, CODE_ID code, QString filePath, QString& outText, bool& existGrbledCode);
static CODE_ID getTextFileEncodeType(uchar* fileFpr, int fileLength, QString filePath="", bool isCheckHead = true);
static bool tranUnicodeLeToUtf8Bytes(uchar* fileFpr, const int fileLength, QString& outUtf8Bytes, bool isSkipHead=false);
static bool isUnicodeLeBomFile(uchar* fileFpr, int fileLength);
private:
static bool recognizeTextCode(QByteArray & text, LineFileInfo & lineInfo, QString & outUnicodeText);
quint32 static readLineFromFileWithUnicodeLe(uchar* m_fileFpr, const int fileLength, QList<LineFileInfo>& lineInfoVec, QList<LineFileInfo>& blankLineInfoVec,int mode, int &maxLineSize);
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/cxasm/notepad--.git
git@gitee.com:cxasm/notepad--.git
cxasm
notepad--
ndd
master

搜索帮助