You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

encoding.h 772 B

8 years ago
12345678910111213141516171819202122232425262728293031323334
  1. #ifndef ENCODING_H
  2. #define ENCODING_H
  3. #include <vector>
  4. #include <string>
  5. using namespace std;
  6. #include <iconv.h>
  7. class Encoding
  8. {
  9. public:
  10. Encoding(const string& fromCharset, const string& toCharset);
  11. ~Encoding();
  12. vector<char> convert(const vector<char>& str);
  13. string convert(const string& str);
  14. /**
  15. * @brief convert 编码转换
  16. * @param input 源内存首地址
  17. * @param len 源长度
  18. * @param output 目标内存首地址
  19. * @param outLen 输入输出参数,输入目标缓冲区大小,输出实际使用大小
  20. * @return
  21. */
  22. bool convert(const char* input, size_t len, char* output, size_t* outLen);
  23. private:
  24. iconv_t mIconv;
  25. };
  26. extern Encoding* encOut;
  27. extern Encoding* encIn;
  28. #endif // ENCODING_H

mac下的“飞秋”大多数只是飞鸽传书协议,而且未发现令人满意的开源项目,所以基于c++与qt实现了基础的飞秋协议。

Contributors (1)