Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3 KiB

  1. #include "convbase.h"
  2. #define HIGHT_SURROGATE_START 0xD800
  3. #define HIGHT_SURROGATE_END 0xDBFF
  4. #define LOW_SURROGATE_START 0xDC00
  5. #define LOW_SURROGATE_END 0xDFFF
  6. class CInccUTF8In : public CINetCodeConverter
  7. {
  8. private:
  9. BOOL (CInccUTF8In::*m_pfnConv)(UCHAR tc);
  10. BOOL (CInccUTF8In::*m_pfnCleanUp)();
  11. WORD m_tcUnicode ;
  12. DWORD m_tcSurrogateUnicode ;
  13. int m_nByteFollow;
  14. int m_nBytesUsed;
  15. BOOL m_fSurrogatesPairs;
  16. public:
  17. CInccUTF8In(UINT uCodePage, int nCodeSet);
  18. ~CInccUTF8In() {}
  19. virtual HRESULT ConvertChar(UCHAR tc, int cchSrc=-1);
  20. virtual BOOL CleanUp();
  21. virtual int GetUnconvertBytes();
  22. virtual DWORD GetConvertMode();
  23. virtual void SetConvertMode(DWORD mode);
  24. private:
  25. void Reset();
  26. BOOL ConvMain(UCHAR tc);
  27. BOOL CleanUpMain();
  28. };
  29. class CInccUTF8Out : public CINetCodeConverter
  30. {
  31. private:
  32. BOOL m_fDoubleByte;
  33. BYTE m_tcLeadByte;
  34. WCHAR m_wchSurrogateHigh;
  35. public:
  36. CInccUTF8Out(UINT uCodePage, int nCodeSet);
  37. ~CInccUTF8Out() {}
  38. virtual HRESULT ConvertChar(UCHAR tc, int cchSrc=-1);
  39. virtual BOOL CleanUp();
  40. virtual int GetUnconvertBytes();
  41. virtual DWORD GetConvertMode();
  42. virtual void SetConvertMode(DWORD mode);
  43. private:
  44. void Reset();
  45. };