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 nsEscCharSetProber_h__
0008 #define nsEscCharSetProber_h__
0009 
0010 #include "nsCharSetProber.h"
0011 #include "nsCodingStateMachine.h"
0012 
0013 #define NUM_OF_ESC_CHARSETS 4
0014 namespace kencodingprober
0015 {
0016 class KCODECS_NO_EXPORT nsEscCharSetProber : public nsCharSetProber
0017 {
0018 public:
0019     nsEscCharSetProber(void);
0020     ~nsEscCharSetProber(void) override;
0021     nsProbingState HandleData(const char *aBuf, unsigned int aLen) override;
0022     const char *GetCharSetName() override
0023     {
0024         return mDetectedCharset;
0025     }
0026     nsProbingState GetState(void) override
0027     {
0028         return mState;
0029     }
0030     void Reset(void) override;
0031     float GetConfidence(void) override
0032     {
0033         return (float)0.99;
0034     }
0035     void SetOpion() override
0036     {
0037     }
0038 
0039 protected:
0040     void GetDistribution(unsigned int aCharLen, const char *aStr);
0041 
0042     nsCodingStateMachine *mCodingSM[NUM_OF_ESC_CHARSETS];
0043     unsigned int mActiveSM;
0044     nsProbingState mState;
0045     const char *mDetectedCharset;
0046 };
0047 }
0048 #endif /* nsEscCharSetProber_h__ */