7#include "nsEUCKRProber.h"
9namespace kencodingprober
11void nsEUCKRProber::Reset(
void)
15 mDistributionAnalyser.Reset();
19nsProbingState nsEUCKRProber::HandleData(
const char *aBuf,
unsigned int aLen)
25 for (
unsigned int i = 0; i < aLen; i++) {
26 const nsSMState codingState = mCodingSM->NextState(aBuf[i]);
27 if (codingState == eError) {
31 if (codingState == eItsMe) {
35 if (codingState == eStart) {
36 unsigned int charLen = mCodingSM->GetCurrentCharLen();
39 mLastChar[1] = aBuf[0];
40 mDistributionAnalyser.HandleOneChar(mLastChar, charLen);
42 mDistributionAnalyser.HandleOneChar(aBuf + i - 1, charLen);
47 mLastChar[0] = aBuf[aLen - 1];
49 if (mState == eDetecting) {
50 if (mDistributionAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD) {
60float nsEUCKRProber::GetConfidence(
void)
62 float distribCf = mDistributionAnalyser.GetConfidence();
64 return (
float)distribCf;
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:08 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.