Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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/. */
6 #ifndef nsGB2312Prober_h__
7 #define nsGB2312Prober_h__
9 #include "nsCharSetProber.h"
10 #include "nsCodingStateMachine.h"
11 #include "CharDistribution.h"
13 // We use gb18030 to replace gb2312, because 18030 is a superset.
15 class nsGB18030Prober: public nsCharSetProber {
16 public:
17 nsGB18030Prober(bool aIsPreferredLanguage)
18 :mIsPreferredLanguage(aIsPreferredLanguage)
19 {mCodingSM = new nsCodingStateMachine(&GB18030SMModel);
20 Reset();}
21 virtual ~nsGB18030Prober(void){delete mCodingSM;}
22 nsProbingState HandleData(const char* aBuf, uint32_t aLen);
23 const char* GetCharSetName() {return "gb18030";}
24 nsProbingState GetState(void) {return mState;}
25 void Reset(void);
26 float GetConfidence(void);
28 protected:
29 void GetDistribution(uint32_t aCharLen, const char* aStr);
31 nsCodingStateMachine* mCodingSM;
32 nsProbingState mState;
34 //GB2312ContextAnalysis mContextAnalyser;
35 GB2312DistributionAnalysis mDistributionAnalyser;
36 char mLastChar[2];
37 bool mIsPreferredLanguage;
39 };
42 #endif /* nsGB2312Prober_h__ */