7#include "nsBig5Prober.h"
9namespace kencodingprober
11void nsBig5Prober::Reset(
void)
15 mDistributionAnalyser.Reset();
18nsProbingState nsBig5Prober::HandleData(
const char *aBuf,
unsigned int aLen)
24 for (
unsigned int i = 0; i < aLen; i++) {
25 const nsSMState codingState = mCodingSM->NextState(aBuf[i]);
26 if (codingState == eError) {
30 if (codingState == eItsMe) {
34 if (codingState == eStart) {
35 unsigned int charLen = mCodingSM->GetCurrentCharLen();
38 mLastChar[1] = aBuf[0];
39 mDistributionAnalyser.HandleOneChar(mLastChar, charLen);
41 mDistributionAnalyser.HandleOneChar(aBuf + i - 1, charLen);
46 mLastChar[0] = aBuf[aLen - 1];
48 if (mState == eDetecting) {
49 if (mDistributionAnalyser.GotEnoughData() && GetConfidence() > SHORTCUT_THRESHOLD) {
57float nsBig5Prober::GetConfidence(
void)
59 float distribCf = mDistributionAnalyser.GetConfidence();
61 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.