1 | /* -*- C++ -*- |
2 | SPDX-FileCopyrightText: 1998 Netscape Communications Corporation <developer@mozilla.org> |
3 | |
4 | SPDX-License-Identifier: MIT |
5 | */ |
6 | |
7 | #ifndef nsEscCharSetProber_h__ |
8 | #define nsEscCharSetProber_h__ |
9 | |
10 | #include "nsCharSetProber.h" |
11 | #include "nsCodingStateMachine.h" |
12 | |
13 | #define NUM_OF_ESC_CHARSETS 4 |
14 | namespace kencodingprober |
15 | { |
16 | class KCODECS_NO_EXPORT nsEscCharSetProber : public nsCharSetProber |
17 | { |
18 | public: |
19 | nsEscCharSetProber(void); |
20 | ~nsEscCharSetProber(void) override; |
21 | nsProbingState HandleData(const char *aBuf, unsigned int aLen) override; |
22 | const char *GetCharSetName() override |
23 | { |
24 | return mDetectedCharset; |
25 | } |
26 | nsProbingState GetState(void) override |
27 | { |
28 | return mState; |
29 | } |
30 | void Reset(void) override; |
31 | float GetConfidence(void) override |
32 | { |
33 | return (float)0.99; |
34 | } |
35 | void SetOpion() override |
36 | { |
37 | } |
38 | |
39 | protected: |
40 | void GetDistribution(unsigned int aCharLen, const char *aStr); |
41 | |
42 | nsCodingStateMachine *mCodingSM[NUM_OF_ESC_CHARSETS]; |
43 | unsigned int mActiveSM; |
44 | nsProbingState mState; |
45 | const char *mDetectedCharset; |
46 | }; |
47 | } |
48 | #endif /* nsEscCharSetProber_h__ */ |
49 | |