michael@0: /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsGB2312Prober_h__ michael@0: #define nsGB2312Prober_h__ michael@0: michael@0: #include "nsCharSetProber.h" michael@0: #include "nsCodingStateMachine.h" michael@0: #include "CharDistribution.h" michael@0: michael@0: // We use gb18030 to replace gb2312, because 18030 is a superset. michael@0: michael@0: class nsGB18030Prober: public nsCharSetProber { michael@0: public: michael@0: nsGB18030Prober(bool aIsPreferredLanguage) michael@0: :mIsPreferredLanguage(aIsPreferredLanguage) michael@0: {mCodingSM = new nsCodingStateMachine(&GB18030SMModel); michael@0: Reset();} michael@0: virtual ~nsGB18030Prober(void){delete mCodingSM;} michael@0: nsProbingState HandleData(const char* aBuf, uint32_t aLen); michael@0: const char* GetCharSetName() {return "gb18030";} michael@0: nsProbingState GetState(void) {return mState;} michael@0: void Reset(void); michael@0: float GetConfidence(void); michael@0: michael@0: protected: michael@0: void GetDistribution(uint32_t aCharLen, const char* aStr); michael@0: michael@0: nsCodingStateMachine* mCodingSM; michael@0: nsProbingState mState; michael@0: michael@0: //GB2312ContextAnalysis mContextAnalyser; michael@0: GB2312DistributionAnalysis mDistributionAnalyser; michael@0: char mLastChar[2]; michael@0: bool mIsPreferredLanguage; michael@0: michael@0: }; michael@0: michael@0: michael@0: #endif /* nsGB2312Prober_h__ */ michael@0: