KCodecs

nsGB2312Prober.h
1/* -*- C++ -*-
2 SPDX-FileCopyrightText: 1998 Netscape Communications Corporation <developer@mozilla.org>
3
4 SPDX-License-Identifier: MIT
5*/
6
7#ifndef nsGB2312Prober_h__
8#define nsGB2312Prober_h__
9
10#include "CharDistribution.h"
11#include "nsCharSetProber.h"
12#include "nsCodingStateMachine.h"
13
14// We use gb18030 to replace gb2312, because 18030 is a superset.
15namespace kencodingprober
16{
17class KCODECS_NO_EXPORT nsGB18030Prober : public nsCharSetProber
18{
19public:
20 nsGB18030Prober(void)
21 {
22 mCodingSM = new nsCodingStateMachine(&GB18030SMModel);
23 Reset();
24 }
25 ~nsGB18030Prober(void) override
26 {
27 delete mCodingSM;
28 }
29 nsProbingState HandleData(const char *aBuf, unsigned int aLen) override;
30 const char *GetCharSetName() override
31 {
32 return "gb18030";
33 }
34 nsProbingState GetState(void) override
35 {
36 return mState;
37 }
38 void Reset(void) override;
39 float GetConfidence(void) override;
40 void SetOpion() override
41 {
42 }
43
44protected:
45 void GetDistribution(unsigned int aCharLen, const char *aStr);
46
47 nsCodingStateMachine *mCodingSM;
48 nsProbingState mState;
49
50 // GB2312ContextAnalysis mContextAnalyser;
51 GB2312DistributionAnalysis mDistributionAnalyser;
52 char mLastChar[2];
53};
54}
55
56#endif /* nsGB2312Prober_h__ */
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.