Coverage Report

Created: 2026-08-11 07:29

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/kcodecs/src/probers/nsEUCJPProber.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
// for S-JIS encoding, observe characteristic:
8
// 1, kana character (or hankaku?) often have high frequency of appearance
9
// 2, kana character often exist in group
10
// 3, certain combination of kana is never used in japanese language
11
12
#ifndef nsEUCJPProber_h__
13
#define nsEUCJPProber_h__
14
15
#include "CharDistribution.h"
16
#include "JpCntx.h"
17
#include "nsCharSetProber.h"
18
#include "nsCodingStateMachine.h"
19
20
#include <memory>
21
22
namespace kencodingprober
23
{
24
class KCODECS_NO_EXPORT nsEUCJPProber : public nsCharSetProber
25
{
26
public:
27
    nsEUCJPProber();
28
4.59k
    ~nsEUCJPProber() override = default;
29
30
    nsProbingState HandleData(const char *aBuf, unsigned int aLen) override;
31
    const char *GetCharSetName() override
32
222
    {
33
222
        return "EUC-JP";
34
222
    }
35
    nsProbingState GetState(void) override
36
0
    {
37
0
        return mState;
38
0
    }
39
    float GetConfidence(void) override;
40
41
protected:
42
    std::unique_ptr<nsCodingStateMachine> mCodingSM;
43
    nsProbingState mState = eDetecting;
44
45
    EUCJPContextAnalysis mContextAnalyser;
46
    EUCJPDistributionAnalysis mDistributionAnalyser;
47
48
    char mLastChar[2] = {0};
49
};
50
}
51
52
#endif /* nsEUCJPProber_h__ */