#pragma once #include #include #include #include #include #include #include #pragma warning(disable:4996) namespace std { inline bool equal_nocase(const std::string &argStringA, const std::string &argStringB) { return 0 == stricmp (argStringA.c_str(), argStringB.c_str()); } inline bool equal_nocase(const std::wstring &argStringA, const std::wstring &argStringB) { return 0 == wcsicmp(argStringA.c_str(), argStringB.c_str()); } inline std::string to_string8(const std::wstring& argString) { if (argString.empty()) return std::string(); const std::ctype* cType = &std::use_facet >(std::locale()); std::wstring::size_type srcLen = argString.length(); const wchar_t* srcBegin = argString.c_str(); std::vector tmp(srcLen); cType->narrow(srcBegin, srcBegin + srcLen, '\0', &tmp[0]); return std::string(&tmp[0], srcLen); } inline std::wstring to_string16(const std::string& argString) { if (argString.empty()) return std::wstring(); const std::ctype* cType = &std::use_facet >(std::locale()); std::wstring::size_type srcLen = argString.length(); const char* srcBegin = argString.c_str(); std::vector tmp(srcLen); cType->widen(srcBegin, srcBegin + srcLen, &tmp[0]); return std::wstring(&tmp[0], srcLen); } } #pragma warning(default:4996)