1 Star 0 Fork 1.7K

Oislop./ndd

forked from 爬山虎/ndd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
CmpareMode.h 2.70 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);
static CODE_ID scanFileOutPut(CODE_ID code, QString filePath, QList<LineFileInfo>& outputLineInfoVec, int & maxLineSize, int & charsNums, bool &isHexFile);
inline QList<LineFileInfo>* getLeftLineInfo();
inline QList<LineFileInfo>* getRightLineInfo();
void getLines(RC_DIRECTION direction, QList<LineFileInfo>& lines);
void getLinesExternInfo(QList<BlockUserData*>*& leftExternBlockInfo, QList<BlockUserData*>*& rightExternBlockInfo);
private:
static bool recognizeTextCode(QByteArray & text, LineFileInfo & lineInfo, QString & outUnicodeText);
static CODE_ID getTextFileEncodeType(uchar* fileFpr, int fileLength, QString filePath);
CODE_ID static readLineFromFileWithUnicodeLe(uchar* m_fileFpr, const int fileLength, QList<LineFileInfo>& lineInfoVec, QList<LineFileInfo>& blankLineInfoVec,int mode, int &maxLineSize);
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/Oislop/notepad--.git
git@gitee.com:Oislop/notepad--.git
Oislop
notepad--
ndd
master

搜索帮助