File indexing completed on 2024-04-28 03:53:03

0001 /*  -*- C++ -*-
0002     SPDX-FileCopyrightText: 1998 Netscape Communications Corporation <developer@mozilla.org>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #ifndef nsBig5Prober_h__
0008 #define nsBig5Prober_h__
0009 
0010 #include "CharDistribution.h"
0011 #include "nsCharSetProber.h"
0012 #include "nsCodingStateMachine.h"
0013 namespace kencodingprober
0014 {
0015 class KCODECS_NO_EXPORT nsBig5Prober : public nsCharSetProber
0016 {
0017 public:
0018     nsBig5Prober(void)
0019     {
0020         mCodingSM = new nsCodingStateMachine(&Big5SMModel);
0021         Reset();
0022     }
0023     ~nsBig5Prober() override
0024     {
0025         delete mCodingSM;
0026     }
0027     nsProbingState HandleData(const char *aBuf, unsigned int aLen) override;
0028     const char *GetCharSetName() override
0029     {
0030         return "Big5";
0031     }
0032     nsProbingState GetState(void) override
0033     {
0034         return mState;
0035     }
0036     void Reset(void) override;
0037     float GetConfidence(void) override;
0038     void SetOpion() override
0039     {
0040     }
0041 
0042 protected:
0043     void GetDistribution(unsigned int aCharLen, const char *aStr);
0044 
0045     nsCodingStateMachine *mCodingSM;
0046     nsProbingState mState;
0047 
0048     // Big5ContextAnalysis mContextAnalyser;
0049     Big5DistributionAnalysis mDistributionAnalyser;
0050     char mLastChar[2];
0051 };
0052 }
0053 
0054 #endif /* nsBig5Prober_h__ */