7#include "nsMBCSGroupProber.h"
12namespace kencodingprober
15static const char *
const ProberName[] = {
26nsMBCSGroupProber::nsMBCSGroupProber()
28 mProbers[0] =
new UnicodeGroupProber();
29 mProbers[1] =
new nsSJISProber();
30 mProbers[2] =
new nsEUCJPProber();
31 mProbers[3] =
new nsGB18030Prober();
32 mProbers[4] =
new nsEUCKRProber();
33 mProbers[5] =
new nsBig5Prober();
37nsMBCSGroupProber::~nsMBCSGroupProber()
39 for (
unsigned int i = 0; i < NUM_OF_PROBERS; i++) {
44const char *nsMBCSGroupProber::GetCharSetName()
46 if (mBestGuess == -1) {
48 if (mBestGuess == -1) {
52 return mProbers[mBestGuess]->GetCharSetName();
55void nsMBCSGroupProber::Reset(
void)
58 for (
unsigned int i = 0; i < NUM_OF_PROBERS; i++) {
71nsProbingState nsMBCSGroupProber::HandleData(
const char *aBuf,
unsigned int aLen)
80 hptr = highbyteBuf = (
char *)malloc(aLen);
84 for (i = 0; i < aLen; ++i) {
97 for (i = 0; i < NUM_OF_PROBERS; ++i) {
101 st = mProbers[i]->HandleData(highbyteBuf, hptr - highbyteBuf);
102 if (st == eFoundIt) {
106 }
else if (st == eNotMe) {
107 mIsActive[i] =
false;
109 if (mActiveNum == 0) {
121float nsMBCSGroupProber::GetConfidence(
void)
124 float bestConf = 0.0;
133 for (i = 0; i < NUM_OF_PROBERS; ++i) {
137 cf = mProbers[i]->GetConfidence();
148void nsMBCSGroupProber::DumpStatus()
154 for (i = 0; i < NUM_OF_PROBERS; i++) {
156 printf(
" MBCS inactive: [%s] (confidence is too low).\r\n", ProberName[i]);
158 cf = mProbers[i]->GetConfidence();
159 printf(
" MBCS %1.3f: [%s]\r\n", cf, ProberName[i]);
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:08:36 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.