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