KCodecs

nsSJISProber.h
1/*
2 The Original Code is mozilla.org code.
3
4 SPDX-FileCopyrightText: 1998 Netscape Communications Corporation
5
6 SPDX-License-Identifier: MPL-1.1 OR GPL-2.0-or-later OR LGPL-2.1-or-later
7*/
8
9// for S-JIS encoding, observe characteristic:
10// 1, kana character (or hankaku?) often have high frequency of appearance
11// 2, kana character often exist in group
12// 3, certain combination of kana is never used in japanese language
13
14#ifndef nsSJISProber_h__
15#define nsSJISProber_h__
16
17#include "CharDistribution.h"
18#include "JpCntx.h"
19#include "nsCharSetProber.h"
20#include "nsCodingStateMachine.h"
21
22namespace kencodingprober
23{
24class KCODECS_NO_EXPORT nsSJISProber : public nsCharSetProber
25{
26public:
27 nsSJISProber(void)
28 {
29 mCodingSM = new nsCodingStateMachine(&SJISSMModel);
30 Reset();
31 }
32 ~nsSJISProber(void) override
33 {
34 delete mCodingSM;
35 }
36 nsProbingState HandleData(const char *aBuf, unsigned int aLen) override;
37 const char *GetCharSetName() override
38 {
39 return "Shift_JIS";
40 }
41 nsProbingState GetState(void) override
42 {
43 return mState;
44 }
45 void Reset(void) override;
46 float GetConfidence(void) override;
47 void SetOpion() override
48 {
49 }
50
51protected:
52 nsCodingStateMachine *mCodingSM;
53 nsProbingState mState;
54
55 SJISContextAnalysis mContextAnalyser;
56 SJISDistributionAnalysis mDistributionAnalyser;
57
58 char mLastChar[2];
59};
60}
61
62#endif /* nsSJISProber_h__ */
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.