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 {
17
nsGB18030Prober(bool aIsPreferredLanguage)
18
:mIsPreferredLanguage(aIsPreferredLanguage)
19
{mCodingSM = new nsCodingStateMachine(&GB18030SMModel);
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;}
26
float GetConfidence(void);
29
void GetDistribution(uint32_t aCharLen, const char* aStr);
31
nsCodingStateMachine* mCodingSM;
32
nsProbingState mState;
34
//GB2312ContextAnalysis mContextAnalyser;
35
GB2312DistributionAnalysis mDistributionAnalyser;
37
bool mIsPreferredLanguage;
42
#endif /* nsGB2312Prober_h__ */