7#include "nsEscCharsetProber.h"
9namespace kencodingprober
11nsEscCharSetProber::nsEscCharSetProber(
void)
13 mCodingSM[0] =
new nsCodingStateMachine(&HZSMModel);
14 mCodingSM[1] =
new nsCodingStateMachine(&ISO2022CNSMModel);
15 mCodingSM[2] =
new nsCodingStateMachine(&ISO2022JPSMModel);
16 mCodingSM[3] =
new nsCodingStateMachine(&ISO2022KRSMModel);
17 mActiveSM = NUM_OF_ESC_CHARSETS;
19 mDetectedCharset =
nullptr;
22nsEscCharSetProber::~nsEscCharSetProber(
void)
24 for (
unsigned int i = 0; i < NUM_OF_ESC_CHARSETS; i++) {
29void nsEscCharSetProber::Reset(
void)
32 for (
unsigned int i = 0; i < NUM_OF_ESC_CHARSETS; i++) {
33 mCodingSM[i]->Reset();
35 mActiveSM = NUM_OF_ESC_CHARSETS;
36 mDetectedCharset =
nullptr;
39nsProbingState nsEscCharSetProber::HandleData(
const char *aBuf,
unsigned int aLen)
41 nsSMState codingState;
45 for (i = 0; i < aLen && mState == eDetecting; i++) {
46 for (j = mActiveSM - 1; j >= 0; j--) {
48 codingState = mCodingSM[j]->NextState(aBuf[i]);
49 if (codingState == eError) {
55 }
else if (j != (
int)mActiveSM) {
56 nsCodingStateMachine *t;
57 t = mCodingSM[mActiveSM];
58 mCodingSM[mActiveSM] = mCodingSM[j];
61 }
else if (codingState == eItsMe) {
63 mDetectedCharset = mCodingSM[j]->GetCodingStateMachine();
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.