1 Star 0 Fork 2

邢瑞/NDD-HexConverter

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Conversion.h 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
nessan1987 提交于 2023-06-04 16:50 . V1.0.3
#ifndef NDD_CONVERSIONL_H
#define NDD_CONVERSIONL_H
#include <string>
#include <QByteArray>
enum NewLineType {
NEW_LINE_CR, // Mac
NEW_LINE_LF, // Unix
NEW_LINE_CR_LF // Win
};
enum NewLineConvertMethod {
NEWLINE_CVT_CVT, // ת
NEWLINE_CVT_SKIP, //
NEWLINE_CVT_TRANS // ͸
};
struct ConvertSetting {
// permanent config:
bool insertSpace;
bool uppercase;
size_t charsPerLine;
NewLineConvertMethod toHexNewlineCvtMethod;
NewLineConvertMethod toAsciiNewlineCvtMethod;
bool toAsciiSkipOutputNewline;
// temporary config:
bool wholeTextConvert;
NewLineType newLineType;
ConvertSetting(bool insert = true, bool upper = true, size_t charPerLine = 0, NewLineConvertMethod toHexNewlineMethod = NEWLINE_CVT_CVT,
NewLineConvertMethod toAsciiNewlineMethod = NEWLINE_CVT_SKIP, bool toAsciiSkipOutNewline = false, bool wholeTextCvt = false,
NewLineType newline = NEW_LINE_CR_LF);
};
class Converter {
public:
static bool HexToChar(uchar& c);
static QByteArray CharToIntStr(uint64_t c, int radix, bool upperCase);
static bool IsNewLineChar(char c, NewLineType newLineType);
static QByteArray AsciiToIntStr(const QByteArray& txt, int radix, const ConvertSetting& cfg);
static QByteArray HexToAscii(const QByteArray& txt, std::string& convertState, const ConvertSetting& cfg);
};
#endif // NDD_CONVERSIONL_H
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/xrui94/hexconverter.git
git@gitee.com:xrui94/hexconverter.git
xrui94
hexconverter
NDD-HexConverter
master

搜索帮助