nsGBKToUnicode.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef nsGBKToUnicode_h___
  6. #define nsGBKToUnicode_h___
  7. #include "nsCOMPtr.h"
  8. #include "nsIUnicodeDecoder.h"
  9. #include "nsUCSupport.h"
  10. #include "nsGBKConvUtil.h"
  11. //----------------------------------------------------------------------
  12. // Class nsGB18030ToUnicode [declaration]
  13. /**
  14. * A character set converter from GB18030 to Unicode.
  15. *
  16. *
  17. * @created 07/Sept/1999
  18. * @author Yueheng Xu, Yueheng.Xu@intel.com
  19. */
  20. class nsGB18030ToUnicode : public nsBufferDecoderSupport
  21. {
  22. public:
  23. /**
  24. * Class constructor.
  25. */
  26. nsGB18030ToUnicode() : nsBufferDecoderSupport(1)
  27. {
  28. }
  29. protected:
  30. //--------------------------------------------------------------------
  31. // Subclassing of nsBufferDecoderSupport class [declaration]
  32. NS_IMETHOD ConvertNoBuff(const char* aSrc, int32_t * aSrcLength, char16_t *aDest, int32_t * aDestLength);
  33. protected:
  34. nsGBKConvUtil mUtil;
  35. bool TryExtensionDecoder(const char* aSrc, char16_t* aDest);
  36. bool Try4BytesDecoder(const char* aSrc, char16_t* aDest);
  37. bool DecodeToSurrogate(const char* aSrc, char16_t* aDest);
  38. };
  39. #endif /* nsGBKToUnicode_h___ */