Files
envi-code/SourceCode/Code2026/inc/Base64.h
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

33 lines
1.1 KiB
C++

#pragma once
#include <string>
#ifdef AECRXBASE_EXPORT
#define AECDLLIMPEXP __declspec(dllexport)
#else
#define AECDLLIMPEXP __declspec(dllimport)
#endif
class AECDLLIMPEXP Base64
{
public:
static std::string EncodeF2S(CFile *pFile);
static std::string Encode(const char *pBuffer, const ULONGLONG &length);
static std::string Encode(const std::string &plaintext);
static std::string Decode(const std::string &ciphertext);
static ULONGLONG Decode(const std::string &ciphertext, char *&pBuffer);
static ULONGLONG DecodeS2F(const std::string &ciphertext, CFile *pFile);
public:
/*注意:
plaintext 会在内部转成 utf-8 格式进行base64编码
ciphertext 实际上是ANSII编码,会在内部转为ANSII码
*/
static std::wstring Encode(const std::wstring &plaintext);
static std::wstring Decode(const std::wstring &ciphertext);
static std::wstring EncodeF2W(CFile *pFile);
static ULONGLONG DecodeW2F(const std::wstring &ciphertext, CFile *pFile);
static std::string unicode2Ansii(LPCTSTR psz, const DWORD &codePage);
static std::wstring ansii2Unicode(LPCSTR psz, const DWORD &codePage);
};