2001-09-26 04:40:45 +04:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-09-18 04:05:27 +04:00
|
|
|
|
|
|
|
#ifndef nsHZToUnicode_h___
|
|
|
|
#define nsHZToUnicode_h___
|
|
|
|
|
2002-08-12 23:16:16 +04:00
|
|
|
#include "nsUCSupport.h"
|
2001-04-12 03:52:46 +04:00
|
|
|
#include "gbku.h"
|
1999-09-18 04:05:27 +04:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Class nsHZToUnicode [declaration]
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A character set converter from GBK to Unicode.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @created 08/Sept/1999
|
|
|
|
* @author Yueheng Xu, Yueheng.Xu@intel.com
|
|
|
|
*/
|
|
|
|
class nsHZToUnicode : public nsBufferDecoderSupport
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class constructor.
|
|
|
|
*/
|
2001-05-15 16:52:29 +04:00
|
|
|
nsHZToUnicode();
|
1999-09-18 04:05:27 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------
|
|
|
|
// Subclassing of nsDecoderSupport class [declaration]
|
2012-08-22 19:56:38 +04:00
|
|
|
NS_IMETHOD ConvertNoBuff(const char* aSrc, int32_t * aSrcLength,
|
|
|
|
PRUnichar *aDest, int32_t * aDestLength);
|
2001-05-15 16:52:29 +04:00
|
|
|
nsGBKConvUtil mUtil;
|
1999-09-18 04:05:27 +04:00
|
|
|
|
|
|
|
private:
|
2012-08-22 19:56:38 +04:00
|
|
|
int16_t mHZState;
|
|
|
|
uint32_t mRunLength; // length of a run of 8-bit GB-encoded characters
|
2009-06-16 11:13:28 +04:00
|
|
|
char mOddByte; // first byte of a multi-byte sequence from a previous buffer
|
1999-09-18 04:05:27 +04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsHZToUnicode_h___ */
|