123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- //
- // Created by huli on 2021/12/20.
- //
- #ifndef NNXX_TESTS_STRING_CONVERT_H
- #define NNXX_TESTS_STRING_CONVERT_H
- #include <iostream>
- #include <string>
- #include <string.h>
- #include <stdlib.h>
- //#define _WIN32
- //using namespace std;
- #ifdef _WIN32
- #include <windows.h>
- #else
- #include <iconv.h>
- #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
|