extensions/universalchardet/src/base/nsGB2312Prober.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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__ */

mercurial