12#include "nsGB2312Prober.h"
14namespace kencodingprober
16void nsGB18030Prober::Reset(
void)
20 mDistributionAnalyser.Reset();
24nsProbingState nsGB18030Prober::HandleData(
const char *aBuf,
unsigned int aLen)
30 for (
unsigned int i = 0; i < aLen; i++) {
31 const nsSMState codingState = mCodingSM->NextState(aBuf[i]);
32 if (codingState == eError) {
36 if (codingState == eItsMe) {
40 if (codingState == eStart) {
41 unsigned int charLen = mCodingSM->GetCurrentCharLen();
44 mLastChar[1] = aBuf[0];
45 mDistributionAnalyser.HandleOneChar(mLastChar, charLen);
47 mDistributionAnalyser.HandleOneChar(aBuf + i - 1, charLen);
52 mLastChar[0] = aBuf[aLen - 1];
54 if (mState == eDetecting) {
55 if (mDistributionAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD) {
65float nsGB18030Prober::GetConfidence(
void)
67 float distribCf = mDistributionAnalyser.GetConfidence();
69 return (
float)distribCf;
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:52 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.