1/* -*- C++ -*-
2 SPDX-FileCopyrightText: 1998 Netscape Communications Corporation <developer@mozilla.org>
3
4 SPDX-License-Identifier: MIT
5*/
6
7#ifndef nsMBCSGroupProber_h__
8#define nsMBCSGroupProber_h__
9
10#include "nsCharSetProber.h"
11
12#include <array>
13#include <cstdint>
14#include <span>
15
16#define NUM_OF_PROBERS 6
17namespace kencodingprober
18{
19class KCODECS_NO_EXPORT nsMBCSGroupProber : public nsCharSetProber
20{
21public:
22 enum class Prober : uint8_t {
23 Unicode = 0,
24 SJIS = 1,
25 EUCJP = 2,
26 GB18030 = 3,
27 EUCKR = 4,
28 Big5 = 5,
29 };
30
31 nsMBCSGroupProber();
32 explicit nsMBCSGroupProber(std::span<const Prober> selected);
33 ~nsMBCSGroupProber() override;
34 nsProbingState HandleData(const char *aBuf, unsigned int aLen) override;
35 const char *GetCharSetName() override;
36 nsProbingState GetState(void) override
37 {
38 return mState;
39 }
40 void Reset(void) override;
41 float GetConfidence(void) override;
42
43#ifdef DEBUG_PROBE
44 void DumpStatus() override;
45#endif
46
47protected:
48 nsProbingState mState;
49 nsCharSetProber *mProbers[NUM_OF_PROBERS];
50 bool mIsActive[NUM_OF_PROBERS];
51 const std::array<bool, NUM_OF_PROBERS> mIsSelected = {true};
52 int mBestGuess;
53 unsigned int mActiveNum;
54};
55}
56
57#endif /* nsMBCSGroupProber_h__ */
58

source code of kcodecs/src/probers/nsMBCSGroupProber.h