extensions/universalchardet/src/base/nsGB2312Prober.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsGB2312Prober_h__
michael@0 7 #define nsGB2312Prober_h__
michael@0 8
michael@0 9 #include "nsCharSetProber.h"
michael@0 10 #include "nsCodingStateMachine.h"
michael@0 11 #include "CharDistribution.h"
michael@0 12
michael@0 13 // We use gb18030 to replace gb2312, because 18030 is a superset.
michael@0 14
michael@0 15 class nsGB18030Prober: public nsCharSetProber {
michael@0 16 public:
michael@0 17 nsGB18030Prober(bool aIsPreferredLanguage)
michael@0 18 :mIsPreferredLanguage(aIsPreferredLanguage)
michael@0 19 {mCodingSM = new nsCodingStateMachine(&GB18030SMModel);
michael@0 20 Reset();}
michael@0 21 virtual ~nsGB18030Prober(void){delete mCodingSM;}
michael@0 22 nsProbingState HandleData(const char* aBuf, uint32_t aLen);
michael@0 23 const char* GetCharSetName() {return "gb18030";}
michael@0 24 nsProbingState GetState(void) {return mState;}
michael@0 25 void Reset(void);
michael@0 26 float GetConfidence(void);
michael@0 27
michael@0 28 protected:
michael@0 29 void GetDistribution(uint32_t aCharLen, const char* aStr);
michael@0 30
michael@0 31 nsCodingStateMachine* mCodingSM;
michael@0 32 nsProbingState mState;
michael@0 33
michael@0 34 //GB2312ContextAnalysis mContextAnalyser;
michael@0 35 GB2312DistributionAnalysis mDistributionAnalyser;
michael@0 36 char mLastChar[2];
michael@0 37 bool mIsPreferredLanguage;
michael@0 38
michael@0 39 };
michael@0 40
michael@0 41
michael@0 42 #endif /* nsGB2312Prober_h__ */
michael@0 43

mercurial