1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/uconv/ucvcn/nsGBKToUnicode.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,68 @@ 1.4 +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 +#ifndef nsGBK2312ToUnicode_h___ 1.9 +#define nsGBK2312ToUnicode_h___ 1.10 + 1.11 +#include "nsCOMPtr.h" 1.12 +#include "nsIUnicodeDecoder.h" 1.13 +#include "nsUCSupport.h" 1.14 +#include "nsGBKConvUtil.h" 1.15 + 1.16 +//---------------------------------------------------------------------- 1.17 +// Class nsGBKToUnicode [declaration] 1.18 + 1.19 +/** 1.20 + * A character set converter from GBK to Unicode. 1.21 + * 1.22 + * 1.23 + * @created 07/Sept/1999 1.24 + * @author Yueheng Xu, Yueheng.Xu@intel.com 1.25 + */ 1.26 +class nsGBKToUnicode : public nsBufferDecoderSupport 1.27 +{ 1.28 +public: 1.29 + 1.30 + /** 1.31 + * Class constructor. 1.32 + */ 1.33 + nsGBKToUnicode() : nsBufferDecoderSupport(1) 1.34 + { 1.35 + mExtensionDecoder = nullptr; 1.36 + m4BytesDecoder = nullptr; 1.37 + } 1.38 + 1.39 +protected: 1.40 + 1.41 + //-------------------------------------------------------------------- 1.42 + // Subclassing of nsDecoderSupport class [declaration] 1.43 + NS_IMETHOD ConvertNoBuff(const char* aSrc, int32_t * aSrcLength, char16_t *aDest, int32_t * aDestLength); 1.44 + 1.45 +protected: 1.46 + nsGBKConvUtil mUtil; 1.47 + nsCOMPtr<nsIUnicodeDecoder> mExtensionDecoder; 1.48 + nsCOMPtr<nsIUnicodeDecoder> m4BytesDecoder; 1.49 + 1.50 + virtual void CreateExtensionDecoder(); 1.51 + virtual void Create4BytesDecoder(); 1.52 + bool TryExtensionDecoder(const char* aSrc, char16_t* aDest); 1.53 + bool Try4BytesDecoder(const char* aSrc, char16_t* aDest); 1.54 + virtual bool DecodeToSurrogate(const char* aSrc, char16_t* aDest); 1.55 + 1.56 +}; 1.57 + 1.58 + 1.59 +class nsGB18030ToUnicode : public nsGBKToUnicode 1.60 +{ 1.61 +public: 1.62 + nsGB18030ToUnicode() {} 1.63 + virtual ~nsGB18030ToUnicode() {} 1.64 +protected: 1.65 + virtual void CreateExtensionDecoder(); 1.66 + virtual void Create4BytesDecoder(); 1.67 + virtual bool DecodeToSurrogate(const char* aSrc, char16_t* aDest); 1.68 +}; 1.69 + 1.70 +#endif /* nsGBK2312ToUnicode_h___ */ 1.71 +