2009-11-10 16:48:42 +01:00
|
|
|
#ifndef _RAR_UNICODE_
|
|
|
|
#define _RAR_UNICODE_
|
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
#if defined( _WIN_ALL)
|
2009-11-10 16:48:42 +01:00
|
|
|
#define DBCS_SUPPORTED
|
|
|
|
#endif
|
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
bool WideToChar(const wchar *Src,char *Dest,size_t DestSize);
|
|
|
|
bool CharToWide(const char *Src,wchar *Dest,size_t DestSize);
|
|
|
|
byte* WideToRaw(const wchar *Src,byte *Dest,size_t SrcSize);
|
|
|
|
wchar* RawToWide(const byte *Src,wchar *Dest,size_t DestSize);
|
2009-11-10 16:48:42 +01:00
|
|
|
void WideToUtf(const wchar *Src,char *Dest,size_t DestSize);
|
2020-07-15 00:40:26 +02:00
|
|
|
size_t WideToUtfSize(const wchar *Src);
|
|
|
|
bool UtfToWide(const char *Src,wchar *Dest,size_t DestSize);
|
|
|
|
bool IsTextUtf8(const byte *Src);
|
|
|
|
bool IsTextUtf8(const byte *Src,size_t SrcSize);
|
2009-11-10 16:48:42 +01:00
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
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);
|
|
|
|
#ifndef SFX_MODULE
|
|
|
|
wchar* wcslower(wchar *s);
|
|
|
|
wchar* wcsupper(wchar *s);
|
|
|
|
#endif
|
2009-11-10 16:48:42 +01:00
|
|
|
int toupperw(int ch);
|
2020-07-15 00:40:26 +02:00
|
|
|
int tolowerw(int ch);
|
2009-11-10 16:48:42 +01:00
|
|
|
int atoiw(const wchar *s);
|
2020-07-15 00:40:26 +02:00
|
|
|
int64 atoilw(const wchar *s);
|
2009-11-10 16:48:42 +01:00
|
|
|
|
|
|
|
#ifdef DBCS_SUPPORTED
|
|
|
|
class SupportDBCS
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SupportDBCS();
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
char* charnext(const char *s);
|
|
|
|
size_t strlend(const char *s);
|
|
|
|
char *strchrd(const char *s, int c);
|
|
|
|
char *strrchrd(const char *s, int c);
|
|
|
|
void copychrd(char *dest,const char *src);
|
|
|
|
|
|
|
|
bool IsLeadByte[256];
|
|
|
|
bool DBCSMode;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern SupportDBCS gdbcs;
|
|
|
|
|
|
|
|
inline char* charnext(const char *s) {return (char *)(gdbcs.DBCSMode ? gdbcs.charnext(s):s+1);}
|
|
|
|
inline size_t strlend(const char *s) {return (uint)(gdbcs.DBCSMode ? gdbcs.strlend(s):strlen(s));}
|
|
|
|
inline char* strchrd(const char *s, int c) {return (char *)(gdbcs.DBCSMode ? gdbcs.strchrd(s,c):strchr(s,c));}
|
|
|
|
inline char* strrchrd(const char *s, int c) {return (char *)(gdbcs.DBCSMode ? gdbcs.strrchrd(s,c):strrchr(s,c));}
|
|
|
|
inline void copychrd(char *dest,const char *src) {if (gdbcs.DBCSMode) gdbcs.copychrd(dest,src); else *dest=*src;}
|
|
|
|
inline bool IsDBCSMode() {return(gdbcs.DBCSMode);}
|
|
|
|
inline void InitDBCS() {gdbcs.Init();}
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define charnext(s) ((s)+1)
|
|
|
|
#define strlend strlen
|
|
|
|
#define strchrd strchr
|
|
|
|
#define strrchrd strrchr
|
|
|
|
#define IsDBCSMode() (true)
|
|
|
|
inline void copychrd(char *dest,const char *src) {*dest=*src;}
|
|
|
|
#endif
|
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
|
2009-11-10 16:48:42 +01:00
|
|
|
#endif
|