#include "rar.hpp"
#define MBFUNCTIONS
#if defined(_UNIX) && defined(MBFUNCTIONS)
static bool WideToCharMap(const wchar *Src,char *Dest,size_t DestSize,bool &Success);
static void CharToWideMap(const char *Src,wchar *Dest,size_t DestSize,bool &Success);
static const uint MapAreaStart= …;
static const uint MappedStringMark= …;
#endif
bool WideToChar(const wchar *Src,char *Dest,size_t DestSize)
{ … }
bool CharToWide(const char *Src,wchar *Dest,size_t DestSize)
{ … }
bool WideToChar(const std::wstring &Src,std::string &Dest)
{ … }
bool CharToWide(const std::string &Src,std::wstring &Dest)
{ … }
#if defined(_UNIX) && defined(MBFUNCTIONS)
bool WideToCharMap(const wchar *Src,char *Dest,size_t DestSize,bool &Success)
{ … }
#endif
#if defined(_UNIX) && defined(MBFUNCTIONS)
void CharToWideMap(const char *Src,wchar *Dest,size_t DestSize,bool &Success)
{ … }
#endif
byte* WideToRaw(const wchar *Src,size_t SrcSize,byte *Dest,size_t DestSize)
{ … }
void WideToRaw(const std::wstring &Src,std::vector<byte> &Dest)
{ … }
wchar* RawToWide(const byte *Src,wchar *Dest,size_t DestSize)
{ … }
std::wstring RawToWide(const std::vector<byte> &Src)
{ … }
void WideToUtf(const wchar *Src,char *Dest,size_t DestSize)
{ … }
void WideToUtf(const std::wstring &Src,std::string &Dest)
{ … }
size_t WideToUtfSize(const wchar *Src)
{ … }
bool UtfToWide(const char *Src,wchar *Dest,size_t DestSize)
{ … }
bool UtfToWide(const char *Src,std::wstring &Dest)
{ … }
bool IsTextUtf8(const byte *Src)
{ … }
bool IsTextUtf8(const byte *Src,size_t SrcSize)
{ … }
int wcsicomp(const wchar *s1,const wchar *s2)
{ … }
int wcsnicomp(const wchar *s1,const wchar *s2,size_t n)
{ … }
const wchar_t* wcscasestr(const wchar_t *str, const wchar_t *search)
{ … }
std::wstring::size_type wcscasestr(const std::wstring &str, const std::wstring &search)
{ … }
#ifndef SFX_MODULE
wchar* wcslower(wchar *s)
{ … }
void wcslower(std::wstring &s)
{ … }
wchar* wcsupper(wchar *s)
{ … }
void wcsupper(std::wstring &s)
{ … }
#endif
int toupperw(int ch)
{ … }
int tolowerw(int ch)
{ … }
int atoiw(const std::wstring &s)
{ … }
int64 atoilw(const std::wstring &s)
{ … }
#ifdef DBCS_SUPPORTED
SupportDBCS::SupportDBCS()
{
Init();
}
void SupportDBCS::Init()
{
CPINFO CPInfo;
GetCPInfo(CP_ACP,&CPInfo);
DBCSMode=CPInfo.MaxCharSize > 1;
for (uint I=0;I<ASIZE(IsLeadByte);I++)
IsLeadByte[I]=IsDBCSLeadByte(I)!=0;
}
SupportDBCS& SupportDBCS::GetInstance() {
static SupportDBCS supportDBCS;
return supportDBCS;
}
char* SupportDBCS::charnext(const char *s)
{
return (char *)(IsLeadByte[(byte)*s] && s[1]!=0 ? s+2:s+1);
}
#endif