#pragma once #define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ #define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ #define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ #define FNM_NOMATCH 1 #define fnmatch fnmatch_win class CUtils { public: CUtils(); ~CUtils(void); int MultiByToUtf8(const char* multi, char*& utf8); int Utf8ToMultiBy(const char* utf8, char*& multi); int Utf8ToUnicode(const char* utf8, wchar_t*& unicode); int UnicodeToUtf8(const wchar_t* unicode, char*& utf8); int MultiByToUnicode(const char* multi, wchar_t*& unicode); int UnicodeToMultiBy(const wchar_t* unicode, char*& multi); int fnmatch_win(const char* pattern, const char* name, int flags = 0); bool SafeFNMatch(const char* pattern, size_t patt_len, const char* str, size_t str_len); static std::string CvtA2A(const std::string& str, unsigned int cpFrom = CP_UTF8, unsigned int cpTo = CP_ACP); static std::wstring CvtW2W(const std::wstring& str, unsigned int cp = CP_ACP); static std::wstring CvtA2W(const std::string& str, unsigned int cp = CP_ACP, unsigned int cp2 = 0); static std::string CvtW2A(const std::wstring& str, unsigned int cp); }; #define S_CA2W CUtils::CvtA2W #define S_CW2A CUtils::CvtW2A #define S_CA2A CUtils::CvtA2A #define S_CW2W CUtils::CvtW2W #ifdef UNICODE #define S_CA2T S_CA2W #define S_CT2A S_CW2A #define S_CW2T S_CW2W #define S_CT2W S_CW2W #else #define S_CA2T S_CA2A #define S_CT2A S_CA2A #define S_CW2T S_CW2A #define S_CT2W S_CA2W #endif // UNICODE