12#include "nsEUCJPProber.h"
14namespace kencodingprober
16void nsEUCJPProber::Reset(
void)
20 mContextAnalyser.Reset();
21 mDistributionAnalyser.Reset();
24nsProbingState nsEUCJPProber::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 mContextAnalyser.HandleOneChar(mLastChar, charLen);
46 mDistributionAnalyser.HandleOneChar(mLastChar, charLen);
48 mContextAnalyser.HandleOneChar(aBuf + i - 1, charLen);
49 mDistributionAnalyser.HandleOneChar(aBuf + i - 1, charLen);
54 mLastChar[0] = aBuf[aLen - 1];
56 if (mState == eDetecting) {
57 if (mContextAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD) {
65float nsEUCJPProber::GetConfidence(
void)
67 float contxtCf = mContextAnalyser.GetConfidence();
68 float distribCf = mDistributionAnalyser.GetConfidence();
70 return (contxtCf > distribCf ? contxtCf : distribCf);
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 13 2024 11:48:48 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.