// // Created by huli on 2021/12/20. // #ifndef NNXX_TESTS_STRING_CONVERT_H #define NNXX_TESTS_STRING_CONVERT_H #include #include #include #include //#define _WIN32 //using namespace std; #ifdef _WIN32 #include #else #include #endif class String_convert { public: String_convert(); String_convert(const String_convert& other)= default; String_convert& operator =(const String_convert& other)= default; ~String_convert(); public://API functions #ifdef _WIN32 static std::string gbk_to_utf8(const char *src_str); static std::string utf8_to_gbk(const char *src_str); #else static int gbk_to_utf8(char *str_str, size_t src_len, char *dst_str, size_t dst_len); static int utf8_to_gbk(char *src_str, size_t src_len, char *dst_str, size_t dst_len); static std::string gbk_to_utf8(std::string src_str); static std::string utf8_to_gbk(std::string src_str); #endif public://get or set member variable protected://member functions protected://member variable private: }; #endif //NNXX_TESTS_STRING_CONVERT_H