Coverage Report

Created: 2026-08-25 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/kcodecs/src/probers/nsMBCSGroupProber.h
Line
Count
Source
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 <memory>
15
#include <span>
16
17
203k
#define NUM_OF_PROBERS 8
18
namespace kencodingprober
19
{
20
class KCODECS_NO_EXPORT nsMBCSGroupProber : public nsCharSetProber
21
{
22
public:
23
    enum class Prober : uint8_t {
24
        Utf8 = 0,
25
        SJIS = 1,
26
        EUCJP = 2,
27
        GB18030 = 3,
28
        EUCKR = 4,
29
        Big5 = 5,
30
        Utf16LE = 6,
31
        Utf16BE = 7,
32
    };
33
34
    nsMBCSGroupProber();
35
    explicit nsMBCSGroupProber(std::span<const Prober> selected);
36
4.39k
    ~nsMBCSGroupProber() override = default;
37
38
    nsProbingState HandleData(const char *aBuf, unsigned int aLen) override;
39
    const char *GetCharSetName() override;
40
    nsProbingState GetState(void) override
41
0
    {
42
0
        return mState;
43
0
    }
44
    float GetConfidence(void) override;
45
46
    std::string StatusOutput(uint8_t indent) override;
47
48
protected:
49
    nsProbingState mState = eDetecting;
50
    std::array<std::unique_ptr<nsCharSetProber>, NUM_OF_PROBERS> mProbers;
51
    std::array<bool, NUM_OF_PROBERS> mIsActive = {false};
52
    const std::array<bool, NUM_OF_PROBERS> mIsSelected = {true};
53
    int mBestGuess = -1;
54
    unsigned int mActiveNum = 0;
55
};
56
}
57
58
#endif /* nsMBCSGroupProber_h__ */